You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
225 lines
8.2 KiB
225 lines
8.2 KiB
using Gm_WMS.DataAccess.DataService;
|
|
using Stone.Common;
|
|
using Stone.Entity;
|
|
using Stone.WinBiz.BasicData;
|
|
using Stone.WinBiz.Preordering;
|
|
using Stone.WinBiz.ProductionPlan;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Stone.WinModule.ProductionPlan
|
|
{
|
|
public partial class frmAssemble : Stone.WinModule.BasicData.frmBaseMain
|
|
{
|
|
public frmAssemble()
|
|
{
|
|
InitializeComponent();
|
|
|
|
base.ReadOnly();
|
|
|
|
this.lblStateRecord.SendToBack();
|
|
}
|
|
|
|
private void frmAssemble_Load(object sender, EventArgs e)
|
|
{
|
|
base.CreateButton("打印序列单", 4, 0).Click += btnPrint_Click;
|
|
base.CreateButton("补打序列单", 4, 1).Click += btnRePrint_Click;
|
|
base.CreateButton("补打标签和装配单", 4, 2).Click += btnAssembleLabel_Click;
|
|
base.CreateButton("插单", 5, 3).Click += btnInsert_Click;
|
|
}
|
|
|
|
private void btnInsert_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.dgrdView.SelectedRows.Count == 0) throw new Exception("请选择要插单的记录");
|
|
|
|
if (!MyMessageBox.ShowQuestion("是否要插单选择的记录?")) return;
|
|
|
|
string ID = this.dgrdView.SelectedRows[0].Cells["ID"].Value.ToString();
|
|
|
|
Entity_t_JIS_Assemble t_JIS_Assemble = new Entity_t_JIS_Assemble();
|
|
DataSet dsData = t_JIS_Assemble.GetData("[ID]=" + ID);
|
|
if (dsData.Tables[0].Rows.Count == 0) throw new Exception("插单的数据不存在");
|
|
|
|
if (Convert.ToInt32(dsData.Tables[0].Rows[0]["IsPrint"]) == 0) throw new Exception("订单还未打印,不能插单");
|
|
|
|
t_JIS_Assemble.Edit("IsAssemble=0, IsInsert=1, [IsScan]=1, [IsCheck]=0, [IsOnline]=0", "[ID]=" + dsData.Tables[0].Rows[0]["ID"].ToString());
|
|
|
|
dsData.Tables[0].Rows[0]["IsInsert"] = 1;
|
|
dsData.Tables[0].TableName = "Head";
|
|
Entity_t_JIS_List t_JIS_List = new Entity_t_JIS_List();
|
|
dsData.Tables.Add(
|
|
t_JIS_List.GetData("[productionNumber] = '" + dsData.Tables["Head"].Rows[0]["productionNumber"].ToString() + "' AND [partType] = '" + dsData.Tables["Head"].Rows[0]["partType"].ToString() + "'").Tables[0].Copy()
|
|
);
|
|
dsData.Tables[1].TableName = "Detail";
|
|
|
|
F_Preordering.PrintLabel(dsData);
|
|
|
|
MyMessageBox.ShowInfoMessage(dsData.Tables[0].Rows[0]["productionNumber"].ToString() + " 插单完成");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void btnAssembleLabel_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.dgrdView.SelectedRows.Count == 0) throw new Exception("请选择要补打的记录");
|
|
|
|
if (!MyMessageBox.ShowQuestion("是否要补打选择的记录?")) return;
|
|
|
|
string ID = this.dgrdView.SelectedRows[0].Cells["ID"].Value.ToString();
|
|
|
|
Entity_t_JIS_Assemble t_JIS_Assemble = new Entity_t_JIS_Assemble();
|
|
DataSet dsData = t_JIS_Assemble.GetData("[ID]=" + ID);
|
|
dsData.Tables[0].TableName = "Head";
|
|
|
|
if (dsData.Tables["Head"].Rows.Count == 0) throw new Exception("打印的记录不存在");
|
|
|
|
Entity_t_JIS_List t_JIS_List = new Entity_t_JIS_List();
|
|
dsData.Tables.Add(
|
|
t_JIS_List.GetData("[productionNumber] = '" + dsData.Tables["Head"].Rows[0]["productionNumber"].ToString() + "' AND [partType] = '" + dsData.Tables["Head"].Rows[0]["partType"].ToString() + "'").Tables[0].Copy()
|
|
);
|
|
dsData.Tables[1].TableName = "Detail";
|
|
|
|
F_Preordering.PrintLabel(dsData);
|
|
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
|
|
public override void init()
|
|
{
|
|
strWhere = "[IsPrint]=0";
|
|
base.init();
|
|
}
|
|
|
|
private void btnPrint_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.dgrdView.SelectedRows.Count == 0) throw new Exception("请选择要打印的单据");
|
|
|
|
string BillNo = this.dgrdView.SelectedRows[0].Cells["BillNo"].Value.ToString();
|
|
if (MyMessageBox.ShowQuestion($"是否要打印 {BillNo} ?"))
|
|
{
|
|
LocalDBService db = null;
|
|
try
|
|
{
|
|
db = new LocalDBService();
|
|
db.BeginTrans();
|
|
|
|
Entity_t_JIS_Assemble t_JIS_Assemble = new Entity_t_JIS_Assemble(db);
|
|
DataTable dtPrint = t_JIS_Assemble.GetData("", $"[BillNo]='{BillNo}'", "[assemblyDate] asc").Tables[0];
|
|
if (dtPrint.Rows.Count == 0) throw new Exception($"单据 {BillNo} 在系统中不存在");
|
|
|
|
if (Convert.ToInt32(dtPrint.Rows[0]["IsPrint"]) == 1) throw new Exception($"单据 {BillNo} 已经打印过了,请使用补打功能");
|
|
|
|
t_JIS_Assemble.Edit("[IsPrint]=1, [PrintTime]=getdate()", $"[BillNo]='{BillNo}'");
|
|
|
|
db.Commit();
|
|
|
|
try
|
|
{
|
|
F_Assemble.Print(dtPrint, BillNo);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
catch (Exception exx)
|
|
{
|
|
if (db != null) db.Rollback();
|
|
throw exx;
|
|
}
|
|
finally
|
|
{
|
|
if (db != null) db.EndTrans();
|
|
}
|
|
|
|
UpdateGridView();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void btnRePrint_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.dgrdView.SelectedRows.Count == 0) throw new Exception("请选择要打印的单据");
|
|
|
|
string BillNo = this.dgrdView.SelectedRows[0].Cells["BillNo"].Value.ToString();
|
|
if (MyMessageBox.ShowQuestion($"是否要补打 {BillNo} ?"))
|
|
{
|
|
Entity_t_JIS_Assemble t_JIS_Assemble = new Entity_t_JIS_Assemble();
|
|
DataTable dtPrint = t_JIS_Assemble.GetData("", $"[BillNo]='{BillNo}'", "[assemblyDate] asc").Tables[0];
|
|
if (dtPrint.Rows.Count == 0) throw new Exception($"单据 {BillNo} 在系统中不存在");
|
|
|
|
if (Convert.ToInt32(dtPrint.Rows[0]["IsPrint"]) == 0) throw new Exception($"单据 {BillNo} 未打印,不能补打");
|
|
|
|
F_Assemble.Print(dtPrint, BillNo);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
|
|
public override void Search(string code)
|
|
{
|
|
if (code == "")
|
|
{
|
|
strWhere = "1=1";
|
|
}
|
|
else
|
|
{
|
|
strWhere = " [productionNumber] like '%" + code + "%' or ";
|
|
strWhere += " [itemNumber] like '%" + code + "%' or ";
|
|
strWhere += " [CarModelCode] like '%" + code + "%' or ";
|
|
strWhere += " [description] like '%" + code + "%' or ";
|
|
strWhere += " [sequenceNumber] like '%" + code + "%' or ";
|
|
strWhere += " [BillNo] like '%" + code + "%' ";
|
|
|
|
}
|
|
|
|
if (this.txtIsPrint.Checked)
|
|
{
|
|
strWhere = $"({strWhere}) and [IsPrint]=1";
|
|
}
|
|
else
|
|
{
|
|
strWhere = $"({strWhere}) and [IsPrint]=0";
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|