From 89619de0c3dac885dceccd054cc1d72ec40be61d Mon Sep 17 00:00:00 2001 From: "hao.jin" Date: Fri, 18 Mar 2022 11:27:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=8C=81=E5=A2=9E=E5=8A=A0=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=201.=E6=A0=B9=E6=8D=AEVDA=E8=8E=B7=E5=8F=96=E5=86=85?= =?UTF-8?q?=E9=83=A8=E6=A0=87=E7=AD=BE=202.=E8=A1=A5=E6=89=93=E5=86=85?= =?UTF-8?q?=E9=83=A8=E6=A0=87=E7=AD=BE=E5=90=8E=EF=BC=8C=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bill/VDA/frmBarCodeSelect.Designer.cs | 7 +- PDAForm/PDAForm/Bill/VDA/frmBarCodeSelect.cs | 38 +++++++-- .../PDAForm/Bill/VDA/frmVDACheck.Designer.cs | 8 +- PDAForm/PDAForm/Bill/VDA/frmVDACheck.cs | 80 +++++++++++++++++++ PDAForm/PDAForm/PDABiz/F_VerifyBill.cs | 21 +++++ PDAForm/PDAForm/PDAForm.csproj | 3 +- .../Stone.DataService/PDAService/Web.Config | 2 +- .../Stone.DataService.Biz/Bill/F_STD_Check.cs | 46 +++++++++++ .../Stone.DataService.Biz/CommandFactory.cs | 18 ++++- .../Info/F_VerifyBill.cs | 25 ++++++ .../Stone.DataService.Biz.csproj | 1 + .../Stone.WinBiz/VerifyData/F_VerifyBill.cs | 1 + .../VerifyData/frmVerifyBill.cs | 1 + 13 files changed, 232 insertions(+), 19 deletions(-) create mode 100644 PDAForm/PDAForm/PDABiz/F_VerifyBill.cs create mode 100644 Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Info/F_VerifyBill.cs diff --git a/PDAForm/PDAForm/Bill/VDA/frmBarCodeSelect.Designer.cs b/PDAForm/PDAForm/Bill/VDA/frmBarCodeSelect.Designer.cs index 9ccc819..914a214 100644 --- a/PDAForm/PDAForm/Bill/VDA/frmBarCodeSelect.Designer.cs +++ b/PDAForm/PDAForm/Bill/VDA/frmBarCodeSelect.Designer.cs @@ -38,11 +38,12 @@ // // txt_barcode // + this.txt_barcode.Enabled = false; + this.txt_barcode.Font = new System.Drawing.Font("Tahoma", 16F, System.Drawing.FontStyle.Regular); this.txt_barcode.Location = new System.Drawing.Point(3, 158); this.txt_barcode.MaxLength = 40; this.txt_barcode.Multiline = true; this.txt_barcode.Name = "txt_barcode"; - this.txt_barcode.ReadOnly = true; this.txt_barcode.Size = new System.Drawing.Size(228, 72); this.txt_barcode.TabIndex = 22; // @@ -57,10 +58,10 @@ // this.txt_vda.Location = new System.Drawing.Point(5, 52); this.txt_vda.MaxLength = 40; - this.txt_vda.Multiline = true; this.txt_vda.Name = "txt_vda"; - this.txt_vda.Size = new System.Drawing.Size(228, 64); + this.txt_vda.Size = new System.Drawing.Size(228, 23); this.txt_vda.TabIndex = 21; + this.txt_vda.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_vda_KeyDown); this.txt_vda.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_vda_KeyPress); // // label3 diff --git a/PDAForm/PDAForm/Bill/VDA/frmBarCodeSelect.cs b/PDAForm/PDAForm/Bill/VDA/frmBarCodeSelect.cs index 631fa64..db8ea22 100644 --- a/PDAForm/PDAForm/Bill/VDA/frmBarCodeSelect.cs +++ b/PDAForm/PDAForm/Bill/VDA/frmBarCodeSelect.cs @@ -6,6 +6,7 @@ using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; +using PDAForm.PDABiz; namespace PDAForm.Bill.VDA { @@ -33,14 +34,39 @@ namespace PDAForm.Bill.VDA private void txt_vda_KeyPress(object sender, KeyPressEventArgs e) { - try - { + + } - } - catch (Exception) + private void txt_vda_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) { - - throw; + try + { + txt_barcode.Text = ""; + string VDA = this.txt_vda.Text.Trim(); + if (string.IsNullOrEmpty(VDA)) return; + + DataSet dsVerifyBill = F_VerifyBill.GetBarCode(VDA); + if (dsVerifyBill == null || dsVerifyBill.Tables[0].Rows.Count == 0) + { + MessageBox.Show("未找到VDA标签的校验记录!"); + txt_vda.SelectAll(); + return; + } + var barCode = dsVerifyBill.Tables[0].Rows[0][0].ToString(); + txt_barcode.Text = barCode; + if (string.IsNullOrEmpty(barCode)) + { + MessageBox.Show("未找到VDA对应的内部标签!"); + } + txt_vda.SelectAll(); + } + catch (Exception ex) + { + MessageBox.Show("未找到VDA标签的校验记录!"); + txt_vda.SelectAll(); + } } } } diff --git a/PDAForm/PDAForm/Bill/VDA/frmVDACheck.Designer.cs b/PDAForm/PDAForm/Bill/VDA/frmVDACheck.Designer.cs index db70349..d2610ea 100644 --- a/PDAForm/PDAForm/Bill/VDA/frmVDACheck.Designer.cs +++ b/PDAForm/PDAForm/Bill/VDA/frmVDACheck.Designer.cs @@ -41,10 +41,10 @@ // this.txt_barcode.Location = new System.Drawing.Point(4, 165); this.txt_barcode.MaxLength = 40; - this.txt_barcode.Multiline = true; this.txt_barcode.Name = "txt_barcode"; - this.txt_barcode.Size = new System.Drawing.Size(228, 72); + this.txt_barcode.Size = new System.Drawing.Size(228, 23); this.txt_barcode.TabIndex = 26; + this.txt_barcode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_barcode_KeyDown); // // label2 // @@ -57,10 +57,10 @@ // this.txt_vda.Location = new System.Drawing.Point(6, 59); this.txt_vda.MaxLength = 40; - this.txt_vda.Multiline = true; this.txt_vda.Name = "txt_vda"; - this.txt_vda.Size = new System.Drawing.Size(228, 64); + this.txt_vda.Size = new System.Drawing.Size(228, 23); this.txt_vda.TabIndex = 25; + this.txt_vda.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_vda_KeyDown); this.txt_vda.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_vda_KeyPress_1); // // label3 diff --git a/PDAForm/PDAForm/Bill/VDA/frmVDACheck.cs b/PDAForm/PDAForm/Bill/VDA/frmVDACheck.cs index 06f37c3..56553f9 100644 --- a/PDAForm/PDAForm/Bill/VDA/frmVDACheck.cs +++ b/PDAForm/PDAForm/Bill/VDA/frmVDACheck.cs @@ -6,6 +6,8 @@ using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; +using PDAForm.Comm; +using PDAForm.PDABiz; namespace PDAForm.Bill.VDA { @@ -30,5 +32,83 @@ namespace PDAForm.Bill.VDA { } + + private void txt_vda_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + try + { + var vda = txt_vda.Text.Trim(); + //校验VDA标签是否有效 + if (string.IsNullOrEmpty(vda)) + { + MessageBox.Show("VDA标签不能为空!"); + txt_vda.Focus(); + } + DataSet dsVerifyBill = F_VerifyBill.GetBarCode(vda); + if (dsVerifyBill == null || dsVerifyBill.Tables[0].Rows.Count == 0) + { + MessageBox.Show("未找到VDA标签的校验记录!"); + txt_vda.SelectAll(); + return; + } + } + catch + { + MessageBox.Show("未找到VDA标签的校验记录!"); + txt_vda.SelectAll(); + } + + txt_barcode.Focus(); + } + } + + private void txt_barcode_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + try + { + + #region 提交数据到服务器 + var VDA = txt_vda.Text.Trim(); + var BarCode = txt_barcode.Text.Trim(); + if (string.IsNullOrEmpty(VDA)) + { + MessageBox.Show("VDA标签不能为空!"); + txt_vda.Focus(); + } + if (string.IsNullOrEmpty(BarCode)) + { + MessageBox.Show("内部标签不能为空!"); + txt_barcode.Focus(); + } + string Cmd = "BILL_RE_CHECK"; + string Pars = UserInfo.UserName + ";" + VDA + ";" + BarCode; + + MyCommand cmd = new MyCommand(Cmd, Pars); + DataSet dsData = F_Message.ServiceMessage(cmd.GetCommand()); + if (dsData.Tables[0].Rows[0]["Str"].ToString() == "OK") + { + this.txt_vda.Text = ""; + this.txt_barcode.Text = ""; + this.txt_vda.Focus(); + } + else + { + txt_barcode.SelectAll(); + throw new Exception("装箱校验失败,请检查"); + } + + #endregion + } + catch (Exception ex) + { + MessageBox.Show("装箱校验失败,请检查标签!"); + txt_barcode.SelectAll(); + } + } + } } } \ No newline at end of file diff --git a/PDAForm/PDAForm/PDABiz/F_VerifyBill.cs b/PDAForm/PDAForm/PDABiz/F_VerifyBill.cs new file mode 100644 index 0000000..dab0cf0 --- /dev/null +++ b/PDAForm/PDAForm/PDABiz/F_VerifyBill.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using System.Data; +using PDAForm.Comm; + +namespace PDAForm.PDABiz +{ + public class F_VerifyBill + { + public static DataSet GetBarCode(string VDA) + { + string Cmd = "GetBarCode"; + string Pars = VDA; + + MyCommand command = new MyCommand(Cmd, Pars); + return F_Message.ServiceMessage(command.GetCommand()); + } + } +} diff --git a/PDAForm/PDAForm/PDAForm.csproj b/PDAForm/PDAForm/PDAForm.csproj index 35033e5..55934a4 100644 --- a/PDAForm/PDAForm/PDAForm.csproj +++ b/PDAForm/PDAForm/PDAForm.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 9.0.30729 + 9.0.21022 2.0 {6B9249A0-CACF-4DBB-8281-EF43C9078100} WinExe @@ -425,6 +425,7 @@ frmVerifySelect.cs + UserControl diff --git a/Stone.WinForm/Stone.DataService/PDAService/Web.Config b/Stone.WinForm/Stone.DataService/PDAService/Web.Config index 676ef84..a8217dd 100644 --- a/Stone.WinForm/Stone.DataService/PDAService/Web.Config +++ b/Stone.WinForm/Stone.DataService/PDAService/Web.Config @@ -9,7 +9,7 @@ --> - + diff --git a/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Bill/F_STD_Check.cs b/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Bill/F_STD_Check.cs index 2a7f085..c3a239f 100644 --- a/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Bill/F_STD_Check.cs +++ b/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Bill/F_STD_Check.cs @@ -81,6 +81,52 @@ namespace Stone.DataService.Biz.Bill } + public DataSet VDA_UPDATE_Submit(Command cmd) + { + string UserName = cmd.Pars[0]; + string VDA = cmd.Pars[1]; + string BarCode = cmd.Pars[2]; + LocalDBService db = null; + try + { + db = new LocalDBService(); + db.BeginTrans(); + Entity_t_VerifyBill t_VerifyBill = new Entity_t_VerifyBill(db); + var dsVerifyBill = t_VerifyBill.GetData($"[PackageNo1]='{VDA}' or [PackageNo2]='{VDA}'"); + if(dsVerifyBill.Tables.Count == 0 || dsVerifyBill == null) + { + throw new Exception($"不存在 VDA标签 {VDA} 的校验记录!"); + } + var strID = dsVerifyBill.Tables[0].Rows[0]["ID"].ToString(); + + var strsql = ""; + //更新为失效 + strsql = "Update t_VerifyBill" + + " set State = '已失效'" + + " where PackageNo1 = '" + VDA + "' or PackageNo2 = '" + VDA + "'"; + db.Exec_NonQuery(strsql); + + //插入新记录 + strsql = "Insert into t_VerifyBill(AsnNumber,PackageNo,PackageNo1,PackageNo2,PartNumber,Qty,BarCode,UserName)" + + " select AsnNumber,PackageNo,PackageNo1,PackageNo2,PartNumber,Qty,'" + BarCode + "'," + + "'" + UserName + "'" + + " from t_VerifyBill where ID = " + strID; + db.Exec_NonQuery(strsql); + db.Commit(); + + return Stone.DataService.Biz.BizPublic.MyDataSet.GetDataByString("OK"); + } + catch (Exception ex) + { + if (db != null) db.Rollback(); + throw ex; + } + finally + { + if (db != null) db.EndTrans(); + } + + } } } diff --git a/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/CommandFactory.cs b/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/CommandFactory.cs index aa8173f..a3b9914 100644 --- a/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/CommandFactory.cs +++ b/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/CommandFactory.cs @@ -24,6 +24,7 @@ namespace Stone.DataService.Biz F_BillVDA f_BillVDA = null; F_BillAsn f_BillAsn = null; //F_BillSort f_BillSort = null; + F_STD_Check f_STD_Check = null; Command cmd = new Command(dsCommand); @@ -84,19 +85,28 @@ namespace Stone.DataService.Biz f_BillAsn.BillSubmit(cmd, dsData); return null; - #endregion - + #endregion #region STDУ case "VDA_CHECK_SUBMIT": return F_STD_Check.VDA_Check_Submit(cmd); #endregion + + #region VDAȡڲ + case "GETBARCODE": + return F_VerifyBill.GetBarCodeByVDA(cmd); + #endregion + + #region ڲ-Уװ + case "BILL_RE_CHECK": + f_STD_Check = new F_STD_Check(); + var ds = f_STD_Check.VDA_UPDATE_Submit(cmd); + return ds; + #endregion } throw new Exception("δȡκָݣ"); } - - } } diff --git a/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Info/F_VerifyBill.cs b/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Info/F_VerifyBill.cs new file mode 100644 index 0000000..bf531bc --- /dev/null +++ b/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Info/F_VerifyBill.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using System.Data; +using Gm_WMS.DataAccess.DataService; +using Stone.Common; + +namespace Stone.DataService.Biz.Info +{ + public class F_VerifyBill + { + + public static DataSet GetBarCodeByVDA(Command cmd) + { + string VDA = cmd.Pars[0]; + string sql = "select BarCode from t_VerifyBill where 1= 1 " + + " and PackageNo1 = '" + VDA + "'" + + " or PackageNo2 = '" + VDA + "'" + + " order by Id desc"; + LocalDBService db = new LocalDBService(); + return db.Exec_DataSet(sql); + } + } +} diff --git a/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Stone.DataService.Biz.csproj b/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Stone.DataService.Biz.csproj index b62972d..7207af4 100644 --- a/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Stone.DataService.Biz.csproj +++ b/Stone.WinForm/Stone.DataService/Stone.DataService.Biz/Stone.DataService.Biz.csproj @@ -85,6 +85,7 @@ + diff --git a/Stone.WinForm/Stone.WinBiz/VerifyData/F_VerifyBill.cs b/Stone.WinForm/Stone.WinBiz/VerifyData/F_VerifyBill.cs index 57a11c0..2dcc468 100644 --- a/Stone.WinForm/Stone.WinBiz/VerifyData/F_VerifyBill.cs +++ b/Stone.WinForm/Stone.WinBiz/VerifyData/F_VerifyBill.cs @@ -29,6 +29,7 @@ namespace Stone.WinBiz.VerifyData dgv.Columns["BarCode"].HeaderText = "内部装箱单号"; dgv.Columns["UserName"].HeaderText = "用户名"; dgv.Columns["AddTime"].HeaderText = "校验时间"; + dgv.Columns["State"].HeaderText = "状态"; } } diff --git a/Stone.WinForm/Stone.WinModule/VerifyData/frmVerifyBill.cs b/Stone.WinForm/Stone.WinModule/VerifyData/frmVerifyBill.cs index 85c8dc8..5b01452 100644 --- a/Stone.WinForm/Stone.WinModule/VerifyData/frmVerifyBill.cs +++ b/Stone.WinForm/Stone.WinModule/VerifyData/frmVerifyBill.cs @@ -30,6 +30,7 @@ namespace Stone.WinModule.VerifyData strWhere += " or [PackageNo] like '%" + code + "%'"; strWhere += " or [BarCode] like '%" + code + "%'"; strWhere += " or [UserName] like '%" + code + "%'"; + strWhere += " or [State] like '%" + code + "%'"; } else {