1
duhe
2023-07-24 4e9ec8d46bc8edb7cda3f6633f4bdd6b9bbc0085
DAL/»ù´¡×ÊÁÏ/ÆäËû»ù´¡×ÊÁÏ/ClsGy_MatePriceSup_Ctl.cs
@@ -11,6 +11,7 @@
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public List<Model.ClsGy_MatePriceSup_Model> DetailColl = new List<Model.ClsGy_MatePriceSup_Model>();
        public Model.ClsGy_MatePriceSup_Model oModel = new Model.ClsGy_MatePriceSup_Model();
@@ -58,17 +59,26 @@
            try
            {
                oCn.BeginTran();
                //插入子表
                foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Gy_MatePriceSup " +
                        " (HInterID,HEntryID,HMaterID,HRelationID" +
                //插入表
                //foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl)
                //{
                //    oCn.RunProc("Insert into Gy_MatePriceSup " +
                //        " (HInterID,HEntryID,HMaterID,HRelationID" +
                //        ",HUnitID,HBeginQty,HEndQty,HCurID,HType" +
                //        ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" +
                //        " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() +
                //        "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" +
                //        "," + oSub.HPrice.ToString() + ",'" + "GETDATE()" + "','" + "GETDATE()" + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') ");
                //}
                oCn.RunProc("Insert into " + MvarItemKey + " " +
                    " (HInterID,HEntryID,HMaterID,HRelationID" +
                        ",HUnitID,HBeginQty,HEndQty,HCurID,HType" +
                        ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" +
                        " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() +
                        "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" +
                        "," + oSub.HPrice.ToString() + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') ");
                }
                        ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate) " +
                        " values(" + oModel.HInterID.ToString() + "," + oModel.HEntryID.ToString() + "," + oModel.HMaterID.ToString() + "," + oModel.HRelationID.ToString() +
                        "," + oModel.HUnitID.ToString() + "," + oModel.HBeginQty.ToString() + "," + oModel.HEndQty.ToString() + "," + oModel.HCurID.ToString() + ",'" + oModel.HType + "'" +
                        "," + oModel.HPrice.ToString() + ",'" + oModel.HBeginDate + "','" + oModel.HEndDate + "'," + oModel.HUsed + ",'" + oModel.HRemark + "','" + oModel.HMaker + "','" + oModel.HMakeDate + "') ");
                //修改上级为非末级代码
                //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                return true;
            }
@@ -85,18 +95,25 @@
            try
            {
                oCn.BeginTran();
                DeleteByID(sItemID);        //删除记录
                //插入表
                foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Gy_MatePriceSup " +
                        " (HInterID,HEntryID,HMaterID,HRelationID" +
                        ",HUnitID,HBeginQty,HEndQty,HCurID,HType" +
                        ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" +
                        " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() +
                        "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" +
                        "," + oSub.HPrice.ToString() + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') ");
                }
                oCn.RunProc("Update " + MvarItemKey + " set " +
                   " HPrice='" + oModel.HPrice + "'" +
                   ",HRemark='" + oModel.HRemark + "'" +
                   ",HMaterID=" + oModel.HMaterID.ToString() +
                   ",HUnitID=" + oModel.HUnitID.ToString() +
                   ",HCurID=" + oModel.HCurID.ToString() +
                 " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //DeleteByID(sItemID);        //删除记录
                ////插入表
                //foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl)
                //{
                //    oCn.RunProc("Insert into Gy_MatePriceSup " +
                //        " (HInterID,HEntryID,HMaterID,HRelationID" +
                //        ",HUnitID,HBeginQty,HEndQty,HCurID,HType" +
                //        ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" +
                //        " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() +
                //        "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" +
                //        "," + oSub.HPrice.ToString() + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') ");
                //}
                oCn.Commit();
                return true;
            }
@@ -190,6 +207,7 @@
        {
            MvarItemKey = "Gy_MatePriceSup";
            MvarReportTitle = "采购价格资料设置";
            oModel = new Model.ClsGy_MatePriceSup_Model();
        }
    }
}