From 19d0afadbe1c90e227b852db0a97ae413e90691f Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期日, 29 九月 2024 19:13:25 +0800 Subject: [PATCH] 1 --- WarM/条码打印/Kf_WeighToBarCode.cs | 257 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 252 insertions(+), 5 deletions(-) diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Kf_WeighToBarCode.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Kf_WeighToBarCode.cs" index 4dc1ac2..06a734f 100644 --- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Kf_WeighToBarCode.cs" +++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Kf_WeighToBarCode.cs" @@ -703,6 +703,7 @@ Int64 HBadReasonID = 0; //涓嶈壇鍘熷洜ID string HCusMaterName = ""; //瀹㈡埛鐗╂枡鍚嶇О string HCusModel = ""; //瀹㈡埛瑙勬牸鍨嬪彿 + string HBarCode_Pack = ""; //鎵樼洏鏉$爜 HBarCode = TM; HBarCodeType = DBUtility.ClsPub.isStrNull(cmbHBarCodeType.Text); @@ -719,6 +720,7 @@ HBadReasonID = DBUtility.ClsPub.isLong(txtHRemark.Tag); HCusMaterName = DBUtility.ClsPub.isStrNull(txtHCusMaterName.Text); HCusModel = DBUtility.ClsPub.isStrNull(txtHCusModel.Text); + HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text); try { @@ -730,7 +732,7 @@ ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate,HMaterialJQty,HMaterialMQty,HNowQty " + - ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag " + + ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag,HBarCode_Pack " + ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1,HMaterialModel,HCusModel " + ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HLogo " + ") Values (" @@ -739,7 +741,7 @@ + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "',''" + ", 1," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'" + ", 0,'',getdate(),'','" + sDate + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString() + "," + HNowQty.ToString() - + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0" + + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0,'" + HBarCode_Pack + "'" + ", " + HProcessExchangeInterID.ToString() + ",0,'" + HProcessExchangeBillNo + "'," + HBadReasonID.ToString() + ",'" + HCusMaterName + "','" + HCusModel + "'" + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','','1')"); @@ -761,8 +763,8 @@ " Values(" + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HMaterID.ToString() + "," + HAuxPropID.ToString() + ",0" + "," + HWhID.ToString() + ",0," + HSPID.ToString() + ",0,0,''" - +",0," + HQty.ToString() + ",1,'" + HBatchNo + "','" + HBarCode + "',''" - +",'" + HMaker + "',getdate()," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillType + "','" + HSourceBillNo + "'" + +",0," + HQty.ToString() + ",1,'" + HBatchNo + "','" + HBarCode + "','" + HBarCode_Pack + "'" + + ",'" + HMaker + "',getdate()," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillType + "','" + HSourceBillNo + "'" +",0,0,'',0,'',0" +"," + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",'','绉伴噸鍏ュ簱鐢熸垚','2'" +",0,0,'',0)"); @@ -888,6 +890,11 @@ { HRemark = HRemark + "銆�" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); } + if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜绫诲瀷")].Value) == "鎵樼洏鏉$爜") + { + MessageBox.Show("鎵�閫夋潯鐮佺紪鍙凤細" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value) + " 涓烘墭鐩樻潯鐮侊紝涓嶅厑璁镐綔搴燂紒", "鎻愮ず"); + return; + } } if (HRemark != "") { @@ -950,6 +957,7 @@ string HItemID = ""; string HBarCode = ""; string HBarCode2 = ""; + string HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text); for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) { HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()); @@ -965,6 +973,17 @@ if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("浣滃簾鏍囪")].Value) == "") { HRemark = HRemark + "銆�" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜绫诲瀷")].Value) == "鎵樼洏鏉$爜") + { + MessageBox.Show("鎵�閫夋潯鐮佺紪鍙凤細" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value) + " 涓烘墭鐩樻潯鐮侊紝涓嶅厑璁稿弽浣滃簾锛�", "鎻愮ず"); + return; + } + if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) != "" + && DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) != HBarCode_Pack) + { + MessageBox.Show("鎵�閫夋潯鐮佺紪鍙凤細" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value) + " 宸茬敓鎴愬搴旂粍鎵樺崟锛屼笉鍏佽鍙嶄綔搴燂紒", "鎻愮ず"); + return; } } if (HRemark != "") @@ -999,7 +1018,7 @@ ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " + " select " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "',HMaterID,HAuxPropID,0" + ",HWhID,0,HSPID,0,0,''" + - ",0,HQty,1,HBatchNo,HBarCode,''" + + ",0,HQty,1,HBatchNo,HBarCode,HBarCode_Pack" + ",'" + HMaker + "',getdate(),HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" + ",0,0,'',0,'',0" + ",HSTOCKORGID,HSTOCKORGID,HSTOCKORGID,'','绉伴噸鍏ュ簱鐢熸垚-鍙嶄綔搴�','2'" + @@ -1043,6 +1062,229 @@ #endregion + #region //寮�濮嬬粍鎵� + private void cmdHBPack_Click(object sender, EventArgs e) + { + if (!PackSub_AllowSave()) + { + return; + } + SavePackBarCode(); + BarCode_Display(); + grdMain.Rows[0].Selected = true; + + txtHBarCode_Pack.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + cmdHBPack.Enabled = false; + + sBarCodeItemID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("HItemID")].Value).ToString(); + //鑷姩鎵撳嵃 + if (chkHDYFlag.Checked == true) + { + //鎵撳嵃鏉$爜 + Sub_SetReport("鎵樼洏鏉$爜"); + Report.Print(false); + Thread.Sleep(1000); + } + else + { + //閫夋嫨鎵撳嵃妯℃澘 + BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp(); + oFrm.sBillName = ModName; + oFrm.sBillModel = ModCaption; + oFrm.ShowDialog(); + if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) + { + Sub_SetReport(oFrm.sOpenTmp); + Report.Print(false); + Thread.Sleep(1000); + } + } + } + + //鏉$爜鐢熸垚鍓嶅垽鏂� + private bool PackSub_AllowSave() + { + //鍒ゆ柇褰撳墠鍗曟嵁ID鏄惁宸蹭笂浼犵敓鎴愬崟鎹� + DataSet Ds = oCn.RunProcReturn("select top 1 1 from KF_WeighSource_Temp with(nolock) where HInterID=" + HInterID.ToString() + " and HRelationInterID=1 ", "KF_WeighSource_Temp", ref DBUtility.ClsPub.sExeReturnInfo); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + } + else + { + MessageBox.Show("褰撳墠鏉$爜璁板綍宸叉崲鐝笂浼犵敓鎴愬崟鎹紝璇烽��鍑哄悗閲嶆柊杩涘叆璇ユā鍧楄繘琛屾潯鐮佺敓鎴愭搷浣滐紒", "鎻愮ず"); + return false; + } + + if (HInterID == 0 || HBillNo == "") + { + MessageBox.Show("鑾峰彇鏉$爜瀵瑰簲鍗曟嵁ID鎴栧崟鎹彿澶辫触锛岃閲嶆柊鍒锋柊鐣岄潰锛�", "鎻愮ず"); + return false; + } + return true; + } + + //鐢熸垚鎵樼洏鏉$爜 + private void SavePackBarCode() + { + int LSHlen = 6; //娴佹按鍙烽暱搴� + Int64 LSH = 0; //娴佹按鍙� + string LSH2 = ""; //娴佹按鍙疯浆鎹㈡垚瀛楃 + string sDate = ""; //鏃ユ湡 + string sYear = ""; //骞� + string sPeriod = ""; //鏈� + string sDay = ""; //鏃� + string sTMNumber = ""; //鏉$爜鑷畾涔夊墠缂� + string TM = ""; //鏉$爜缂栧彿 + DataSet Ds; + + //鏃ユ湡鑾峰彇鏂瑰紡 + sDate = dtpHDate.Value.ToShortDateString(); + sYear = DBUtility.ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); + sPeriod = "0" + DBUtility.ClsPub.isDate(sDate).Month.ToString(); + sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); + sDay = "0" + DBUtility.ClsPub.isDate(sDate).Day.ToString(); + sDay = sDay.Substring(sDay.Length - 2, 2); + //================================== + //鏉$爜鍓嶇紑 = 'TP' + 缁勭粐浠g爜 + 骞� + 鏈� + 鏃� + sTMNumber = "TP" + DBUtility.ClsPub.HOrgNumber + sYear + sPeriod + sDay; + Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 + LSH = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]); + LSH = LSH + 1; + LSH2 = LSH.ToString(); + while (LSH2.Length < LSHlen) //濡傛灉娴佹按鍙峰皬浜�6浣嶆暟鍓嶉潰琛�0 + { + LSH2 = "0" + LSH2; + } + TM = sTMNumber + LSH2; + + string HBarCode = ""; + string HBarCodeType = "鎵樼洏鏉$爜"; + + HBarCode = TM; + HBarCodeType = ""; + + try + { + oCn.BeginTran(); + //鍐欏叆鏉$爜妗f + oCn.RunProc("Insert into Gy_BarCodeBill " + + "(HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBarCode_Pack" + + ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate,HMaterialJQty,HMaterialMQty,HNowQty " + + ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag " + + ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1,HMaterialModel,HCusModel " + + ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HLogo " + + ") Values (" + + "'" + HBarCode + "','" + HBarCodeType + "',0,0,1,'" + HBarCode + "'" + + ",'',0,0,'" + HMaker + "',getdate(),0,1" + + ",0,0,'','',''" + + ",1,0,0,0,0,''" + + ", 0,'',getdate(),'','" + sDate + "',0,0,0" + + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0" + + ", " + HProcessExchangeInterID.ToString() + ",0,'',0,'',''" + + ",'','','',0,'','','1')"); + + //鍥炲~鏈�澶ф祦姘村彿 + oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "',1 "); + oCn.Commit(); + } + catch (Exception e) + { + oCn.RollBack(); + MessageBox.Show("鎵樼洏鏉$爜鐢熸垚澶辫触锛�" + e.Message); + } + } + + + #endregion + + #region //缁撴潫缁勬墭 + private void cmdHEPack_Click(object sender, EventArgs e) + { + string HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text); + + //鐢熸垚缁勬墭鍗曞墠鍒ゆ柇 + if(HBarCode_Pack=="") + { + MessageBox.Show("璇峰厛鐐瑰嚮寮�濮嬬粍鎵橈紝杩涜鏉$爜缁勬墭鎿嶄綔锛�", "鎻愮ず"); + return; + } + bool b = false; + for (int i = 0; i < grdMain.RowCount; i++) + { + if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[Fun_GetCol("鏉$爜绫诲瀷")].Value) == "鍞竴鏉$爜" + && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) == HBarCode_Pack) + { + b = true; + break; + } + } + if (b == false) + { + MessageBox.Show("褰撳墠鎵樼洏鏉$爜涓嬭繕娌$敓鎴愬搴旀潯鐮侊紝涓嶅厑璁哥敓鎴愮粍鎵樺崟锛�", "鎻愮ず"); + return; + } + + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + MessageBox.Show(s, "鎻愮ず"); + return; + } + + try + { + oCn.BeginTran(); + //鐢熸垚鐢熶骇缁勬墭鍗� + Int64 HPUInterID = DBUtility.ClsPub.CreateBillID_Prod("3783", ref DBUtility.ClsPub.sExeReturnInfo); //寰楀埌鏈�鏂扮敓浜х粍鎵樺崟ID + string HPUBillNo = DBUtility.ClsPub.CreateBillCode_Prod("3783", ref DBUtility.ClsPub.sExeReturnInfo, true); //寰楀埌鏈�鏂扮敓浜х粍鎵樺崟鍙� + + //鍐欏叆鐢熶骇缁勬墭鍗曚富琛� + oCn.RunProc("Insert Into Sc_PackUnionBillMain " + + "(HInterID,HBillNo,HBillType,HBillSubType,HDate,HRemark" + + ",HYear,HPeriod,HChecker,HCheckDate,HMaker,HMakeDate" + + ",HICMOInterID,HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID,HProdOrgID" + + ") Values (" + + " " + HPUInterID.ToString() + ",'" + HPUBillNo + "','3783','3783',convert(varchar(10),getdate(),120),''" + + "," + sYear.ToString() + "," + sPeriod.ToString() + ",'" + HMaker + "',getdate(),'" + HMaker + "',getdate()" + + ",0,'','" + HBarCode_Pack + "',0,0," + HStockOrgID.ToString() + ") "); + + //鍐欏叆鐢熶骇瑁呯鍗曞瓙琛� + oCn.RunProc("Insert into Sc_PackUnionBillSub " + + "(HInterID,HEntryID,HRelationQty,HRelationMoney,HRemark" + + ",HMaterID,HUnitID,HQty,HBarCode,HBarCode_Pack,HScanDate" + + ",HAuxPropID,HBatchNo,HMTONo" + + ",HSourceID,HEquipID,HGroupID,HWorkerID,HStatus" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType) " + + " select " + HPUInterID.ToString() + ",HItemID,'0,0,''" + + ",HMaterID,HUnitID,HQty,HBarCode,HBarCode_Pack,getdate()" + + ",HAuxPropID,HBatchNo,HMTONo" + + ",0,0,0,0,0" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + "from Gy_BarCodeBill with(nolock) where HInterID=" + HInterID.ToString() + " and HBarCode_Pack='" + HBarCode_Pack + "' and HStopflag=0" + ); + + MessageBox.Show("鐢熸垚鐢熶骇缁勬墭鍗曪細" + HPUBillNo + " 鎴愬姛锛�", "鎻愮ず"); + + txtHBarCode_Pack.Text = ""; + cmdHBPack.Enabled = true; + oCn.Commit(); + return; + } + catch (Exception e2) + { + oCn.RollBack(); + MessageBox.Show("鐢熸垚鐢熶骇缁勬墭鍗曞け璐ワ紒" + e2.Message); + return; + } + } + + #endregion @@ -1343,7 +1585,12 @@ fs.Close(); } } + #endregion + #endregion + + + } } \ No newline at end of file -- Gitblit v1.9.1