| | |
| | | ds = oCN.RunProcReturn("select sum(HQty) from JIT_CallGoodsBackRequestBillSub " + |
| | | $"where HSourceInterID={listCa[i].HSouceInterID} and HSourceEntryID ={listCa[i].HSourceEntryID} and HSourceBillNo = '{listCa[i].HSourceBillNo}' and HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub"); |
| | | |
| | | if ((double.Parse(ds.Tables[0].Rows[0][0].ToString())+listCa[i].éææ°é) > listCa[i].已嫿æ°é) |
| | | if ((double.Parse(ds.Tables[0].Rows[0][0].ToString()==""?"0": ds.Tables[0].Rows[0][0].ToString()) +listCa[i].éææ°é) > listCa[i].已嫿æ°é) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | ds = oCN.RunProcReturn("select sum(HQty) from JIT_CallGoodsBackRequestBillSub " + |
| | | $"where HSourceInterID={listCa[i].HSouceInterID} and HSourceEntryID ={listCa[i].HSourceEntryID} and HSourceBillNo = '{listCa[i].HSourceBillNo}' and HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub"); |
| | | |
| | | if ((double.Parse(ds.Tables[0].Rows[0][0].ToString()) + listCa[i].éææ°é) > listCa[i].已嫿æ°é) |
| | | if ((double.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString()) + listCa[i].éææ°é) > listCa[i].已嫿æ°é) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | ds = oCN.RunProcReturn("select sum(HQty) from JIT_CallGoodsBackRequestBillSub " + |
| | | $"where HSourceInterID={listCa[i].HSouceInterID} and HSourceEntryID ={listCa[i].HSourceEntryID} and HSourceBillNo = '{listCa[i].HSourceBillNo}' and HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub"); |
| | | |
| | | if ((double.Parse(ds.Tables[0].Rows[0][0].ToString()) + listCa[i].éææ°é) > listCa[i].已嫿æ°é) |
| | | if ((double.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString()) + listCa[i].éææ°é) > listCa[i].已嫿æ°é) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | oCN.RunProc($"update b set b.HQty=b.HQty+{listCa[i].æ¬æ¬¡æ£ææ°é} from JIT_SendGoodsBillMain a with(nolock) inner join JIT_SendGoodsBillSub b with(nolock) on a.HInterID = b.HInterID " + |
| | | $"where HMainSourceInterID ={SourceInterID} and b.HMaterID ={listCa[i].HMaterID} and a.HBillStatus =1 "); |
| | | } |
| | | //ä¿®æ¹è°æ¨æ°é |
| | | oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{listCa[i].æ¬æ¬¡æ£ææ°é} where HMaterID={listCa[i].HMaterID} " + |
| | | $" and HSourceInterID=(select top 1 HSourceInterID from JIT_ComplementGoodsBillSub_LK " + |
| | | $"where HMaterID={listCa[i].HMaterID} and HInterID={SourceInterID} order by HSourceInterID ) and HInterID={SourceInterID} "); |
| | | |
| | | DataSet dsTable = new DataSet(); |
| | | //æ¥è¯¢JIT_ComplementGoodsBillSub_LK |
| | | dsTable = oCN.RunProcReturn($"select * from JIT_ComplementGoodsBillSub_LK where HMaterID={listCa[i].HMaterID} and HInterID={SourceInterID} order by HSourceInterID ", "JIT_ComplementGoodsBillSub_LK"); |
| | | |
| | | for (int j = 0; j < dsTable.Tables[0].Rows.Count; j++) |
| | | { |
| | | if (double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()) != double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString())) |
| | | { |
| | | if (double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString()) + listCa[i].æ¬æ¬¡æ£ææ°é > double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString())) |
| | | { |
| | | var HCallQTY = double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()) - double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString()); |
| | | //ä¿®æ¹è°æ¨æ°é è¶
åºé¨åç»äºä¸ä¸åæ°æ® |
| | | oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{HCallQTY} where HMaterID={listCa[i].HMaterID} " + |
| | | $" and HSourceInterID={double.Parse(dsTable.Tables[0].Rows[j]["HSourceInterID"].ToString())} and HInterID={SourceInterID} "); |
| | | |
| | | oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{(listCa[i].æ¬æ¬¡æ£ææ°é - HCallQTY)} where HMaterID={listCa[i].HMaterID} " + |
| | | $" and HSourceInterID={dsTable.Tables[0].Rows[j + 1]["HSourceInterID"].ToString()} and HInterID={SourceInterID} "); |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | //ä¿®æ¹è°æ¨æ°é |
| | | oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{listCa[i].æ¬æ¬¡æ£ææ°é} where HMaterID={listCa[i].HMaterID} " + |
| | | $" and HSourceInterID={dsTable.Tables[0].Rows[j]["HSourceInterID"].ToString()} and HInterID={SourceInterID} "); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | sReturn = "æ°å¢åæ®æåï¼"; |
| | |
| | | tb2.Columns.Add("HEmpID", typeof(Int32));//èå |
| | | tb2.Columns.Add("HUnitID", typeof(Int32));//计éåä½ |
| | | tb2.Columns.Add("HSourceID", typeof(Int32));//çäº§èµæºid |
| | | tb2.Columns.Add("ICMOBillHInterID", typeof(Int32));//ç产订å主id |
| | | tb2.Columns.Add("ICMOBillHEntryID", typeof(Int32));//ç产订ååid |
| | | |
| | | //æ·»å æ°æ® |
| | | for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++) |
| | |
| | | tb2.Rows[i]["ç©æåç§°"] = ds.Tables[0].Rows[0]["产ååç§°"].ToString(); |
| | | tb2.Rows[i]["è§æ ¼åå·"] = ds.Tables[0].Rows[0]["è§æ ¼åå·"].ToString(); |
| | | tb2.Rows[i]["HWorkShopID"] = ds.Tables[0].Rows[0]["HDeptID"].ToString(); |
| | | tb2.Rows[i]["ICMOBillHInterID"] = ds.Tables[0].Rows[0]["hmainid"].ToString();//ç产订å主id |
| | | tb2.Rows[i]["ICMOBillHEntryID"] = ds.Tables[0].Rows[0]["HEntryID"].ToString();//ç产订ååid |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList " + |
| | |
| | | var HCompleteQty = list[i]["æ»é½å¥æ°é"].ToString(); |
| | | var HOrderType = omdelMian.HOrderType; |
| | | var HDate = omdelMian.HDate; |
| | | var HMainSourceInterID = list[i]["ICMOBillHInterID"].ToString(); |
| | | var HMainSourceEntryID = list[i]["ICMOBillHEntryID"].ToString(); |
| | | |
| | | ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" + |
| | | $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"第{i + 1}è¡çäº§èµæºæéå¤,请修æ¹!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //主表 |
| | | oCN.RunProc("insert into Sc_WorkBillSortBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType," + |
| | | "HBillSubType,HDate,HBillStatus,HMaker,HMakeDate,HICMOBillNo,HOrderType," + |
| | | "HICMOEntrySEQ,HWorkShopID,HSourceID, HYX, HEmpID," + |
| | | " HMaterID, HMaterName, HMaterModel, HUnitID, HBatchNo," + |
| | | " HSeOrderBillQty, HOrderNeedQty, HCompleteQty,HPreparatDate)values" + |
| | | " HSeOrderBillQty, HOrderNeedQty, HCompleteQty,HPreparatDate," + |
| | | "HMainSourceInterID,HMainSourceEntryID)values" + |
| | | $"({HInterID},'{HBillNo}',{DateTime.Now.Year},{DateTime.Now.Month},'{BillType}'," + |
| | | $"'{BillType}',GETDATE(),1,'{user}','{HDate}','{HICMOBillNo}','{HOrderType}'," + |
| | | $"{(HICMOEntrySEQ == "" ? 0.ToString() : HICMOEntrySEQ)},{(HWorkShopID == "" ? 0.ToString() : HWorkShopID)},{(HSourceID == "" ? 0.ToString() : HSourceID)}, {(HYX == "" ? 0.ToString() : HYX)}, {(HEmpID == "" ? 0.ToString() : HEmpID)}," + |
| | | $" {(HMaterID == "" ? 0.ToString() : HMaterID)}, '{HMaterName}', '{HMaterModel}', {(HUnitID == "" ? 0.ToString() : HUnitID)}, '{HBatchNo}'," + |
| | | $" {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}, {(HOrderNeedQty == "" ? 0.ToString() : HOrderNeedQty)}, {(HCompleteQty == "" ? 0.ToString() : HCompleteQty)},getdate())"); |
| | | $" {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}, {(HOrderNeedQty == "" ? 0.ToString() : HOrderNeedQty)}, {(HCompleteQty == "" ? 0.ToString() : HCompleteQty)},getdate()," + |
| | | $" {HMainSourceInterID},{HMainSourceEntryID})"); |
| | | } |
| | | |
| | | int SumDay = 31; //卿䏤æä¹å·® DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days; |
| | |
| | | string user = sArray[3].ToString(); |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Edit", 1, false, user)) |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | } |
| | | else if (OperationType == 3) |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={omdelMian.HMainSourceInterID}" + |
| | | $" and HMainSourceEntryID={omdelMian.HMainSourceEntryID} and HICMOBillNo='{omdelMian.HICMOBillNo}' and HICMOEntrySEQ={omdelMian.HICMOEntrySEQ} and HSourceID={omdelMian.HSourceID}", "Sc_WorkBillSortBillMain"); |
| | | if ((ds.Tables[0].Rows.Count == 1 && ds.Tables[0].Rows[0]["HInterID"].ToString() != omdelMian.HInterID.ToString())) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "çäº§èµæºæéå¤,请修æ¹!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //ä¿®æ¹ |
| | | oCN.RunProc($"update Sc_WorkBillSortBillMain set HDate='{omdelMian.HDate}',HUpDater='{omdelMian.HMaker}',HUpDateDate=GETDATE()" + |
| | | $", HRemark='{omdelMian.HRemark}', HPrintQty={(omdelMian.HPrintQty == null ? 0 : omdelMian.HPrintQty)}" + |