From c532edd97967ef7590d040ea892bc95b77a0256e Mon Sep 17 00:00:00 2001 From: jinhao Date: Wed, 25 Jun 2025 16:12:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E9=9B=B6=E4=BB=B6=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=9C=A8=E5=AF=BC=E5=85=A5=E6=97=B6=E7=94=9F=E6=88=90ASN?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Stone.WinBiz/BasicData/F_PartPO.cs | 2 + .../BasicData/frmPartPODetail.Designer.cs | 70 ++++++++++---- .../BasicData/frmPartPODetail.cs | 3 + .../Stone.WinModule/Standard/frmJISVDAASN.cs | 96 ++++++++++++++++++- 4 files changed, 148 insertions(+), 23 deletions(-) diff --git a/Stone.WinForm/Stone.WinBiz/BasicData/F_PartPO.cs b/Stone.WinForm/Stone.WinBiz/BasicData/F_PartPO.cs index 734d316..91cd6d8 100644 --- a/Stone.WinForm/Stone.WinBiz/BasicData/F_PartPO.cs +++ b/Stone.WinForm/Stone.WinBiz/BasicData/F_PartPO.cs @@ -26,6 +26,7 @@ namespace Stone.WinBiz.BasicData dgv.Columns["Code"].HeaderText = "存货代码"; dgv.Columns["PONumber"].HeaderText = "订单号"; dgv.Columns["IsCheck"].HeaderText = "发运校验"; + dgv.Columns["PartType"].HeaderText = "零件类型"; } public override void Checking(DataRow drData, bool isNew) @@ -54,6 +55,7 @@ namespace Stone.WinBiz.BasicData drInput["Code"] = drData["存货代码"].ToString().Trim(); drInput["PONumber"] = drData["订单号"].ToString().Trim(); drInput["IsCheck"] = drData["发运校验"].ToString().Trim(); + drInput["PartType"] = drData["零件类型"].ToString().Trim(); if (drInput["Code"].ToString().Trim() == "") throw new Exception("存货代码不能为空!"); diff --git a/Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.Designer.cs b/Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.Designer.cs index 737135a..0959215 100644 --- a/Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.Designer.cs +++ b/Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.Designer.cs @@ -34,77 +34,105 @@ this.label1 = new System.Windows.Forms.Label(); this.colorDialog1 = new System.Windows.Forms.ColorDialog(); this.txtIsCheck = new System.Windows.Forms.CheckBox(); + this.tbPartType = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // btnAddNewLine // - this.btnAddNewLine.Location = new System.Drawing.Point(41, 123); - this.btnAddNewLine.Margin = new System.Windows.Forms.Padding(4); + this.btnAddNewLine.Location = new System.Drawing.Point(62, 255); + this.btnAddNewLine.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); // // btnClose // - this.btnClose.Location = new System.Drawing.Point(254, 123); - this.btnClose.Margin = new System.Windows.Forms.Padding(4); + this.btnClose.Location = new System.Drawing.Point(381, 255); + this.btnClose.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); // // btnOK // - this.btnOK.Location = new System.Drawing.Point(166, 123); - this.btnOK.Margin = new System.Windows.Forms.Padding(4); + this.btnOK.Location = new System.Drawing.Point(249, 255); + this.btnOK.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); // // tbPONumber // - this.tbPONumber.Location = new System.Drawing.Point(113, 71); + this.tbPONumber.Location = new System.Drawing.Point(170, 106); + this.tbPONumber.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tbPONumber.MaxLength = 100; this.tbPONumber.Name = "tbPONumber"; - this.tbPONumber.Size = new System.Drawing.Size(222, 21); + this.tbPONumber.Size = new System.Drawing.Size(331, 28); this.tbPONumber.TabIndex = 1; // // txtCode // - this.txtCode.Location = new System.Drawing.Point(113, 40); + this.txtCode.Location = new System.Drawing.Point(170, 60); + this.txtCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtCode.MaxLength = 10; this.txtCode.Name = "txtCode"; - this.txtCode.Size = new System.Drawing.Size(222, 21); + this.txtCode.Size = new System.Drawing.Size(331, 28); this.txtCode.TabIndex = 0; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(23, 74); + this.label2.Location = new System.Drawing.Point(34, 111); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(53, 12); + this.label2.Size = new System.Drawing.Size(80, 18); this.label2.TabIndex = 109; this.label2.Text = "订单号:"; // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(23, 44); + this.label1.Location = new System.Drawing.Point(34, 66); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(53, 12); + this.label1.Size = new System.Drawing.Size(80, 18); this.label1.TabIndex = 108; this.label1.Text = "物料号:"; // // txtIsCheck // this.txtIsCheck.AutoSize = true; - this.txtIsCheck.Location = new System.Drawing.Point(254, 100); + this.txtIsCheck.Location = new System.Drawing.Point(381, 221); + this.txtIsCheck.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtIsCheck.Name = "txtIsCheck"; - this.txtIsCheck.Size = new System.Drawing.Size(96, 16); + this.txtIsCheck.Size = new System.Drawing.Size(142, 22); this.txtIsCheck.TabIndex = 110; this.txtIsCheck.Text = "是否发运校验"; this.txtIsCheck.UseVisualStyleBackColor = true; // + // tbPartType + // + this.tbPartType.Location = new System.Drawing.Point(170, 156); + this.tbPartType.Margin = new System.Windows.Forms.Padding(4); + this.tbPartType.MaxLength = 100; + this.tbPartType.Name = "tbPartType"; + this.tbPartType.Size = new System.Drawing.Size(331, 28); + this.tbPartType.TabIndex = 111; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(34, 161); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(98, 18); + this.label3.TabIndex = 112; + this.label3.Text = "零件类型:"; + // // frmPartPODetail // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.ClientSize = new System.Drawing.Size(381, 170); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.ClientSize = new System.Drawing.Size(572, 323); + this.Controls.Add(this.tbPartType); + this.Controls.Add(this.label3); this.Controls.Add(this.txtIsCheck); this.Controls.Add(this.tbPONumber); this.Controls.Add(this.txtCode); this.Controls.Add(this.label2); this.Controls.Add(this.label1); - this.Margin = new System.Windows.Forms.Padding(4); + this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); this.Name = "frmPartPODetail"; this.Load += new System.EventHandler(this.frmColorDetail_Load); this.Controls.SetChildIndex(this.btnOK, 0); @@ -115,6 +143,8 @@ this.Controls.SetChildIndex(this.txtCode, 0); this.Controls.SetChildIndex(this.tbPONumber, 0); this.Controls.SetChildIndex(this.txtIsCheck, 0); + this.Controls.SetChildIndex(this.label3, 0); + this.Controls.SetChildIndex(this.tbPartType, 0); this.ResumeLayout(false); this.PerformLayout(); @@ -127,5 +157,7 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.ColorDialog colorDialog1; private System.Windows.Forms.CheckBox txtIsCheck; + private System.Windows.Forms.TextBox tbPartType; + private System.Windows.Forms.Label label3; } } diff --git a/Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.cs b/Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.cs index 20bfab1..0ddc4aa 100644 --- a/Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.cs +++ b/Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.cs @@ -28,6 +28,7 @@ namespace Stone.WinModule.BasicData base.GetData(); drData["Code"] = MyStrings.GetString(this.txtCode.Text.Trim()); drData["PONumber"] = MyStrings.GetString(this.tbPONumber.Text.Trim()); + drData["PartType"] = MyStrings.GetString(this.tbPartType.Text.Trim()); drData["IsCheck"] = this.txtIsCheck.Checked ? true : false; return true; } @@ -43,6 +44,7 @@ namespace Stone.WinModule.BasicData { this.txtCode.Text = drData["Code"].ToString(); this.tbPONumber.Text = drData["PONumber"].ToString(); + this.tbPartType.Text = drData["PartType"].ToString(); this.txtIsCheck.Checked = Convert.ToBoolean(drData["IsCheck"]); } @@ -54,6 +56,7 @@ namespace Stone.WinModule.BasicData base.Clear(); this.txtCode.Text = ""; this.tbPONumber.Text = ""; + this.tbPartType.Text = ""; this.txtCode.Focus(); txtIsCheck.Checked = true; } diff --git a/Stone.WinForm/Stone.WinModule/Standard/frmJISVDAASN.cs b/Stone.WinForm/Stone.WinModule/Standard/frmJISVDAASN.cs index 0fcfc3c..a01b661 100644 --- a/Stone.WinForm/Stone.WinModule/Standard/frmJISVDAASN.cs +++ b/Stone.WinForm/Stone.WinModule/Standard/frmJISVDAASN.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using System.Data; using System.Data.OleDb; using System.Drawing; +using System.Linq; using System.Text; using System.Windows.Forms; using Stone.Common; @@ -125,6 +126,12 @@ namespace Stone.WinModule.Standard // btnPrintLabel.Click += btnPrintLabel_Click; // this.toolStrip1.Items.Insert(0, btnPrintLabel); + ToolStripButton btnCreateASN = new ToolStripButton("ASN单号创建"); + btnCreateASN.Image = this.imageList1.Images[3]; + btnCreateASN.TextImageRelation = TextImageRelation.ImageAboveText; + btnCreateASN.Click += btnCreateASN_Click; + this.toolStrip1.Items.Insert(0, btnCreateASN); + ToolStripButton btnPREDN = new ToolStripButton("ASN发运"); btnPREDN.Image = this.imageList1.Images[1]; btnPREDN.TextImageRelation = TextImageRelation.ImageAboveText; @@ -464,6 +471,29 @@ namespace Stone.WinModule.Standard } } + private void btnCreateASN_Click(object sender, EventArgs e) + { + try + { + if (this.dgrdView.SelectedRows.Count == 0) throw new Exception("请选择要打印标签的ASN"); + string AsnNumber = this.dgrdView.SelectedRows[0].Cells["AsnNumber"].Value.ToString(); + if (!string.IsNullOrEmpty(AsnNumber)) + { + if (!MyMessageBox.ShowQuestion($"【{AsnNumber}】已创建,是否要重新生成?")) return; + } + string partCode = this.dgrdView.SelectedRows[0].Cells["PartNumber"].Value.ToString(); + + + + Search(""); + btnSerach_Click(sender, null); + } + catch (Exception ex) + { + MyMessageBox.ShowErrorMessage(ex.Message); + } + } + private void btnPrintLabel_Click(object sender, EventArgs e) { Gm_WMS.DataAccess.DataService.LocalDBService db = null; @@ -914,7 +944,7 @@ namespace Stone.WinModule.Standard //导入的列数 var coloumnCount = dsData.Tables[0].Columns.Count; //零件号所在的行 从0开始 - var partRowIndex = 8; + var partRowIndex = 6; //零件号所在的列数 从0 开始 var partIndex = 2; //校验零件号是否有订单信息 @@ -925,9 +955,10 @@ namespace Stone.WinModule.Standard throw new Exception("导入数据失败!\r\n" + "原因为:\r\n" + strCheckPO); } - //删掉以导入的ASN - DelDPASNHis(dsData.Tables[0]); + //删掉已导入的ASN + DelDPDateHis(dsData.Tables[0]); //获取零件订单基础数据 + var lstPartType = new List(); for (int i = 0; i < dsData.Tables[0].Rows.Count; i++) { @@ -982,6 +1013,12 @@ namespace Stone.WinModule.Standard //是否上传ASN drInput["IsUpload"] = 0; t_Input.Add(drInput); + //添加零件类型 + var partType = partPO[0]["PartType"].ToString(); + if (!lstPartType.Contains(partType)) + { + lstPartType.Add(partType); + } } } } @@ -990,6 +1027,22 @@ namespace Stone.WinModule.Standard } } } + //对ASN进行赋值 + foreach (var partType in lstPartType) + { + //背板是SJB00001和侧翼是SJC00002 + var asnNum = GetVDA_AsnLiushui(db, partType, 5); + t_Input.Edit( + $"[AsnNumber]='{asnNum}'", + $"[PartNumber] in (select Code from t_PartPONumber where PartType = '{partType}'"); + } + } + + private string GetVDA_AsnLiushui(LocalDBService db, string type, int len) + { + string value = db.Exec_Object("exec p_GetBillNo 'ASN流水号_"+type).ToString(); + + return type + MyStrings.PadLeftString(value, '0', len); } public static string GetDateTimeStyle4(string sDateTime, MyDateTimeType dType) @@ -1076,9 +1129,44 @@ namespace Stone.WinModule.Standard if (dtData.Rows.Count == 0) throw new Exception("补打的记录不存在"); return strRtn; } + /// + /// 删除历史导入的ASN单 根据发货的计划时间进行删除 + /// + private void DelDPDateHis(DataTable dtImport) + { + LocalDBService db = new LocalDBService(); + var sql = ""; + var deliverDate = ""; + //日期 行位置 + var dateRowIndex = 3; + //时间 行位置 + var timeRowIndex = 4; + var dateRow = dtImport.Rows[dateRowIndex]; + var timeRow = dtImport.Rows[timeRowIndex]; + //ASN 列开始位置 + var asnColumnStartIndex = 5; + var strLabelDate = ""; + for (int i = asnColumnStartIndex; i < dtImport.Columns.Count; i++) + { + if (!string.IsNullOrEmpty(dateRow[i].ToString())) + { + var date = dateRow[i].ToString(); + date = GetDateTimeStyle4(date, MyDateTimeType.Date); + var DPTime = timeRow[i].ToString(); + var labelDate = DateTime.Parse(date).ToString("yyyy-MM-dd") + " " + DPTime + ":00"; + strLabelDate += "'" + labelDate + "',"; + } + } + if (strLabelDate.Length > 0) + { + strLabelDate = strLabelDate.Substring(0, strLabelDate.Length - 1); + sql = $"delete from t_JIS_VDA where LabelDate in (" + strLabelDate + ")"; + db.Exec_NonQuery(sql); + } + } /// - /// 删除历史导入的ASN单 + /// 删除历史导入的ASN单 根据发货的计划时间进行删除 /// private void DelDPASNHis(DataTable dtImport) {