llj
2026-02-25 810525d873ae032b9e8d0335e90c93b791bfbbde
成本分配类型增加子表
1个文件已添加
3个文件已修改
90 ■■■■■ 已修改文件
DAL/基础资料/公用基础资料/ClsGy_CostAverageType_Ctl.cs 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_CostAverageTypeSub_Model.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_CostAverageTypeController.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/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);
                //修改上级为非末级代码
                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;
            }
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" />
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_CostAverageTypeSub_Model.cs
New file
@@ -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;       //物料类型
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/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;