From 4286ee5823987af404e167a7c4aeacbe7def3c36 Mon Sep 17 00:00:00 2001 From: 王 垚 <1402714037@qq.com> Date: 星期三, 27 七月 2022 10:19:37 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API into master --- WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs | 317 ++++++++++++++++++++++++++++------------------------ 1 files changed, 168 insertions(+), 149 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 55afaf2..0e031b3 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" @@ -109,7 +109,8 @@ { try { - //string sql = string.Format(@"select a.HInterID,a.HBillNo,a.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName, a.HUnitID,u.HName HUnitName,b.HQty HPlanQty,a.HCusID, c.HName HCusName,a.HEmpID,e.HName HEmpName,a.HDeptID,d.HName HDeptName,a.HPlanEndDate,0 HMinQty,0 HTotalQty,0 HSpsQty,a.HSeOrderBillNo + //string sql = string.Format(@"select a.HInterID,a.HBillNo,b.HEntryID,b.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName, b.HUnitID,u.HName HUnitName,b.HQty HPlanQty,b.HQty HSPlanQty, + // a.HCusID, c.HName HCusName,a.HEmpID,e.HName HEmpName,b.HDeptID,d.HName HDeptName,a.HPlanEndDate,0 HMinQty,0 HTotalQty,0 HSpsQty,a.HSeOrderBillNo,a.HRemark // from Sc_ICMOBillMain a // left join Sc_ICMOBillSub b on a.HInterID=b.HInterID // left join Gy_Material m on b.HMaterID=m.HItemID @@ -118,10 +119,10 @@ // left join Gy_Employee e on a.HEmpID=e.HItemID // left join Gy_Department d on a.HDeptID=d.HItemID // where b.HInterID=(select HICMOInterID from Sc_PPBomBillMain where HBillNo='" + HBillNo + "')"); - string sql = string.Format(@" select a.HInterID,a.HBillNo,a.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName, a.HUnitID,u.HName HUnitName,b.HQty HPlanQty,a.HCusID, - c.HName HCusName,a.HEmpID,e.HName HEmpName,a.HDeptID,d.HName HDeptName,a.HPlanEndDate,0 HMinQty,0 HTotalQty,0 HSpsQty,a.HSeOrderBillNo - ,fo.FBILLNO FBillNo,fo.F_ZZZZ_TEXT7 FLXName,fo.FRECEIVEADDRESS FInAddress,fm1.FOLDNUMBER FMaterName,fo.F_ZZZZ_TEXT FBZFS,fu.FDATAVALUE FHX, - fu1.FDATAVALUE FQK,fo.F_ZZZZ_WBBZ FWBBZ + string sql = string.Format(@"select a.HInterID,a.HBillNo,b.HMaterID,b.HEntryID, m.HNumber HMaterNumber, m.HName HMaterName, b.HUnitID,u.HName HUnitName,b.HQty HPlanQty,b.HQty HSPlanQty,a.HCusID, c.HName HCusName, + a.HEmpID,e.HName HEmpName,b.HDeptID,d.HName HDeptName,a.HPlanEndDate,0 HMinQty,0 HTotalQty,0 HSpsQty,a.HSeOrderBillNo,a.HRemark, + fo.FBILLNO FBillNo,fo.F_ZZZZ_TEXT7 FLXName,fo.FRECEIVEADDRESS FInAddress,fmn.FNAME FMaterName,fo1.F_ZZZZ_TEXT FBZFS,fu.FDATAVALUE FHX, + fu1.FDATAVALUE FQK,fo1.F_ZZZZ_WBBZ1 FWBBZ from Sc_ICMOBillMain a left join Sc_ICMOBillSub b on a.HInterID=b.HInterID left join Gy_Material m on b.HMaterID=m.HItemID @@ -130,9 +131,10 @@ left join Gy_Employee e on a.HEmpID=e.HItemID left join Gy_Department d on a.HDeptID=d.HItemID left join AIS20200908101915zs..T_PRD_MOENTRY f1 on b.HERPEntryID=f1.FENTRYID - left join AIS20200908101915zs..T_SAL_ORDER fo on f1.FSaleOrderId =fo.FID - left join AIS20200908101915zs..T_SAL_ORDERENTRY fo1 on fo.FID=fo1.FID + left join AIS20200908101915zs..T_SAL_ORDERENTRY fo1 on f1.FSaleOrderEntryId=fo1.FENTRYID + left join AIS20200908101915zs..T_SAL_ORDER fo on fo1.FID=fo.FID left join AIS20200908101915zs..T_BD_MATERIAL fm1 on fo1.FSUBMATERIALNUMBER=fm1.FMATERIALID + left join AIS20200908101915zs..T_BD_MATERIAL_L fmn on fo1.FSUBMATERIALNUMBER=fmn.FMATERIALID LEFT JOIN AIS20200908101915zs..T_BAS_ASSISTANTDATAENTRY_L fu1 on fo1.F_ZZZZ_ASSISTANT1=fu1.FENTRYID LEFT JOIN AIS20200908101915zs..T_BAS_ASSISTANTDATAENTRY_L fu on fo1.F_ZZZZ_ASSISTANT2=fu.FENTRYID where b.HInterID=(select HICMOInterID from Sc_PPBomBillMain where HBillNo='" + HBillNo + "')"); @@ -171,15 +173,17 @@ var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); - string msg2 = sArray[0].ToString(); - string msg3 = sArray[1].ToString(); - string msg4 = sArray[2].ToString(); - string msg5 = sArray[3].ToString(); + string msg2 = sArray[0].ToString();//琛ㄦ牸鏁版嵁 + string msg3 = sArray[1].ToString();//鐧诲綍浜� + string msg5 = sArray[2].ToString();//鐧诲綍缁勭粐 + string msg6 = sArray[3].ToString();//鏍囪 + string msg7 = sArray[4].ToString();//褰撳墠鐢ㄦ枡娓呭崟 ListModels oListModels = new ListModels(); DataSet ds = new DataSet(); ds = oCN.RunProcReturn("select * from Xt_ORGANIZATIONS where HItemID=" + msg5, "Xt_ORGANIZATIONS"); string OrgNum = ds.Tables[0].Rows[0]["HNumber"].ToString();//缁勭粐浠g爜 + DataSet d = oCN.RunProcReturn("select HRemark from Sc_PPBomBillMain where HBillNo='" + msg7 + "'", "Sc_ICMOBillMain");//鏌ユ壘璇ョ敤鏂欐竻鍗曚笂娆$敓鎴愮殑绠卞彿(HRemark瀛樻斁绠卞彿) DataSet Ds1 = new DataSet(); try { @@ -197,82 +201,44 @@ string month = DateTime.Now.Month.ToString(); string day = DateTime.Now.Day.ToString(); string nowDate = year + month + day; - string materid = ""; + //string materid = ""; + //long sum = 0; + //if (msg4 == "ZZ") + //{ + string FID = ""; int LSH; string LSH2; string TM = ""; - long sum = 0; - if (msg4 == "ZZ") - { - string FID = ""; - oCN.BeginTran(); - foreach (Models.ClsQK_PackingBill oItemSub in ls) - { - //鏍规嵁鐢熸垚鏉℃暟鐢熸垚鐩稿簲鏁伴噺鏉$爜 - foreach (var item in oItemSub.HTotalQty.ToString()) - { - //鐢熸垚鍞竴鏉$爜 鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃� - string sTMNumber = OrgNum + oItemSub.HMaterNumber + nowDate; + int XH = Convert.ToInt32(d.Tables[0].Rows[0]["HRemark"].ToString() == ""? 0 : Convert.ToInt32(d.Tables[0].Rows[0]["HRemark"].ToString())); - Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 - LSH = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮� - LSH = LSH + 1; - LSH2 = LSH.ToString(); - while (LSH2.Length<6) - { - LSH2 = "0" + LSH2; - } - TM = sTMNumber + LSH2; - //鑾峰彇鍐呯爜 - long HInterID = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo); - string str = string.Format(@"insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + - ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + - ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + - ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " + - ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " + - ",HGiveAwayFlag " + - ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " + - ") values (" - + "'" + TM + "','鍞竴鏉$爜'," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString() - + ",'',0,0,'" + msg3 + "',getdate(),0," + oItemSub.HMinQty.ToString() - + ", " + oItemSub.HInterID.ToString() + "," + oItemSub.HInterID.ToString() + ",'" + oItemSub.HBillNo + "','3710',''" - + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,''" - + ", " + oItemSub.HCusID.ToString() + ",'',getdate(),'',getdate()" - + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",'" + oItemSub.HSeOrderBillNo.ToString() + "'," + HInterID.ToString() - + ",0" - + ",'" + oItemSub.HMaterName + "','','',0,'','')"); - oCN.RunProc(str); - oCN.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); - string sql1 = string.Format(@"update Sc_ICMOBillSub set HQty=" + oItemSub.HSpsQty + " where HInterID=" + oItemSub.HInterID); - oCN.RunProc(sql1); - FID = FID + HInterID + ","; - } - } - oCN.Commit(); - objJsonResult.code = FID; - objJsonResult.count = 1; - objJsonResult.Message = "鏁磋鐢熸垚鎴愬姛锛�"; - objJsonResult.data = 1; - return objJsonResult; - } - else + foreach (Models.ClsQK_PackingBill oItemSub in ls) { - var HInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo); - var HBillNo = DBUtility.ClsPub.CreateBillCode("3783", ref DBUtility.ClsPub.sExeReturnInfo, true); - oCN.BeginTran(); - foreach (Models.ClsQK_PackingBill oItemSub in ls) + //鏍规嵁鐢熸垚鏉℃暟鐢熸垚鐩稿簲鏁伴噺鏉$爜 + for (int i = 0; i < oItemSub.HTotalQty; i++) { - sum += oItemSub.HMinQty; - materid = oItemSub.HMaterNumber; - //鑾峰彇鍐呯爜 - long HInterID2 = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo); - //鐢熸垚鍞竴鏉$爜 鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃� + long HInterID = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo); string sTMNumber = OrgNum + oItemSub.HMaterNumber + nowDate; Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 - LSH = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮� - //鎻掑叆鏉$爜妗f - oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + LSH = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);// + LSH = LSH + 1; + LSH2 = LSH.ToString(); + while (LSH2.Length < 6) + { + LSH2 = "0" + LSH2; + } + TM = sTMNumber + LSH2; + + if (msg6 == "ZZ") + { + XH = XH +1; + } + else if (msg6 == "PZ"&& ls.IndexOf(oItemSub) == 0) + { + XH = XH + 1; + } + + //鑾峰彇鍐呯爜 + oCN.RunProc("insert into Gy_BarCodeBill (HEntryID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + @@ -280,77 +246,127 @@ ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " + ",HGiveAwayFlag " + ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " + - ") values (" - + "'" + LSH + "','鍞竴鏉$爜'," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString() + ") values ("+i + + ",'" + TM + "','鍞竴鏉$爜'," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString() + ",'',0,0,'" + msg3 + "',getdate(),0," + oItemSub.HMinQty.ToString() - + ", " + oItemSub.HInterID.ToString() + "," + oItemSub.HInterID.ToString() + ",'" + oItemSub.HBillNo + "','3710',''" - + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,''" + + ", " + oItemSub.HInterID.ToString() + "," + oItemSub.HEntryID.ToString() + ",'" + oItemSub.HBillNo + "','3710',''" + + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,'"+ XH + "'" + ", " + oItemSub.HCusID.ToString() + ",'',getdate(),'',getdate()" - + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",''," + HInterID2.ToString() + + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",'" + oItemSub.HSeOrderBillNo.ToString() + "'," + HInterID.ToString() + ",0" + ",'" + oItemSub.HMaterName + "','','',0,'','')"); - //鎻掑叆缁勬墭鍗曞瓙琛� - string sql = string.Format(@"insert into Sc_PackUnionBillSub(HInterID,HEntryID,HCloseMan,HCloseType,HRemark, - HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType, - HRelationQty,HRelationMoney,HMaterID,HUnitID,HQty,HSourceID,HEquipID,HGroupID,HWorkerID, - HScanDate,HBarCode,HBarCode_Pack) - values(" + HInterID + ",'','',0,'鑷姩缁戝畾'," + oItemSub.HInterID + ",'','" + oItemSub.HBillNo + "','3710'," + - "0,0," + oItemSub.HMaterID + "," + oItemSub.HUnitID + "," + oItemSub.HPlanQty + ", 0,0,0,0," + - "getdate(),'" + LSH + "','" + HBillNo + "')"); - //鏇存敼鐢熶骇璁㈠崟鐨勬暟閲� - string sql1 = string.Format(@"update Sc_ICMOBillSub set HQty=" + oItemSub.HSpsQty + " where HInterID=" + oItemSub.HInterID); - - oCN.RunProc(sql); - oCN.RunProc(sql1); + + oCN.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); + } - //鐢熸垚缁勬墭鍗曚富琛� - string sql2 = string.Format(@"Insert Sc_PackUnionBillMain(HYear,HPeriod,HBillType,HInterID,HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID, - HRemark,HBacker,HChecker,HMaker,HMakeDate,HUpDater,HCloseMan,HCloseType,HDeleteMan,HICMOInterID,HICMOBillNo, - HBarCode_Pack,HMaterID,HUnitID,HWeight,HMWeight,HPWeight, - HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo,HBillSubType) - values('2022',1,'3783'," + HInterID + ",getdate(),'" + HBillNo + "',1,0,0," + - "'鑷姩缁戝畾','','', '" + msg3 + "',getdate(),'','',0,'',0,0,'" + - HBillNo + "',0,0,0,0,0," + - "0,0,0,0,0,'','','')"); - oCN.RunProc(sql2); - //鍐嶆鐢熸垚鍞竴鐮� - //鑾峰彇鍐呯爜 - long HInterID3 = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo); - //鐢熸垚鍞竴鏉$爜 鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃� - string sTMNumber1 = OrgNum + materid + nowDate; - Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber1 + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 - int LSH1 = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮� - string sql3 = string.Format(@"insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + - ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + - ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + - ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " + - ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " + - ",HGiveAwayFlag " + - ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " + - ") values (" - + "'" + LSH1 + "','鍞竴鏉$爜','" + materid.ToString() + "',0," + sum.ToString() - + ",'',0,0,'" + msg3 + "',getdate(),0," + sum.ToString() - + ", 0,0,'" + HBillNo + "','3710',''," - + sum.ToString() + "," + HInterID.ToString() + ",0,0,0,''" - + ",0,'',getdate(),'',getdate()" - + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",''," + HInterID3.ToString() - + ",0" - + ",'','','',0,'','')"); - - oCN.RunProc(sql3); - oCN.Commit(); - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "鎷艰鐢熸垚鎴愬姛"; - objJsonResult.data = null; - return objJsonResult; + 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++) + { + FID = FID + Dsn.Tables[0].Rows[i][0] + ","; + } } + objJsonResult.code = FID; + objJsonResult.count = 1; + objJsonResult.Message = "鏁磋鐢熸垚鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + //} + //else + //{ + // var HInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo); + // var HBillNo = DBUtility.ClsPub.CreateBillCode("3783", ref DBUtility.ClsPub.sExeReturnInfo, true); + // oCN.BeginTran(); + // foreach (Models.ClsQK_PackingBill oItemSub in ls) + // { + // sum += oItemSub.HMinQty; + // materid = oItemSub.HMaterNumber; + // //鑾峰彇鍐呯爜 + // long HInterID2 = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo); + // //鐢熸垚鍞竴鏉$爜 鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃� + // string sTMNumber = OrgNum + oItemSub.HMaterNumber + nowDate; + // Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 + // LSH = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮� + // //鎻掑叆鏉$爜妗f + // oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + // ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " + + // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " + + // ",HGiveAwayFlag " + + // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " + + // ") values (" + // + "'" + LSH + "','鍞竴鏉$爜'," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString() + // + ",'',0,0,'" + msg3 + "',getdate(),0," + oItemSub.HMinQty.ToString() + // + ", " + oItemSub.HInterID.ToString() + "," + oItemSub.HInterID.ToString() + ",'" + oItemSub.HBillNo + "','3710',''" + // + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,''" + // + ", " + oItemSub.HCusID.ToString() + ",'',getdate(),'',getdate()" + // + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",''," + HInterID2.ToString() + // + ",0" + // + ",'" + oItemSub.HMaterName + "','','',0,'','')"); + // //鎻掑叆缁勬墭鍗曞瓙琛� + // string sql = string.Format(@"insert into Sc_PackUnionBillSub(HInterID,HEntryID,HCloseMan,HCloseType,HRemark, + // HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType, + // HRelationQty,HRelationMoney,HMaterID,HUnitID,HQty,HSourceID,HEquipID,HGroupID,HWorkerID, + // HScanDate,HBarCode,HBarCode_Pack) + // values(" + HInterID + ",'','',0,'鑷姩缁戝畾'," + oItemSub.HInterID + ",'','" + oItemSub.HBillNo + "','3710'," + + // "0,0," + oItemSub.HMaterID + "," + oItemSub.HUnitID + "," + oItemSub.HPlanQty + ", 0,0,0,0," + + // "getdate(),'" + LSH + "','" + HBillNo + "')"); + // //鏇存敼鐢熶骇璁㈠崟鐨勬暟閲� + // string sql1 = string.Format(@"update Sc_ICMOBillSub set HQty=" + oItemSub.HSpsQty + " where HInterID=" + oItemSub.HInterID); + + // oCN.RunProc(sql); + // oCN.RunProc(sql1); + // } + // //鐢熸垚缁勬墭鍗曚富琛� + // string sql2 = string.Format(@"Insert Sc_PackUnionBillMain(HYear,HPeriod,HBillType,HInterID,HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID, + // HRemark,HBacker,HChecker,HMaker,HMakeDate,HUpDater,HCloseMan,HCloseType,HDeleteMan,HICMOInterID,HICMOBillNo, + // HBarCode_Pack,HMaterID,HUnitID,HWeight,HMWeight,HPWeight, + // HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo,HBillSubType) + // values('2022',1,'3783'," + HInterID + ",getdate(),'" + HBillNo + "',1,0,0," + + // "'鑷姩缁戝畾','','', '" + msg3 + "',getdate(),'','',0,'',0,0,'" + + // HBillNo + "',0,0,0,0,0," + + // "0,0,0,0,0,'','','')"); + // oCN.RunProc(sql2); + // //鍐嶆鐢熸垚鍞竴鐮� + // //鑾峰彇鍐呯爜 + // long HInterID3 = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo); + // //鐢熸垚鍞竴鏉$爜 鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃� + // string sTMNumber1 = OrgNum + materid + nowDate; + // Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber1 + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 + // int LSH1 = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮� + // string sql3 = string.Format(@"insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + // ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " + + // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " + + // ",HGiveAwayFlag " + + // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " + + // ") values (" + // + "'" + LSH1 + "','鍞竴鏉$爜','" + materid.ToString() + "',0," + sum.ToString() + // + ",'',0,0,'" + msg3 + "',getdate(),0," + sum.ToString() + // + ", 0,0,'" + HBillNo + "','3710',''," + // + sum.ToString() + "," + HInterID.ToString() + ",0,0,0,''" + // + ",0,'',getdate(),'',getdate()" + // + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",''," + HInterID3.ToString() + // + ",0" + // + ",'','','',0,'','')"); + + // oCN.RunProc(sql3); + // 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(); @@ -447,14 +463,15 @@ public static DataSet QK_GetPackingBillList_s(string sWhere) { + ; if (sWhere == null || sWhere.Equals("")) { - return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_QK_PackedBillList order by hmainid desc", "h_v_QK_PackedBillList"); + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_QK_PackedBillList order by 鍒跺崟鏃ユ湡 desc", "h_v_QK_PackedBillList"); } else { - string sql1 = "select * from h_v_QK_PackedBillList where 1 = 1 "; - string sql = sql1 + sWhere + "order by hmainid desc"; + string sql1 = "select * from h_v_QK_PackedBillList where HBarCodeType='鍞竴鏉$爜' "; + string sql = sql1 + sWhere + " order by 鍒跺崟鏃ユ湡 desc"; return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_QK_PackedBillList"); } @@ -468,6 +485,8 @@ /// <summary> /// 澧欏挃瑁呯鍒楄〃-鍒犻櫎 /// </summary> + /// <param name="HInterID">鏉$爜妗f涓昏〃涓籌D锛堝敮涓�锛�</param> + /// <param name="Flag">鏍囪瘑</param> /// <returns></returns> [Route("Sc_ICMOBillController/DeleteQK_GetPackingBillList")] [HttpGet] @@ -482,14 +501,14 @@ ds = oCN.RunProcReturn("select * from Gy_BarCodeBill where HItemID=" + HInterID, "Gy_BarCodeBill"); DataRow dr = ds.Tables[0].Rows[0]; string sql = string.Format(@"delete from Gy_BarCodeBill where HItemID=" + HInterID); - string sql1 = string.Format(@"update Sc_ICMOBillSub set HQty=HPlanQty+" + dr["HQty"] + " where HInterID=(select HSourceInterID from Gy_BarCodeBill where HItemID=" + HInterID + ")"); - oCN.RunProc(sql); + string sql1 = string.Format(@"update Sc_ICMOBillSub set HQty=HQty+" + dr["HQty"] + " where HEntryID=(select HSourceEntryID from Gy_BarCodeBill where HItemID=" + HInterID + ")"); oCN.RunProc(sql1); + oCN.RunProc(sql); } 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]; @@ -503,9 +522,9 @@ DataRow dr1 = ds.Tables[0].Rows[0]; string sql = string.Format(@"delete from Gy_BarCodeBill where HBarCode='" + dr["HBarCode"].ToString() + "'"); - string sql1 = string.Format(@"update Sc_ICMOBillSub set HQty=HPlanQty+" + dr1["HQty"] + " where HInterID=(select HSourceInterID 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(sql); - oCN.RunProc(sql1); } } @@ -538,6 +557,6 @@ } #endregion - + } } \ No newline at end of file -- Gitblit v1.9.1