From 810525d873ae032b9e8d0335e90c93b791bfbbde Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期三, 25 二月 2026 13:59:41 +0800
Subject: [PATCH] 成本分配类型增加子表
---
WebAPI/Controllers/基础资料/基础资料/Gy_CostAverageTypeController.cs | 21 ++++++++++
Model/基础资料/基础资料/ClsGy_CostAverageTypeSub_Model.cs | 13 ++++++
Model/Model.csproj | 1
DAL/基础资料/公用基础资料/ClsGy_CostAverageType_Ctl.cs | 55 +++++++++++++++++++++++++++
4 files changed, 89 insertions(+), 1 deletions(-)
diff --git "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CostAverageType_Ctl.cs" "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CostAverageType_Ctl.cs"
index 8272f99..a7b8828 100644
--- "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CostAverageType_Ctl.cs"
+++ "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CostAverageType_Ctl.cs"
@@ -11,6 +11,7 @@
//鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩�
public string HOldNumber;
public Model.ClsGy_CostAverageType_Model oModel = new Model.ClsGy_CostAverageType_Model();
+ public List<Model.ClsGy_CostAverageTypeSub_Model> DetailColl = new List<Model.ClsGy_CostAverageTypeSub_Model>();
//鏂板
public override bool AddNew(ref string sReturn)
{
@@ -31,6 +32,34 @@
", ref sReturn);
//淇敼涓婄骇涓洪潪鏈骇浠g爜
oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref sReturn);
+ DataSet dss= oCn.RunProcReturn("select MAX(HItemID) as HInterID from Gy_CostAverageType", "Gy_CostAverageType");
+ int HInterID = Convert.ToInt32(dss.Tables[0].Rows[0]["HInterID"]);
+ oCn.RunProc("Delete From " + "Gy_CostAverageTypeSub" + " where HInterID=" + HInterID);
+
+ //鎻掑叆瀛愯〃
+ if (DetailColl != null && DetailColl.Count > 0)
+ {
+ foreach (Model.ClsGy_CostAverageTypeSub_Model oSub in DetailColl)
+ {
+ if (oSub == null)
+ continue;
+
+ string subSql = "insert into Gy_CostAverageTypeSub" +
+ "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+ ",HWeight,HMaterTypeID" + ")" +
+ " values(" +
+ HInterID + "," +
+ (oSub.HEntryID != null ? oSub.HEntryID.ToString() : "0") + "," +
+ (oSub.HSourceInterID != null && oSub.HSourceInterID != 0 ? oSub.HSourceInterID.ToString() : "0") + "," +
+ (oSub.HSourceEntryID != null && oSub.HSourceEntryID != 0 ? oSub.HSourceEntryID.ToString() : "0") + ",'" +
+ (oSub.HSourceBillNo ?? "") + "','" + (oSub.HSourceBillType ?? "") + "'," +
+ (oSub.HWeight != null && oSub.HWeight != 0 ? oSub.HWeight.ToString() : "0") + "," +
+ (oSub.HMaterTypeID != null && oSub.HMaterTypeID != 0 ? oSub.HMaterTypeID.ToString() : "0") +
+ ")";
+
+ oCn.RunProc(subSql);
+ }
+ }
oCn.Commit();
return true;
}
@@ -71,6 +100,32 @@
//灏嗕笂绾� 涓洪潪鏈骇
oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref sReturn);
//
+
+ oCn.RunProc("Delete From " + "Gy_CostAverageTypeSub" + " where HInterID=" + oModel.HItemID);
+ //鎻掑叆瀛愯〃
+ if (DetailColl != null && DetailColl.Count > 0)
+ {
+ foreach (Model.ClsGy_CostAverageTypeSub_Model oSub in DetailColl)
+ {
+ if (oSub == null)
+ continue;
+
+ string subSql = "insert into Gy_CostAverageTypeSub" +
+ "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+ ",HWeight,HMaterTypeID" + ")" +
+ " values(" +
+ oModel.HItemID + "," +
+ (oSub.HEntryID != null ? oSub.HEntryID.ToString() : "0") + "," +
+ (oSub.HSourceInterID != null && oSub.HSourceInterID != 0 ? oSub.HSourceInterID.ToString() : "0") + "," +
+ (oSub.HSourceEntryID != null && oSub.HSourceEntryID != 0 ? oSub.HSourceEntryID.ToString() : "0") + ",'" +
+ (oSub.HSourceBillNo ?? "") + "','" + (oSub.HSourceBillType ?? "") + "'," +
+ (oSub.HWeight != null && oSub.HWeight != 0 ? oSub.HWeight.ToString() : "0") + "," +
+ (oSub.HMaterTypeID != null && oSub.HMaterTypeID != 0 ? oSub.HMaterTypeID.ToString() : "0") +
+ ")";
+
+ oCn.RunProc(subSql);
+ }
+ }
oCn.Commit();
return true;
}
diff --git a/Model/Model.csproj b/Model/Model.csproj
index b2dd3ac..966355b 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -106,6 +106,7 @@
<Compile Include="浠撳簱绠$悊\ClsKf_TrolleyPositionBillSub.cs" />
<Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_PurPrice_Model.cs" />
<Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_MatePrice_Model.cs" />
+ <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_CostAverageTypeSub_Model.cs" />
<Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_Gy_CostItemAverageType_Model_2.cs" />
<Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_CostItemFixRate_Model_2.cs" />
<Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_CostCenter_Model_2.cs" />
diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CostAverageTypeSub_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CostAverageTypeSub_Model.cs"
new file mode 100644
index 0000000..16d8a0c
--- /dev/null
+++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CostAverageTypeSub_Model.cs"
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+ public class ClsGy_CostAverageTypeSub_Model : DBUtility.ClsXt_BaseBillSub
+ {
+ public int HWeight; //quanzhong
+ public int HMaterTypeID; //物料类型
+
+ }
+}
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CostAverageTypeController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CostAverageTypeController.cs"
index 17d275f..a7279d58 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CostAverageTypeController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CostAverageTypeController.cs"
@@ -171,7 +171,8 @@
string msg3 = _value.ToString();
string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
string msg1 = sArray[0].ToString();
- string msg2 = sArray[1].ToString();
+ string msg2 = sArray[2].ToString();
+ string msg4 = sArray[1].ToString();//瀛愯〃
//鏌ョ湅鏉冮檺
if (!DBUtility.ClsPub.Security_Log("Gy_CostAverageType_Edit", 1, false, msg2))
@@ -190,10 +191,16 @@
{
DAL.ClsGy_CostAverageType_Ctl oBill = new DAL.ClsGy_CostAverageType_Ctl();
List<Model.ClsGy_CostAverageType_Model> lsmain = new List<Model.ClsGy_CostAverageType_Model>();
+ List<Model.ClsGy_CostAverageTypeSub_Model> lssub = new List<Model.ClsGy_CostAverageTypeSub_Model>();
msg1 = msg1.Replace("\\", "");
msg1 = msg1.Replace("\n", ""); //\n
msg1 = "[" + msg1.ToString() + "]";
+ msg4 = msg4.Substring(1, msg4.Length - 2);
+ msg4 = msg4.Replace("\\", "");
+ msg4 = msg4.Replace("\n", ""); //\n
+ msg4 = "[" + msg4.ToString() + "]";
lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_CostAverageType_Model>>(msg1);
+ lssub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_CostAverageTypeSub_Model>>(msg4);
foreach (Model.ClsGy_CostAverageType_Model oItem in lsmain)
{
if (oItem.HNumber.Trim() == "")
@@ -308,7 +315,19 @@
oItem.HMakeEmp = msg2;//鍒涘缓浜�
oBill.oModel = oItem;
}
+ int i = 0;
+ foreach (Model.ClsGy_CostAverageTypeSub_Model oItemSub in lssub)
+ {
+ i++;
+ oItemSub.HEntryID = i;
+
+ oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ oItemSub.HCloseType = false; //鍏抽棴绫诲瀷
+
+ oBill.DetailColl.Add(oItemSub);
+
+ }
//淇濆瓨
//淇濆瓨瀹屾瘯鍚庡鐞�
bool bResult;
--
Gitblit v1.9.1