|  |  | 
 |  |  |             string msg2 = sArray[0].ToString(); | 
 |  |  |             string msg3 = sArray[1].ToString(); | 
 |  |  |  | 
 |  |  |             int hentryid = int.Parse(sArray[2].ToString());//å表ç顺åºid | 
 |  |  |             int OperationType = int.Parse(sArray[3].ToString());//æ°æ®ç±»å 1添堠3ä¿®æ¹ | 
 |  |  |             string user = sArray[4].ToString(); | 
 |  |  |             int OperationType = int.Parse(sArray[2].ToString());//æ°æ®ç±»å 1添堠3ä¿®æ¹ | 
 |  |  |             string user = sArray[3].ToString(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("JIT_ComplementGoodBill_Edit", 1, false, user)) | 
 |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsXt_BaseBillMain>(msg2); | 
 |  |  |                | 
 |  |  |                 if (omdelMian.HPRDORGID.ToString() == "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "ç»ç»ä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 string BillType = "4612"; | 
 |  |  |  | 
 |  |  |                 ds = ds = oCN.RunProcReturn($"select * from  h_v_JIT_Gy_WorkWarehouseBillList where hmainid={omdelMian.HInterID} and  åæ®å·='{omdelMian.HBillNo}'", "h_v_JIT_Gy_WorkWarehouseBillList"); | 
 |  |  |                 if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                 { | 
 |  |  |                     OperationType = 3; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (OperationType == 1)//æ°å¢ | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                 ",HUpDater='" + omdelMian.HMaker + "'" + | 
 |  |  |                 ",HUpDateDate='" + DateTime.Now+ "'" + | 
 |  |  |                 " where HInterID=" + omdelMian.HInterID.ToString()); | 
 |  |  |  | 
 |  |  |                     //å é¤å表 | 
 |  |  |                     oCN.RunProc("delete from Gy_WorkWarehouseBillMainSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'"); | 
 |  |  |                 } | 
 |  |  |                 //ä¿åå表 | 
 |  |  |                 objJsonResult = AddBillSub(msg3, hentryid); | 
 |  |  |                 objJsonResult = AddBillSub(msg3); | 
 |  |  |                 if (objJsonResult.code == "0") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public json AddBillSub(string msg3, int hentryid) | 
 |  |  |         public json AddBillSub(string msg3) | 
 |  |  |         { | 
 |  |  |             omodelsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_WorkWarehouseBillMainSub>>(msg3); | 
 |  |  |  | 
 |  |  |             foreach (Models.Gy_WorkWarehouseBillMainSub oSub in omodelsub) | 
 |  |  |             { | 
 |  |  |                 if (oSub.HWorkShopID == 0 || oSub.HWorkShopID ==null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "ç产车é´ä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (oSub.HWHID == 0|| oSub.HWHID == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "ä»åºä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             //å é¤å表 | 
 |  |  |             oCN.RunProc("delete from Gy_WorkWarehouseBillMainSub where HInterID='" + omdelMian.HInterID.ToString() + "'"); | 
 |  |  |             | 
 |  |  |             int i = 1; | 
 |  |  |             //æå
¥å表 | 
 |  |  |             foreach (Models.Gy_WorkWarehouseBillMainSub oSub in omodelsub) | 
 |  |  | 
 |  |  |                 oCN.RunProc("insert into Gy_WorkWarehouseBillMainSub(HInterID,HEntryID,HRemark,HWorkShopID," + | 
 |  |  |                     "HWorkShopName,HWHID,HWHName) " + | 
 |  |  |                    "values(" | 
 |  |  |                    + omdelMian.HInterID.ToString() + "," + (hentryid == -1 ? i : hentryid) + ",'" + oSub.HRemark + "'," + (oSub.HWorkShopID==null?0:oSub.HWorkShopID) | 
 |  |  |                    + omdelMian.HInterID.ToString() + "," + i + ",'" + oSub.HRemark + "'," + (oSub.HWorkShopID==null?0:oSub.HWorkShopID) | 
 |  |  |                    + ",'" +oSub.HWorkShopName + "'," + (oSub.HWHID==null?0: oSub.HWHID) + ",'" + oSub.HWHName.ToString()+ "') "); | 
 |  |  |                 i++; | 
 |  |  |             } | 
 |  |  | 
 |  |  |             string msg2 = sArray[0].ToString();//ä¸»è¡¨æ°æ® | 
 |  |  |             string msg3 = sArray[1].ToString();//åè¡¨æ°æ® | 
 |  |  |  | 
 |  |  |             int hentryid = int.Parse(sArray[2].ToString());//å表ç顺åºid | 
 |  |  |             int OperationType = int.Parse(sArray[3].ToString());//æ°æ®ç±»å 1添堠3ä¿®æ¹ | 
 |  |  |             string user = sArray[4].ToString(); | 
 |  |  |             int OperationType = int.Parse(sArray[2].ToString());//æ°æ®ç±»å 1添堠3ä¿®æ¹ | 
 |  |  |             string user = sArray[3].ToString(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Cg_PODemandPlanConfigBill_Edit", 1, false, user)) | 
 |  |  | 
 |  |  |                 omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsXt_BaseBillMain>(msg2); | 
 |  |  |                 string BillType = "4611"; | 
 |  |  |  | 
 |  |  |                 ds = ds = oCN.RunProcReturn($"select * from  h_v_JIT_Cg_PODemandPlanConfigBillList where hmainid={omdelMian.HInterID} and  åæ®å·='{omdelMian.HBillNo}'", "h_v_JIT_Cg_PODemandPlanConfigBillList"); | 
 |  |  |                 if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                 { | 
 |  |  |                     OperationType = 3; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (OperationType == 1)//æ°å¢ | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                 ",HUpDater='" + omdelMian.HMaker + "'" + | 
 |  |  |                 ",HUpDateDate='" + DateTime.Now + "'" + | 
 |  |  |                 " where HInterID=" + omdelMian.HInterID.ToString()); | 
 |  |  |  | 
 |  |  |                     //å é¤å表 | 
 |  |  |                     oCN.RunProc("delete from Cg_PODemandPlanConfigBillSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'"); | 
 |  |  |                 } | 
 |  |  |                 //ä¿åå表 | 
 |  |  |                 objJsonResult = AddPODBillSub(msg3, hentryid); | 
 |  |  |                 objJsonResult = AddPODBillSub(msg3); | 
 |  |  |                 if (objJsonResult.code == "0") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public json AddPODBillSub(string msg3, int hentryid) | 
 |  |  |         public json AddPODBillSub(string msg3) | 
 |  |  |         { | 
 |  |  |             omodelPODsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Cg_PODemandPlanConfigBillSub>>(msg3); | 
 |  |  |  | 
 |  |  |             foreach (Models.Cg_PODemandPlanConfigBillSub oSub in omodelPODsub) | 
 |  |  |             { | 
 |  |  |                 if (oSub.HSupplierID == 0 || oSub.HSupplierID == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "ä¾åºåä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (oSub.HMaterID == 0 || oSub.HMaterID == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "ç©æä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (oSub.HLeadTime == 0 || oSub.HLeadTime == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = " JITä¾è´§æåæä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (oSub.HLeadTime_Sec == 0 || oSub.HLeadTime_Sec == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = " JITå°è´§åç½®æä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (oSub.HDeliveryDaysCtrl == 0 || oSub.HDeliveryDaysCtrl == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = " JITéè´§æ§å¶å¤©æ°ä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             //å é¤å表 | 
 |  |  |             oCN.RunProc("delete from Cg_PODemandPlanConfigBillSub where HInterID='" + omdelMian.HInterID.ToString() + "'"); | 
 |  |  |  | 
 |  |  |             int i = 1; | 
 |  |  |             //æå
¥å表 | 
 |  |  |             foreach (Models.Cg_PODemandPlanConfigBillSub oSub in omodelPODsub) | 
 |  |  | 
 |  |  |                 oCN.RunProc("insert into Cg_PODemandPlanConfigBillSub(HInterID,HEntryID,HRemark,HSupplierID,HSupplierName,HMaterID," + | 
 |  |  |                     "HMaterName, HMaterModel, HJITMaterGroup, HJITSafeStock, HJITMaterDemand, HJITBatchQty, HDeliveryPeriod, " + | 
 |  |  |                     "HLeadTime, HLeadTime_Sec, HDeliveryMode, HDeliveryDaysCtrl)values" + | 
 |  |  |                     $"({omdelMian.HInterID}, {(hentryid == -1 ? i : hentryid) }, '{oSub.HRemark}', {(oSub.HSupplierID==null?0: oSub.HSupplierID)}, '{oSub.HSupplierName}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}," + | 
 |  |  |                     $"({omdelMian.HInterID}, {i}, '{oSub.HRemark}', {(oSub.HSupplierID==null?0: oSub.HSupplierID)}, '{oSub.HSupplierName}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}," + | 
 |  |  |                     $" '{oSub.HMaterName}', '{oSub.HMaterModel}', '{oSub.HJITMaterGroup}', {(oSub.HJITSafeStock == null ? 0 : oSub.HJITSafeStock)}, {(oSub.HJITMaterDemand == null ? 0 : oSub.HJITMaterDemand)},{(oSub.HJITBatchQty == null ? 0 : oSub.HJITBatchQty)},{(oSub.HDeliveryPeriod == null ? 0 : oSub.HDeliveryPeriod)}," + | 
 |  |  |                     $" {(oSub.HLeadTime == null ? 0 : oSub.HLeadTime)}, {(oSub.HLeadTime_Sec == null ? 0 : oSub.HLeadTime_Sec)}, '{oSub.HDeliveryMode}', {(oSub.HDeliveryDaysCtrl == null ? 0 : oSub.HDeliveryDaysCtrl)}) "); | 
 |  |  |                 i++; | 
 |  |  | 
 |  |  |             string msg2 = sArray[0].ToString();//ä¸»è¡¨æ°æ® | 
 |  |  |             string msg3 = sArray[1].ToString();//åè¡¨æ°æ® | 
 |  |  |  | 
 |  |  |             int hentryid = int.Parse(sArray[2].ToString());//å表ç顺åºid | 
 |  |  |             int OperationType = int.Parse(sArray[3].ToString());//æ°æ®ç±»å 1添堠3ä¿®æ¹ | 
 |  |  |             string user = sArray[4].ToString(); | 
 |  |  |             int OperationType = int.Parse(sArray[2].ToString());//æ°æ®ç±»å 1添堠3ä¿®æ¹ | 
 |  |  |             string user = sArray[3].ToString(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("JIT_NeedMaterPlanConfigBill_Edit", 1, false, user)) | 
 |  |  | 
 |  |  |  | 
 |  |  |                 omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsXt_BaseBillMain>(msg2); | 
 |  |  |                 string BillType = "4615"; | 
 |  |  |  | 
 |  |  |                 ds = ds = oCN.RunProcReturn($"select * from  h_v_JIT_NeedMaterPlanConfigBillList where hmainid={omdelMian.HInterID} and  åæ®å·='{omdelMian.HBillNo}'", "h_v_JIT_NeedMaterPlanConfigBillList"); | 
 |  |  |                 if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                 { | 
 |  |  |                     OperationType = 3; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 if (OperationType == 1)//æ°å¢ | 
 |  |  | 
 |  |  |                 ",HUpDater='" + omdelMian.HMaker + "'" + | 
 |  |  |                 ",HUpDateDate='" + DateTime.Now + "'" + | 
 |  |  |                 " where HInterID=" + omdelMian.HInterID.ToString()); | 
 |  |  |  | 
 |  |  |                     //å é¤å表 | 
 |  |  |                     oCN.RunProc("delete from JIT_NeedMaterPlanConfigBillSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'"); | 
 |  |  |                 } | 
 |  |  |                 //ä¿åå表 | 
 |  |  |                 objJsonResult = AddNeedBillSub(msg3, hentryid); | 
 |  |  |                 objJsonResult = AddNeedBillSub(msg3); | 
 |  |  |                 if (objJsonResult.code == "0") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public json AddNeedBillSub(string msg3, int hentryid) | 
 |  |  |         public json AddNeedBillSub(string msg3) | 
 |  |  |         { | 
 |  |  |             omodelNeedsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JIT_NeedMaterPlanConfigBillSub>>(msg3); | 
 |  |  |  | 
 |  |  |             foreach (Models.JIT_NeedMaterPlanConfigBillSub oSub in omodelNeedsub) | 
 |  |  |             { | 
 |  |  |                 if (oSub.HWorkShopID == 0 || oSub.HWorkShopID == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "ç产车é´ä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (oSub.HMaterID == 0 || oSub.HMaterID == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "ç©æä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (oSub.HLeadTime == 0 || oSub.HLeadTime == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = " JITä¾è´§æåæä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (oSub.HLeadTime_Sec == 0 || oSub.HLeadTime_Sec == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = " JITå°è´§åç½®æä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (oSub.HDeliveryDaysCtrl == 0 || oSub.HDeliveryDaysCtrl == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = " JITéè´§æ§å¶å¤©æ°ä¸è½ä¸ºç©º"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             //å é¤å表 | 
 |  |  |             oCN.RunProc("delete from JIT_NeedMaterPlanConfigBillSub where HInterID='" + omdelMian.HInterID.ToString() + "'"); | 
 |  |  |  | 
 |  |  |             int i = 1; | 
 |  |  |             //æå
¥å表 | 
 |  |  |             foreach (Models.JIT_NeedMaterPlanConfigBillSub oSub in omodelNeedsub) | 
 |  |  | 
 |  |  |                 oCN.RunProc("insert into JIT_NeedMaterPlanConfigBillSub(HInterID,HEntryID,HRemark,HWorkShopID,HWorkShopName,HMaterID," + | 
 |  |  |                     "HMaterName, HMaterModel, HJITMaterGroup, HJITSafeStock, HJITMaterDemand, HJITBatchQty, HDeliveryPeriod, " + | 
 |  |  |                     "HLeadTime, HLeadTime_Sec, HDeliveryMode, HDeliveryDaysCtrl)values" + | 
 |  |  |                     $"({omdelMian.HInterID}, {(hentryid == -1 ? i : hentryid) }, '{oSub.HRemark}', {(oSub.HWorkShopID == null ? 0 : oSub.HWorkShopID)}, '{oSub.HWorkShopName}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}," + | 
 |  |  |                     $"({omdelMian.HInterID}, {i}, '{oSub.HRemark}', {(oSub.HWorkShopID == null ? 0 : oSub.HWorkShopID)}, '{oSub.HWorkShopName}', {(oSub.HMaterID == null ? 0 : oSub.HMaterID)}," + | 
 |  |  |                     $" '{oSub.HMaterName}', '{oSub.HMaterModel}', '{oSub.HJITMaterGroup}', {(oSub.HJITSafeStock == null ? 0 : oSub.HJITSafeStock)}, {(oSub.HJITMaterDemand == null ? 0 : oSub.HJITMaterDemand)},{(oSub.HJITBatchQty == null ? 0 : oSub.HJITBatchQty)},{(oSub.HDeliveryPeriod == null ? 0 : oSub.HDeliveryPeriod)}," + | 
 |  |  |                     $" {(oSub.HLeadTime == null ? 0 : oSub.HLeadTime)}, {(oSub.HLeadTime_Sec == null ? 0 : oSub.HLeadTime_Sec)}, '{oSub.HDeliveryMode}', {(oSub.HDeliveryDaysCtrl == null ? 0 : oSub.HDeliveryDaysCtrl)}) "); | 
 |  |  |                 i++; |