Browse Source

按零件类型在导入时生成ASN号

STD_NA
金浩 4 days ago
parent
commit
c532edd979
  1. 2
      Stone.WinForm/Stone.WinBiz/BasicData/F_PartPO.cs
  2. 70
      Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.Designer.cs
  3. 3
      Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.cs
  4. 96
      Stone.WinForm/Stone.WinModule/Standard/frmJISVDAASN.cs

2
Stone.WinForm/Stone.WinBiz/BasicData/F_PartPO.cs

@ -26,6 +26,7 @@ namespace Stone.WinBiz.BasicData
dgv.Columns["Code"].HeaderText = "存货代码"; dgv.Columns["Code"].HeaderText = "存货代码";
dgv.Columns["PONumber"].HeaderText = "订单号"; dgv.Columns["PONumber"].HeaderText = "订单号";
dgv.Columns["IsCheck"].HeaderText = "发运校验"; dgv.Columns["IsCheck"].HeaderText = "发运校验";
dgv.Columns["PartType"].HeaderText = "零件类型";
} }
public override void Checking(DataRow drData, bool isNew) public override void Checking(DataRow drData, bool isNew)
@ -54,6 +55,7 @@ namespace Stone.WinBiz.BasicData
drInput["Code"] = drData["存货代码"].ToString().Trim(); drInput["Code"] = drData["存货代码"].ToString().Trim();
drInput["PONumber"] = drData["订单号"].ToString().Trim(); drInput["PONumber"] = drData["订单号"].ToString().Trim();
drInput["IsCheck"] = drData["发运校验"].ToString().Trim(); drInput["IsCheck"] = drData["发运校验"].ToString().Trim();
drInput["PartType"] = drData["零件类型"].ToString().Trim();
if (drInput["Code"].ToString().Trim() == "") if (drInput["Code"].ToString().Trim() == "")
throw new Exception("存货代码不能为空!"); throw new Exception("存货代码不能为空!");

70
Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.Designer.cs

@ -34,77 +34,105 @@
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.colorDialog1 = new System.Windows.Forms.ColorDialog(); this.colorDialog1 = new System.Windows.Forms.ColorDialog();
this.txtIsCheck = new System.Windows.Forms.CheckBox(); this.txtIsCheck = new System.Windows.Forms.CheckBox();
this.tbPartType = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// btnAddNewLine // btnAddNewLine
// //
this.btnAddNewLine.Location = new System.Drawing.Point(41, 123); this.btnAddNewLine.Location = new System.Drawing.Point(62, 255);
this.btnAddNewLine.Margin = new System.Windows.Forms.Padding(4); this.btnAddNewLine.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
// //
// btnClose // btnClose
// //
this.btnClose.Location = new System.Drawing.Point(254, 123); this.btnClose.Location = new System.Drawing.Point(381, 255);
this.btnClose.Margin = new System.Windows.Forms.Padding(4); this.btnClose.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
// //
// btnOK // btnOK
// //
this.btnOK.Location = new System.Drawing.Point(166, 123); this.btnOK.Location = new System.Drawing.Point(249, 255);
this.btnOK.Margin = new System.Windows.Forms.Padding(4); this.btnOK.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
// //
// tbPONumber // 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.MaxLength = 100;
this.tbPONumber.Name = "tbPONumber"; 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; this.tbPONumber.TabIndex = 1;
// //
// txtCode // 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.MaxLength = 10;
this.txtCode.Name = "txtCode"; 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; this.txtCode.TabIndex = 0;
// //
// label2 // label2
// //
this.label2.AutoSize = true; 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.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.TabIndex = 109;
this.label2.Text = "订单号:"; this.label2.Text = "订单号:";
// //
// label1 // label1
// //
this.label1.AutoSize = true; 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.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.TabIndex = 108;
this.label1.Text = "物料号:"; this.label1.Text = "物料号:";
// //
// txtIsCheck // txtIsCheck
// //
this.txtIsCheck.AutoSize = true; 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.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.TabIndex = 110;
this.txtIsCheck.Text = "是否发运校验"; this.txtIsCheck.Text = "是否发运校验";
this.txtIsCheck.UseVisualStyleBackColor = true; 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 // frmPartPODetail
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.ClientSize = new System.Drawing.Size(381, 170); 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.txtIsCheck);
this.Controls.Add(this.tbPONumber); this.Controls.Add(this.tbPONumber);
this.Controls.Add(this.txtCode); this.Controls.Add(this.txtCode);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.label1); 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.Name = "frmPartPODetail";
this.Load += new System.EventHandler(this.frmColorDetail_Load); this.Load += new System.EventHandler(this.frmColorDetail_Load);
this.Controls.SetChildIndex(this.btnOK, 0); this.Controls.SetChildIndex(this.btnOK, 0);
@ -115,6 +143,8 @@
this.Controls.SetChildIndex(this.txtCode, 0); this.Controls.SetChildIndex(this.txtCode, 0);
this.Controls.SetChildIndex(this.tbPONumber, 0); this.Controls.SetChildIndex(this.tbPONumber, 0);
this.Controls.SetChildIndex(this.txtIsCheck, 0); this.Controls.SetChildIndex(this.txtIsCheck, 0);
this.Controls.SetChildIndex(this.label3, 0);
this.Controls.SetChildIndex(this.tbPartType, 0);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -127,5 +157,7 @@
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.ColorDialog colorDialog1; private System.Windows.Forms.ColorDialog colorDialog1;
private System.Windows.Forms.CheckBox txtIsCheck; private System.Windows.Forms.CheckBox txtIsCheck;
private System.Windows.Forms.TextBox tbPartType;
private System.Windows.Forms.Label label3;
} }
} }

3
Stone.WinForm/Stone.WinModule/BasicData/frmPartPODetail.cs

@ -28,6 +28,7 @@ namespace Stone.WinModule.BasicData
base.GetData(); base.GetData();
drData["Code"] = MyStrings.GetString(this.txtCode.Text.Trim()); drData["Code"] = MyStrings.GetString(this.txtCode.Text.Trim());
drData["PONumber"] = MyStrings.GetString(this.tbPONumber.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; drData["IsCheck"] = this.txtIsCheck.Checked ? true : false;
return true; return true;
} }
@ -43,6 +44,7 @@ namespace Stone.WinModule.BasicData
{ {
this.txtCode.Text = drData["Code"].ToString(); this.txtCode.Text = drData["Code"].ToString();
this.tbPONumber.Text = drData["PONumber"].ToString(); this.tbPONumber.Text = drData["PONumber"].ToString();
this.tbPartType.Text = drData["PartType"].ToString();
this.txtIsCheck.Checked = Convert.ToBoolean(drData["IsCheck"]); this.txtIsCheck.Checked = Convert.ToBoolean(drData["IsCheck"]);
} }
@ -54,6 +56,7 @@ namespace Stone.WinModule.BasicData
base.Clear(); base.Clear();
this.txtCode.Text = ""; this.txtCode.Text = "";
this.tbPONumber.Text = ""; this.tbPONumber.Text = "";
this.tbPartType.Text = "";
this.txtCode.Focus(); this.txtCode.Focus();
txtIsCheck.Checked = true; txtIsCheck.Checked = true;
} }

96
Stone.WinForm/Stone.WinModule/Standard/frmJISVDAASN.cs

@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Data; using System.Data;
using System.Data.OleDb; using System.Data.OleDb;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using Stone.Common; using Stone.Common;
@ -125,6 +126,12 @@ namespace Stone.WinModule.Standard
// btnPrintLabel.Click += btnPrintLabel_Click; // btnPrintLabel.Click += btnPrintLabel_Click;
// this.toolStrip1.Items.Insert(0, btnPrintLabel); // 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发运"); ToolStripButton btnPREDN = new ToolStripButton("ASN发运");
btnPREDN.Image = this.imageList1.Images[1]; btnPREDN.Image = this.imageList1.Images[1];
btnPREDN.TextImageRelation = TextImageRelation.ImageAboveText; 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) private void btnPrintLabel_Click(object sender, EventArgs e)
{ {
Gm_WMS.DataAccess.DataService.LocalDBService db = null; Gm_WMS.DataAccess.DataService.LocalDBService db = null;
@ -914,7 +944,7 @@ namespace Stone.WinModule.Standard
//导入的列数 //导入的列数
var coloumnCount = dsData.Tables[0].Columns.Count; var coloumnCount = dsData.Tables[0].Columns.Count;
//零件号所在的行 从0开始 //零件号所在的行 从0开始
var partRowIndex = 8; var partRowIndex = 6;
//零件号所在的列数 从0 开始 //零件号所在的列数 从0 开始
var partIndex = 2; var partIndex = 2;
//校验零件号是否有订单信息 //校验零件号是否有订单信息
@ -925,9 +955,10 @@ namespace Stone.WinModule.Standard
throw new Exception("导入数据失败!\r\n" + "原因为:\r\n" + strCheckPO); throw new Exception("导入数据失败!\r\n" + "原因为:\r\n" + strCheckPO);
} }
//删掉导入的ASN //删掉导入的ASN
DelDPASNHis(dsData.Tables[0]); DelDPDateHis(dsData.Tables[0]);
//获取零件订单基础数据 //获取零件订单基础数据
var lstPartType = new List<string>();
for (int i = 0; i < dsData.Tables[0].Rows.Count; i++) for (int i = 0; i < dsData.Tables[0].Rows.Count; i++)
{ {
@ -982,6 +1013,12 @@ namespace Stone.WinModule.Standard
//是否上传ASN //是否上传ASN
drInput["IsUpload"] = 0; drInput["IsUpload"] = 0;
t_Input.Add(drInput); 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) public static string GetDateTimeStyle4(string sDateTime, MyDateTimeType dType)
@ -1076,9 +1129,44 @@ namespace Stone.WinModule.Standard
if (dtData.Rows.Count == 0) throw new Exception("补打的记录不存在"); if (dtData.Rows.Count == 0) throw new Exception("补打的记录不存在");
return strRtn; return strRtn;
} }
/// <summary>
/// 删除历史导入的ASN单 根据发货的计划时间进行删除
/// </summary>
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);
}
}
/// <summary> /// <summary>
/// 删除历史导入的ASN单 /// 删除历史导入的ASN单 根据发货的计划时间进行删除
/// </summary> /// </summary>
private void DelDPASNHis(DataTable dtImport) private void DelDPASNHis(DataTable dtImport)
{ {

Loading…
Cancel
Save