From 560cbe48b5c63634ff351477e00c885c4e162f92 Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期二, 11 七月 2023 09:02:30 +0800 Subject: [PATCH] 1 --- WarM/条码打印/Kf_WeighToBarCode.cs | 246 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 237 insertions(+), 9 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 2d1d3ef..bbc60b7 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" @@ -60,6 +60,7 @@ txtHBarCode.Text = ""; grdMain.DataSource = null; grdSub.DataSource = null; + chkHDYFlag.Checked = true; } //绐椾綋鍔犺浇 @@ -461,15 +462,36 @@ BarCode_Display(); grdMain.Rows[0].Selected = true; - //鎵撳嵃鏉$爜 sBarCodeItemID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("HItemID")].Value).ToString(); - Sub_SetReport("鐗╂枡鏉$爜"); - Report.Print(false); - Thread.Sleep(1000); + //鑷姩鎵撳嵃 + 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); + } + } txtHQty.Text = ""; txtHWeightQyt.Text = ""; txtHKDQty.Text = ""; + txtHBarcodeNo.Text = ""; + txtHRemark.Text = ""; + txtHRemark.Tag = 0; txtHQty.Focus(); } @@ -489,6 +511,11 @@ else if (DBUtility.ClsPub.isDoule( txtHWeightQyt.Text) == 0) { MessageBox.Show("璇疯緭鍏ユ纭噸閲忥紒", "鎻愮ず"); + return false; + } + else if (DBUtility.ClsPub.isInt(txtHBarcodeNo.Text) == 0) + { + MessageBox.Show("璇疯緭鍏ュ寘鍙凤紒", "鎻愮ず"); return false; } else if (HWhID==0) @@ -568,6 +595,8 @@ string HMaterName = ""; string HMaterModel = ""; string ProcessExchangeBillNo = ""; + Int64 HBarcodeNo = 0; //鍖呮暟 + Int64 HBadReasonID = 0; //涓嶈壇鍘熷洜ID HBarCode = TM; HBarCodeType = DBUtility.ClsPub.isStrNull(cmbHBarCodeType.Text); @@ -579,6 +608,8 @@ HMaterName = DBUtility.ClsPub.isStrNull(txtHMaterName.Text); HMaterModel = DBUtility.ClsPub.isStrNull(txtHMaterModel.Text); ProcessExchangeBillNo = DBUtility.ClsPub.isStrNull(txtHBillNo.Text); + HBarcodeNo = DBUtility.ClsPub.isLong(txtHBarcodeNo.Text); + HBadReasonID = DBUtility.ClsPub.isLong(txtHRemark.Tag); try { @@ -591,23 +622,23 @@ ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate,HMaterialJQty,HMaterialMQty " + ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag " + - ",HOrderInterID,HOrderEntryID,HOrderBillNo " + + ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1 " + ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " + ") Values (" + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + HMaker + "',getdate(),0," + HQty.ToString() + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "',''" - + ", 1,1," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'" + + ", 1," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'" + ", 0,'',getdate(),'','" + sDate + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString() + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0" - + ", " + ProcessExchangeInterID.ToString() + ",0,'" + ProcessExchangeBillNo + "'" + + ", " + ProcessExchangeInterID.ToString() + ",0,'" + ProcessExchangeBillNo + "'," + HBadReasonID.ToString() + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','')"); //鍥炲~鏈�澶ф祦姘村彿 oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "',1 "); //鍥炲~婧愬崟涓存椂琛℉InterID - oCn.RunProc("update a set a.HInterID=" + HInterID.ToString() + " from KF_WeighSource_Temp a where a.HInterID<>" + HInterID.ToString() + " and a.HMaker='" + HMaker + "' and convert(varchar(10),a.HMakeDate,120)=convert(varchar(10),getdate(),120)"); + oCn.RunProc("update a set a.HInterID=" + HInterID.ToString() + ",a.HBillNo='" + HBillNo + "' from KF_WeighSource_Temp a where a.HInterID<>" + HInterID.ToString() + " and a.HMaker='" + HMaker + "' and convert(varchar(10),a.HMakeDate,120)=convert(varchar(10),getdate(),120)"); //鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃 oCn.RunProc("Insert into KF_PonderationBillMain_Temp " + @@ -623,7 +654,7 @@ + "," + HWhID.ToString() + ",0," + HSPID.ToString() + ",0,0,''" +",0," + HQty.ToString() + ",1,'" + HBatchNo + "','" + HBarCode + "',''" +",'" + HMaker + "',getdate()," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillType + "','" + HSourceBillNo + "'" - +",0,0,'0',0,'',0" + +",0,0,'',0,'',0" +"," + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",'','绉伴噸鍏ュ簱鐢熸垚','2'" +",0,0,'',0)"); @@ -708,5 +739,202 @@ #endregion + #region //浣滃簾 + private void cmdZF_Click(object sender, EventArgs e) + { + if (grdMain.CurrentRow == null) + { + MessageBox.Show("璇峰厛閫夋嫨闇�瑕佷綔搴熺殑鏉$爜锛�", "鎻愮ず"); + return; + } + else + { + if (MessageBox.Show("纭畾瑕佷綔搴熸墍閫夋潯鐮侊紵", "鎻愮ず", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + return; + } + else + { + string HRemark = ""; + string HItemID = ""; + string HBarCode = ""; + string HBarCode2 = ""; + for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) + { + HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()); + HBarCode = HBarCode + ",'" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value) + "'"; + if (i != 0 && i % 100 == 0) + { + HBarCode2 = HBarCode2 + "#" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + else + { + HBarCode2 = HBarCode2 + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("浣滃簾鏍囪")].Value) != "") + { + HRemark = HRemark + "銆�" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + } + if (HRemark != "") + { + MessageBox.Show("鎵�閫夋潯鐮佺紪鍙凤細"+ HRemark.Remove(0, 1)+" 宸蹭綔搴燂紝涓嶅厑璁搁噸澶嶄綔搴燂紒", "鎻愮ず"); + return; + } + HItemID = HItemID.Remove(0, 1); //鍘绘帀瀛楃涓茬涓�涓瓧绗� + HBarCode = HBarCode.Remove(0, 1); + HBarCode2 = HBarCode2.Remove(0, 1); + + try + { + oCn.BeginTran(); + string[] NewBarCode; + NewBarCode = HBarCode2.Split(Convert.ToChar("#")); + + //浣滃簾鏉$爜 + oCn.RunProc("update Gy_BarCodeBill set HStopflag=1,HDeleteMan='" + DBUtility.ClsPub.CurUserName + "',HDeleteDate=getdate() where HItemID in (" + HItemID + ")", ref DBUtility.ClsPub.sExeReturnInfo); + //鍒犻櫎鏉$爜鍑哄叆搴撲复鏃惰〃璁板綍 + oCn.RunProc("delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "' and HBarCode in (" + HBarCode + ")", ref DBUtility.ClsPub.sExeReturnInfo); + //鍐欏叆绯荤粺鏃ュ織 + for (int i = 0; i <= NewBarCode.Length - 1; i++) + { + oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','浣滃簾鏉$爜锛�" + NewBarCode[i] + "','绉伴噸鍏ュ簱妯″潡','" + DBUtility.ClsPub.IPAddress + "','浣滃簾'", ref DBUtility.ClsPub.sExeReturnInfo); + } + oCn.Commit(); + } + catch (Exception e2) + { + oCn.RollBack(); + MessageBox.Show("浣滃簾鏉$爜澶辫触锛�" + e2.Message, "鎻愮ず"); + return; + } + //鍒锋柊绉伴噸璁板綍鍒楄〃淇℃伅 + BarCode_Display(); + MessageBox.Show("鎵�閫夋潯鐮佺紪鍙凤細" + HBarCode.Remove(0, 1) + " 浣滃簾鎴愬姛锛�", "鎻愮ず"); + } + } + } + + #endregion + + #region //鍙嶄綔搴� + private void cmdFZF_Click(object sender, EventArgs e) + { + if (grdMain.CurrentRow == null) + { + MessageBox.Show("璇峰厛閫夋嫨闇�瑕佸弽浣滃簾鐨勬潯鐮侊紒", "鎻愮ず"); + return; + } + else + { + if (MessageBox.Show("纭畾瑕佸弽浣滃簾鎵�閫夋潯鐮侊紵", "鎻愮ず", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + return; + } + else + { + string HRemark = ""; + string HItemID = ""; + string HBarCode = ""; + string HBarCode2 = ""; + for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) + { + HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()); + HBarCode = HBarCode + ",'" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value) + "'"; + if (i != 0 && i % 100 == 0) + { + HBarCode2 = HBarCode2 + "#" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + else + { + HBarCode2 = HBarCode2 + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("浣滃簾鏍囪")].Value) == "") + { + HRemark = HRemark + "銆�" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + } + if (HRemark != "") + { + MessageBox.Show("鎵�閫夋潯鐮佺紪鍙凤細" + HRemark.Remove(0, 1) + " 鏈綔搴燂紝涓嶅厑璁稿弽浣滃簾锛�", "鎻愮ず"); + return; + } + HItemID = HItemID.Remove(0, 1); //鍘绘帀瀛楃涓茬涓�涓瓧绗� + HBarCode = HBarCode.Remove(0, 1); + HBarCode2 = HBarCode2.Remove(0, 1); + + try + { + oCn.BeginTran(); + string[] NewBarCode; + NewBarCode = HBarCode2.Split(Convert.ToChar("#")); + + //鍙嶄綔搴熸潯鐮� + oCn.RunProc("update Gy_BarCodeBill set HStopflag=0,HDeleteMan='',HDeleteDate=null where HItemID in (" + HItemID + ")", ref DBUtility.ClsPub.sExeReturnInfo); + + //鍒犻櫎鏉$爜鍑哄叆搴撲复鏃惰〃璁板綍 + oCn.RunProc("delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "' and HBarCode in (" + HBarCode + ")", ref DBUtility.ClsPub.sExeReturnInfo); + + //鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃 + oCn.RunProc("Insert into KF_PonderationBillMain_Temp " + + "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" + + ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" + + ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" + + ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" + + ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" + + ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" + + ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " + + " select " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "',HMaterID,HAuxPropID,0" + + ",HWhID,0,HSPID,0,0,''" + + ",0,HQty,1,HBatchNo,HBarCode,''" + + ",'" + HMaker + "',getdate(),HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" + + ",0,0,'',0,'',0" + + ",HSTOCKORGID,HSTOCKORGID,HSTOCKORGID,'','绉伴噸鍏ュ簱鐢熸垚-鍙嶄綔搴�','2'" + + ",0,0,'',0" + + "from Gy_BarCodeBill with(nolock) where HItemID in (" + HItemID + ")" + ); + + //鍐欏叆绯荤粺鏃ュ織 + for (int i = 0; i <= NewBarCode.Length - 1; i++) + { + oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','鍙嶄綔搴熸潯鐮侊細" + NewBarCode[i] + "','绉伴噸鍏ュ簱妯″潡','" + DBUtility.ClsPub.IPAddress + "','鍙嶄綔搴�'", ref DBUtility.ClsPub.sExeReturnInfo); + } + oCn.Commit(); + } + catch (Exception e2) + { + oCn.RollBack(); + MessageBox.Show("鍙嶄綔搴熸潯鐮佸け璐ワ紒" + e2.Message, "鎻愮ず"); + return; + } + //鍒锋柊绉伴噸璁板綍鍒楄〃淇℃伅 + BarCode_Display(); + MessageBox.Show("鎵�閫夋潯鐮佺紪鍙凤細" + HBarCode.Remove(0, 1) + " 鍙嶄綔搴熸垚鍔燂紒", "鎻愮ず"); + } + } + } + + + #endregion + + #region //澶囨敞 涓嶈壇鍘熷洜閫夋嫨 + private void cmdHBadReasonID_Click(object sender, EventArgs e) + { + DAL.ClsGy_BadReason_View oBadReason = new DAL.ClsGy_BadReason_View(); + if (oBadReason.RefreshView()) + { + this.txtHRemark.Text = oBadReason.oModel.HName; + this.txtHRemark.Tag = oBadReason.oModel.HItemID.ToString(); + } + } + + #endregion + + + + + + + } } \ No newline at end of file -- Gitblit v1.9.1