From 0c8570bd22ae060cb27f4f7dfa7907ead390a296 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 28 十二月 2022 10:58:03 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs |  164 ++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 140 insertions(+), 24 deletions(-)

diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
index 1b1ef33..3caf227 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
@@ -1,4 +1,5 @@
 锘縰sing Model;
+using Model.鐢熶骇绠$悊;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Pub_Class;
@@ -95,8 +96,11 @@
                 long HEmpID = mainList[0].HEmpID;//涓氬姟鍛�
                 long HCusID = mainList[0].HCusID;//瀹㈡埛
                 long HCenterID = mainList[0].HCenterID;//宸ヤ綔涓績
-                double? HPlanQty = mainList[0].HPlanQty==null?0: mainList[0].HPlanQty;//璁″垝鏁伴噺
+                double? HPlanQty = mainList[0].HPlanQty == null ? 0 : mainList[0].HPlanQty;//璁″垝鏁伴噺
                 string HMaker = user;//鍒跺崟浜�
+
+                long HISENTRUST = mainList[0].HISENTRUST == null ? 0 : mainList[0].HISENTRUST;//缁勭粐鍙楁墭鍔犲伐
+                long HISREWORK = mainList[0].HISREWORK == null ? 0 : mainList[0].HISREWORK;//鏄惁杩斿伐
 
                 ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_ICMOBillList");
 
@@ -107,18 +111,18 @@
                         (HBillType,HInterID,HBillNo,HDate,HPRDORGID
                         ,HYear,HPeriod,HRemark,HMaker,HMakeDate
                         ,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HEmpID,HCusID
-                        ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate)
-                        values('3710'," + HInterID + ",'" + HBillNo + "','" + HDate + "',"+ HPRDORGID +
-                    "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()"+
-                    ",'"+ HSeOrderBillNo+"',"+ HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID+
-                    ","+ HCenterID+ "," + HPlanQty+ ",0,0,0,0,'','') ");
+                        ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate,HISENTRUST,HISREWORK)
+                        values('3710'," + HInterID + ",'" + HBillNo + "','" + HDate + "'," + HPRDORGID +
+                    "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()" +
+                    ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID +
+                    "," + HCenterID + "," + HPlanQty + ",0,0,0,0,'',''" + "," + HISENTRUST + "," + HISREWORK + ") ");
                 }
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                 { //淇敼
                     oCN.RunProc("update Sc_ICMOBillMain  set " +
                                 "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
                                 ", HSeOrderBillNo='" + HSeOrderBillNo + "', HSeOrderInterID=" + HSeOrderInterID + ", HSeOrderEntryID=" + HSeOrderEntryID + ", HEmpID=" + HEmpID + ", HCusID=" + HCusID + "" +
-                                ", HCenterID=" + HCenterID + ", HPlanQty=" + HPlanQty + " where HInterID="+ HInterID);
+                                ", HCenterID=" + HCenterID + ", HPlanQty=" + HPlanQty + " where HInterID=" + HInterID);
 
                     //鍒犻櫎瀛愯〃
                     oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "'");
@@ -154,11 +158,24 @@
         public json AddBillSub(string msg3, long HInterID, int OperationType)
         {
             List<ClsSc_ICMOBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ICMOBillSub>>(msg3);
+
+            string HINSTOCKTYPE = DetailColl[0].HINSTOCKTYPE == null ? "''" : DetailColl[0].HINSTOCKTYPE;      //鍏ュ簱绫诲瀷,
+            long HCHECKPRODUCT = DetailColl[0].HCHECKPRODUCT == null ? 0 : DetailColl[0].HCHECKPRODUCT;		//浜у搧妫�楠�,
+            string HQAIP = DetailColl[0].HQAIP == null ? "''" : DetailColl[0].HQAIP;    //绱ф�ユ斁琛�,
+            long HISBACKFLUSH = DetailColl[0].HISBACKFLUSH == null ? 0 : DetailColl[0].HISBACKFLUSH;		//鍊掑啿棰嗘枡,
+            string HREQSRC = DetailColl[0].HREQSRC == null ? "''" : DetailColl[0].HREQSRC;  //闇�姹傛潵婧�,
+            double HSTOCKINQUASELAUXQTY = DetailColl[0].HSTOCKINQUASELAUXQTY == null ? 0 : DetailColl[0].HSTOCKINQUASELAUXQTY;  //鍚堟牸鍝佸叆搴撻�夊崟鏁伴噺,
+            long HSeOrderEntrySEQ = DetailColl[0].HSeOrderEntrySEQ == null ? 0 : DetailColl[0].HSeOrderEntrySEQ;		//閿�鍞鍗曡鍙�,
+            string HPROJECTNO = DetailColl[0].HPROJECTNO == null ? "''" : DetailColl[0].HPROJECTNO;   //椤圭洰缂栧彿,
+            long HPRODUCTTYPE = DetailColl[0].HPRODUCTTYPE == null ? 0 : DetailColl[0].HPRODUCTTYPE;			//浜у搧绫诲瀷,
+            long HCOSTRATE = DetailColl[0].HCOSTRATE == null ? 0 : DetailColl[0].HCOSTRATE;			// 鏉冮噸,
+            long HBASEUNITID = DetailColl[0].HBASEUNITID == null ? 0 : DetailColl[0].HBASEUNITID;       //鍩烘湰璁¢噺鍗曚綅,
+
             int i = 0;
             foreach (ClsSc_ICMOBillSub oSub in DetailColl)
             {
                 i++;
-                if (oSub.HQty <= 0||oSub.HQty==null)
+                if (oSub.HQty <= 0 || oSub.HQty == null)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -208,12 +225,13 @@
                 ,HPlanBeginDate,HPlanEndDate
 	            ,HBeginDate,HEndDate
                 ,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS
-				,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) 
-                 values({HInterID},{i},{(oSub.HQty==null?0:oSub.HQty)}
+				,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney
+                ,HINSTOCKTYPE,HCHECKPRODUCT,HQAIP,HISBACKFLUSH,HREQSRC,HSTOCKINQUASELAUXQTY,HSeOrderEntrySEQ,HPROJECTNO,HPRODUCTTYPE,HCOSTRATE,HBASEUNITID) 
+                 values({HInterID},{i},{(oSub.HQty == null ? 0 : oSub.HQty)}
                 ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
                 ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
                 ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},{oSub.HSTATUS}
-	                    ,0,0,'','',0,0)");
+	                    ,0,0,'','',0,0,{HINSTOCKTYPE},{HCHECKPRODUCT},{HQAIP},{HISBACKFLUSH},{HREQSRC},{HSTOCKINQUASELAUXQTY},{HSeOrderEntrySEQ},{HPROJECTNO},{HPRODUCTTYPE},{HCOSTRATE},{HBASEUNITID})");
             }
 
             objJsonResult.code = "1";
@@ -223,6 +241,104 @@
             return objJsonResult;
         }
         #endregion
+
+        [Route("Sc_ICMOBill/ICMOBillSaveApi")]
+        [HttpPost]
+        public object ICMOBillSaveApi([FromBody] JObject sMainSub)
+        {
+            try
+            {
+                var model = sMainSub["model"].ToString();
+                var entry = sMainSub["model"]["HENTRY"].ToString();
+                var _model = sMainSub["model"]["HPPBOMMAINENTRY"].ToString();
+                var _entry = sMainSub["model"]["HPPBOMSUBENTRY"].ToString();
+                model = "[" + model.ToString() + "]";
+                List<ClsSc_ICMOBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ICMOBillMain>>(model);
+                List<ClsSc_ICMOBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ICMOBillSub>>(entry);
+                List<ClsSc_PPBomBillMain> _mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_PPBomBillMain>>(_model);
+                List<ClsSc_PPBomBillSub> _subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_PPBomBillSub>>(_entry);
+                string sql = string.Empty;
+                oCN.BeginTran();
+                sql = $"delete Sc_ICMOBillMain where HinterID = {mainList[0].HInterID}";
+                oCN.RunProc(sql);
+                sql = $"delete Sc_ICMOBillSub where HinterID = {mainList[0].HInterID}";
+                oCN.RunProc(sql);
+                //涓昏〃
+                oCN.RunProc(@"Insert Into Sc_ICMOBillMain   
+                        (HBillType,HInterID,HBillNo,HDate,HPRDORGID
+                        ,HYear,HPeriod,HRemark,HMaker,HMakeDate
+                        ,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HEmpID,HCusID
+                        ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate,HBillStatus)
+                        values('3710'," + mainList[0].HInterID + ",'" + mainList[0].HBillNo + "','" + mainList[0].HDate + "'," + mainList[0].HPRDORGID +
+                "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker + "',getdate()" +
+                ",'" + mainList[0].HSeOrderBillNo + "'," + mainList[0].HSeOrderInterID + "," + mainList[0].HSeOrderEntryID + "," + mainList[0].HEmpID + "," + mainList[0].HCusID +
+                "," + mainList[0].HCenterID + "," + mainList[0].HPlanQty + ",0,0,0,0,'','',2) ");
+                //淇濆瓨涓昏〃
+                foreach (var oSub in subList)
+                {
+                    oCN.RunProc($@"Insert into Sc_ICMOBillSub 
+                (HInterID,HENTRYID,HQty
+                ,HPlanBeginDate,HPlanEndDate
+	            ,HBeginDate,HEndDate
+                ,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS
+				,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) 
+                 values({oSub.HInterID},{oSub.HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)}
+                ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
+                ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
+                ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},4
+	                    ,0,0,'','',0,0)");
+                }
+
+                foreach (var _item in _mainList)
+                {
+                    //鐢熶骇鐢ㄦ枡娓呭崟
+                    sql = $"delete Sc_PPBomBillMain where HinterID = {_item.HInterID}";
+                    oCN.RunProc(sql);
+                    sql = $"delete Sc_PPBomBillSub where HinterID = {_item.HInterID}";
+                    oCN.RunProc(sql);
+                    //涓昏〃
+                    oCN.RunProc(@"Insert Into Sc_PPBomBillMain   
+                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus,HICMOInterID
+                        ,HICMOEntryID,HMaterID,HUnitID,HQty,HDeptID,HMaker,HMakeDate,HChecker,HCheckDate
+                        ,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HPRDORGID,HENTRUSTORGID,HPARENTOWNERID
+                        ,HPARENTOWNERTYPEID,HERPInterID,HERPBillType,HSeOrderEntrySEQ,HICMOEntrySEQ,HREQSRC)
+                        values(" + _item.HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 3720 + "','" +
+                    _item.HBillSubType + "','" + _item.HDate + "','" + _item.HBillNo + "','" + _item.HBillStatus + "'," + _item.HICMOInterID +
+                    "," + _item.HICMOEntryID + ",'" + _item.HMaterID + "'," + _item.HUnitID + "," + _item.HQty + "," + _item.HDeptID +
+                    ",'" + _item.HMaker + "','" + _item.HMakeDate + "','" + _item.HChecker + "','" + _item.HCheckDate + "','" + _item.HSeOrderBillNo + "'," + _item.HSeOrderInterID + "," + _item.HSeOrderEntryID + "," + _item.HPRDORGID + "," + _item.HENTRUSTORGID + "," + _item.HPARENTOWNERID + ",'" +
+                    _item.HPARENTOWNERTYPEID + "'," + _item.HERPInterID + ",'" + _item.HERPBillType + "'," + _item.HSeOrderEntrySEQ + "," + _item.HICMOEntrySEQ + ",'" + _item.HREQSRC + "')");
+                }
+                foreach (var oSub in _subList)
+                {
+                    oCN.RunProc($@"Insert into Sc_PPBomBillSub 
+                (HInterID,HEntryID,HMaterID,HMaterNumber,HUnitID,HUnitNumber,HSPID,HQty,HQtyMust,HWHID,HRemark
+	            ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HICMOInterID,HICMOEntryID,HICMOBillNo
+	            ,HCHILDSUPPLYORGID,HSUPPLYORGID,HENTRUSTPICKORGID,HSRCTRANSORGID,HGROUPBYOWNERID,HOWNERID,HOWNERTYPEID
+	            ,HRelationQty,HMoveStockQty,HAuxPropID,HBatchNO,HMTONo,HQtyScrap,HERPInterID,HERPEntryID
+	            ,HBackRelationQty,HNumerator,HDenominator,HBASEUNITID,HProcessID,HICMOENTRYSEQ,HPROJECTNO
+                ,HOPERID,HSEQ,HSTOCKSTATUSID,HLOT,HOPTQUEUE,HRESERVETYPE,HSelPickedQty,HSELPRCDRETURNQTY,HProcName) 
+                 values('{oSub.HInterID}','{oSub.HEntryID}','{oSub.HMaterID}','{oSub.HMaterNumber}','{oSub.HUnitID}','{oSub.HUnitNumber}','{oSub.HSPID}','{oSub.HQty}'
+                ,'{oSub.HQtyMust}','{oSub.HWHID}','{oSub.HRemark}','{oSub.HSourceInterID}','{oSub.HSourceEntryID}','{oSub.HSourceBillNo}','{oSub.HSourceBillType}','{oSub.HICMOInterID}','{oSub.HICMOEntryID}','{oSub.HICMOBillNo}','{oSub.HCHILDSUPPLYORGID}','{oSub.HSUPPLYORGID}','{oSub.HENTRUSTPICKORGID}','{oSub.HSRCTRANSORGID}','{oSub.HGROUPBYOWNERID}','{oSub.HOWNERID}','{oSub.HOWNERTYPEID}','{oSub.HRelationQty}','{oSub.HMoveStockQty}','{oSub.HAuxPropID}','{oSub.HBatchNO}','{oSub.HMTONo}','{oSub.HQtyScrap}','{oSub.HERPInterID}','{oSub.HERPEntryID}','{oSub.HBackRelationQty}','{oSub.HNumerator}','{oSub.HDenominator}','{oSub.HBASEUNITID}','{oSub.HProcessID}','{oSub.HICMOENTRYSEQ}','{oSub.HPROJECTNO}','{oSub.HOPERID}','{oSub.HSEQ}','{oSub.HSTOCKSTATUSID}','{oSub.HLOT}','{oSub.HOPTQUEUE}','{oSub.HRESERVETYPE}','{oSub.HSelPickedQty}','{oSub.HSELPRCDRETURNQTY}','{oSub.HProcName}')");
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍗曟嵁淇濆瓨鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
 
         #region 鐢熶骇浠诲姟鍗�(鏃犲垪琛�) 淇濆瓨/缂栬緫鍔熻兘
         [Route("Sc_ICMOBill/ICMOBillEdit_NoTable")]
@@ -314,14 +430,14 @@
                         values('3710'," + HInterID + ",'" + HBillNo + "','" + HDate + "'," + HPRDORGID +
                     "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()" +
                     ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID +
-                    "," + HCenterID + ",0,0,0,0,"+ HBomID + ",'','') ");
+                    "," + HCenterID + ",0,0,0,0," + HBomID + ",'','') ");
                 }
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                 { //淇敼
                     oCN.RunProc("update Sc_ICMOBillMain  set " +
                                 "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
                                 ", HSeOrderBillNo='" + HSeOrderBillNo + "', HSeOrderInterID=" + HSeOrderInterID + ", HSeOrderEntryID=" + HSeOrderEntryID + ", HEmpID=" + HEmpID + ", HCusID=" + HCusID + "" +
-                                ", HCenterID=" + HCenterID + ",HBomID="+ HBomID + " where HInterID=" + HInterID);
+                                ", HCenterID=" + HCenterID + ",HBomID=" + HBomID + " where HInterID=" + HInterID);
 
                     //鍒犻櫎瀛愯〃
                     oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "'");
@@ -615,7 +731,7 @@
                 int LSH;
                 string LSH2;
                 string TM = "";
-                int XH = Convert.ToInt32(d.Tables[0].Rows[0]["HRemark"].ToString() == ""? 0 : Convert.ToInt32(d.Tables[0].Rows[0]["HRemark"].ToString()));
+                int XH = Convert.ToInt32(d.Tables[0].Rows[0]["HRemark"].ToString() == "" ? 0 : Convert.ToInt32(d.Tables[0].Rows[0]["HRemark"].ToString()));
 
                 foreach (Models.ClsQK_PackingBill oItemSub in ls)
                 {
@@ -636,9 +752,9 @@
 
                         if (msg6 == "ZZ")
                         {
-                            XH = XH +1;
+                            XH = XH + 1;
                         }
-                        else if (msg6 == "PZ"&& ls.IndexOf(oItemSub) == 0)
+                        else if (msg6 == "PZ" && ls.IndexOf(oItemSub) == 0)
                         {
                             XH = XH + 1;
                         }
@@ -652,21 +768,21 @@
                                     ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
                                     ",HGiveAwayFlag " +
                                     ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
-                                    ") values ("+i
+                                    ") values (" + i
                                     + ",'" + TM + "','鍞竴鏉$爜'," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString()
                                     + ",'',0,0,'" + msg3 + "',getdate(),0," + oItemSub.HMinQty.ToString()
                                     + ", " + oItemSub.HInterID.ToString() + "," + oItemSub.HEntryID.ToString() + ",'" + oItemSub.HBillNo + "','3710',''"
-                                    + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,'"+ XH + "'"
+                                    + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,'" + XH + "'"
                                     + ", " + oItemSub.HCusID.ToString() + ",'',getdate(),'',getdate()"
                                     + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",'" + oItemSub.HSeOrderBillNo.ToString() + "'," + HInterID.ToString()
                                     + ",0"
                                     + ",'" + oItemSub.HMaterName + "','','',0,'','')");
-                        
+
                         oCN.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        
+
                     }
-                    oCN.RunProc("update Sc_ICMOBillSub set HQty=" + oItemSub.HSpsQty  + " where HEntryID=" + oItemSub.HEntryID);
-                    oCN.RunProc("update Sc_PPBomBillMain set HRemark=" +XH+ " where HBillNo='" + msg7+"'");
+                    oCN.RunProc("update Sc_ICMOBillSub set HQty=" + oItemSub.HSpsQty + " where HEntryID=" + oItemSub.HEntryID);
+                    oCN.RunProc("update Sc_PPBomBillMain set HRemark=" + XH + " where HBillNo='" + msg7 + "'");
                     DataSet Dsn = oCN.RunProcReturn("select top " + oItemSub.HTotalQty + " HItemID from Gy_BarCodeBill order by HItemID desc", "Gy_BarCodeBill");    //鑾峰彇鏈�澶ф祦姘村彿
                     for (int i = 0; i < oItemSub.HTotalQty; i++)
                     {
@@ -914,7 +1030,7 @@
                 else
                 {
                     //閫氳繃鏉$爜id鎵惧埌鎵樻潯鐮侊紝閫氳繃鎵樻潯鐮佹壘鍒扮粍鎵樺崟瀛愯〃涓殑鍞竴鐮�
-                    string sql2 = "select HBarCode from Sc_PackUnionBillSub where HInterID=(select HBarcodeNo from Gy_BarCodeBill where HItemID=" + HInterID+")";
+                    string sql2 = "select HBarCode from Sc_PackUnionBillSub where HInterID=(select HBarcodeNo from Gy_BarCodeBill where HItemID=" + HInterID + ")";
                     //string sql2 = "select HBarCode from Sc_PackUnionBillSub where HInterID=(select HBarcodeNo from Gy_BarCodeBill where HItemID=3250)";
                     DataSet ds1 = oCN.RunProcReturn(sql2, "Sc_PackUnionBillSub");
                     DataTable dt = ds1.Tables[0];
@@ -929,7 +1045,7 @@
 
                             string sql = string.Format(@"delete from Gy_BarCodeBill where HBarCode='" + dr["HBarCode"].ToString() + "'");
                             string sql1 = string.Format(@"update Sc_ICMOBillSub set HQty=HQty+" + dr1["HQty"] + " where HEntryID=(select HSourceEntryID from Gy_BarCodeBill where HBarCode='" + dr["HBarCode"].ToString() + "')");
-                             oCN.RunProc(sql1);
+                            oCN.RunProc(sql1);
                             oCN.RunProc(sql);
                         }
                     }

--
Gitblit v1.9.1