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.
809 lines
28 KiB
809 lines
28 KiB
using Gm_WMS.DataAccess.DataService;
|
|
using Stone.Common;
|
|
using Stone.Entity;
|
|
using Stone.WinBiz.JisData;
|
|
using Stone.WinBiz.SystemData;
|
|
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.JisData
|
|
{
|
|
public partial class frmAJIS : Stone.WinModule.BasicData.frmBaseMain
|
|
{
|
|
private ToolStripButton btnPrint = null;
|
|
private ToolStripButton btnPrintRe = null;
|
|
private ToolStripButton btnSetPackage = null;
|
|
private ToolStripButton btnError = null;
|
|
private ToolStripButton btnCancel = null;
|
|
private int PackageQty = 0;
|
|
public frmAJIS()
|
|
{
|
|
InitializeComponent();
|
|
|
|
|
|
this.lblStateRecord.SendToBack();
|
|
|
|
|
|
DataTable dtState = new DataTable();
|
|
dtState.Columns.Add("Code");
|
|
|
|
DataRow drState = dtState.NewRow();
|
|
drState["Code"] = "未打印";
|
|
dtState.Rows.Add(drState);
|
|
|
|
drState = dtState.NewRow();
|
|
drState["Code"] = "已打印";
|
|
dtState.Rows.Add(drState);
|
|
|
|
this.txtState.DataSource = dtState;
|
|
this.txtState.DisplayMember = "Code";
|
|
this.txtState.ValueMember = "Code";
|
|
|
|
base.ReadOnly();
|
|
|
|
btnSetPackage = base.CreateButton($"装箱数", 7, 0);
|
|
btnSetPackage.Click += btnSetPackage_Click;
|
|
|
|
btnCancel = base.CreateButton($"取消序列单", 9, 0);
|
|
btnCancel.Click += btnCancel_Click;
|
|
|
|
btnPrintRe = base.CreateButton("补打序列单", 6, 0);
|
|
btnPrintRe.Click += btnPrintRe_Click;
|
|
|
|
btnPrint = base.CreateButton("打印序列单", 4, 0);
|
|
btnPrint.Click += btnPrint_Click;
|
|
|
|
|
|
|
|
|
|
dgrdView.CellClick += dgrdView_CellClick;
|
|
|
|
this.timer1.Interval = Convert.ToInt32(MyAppconfig.ReadValue("UpdateTime")) * 1000 * 60;
|
|
this.timer1.Enabled = true;
|
|
|
|
this.openFileDialog1.Filter = "Excel文件(*.xls)|*.xls";
|
|
this.openFileDialog1.DefaultExt = "xls";
|
|
|
|
this.txtD1.Enabled = false;
|
|
this.txtD2.Enabled = false;
|
|
|
|
this.dgrdView.MultiSelect = true;
|
|
|
|
if (User.UserInfo.UserVerify("001")) //错误处理小权限
|
|
{
|
|
btnError = base.CreateButton("错误处理", 8, 0);
|
|
btnError.Click += btnError_Click;
|
|
}
|
|
}
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
LocalDBService db = null;
|
|
try
|
|
{
|
|
if (this.dgrdView.SelectedRows.Count == 0) throw new Exception("请选择要取消的序列单");
|
|
|
|
string TaskNo = this.dgrdView.SelectedRows[0].Cells["TaskNo"].Value.ToString();
|
|
if (TaskNo == "") throw new Exception("选择的记录未打印,不能取消");
|
|
|
|
if(!MyMessageBox.ShowQuestion($"是否要取消打印序列单{TaskNo}?"))
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
db = new LocalDBService();
|
|
db.BeginTrans();
|
|
|
|
string _type = "";
|
|
if (((F_AJIS)m_Base).address == "104") _type = "1";
|
|
if (((F_AJIS)m_Base).address == "1046") _type = "2";
|
|
|
|
string CancelNo = TaskNo.Substring(0, 9);
|
|
EntityBase t_AJIS = null;
|
|
if (((F_AJIS)m_Base).jistype == 0)
|
|
{
|
|
t_AJIS = new Entity_t_AJIS(db);
|
|
CancelNo = "门板" + CancelNo;
|
|
}
|
|
else
|
|
{
|
|
t_AJIS = new Entity_t_AJISCarpet(db);
|
|
CancelNo = "地毯" + CancelNo;
|
|
}
|
|
|
|
DataTable dtData = t_AJIS.GetData($"[TaskNo]='{TaskNo}' and [isPost]=1").Tables[0];
|
|
if (dtData.Rows.Count == 0) throw new Exception("取消的序列单不存在,请刷新后重试");
|
|
|
|
DataTable dtMax = t_AJIS.GetData("MAX(TaskNo) as c", $"[Address]='{((F_AJIS)m_Base).address}'", "c asc").Tables[0];
|
|
if (dtMax.Rows[0]["c"].ToString() == "") throw new Exception("没有可取消的序列单");
|
|
|
|
if(TaskNo.ToString().Trim() != dtMax.Rows[0]["c"].ToString().Trim())
|
|
{
|
|
throw new Exception($"只能取消最后一个序列单 {dtMax.Rows[0]["c"]}");
|
|
}
|
|
|
|
F_BillNo.CancelBillNo(db, CancelNo);
|
|
|
|
t_AJIS.Edit(
|
|
"[TaskNo]=null, [RunningNo]=null, [isPost]=0, [PostUser]=null, [PostTime]=null",
|
|
$"[TaskNo]='{TaskNo}'"
|
|
);
|
|
|
|
db.Commit();
|
|
|
|
MyMessageBox.ShowInfoMessage($"{TaskNo}取消成功");
|
|
|
|
UpdateGridView();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (db != null) db.Rollback();
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
if (db != null) db.EndTrans();
|
|
|
|
}
|
|
}
|
|
|
|
private void btnError_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.dgrdView.SelectedRows.Count > 0)
|
|
{
|
|
|
|
string ProductionNo = this.dgrdView.SelectedRows[0].Cells["ProductionNo"].Value.ToString();
|
|
|
|
if (((F_AJIS)m_Base).jistype == 0) //门板
|
|
{
|
|
|
|
ProcessAJIS(new Entity_t_PJIS(), new Entity_t_AJIS(), ProductionNo, false);
|
|
}
|
|
else
|
|
{
|
|
ProcessAJIS(new Entity_t_PJISCarpet(), new Entity_t_AJISCarpet(), ProductionNo, true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("请选择一条要处理错误的记录!");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
|
|
//重新解析AJIS
|
|
private void ProcessAJIS(EntityBase t_PJIS, EntityBase t_AJIS, string ProductionNo, bool IsCarpet)
|
|
{
|
|
DataTable dtAJIS = t_AJIS.GetData("", $"[ProductionNo]='{ProductionNo}'", "[ID] desc").Tables[0];
|
|
if (dtAJIS.Rows.Count == 0) throw new Exception($"生产号{ProductionNo}不存在");
|
|
|
|
if (!Convert.ToBoolean(dtAJIS.Rows[0]["IsError"])) throw new Exception($"{ProductionNo}没有错误,不能处理");
|
|
|
|
DataTable dtPJIS = t_PJIS.GetData($"[ProductionNo]='{ProductionNo}'").Tables[0];
|
|
if (dtPJIS.Rows.Count == 0)
|
|
{
|
|
throw new Exception($"{ProductionNo} 未找到PJIS,请检查数据\r\n");
|
|
}
|
|
else
|
|
{
|
|
if (Convert.ToBoolean(dtPJIS.Rows[0]["IsError"]))
|
|
{
|
|
throw new Exception($"{ProductionNo} PJIS有错误未处理,请检查并处理");
|
|
}
|
|
}
|
|
|
|
if(!IsCarpet)
|
|
{
|
|
dtAJIS.Rows[0]["type"] = dtPJIS.Rows[0]["type"].ToString();
|
|
dtAJIS.Rows[0]["code"] = dtPJIS.Rows[0]["code"].ToString();
|
|
dtAJIS.Rows[0]["FLProdNo"] = dtPJIS.Rows[0]["FLProdNo"].ToString();
|
|
dtAJIS.Rows[0]["FRProdNo"] = dtPJIS.Rows[0]["FRProdNo"].ToString();
|
|
dtAJIS.Rows[0]["RLProdNo"] = dtPJIS.Rows[0]["RLProdNo"].ToString();
|
|
dtAJIS.Rows[0]["RRProdNo"] = dtPJIS.Rows[0]["RRProdNo"].ToString();
|
|
dtAJIS.Rows[0]["AssemblyLine"] = dtPJIS.Rows[0]["AssemblyLine"].ToString();
|
|
dtAJIS.Rows[0]["Baumuster"] = dtPJIS.Rows[0]["Baumuster"].ToString();
|
|
dtAJIS.Rows[0]["Location"] = dtPJIS.Rows[0]["Location"].ToString();
|
|
dtAJIS.Rows[0]["IsError"] = false;
|
|
dtAJIS.Rows[0]["ErrorMsg"] = "";
|
|
}
|
|
else
|
|
{
|
|
|
|
|
|
dtAJIS.Rows[0]["moduno"] = dtPJIS.Rows[0]["moduno"].ToString();
|
|
dtAJIS.Rows[0]["AssemblyLine"] = dtPJIS.Rows[0]["AssemblyLine"].ToString();
|
|
dtAJIS.Rows[0]["Baumuster"] = dtPJIS.Rows[0]["Baumuster"].ToString();
|
|
dtAJIS.Rows[0]["Location"] = dtPJIS.Rows[0]["Location"].ToString();
|
|
dtAJIS.Rows[0]["IsError"] = false;
|
|
dtAJIS.Rows[0]["ErrorMsg"] = "";
|
|
}
|
|
|
|
t_AJIS.Edit(dtAJIS.Rows[0]);
|
|
|
|
//写接口
|
|
if (!IsCarpet)
|
|
{
|
|
Entity_byAJISToMES byAJISToMES = new Entity_byAJISToMES();
|
|
DataRow drbyAJISToMES = byAJISToMES.Table.NewRow();
|
|
drbyAJISToMES["ProductionNo"] = ProductionNo;
|
|
drbyAJISToMES["SequenceNo"] = dtAJIS.Rows[0]["SequenceNo"].ToString();
|
|
drbyAJISToMES["FLProdNo"] = dtPJIS.Rows[0]["FLProdNo"].ToString();
|
|
drbyAJISToMES["FRProdNo"] = dtPJIS.Rows[0]["FRProdNo"].ToString();
|
|
drbyAJISToMES["RLProdNo"] = dtPJIS.Rows[0]["RLProdNo"].ToString();
|
|
drbyAJISToMES["RRProdNo"] = dtPJIS.Rows[0]["RRProdNo"].ToString();
|
|
byAJISToMES.Add(drbyAJISToMES);
|
|
|
|
}
|
|
|
|
UpdateGridView();
|
|
|
|
MyMessageBox.ShowInfoMessage($"{ProductionNo}处理成功");
|
|
}
|
|
|
|
private void btnSetPackage_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
frmPackageQty frm = new frmPackageQty();
|
|
frm.txtPackageQty.Text = PackageQty.ToString();
|
|
if (frm.ShowDialog() == DialogResult.OK)
|
|
{
|
|
if (((F_AJIS)m_Base).jistype == 0)
|
|
{
|
|
new Entity_t_Sys_Appconfig().Edit(
|
|
$"[Value]='{frm.PackageQty}'",
|
|
$"[Code]='{((F_AJIS)m_Base).address}_001'"
|
|
);
|
|
}
|
|
else
|
|
{
|
|
new Entity_t_Sys_Appconfig().Edit(
|
|
$"[Value]='{frm.PackageQty}'",
|
|
$"[Code]='{((F_AJIS)m_Base).address}_002'"
|
|
);
|
|
}
|
|
|
|
GetPackage();
|
|
}
|
|
|
|
frm.Dispose();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void GetPackage()
|
|
{
|
|
if (((F_AJIS)m_Base).jistype == 0)
|
|
{
|
|
PackageQty = Convert.ToInt32(new Entity_t_Sys_Appconfig().GetData($"[Code]='{((F_AJIS)m_Base).address}_001'").Tables[0].Rows[0]["Value"]);
|
|
}
|
|
else
|
|
{
|
|
PackageQty = Convert.ToInt32(new Entity_t_Sys_Appconfig().GetData($"[Code]='{((F_AJIS)m_Base).address}_002'").Tables[0].Rows[0]["Value"]);
|
|
}
|
|
|
|
btnSetPackage.Text = $"装箱数:{PackageQty}";
|
|
|
|
}
|
|
|
|
private void btnPrintRe_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.dgrdView.SelectedRows.Count == 0) throw new Exception("请选择要补打的记录");
|
|
|
|
string TaskNo = this.dgrdView.SelectedRows[0].Cells["TaskNo"].Value.ToString();
|
|
if (TaskNo == "") throw new Exception("选择的记录未打印,不能补打");
|
|
|
|
DataTable dtSelect = new DataTable();
|
|
dtSelect.Columns.Add("Name");
|
|
dtSelect.Columns.Add("Value");
|
|
|
|
DataRow drSelect;
|
|
EntityBase t_AJIS = null;
|
|
if (((F_AJIS)m_Base).jistype == 0) //补打门板
|
|
{
|
|
t_AJIS = new Entity_t_AJIS();
|
|
|
|
|
|
drSelect = dtSelect.NewRow(); drSelect["Name"] = "左前"; drSelect["Value"] = "FLProdNo"; dtSelect.Rows.Add(drSelect);
|
|
drSelect = dtSelect.NewRow(); drSelect["Name"] = "右前"; drSelect["Value"] = "FRProdNo"; dtSelect.Rows.Add(drSelect);
|
|
drSelect = dtSelect.NewRow(); drSelect["Name"] = "左后"; drSelect["Value"] = "RLProdNo"; dtSelect.Rows.Add(drSelect);
|
|
drSelect = dtSelect.NewRow(); drSelect["Name"] = "右后"; drSelect["Value"] = "RRProdNo"; dtSelect.Rows.Add(drSelect);
|
|
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
t_AJIS = new Entity_t_AJISCarpet();
|
|
|
|
drSelect = dtSelect.NewRow(); drSelect["Name"] = "后毯"; drSelect["Value"] = "moduno"; dtSelect.Rows.Add(drSelect);
|
|
|
|
}
|
|
|
|
DataTable dtData = t_AJIS.GetData("", $"[TaskNo]='{TaskNo}'", "[SequenceNo] asc").Tables[0];
|
|
if (dtData.Rows.Count == 0) throw new Exception($"{TaskNo} 在系统中不存在");
|
|
|
|
if (dtData.Select("[IsPost]=False").Length > 0) throw new Exception($"{TaskNo} 未打印, 不能补打");
|
|
|
|
frmRePrint frm = new frmRePrint();
|
|
frm.Text += " " + TaskNo;
|
|
frm.chkList.DataSource = dtSelect;
|
|
frm.chkList.ValueMember = "Value";
|
|
frm.chkList.DisplayMember = "Name";
|
|
|
|
if(dtSelect.Rows.Count == 1) frm.chkList.SetItemCheckState(0, CheckState.Checked);
|
|
|
|
if(frm.ShowDialog() == DialogResult.OK)
|
|
{
|
|
for (int i = 0; i < frm.chkList.Items.Count; i++)
|
|
{
|
|
if(frm.chkList.GetItemChecked(i))
|
|
{
|
|
DataRowView dr = (DataRowView)frm.chkList.Items[i];
|
|
//亦庄
|
|
if (((F_AJIS) m_Base).address == "104")
|
|
{
|
|
F_Print.Print(t_AJIS, dtData, TaskNo, dr["Value"].ToString(), dr["Name"].ToString(),
|
|
PackageQty);
|
|
}
|
|
//顺义
|
|
if (((F_AJIS) m_Base).address == "1046")
|
|
{
|
|
F_Print.Print(t_AJIS, dtData, TaskNo, dr["Value"].ToString(), dr["Name"].ToString(),
|
|
PackageQty);
|
|
// //选择左前或右前时进行打印
|
|
// var prodNo = "";
|
|
// prodNo = dr["Value"].ToString();
|
|
// if (prodNo == "FLProdNo" || prodNo == "FRProdNo")
|
|
// {
|
|
// F_Print.Print_SY_Board(t_AJIS, dtData, TaskNo, prodNo, dr["Name"].ToString(), PackageQty);
|
|
// }
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void dgrdView_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (!this.txtSingleSelect.Checked)
|
|
{
|
|
|
|
if (this.dgrdView.SelectedRows.Count == 1)
|
|
{
|
|
int row_index = this.dgrdView.SelectedRows[0].Index;
|
|
|
|
for (int i = row_index; i < row_index + PackageQty; i++)
|
|
{
|
|
if (i < this.dgrdView.Rows.Count)
|
|
{
|
|
this.dgrdView.Rows[i].Selected = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
|
|
}
|
|
|
|
private void frmAJIS_Load(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
GetPackage();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
|
|
public override void init()
|
|
{
|
|
strWhere = "[isPost]=0";
|
|
|
|
base.init();
|
|
}
|
|
|
|
public override void Search(string code)
|
|
{
|
|
//base.Search(code);
|
|
|
|
strWhere = "1=1";
|
|
if(code != "")
|
|
{
|
|
strWhere = $"[ProductionNo]='{code}' or ";
|
|
strWhere += $"[filename]='{code}'";
|
|
}
|
|
|
|
string State = this.txtState.SelectedValue.ToString();
|
|
if(State == "未打印")
|
|
{
|
|
strWhere = $"({strWhere}) and [isPost]=0";
|
|
}
|
|
else
|
|
{
|
|
strWhere = $"({strWhere}) and [isPost]=1";
|
|
}
|
|
|
|
|
|
if (chkError.Checked)
|
|
{
|
|
strWhere = $"[IsError]=1 and ({strWhere})";
|
|
}
|
|
|
|
}
|
|
|
|
private void btnPrint_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.dgrdView.SelectedRows.Count == 0) throw new Exception("请选择要打印序列单的记录");
|
|
|
|
string ids = "";
|
|
for (int i = 0; i < this.dgrdView.SelectedRows.Count; i++)
|
|
{
|
|
ids += this.dgrdView.SelectedRows[i].Cells["ID"].Value.ToString() + ",";
|
|
}
|
|
if (ids != "") ids = ids.Substring(0, ids.Length - 1);
|
|
|
|
EntityBase t_AJIS = null;
|
|
if (((F_AJIS)m_Base).jistype == 0)
|
|
{
|
|
t_AJIS = new Entity_t_AJIS();
|
|
}
|
|
else
|
|
{
|
|
t_AJIS = new Entity_t_AJISCarpet();
|
|
}
|
|
|
|
DataTable dtData = t_AJIS.GetData("", $"[ID] in({ids})", "[SequenceNo] asc").Tables[0];
|
|
if (dtData.Rows.Count == 0) throw new Exception("选择的记录不存在");
|
|
|
|
if (dtData.Select("[isPost]=True").Length > 0) throw new Exception("选择记录中已经有打印过的记录");
|
|
if (dtData.Select("[IsError]=True").Length > 0) throw new Exception("选择记录中有错误未记录");
|
|
|
|
|
|
|
|
|
|
if(!this.txtSingleSelect.Checked)
|
|
{
|
|
if (dtData.Rows.Count != PackageQty) throw new Exception($"自动模式下必须按整包装{PackageQty}打印");
|
|
}
|
|
else
|
|
{
|
|
if (dtData.Rows.Count < PackageQty)
|
|
{
|
|
if (!MyMessageBox.ShowQuestion($"打印的记录数小于标准装箱数{PackageQty},是否确认要打印?"))
|
|
{
|
|
return;
|
|
|
|
}
|
|
}
|
|
|
|
if (dtData.Rows.Count > PackageQty) throw new Exception($"打印的记录数不能大于标准装箱数{PackageQty}");
|
|
|
|
}
|
|
|
|
|
|
if(((F_AJIS)m_Base).address == "104")
|
|
{
|
|
if(MyAppconfig.ReadValue("SkipContinuity").Trim() != "是")
|
|
{
|
|
if (!IsContinue(t_AJIS, dtData)) return;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Print(dtData, ((F_AJIS)m_Base).address);
|
|
|
|
btnSerach_Click(new object(), new EventArgs());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void Print(DataTable dtData, string address)
|
|
{
|
|
LocalDBService db = null;
|
|
try
|
|
{
|
|
db = new LocalDBService();
|
|
db.BeginTrans();
|
|
|
|
string date = MyDateTime.GetServerDateTime().ToString("yyyyMMdd");
|
|
string TaskNo = "";
|
|
if (address == "104")
|
|
{
|
|
date += "1";
|
|
}
|
|
else
|
|
{
|
|
date += "2";
|
|
}
|
|
|
|
EntityBase t_AJIS = null;
|
|
EntityBase byAJISToMES = null;
|
|
if (((F_AJIS)m_Base).jistype == 0)
|
|
{
|
|
t_AJIS = new Entity_t_AJIS(db);
|
|
byAJISToMES = new Entity_byAJISToMES(db);
|
|
|
|
|
|
|
|
TaskNo = date + F_BillNo.GetBillNo(db, $"门板{date}", 3);
|
|
}
|
|
else
|
|
{
|
|
t_AJIS = new Entity_t_AJISCarpet(db);
|
|
TaskNo = date + F_BillNo.GetBillNo(db, $"地毯{date}", 3);
|
|
}
|
|
|
|
|
|
string PostTime = MyDateTime.GetServerDateTime().ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
int n = 1;
|
|
foreach(DataRow drData in dtData.Rows)
|
|
{
|
|
drData["TaskNo"] = TaskNo;
|
|
drData["IsPost"] = 1;
|
|
drData["PostTime"] = PostTime;
|
|
drData["PostUser"] = User.UserInfo.UserName;
|
|
drData["RunningNo"] = n.ToString().PadLeft(2, '0');
|
|
t_AJIS.Edit(drData);
|
|
|
|
if(byAJISToMES != null)
|
|
{
|
|
byAJISToMES.Edit($"[taskNo]='{TaskNo.Substring(TaskNo.Length - 3, 3)}', [locSeq]={n}", $"[ProductionNo]='{drData["ProductionNo"]}'");
|
|
}
|
|
|
|
n++;
|
|
}
|
|
|
|
string SequenceNo = dtData.Compute("Max(SequenceNo)", "1=1").ToString();
|
|
string Address = dtData.Rows[0]["Address"].ToString();
|
|
DataTable dtPrintNo = t_AJIS.GetData($"[Address]='{Address}' and [SequenceNo]<'{SequenceNo}' and [isPost]=0").Tables[0];
|
|
string strPrintNo = "";
|
|
foreach(DataRow drPintNo in dtPrintNo.Rows)
|
|
{
|
|
strPrintNo += drPintNo["SequenceNo"].ToString() + ",";
|
|
}
|
|
if(strPrintNo != "")
|
|
{
|
|
strPrintNo = strPrintNo.Substring(0, strPrintNo.Length - 1);
|
|
throw new Exception($"以下订单漏打印:\r\n{strPrintNo}");
|
|
}
|
|
|
|
if (((F_AJIS)m_Base).jistype == 0)
|
|
{
|
|
F_Print.Print(t_AJIS, dtData, TaskNo, "FLProdNo", "左前", PackageQty);
|
|
F_Print.Print(t_AJIS, dtData, TaskNo, "FRProdNo", "右前", PackageQty);
|
|
F_Print.Print(t_AJIS, dtData, TaskNo, "RLProdNo", "左后", PackageQty);
|
|
F_Print.Print(t_AJIS, dtData, TaskNo, "RRProdNo", "右后", PackageQty);
|
|
|
|
//亦庄、顺义分成两种打印方式
|
|
//亦庄
|
|
//if (address == "104")
|
|
//{
|
|
// F_Print.Print(t_AJIS, dtData, TaskNo, "FLProdNo", "左前", PackageQty);
|
|
// F_Print.Print(t_AJIS, dtData, TaskNo, "FRProdNo", "右前", PackageQty);
|
|
// F_Print.Print(t_AJIS, dtData, TaskNo, "RLProdNo", "左后", PackageQty);
|
|
// F_Print.Print(t_AJIS, dtData, TaskNo, "RRProdNo", "右后", PackageQty);
|
|
//}
|
|
////顺义
|
|
//if (address == "1046")
|
|
//{
|
|
// F_Print.Print_SY_Board(t_AJIS, dtData, TaskNo, "FLProdNo", "左前", PackageQty);
|
|
// F_Print.Print_SY_Board(t_AJIS, dtData, TaskNo, "FRProdNo", "右前", PackageQty);
|
|
//}
|
|
}
|
|
else
|
|
{
|
|
F_Print.Print(t_AJIS, dtData, TaskNo, "moduno", "后毯", PackageQty);
|
|
}
|
|
|
|
|
|
|
|
db.Commit();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (db != null) db.Rollback();
|
|
throw ex;
|
|
}
|
|
finally
|
|
{
|
|
if (db != null) db.EndTrans();
|
|
}
|
|
|
|
}
|
|
|
|
private bool IsContinue(EntityBase t_AJIS, DataTable dtData)
|
|
{
|
|
bool ret = false;
|
|
|
|
bool iscontinue = true;
|
|
|
|
DataTable dtLast = t_AJIS.GetData("top 1 *", $"[Address]='{dtData.Rows[0]["Address"]}' and [IsPost]=1", "[SequenceNo] desc").Tables[0];
|
|
foreach(DataRow drData in dtData.Rows)
|
|
{
|
|
dtLast.Rows.Add(drData.ItemArray);
|
|
}
|
|
|
|
string SequenceNoMin = dtLast.Rows[0]["SequenceNo"].ToString();
|
|
string SequenceNoMax = dtLast.Rows[dtLast.Rows.Count - 1]["SequenceNo"].ToString();
|
|
|
|
|
|
Entity_t_SequenceNo t_SequenceNo = new Entity_t_SequenceNo();
|
|
DataTable dtSequenceNo = t_SequenceNo.GetData("", $"[Address]='{dtData.Rows[0]["Address"]}' and [SequenceNo]>='{SequenceNoMin}' and [SequenceNo]<='{SequenceNoMax}'", "[SequenceNo] asc").Tables[0];
|
|
if (dtSequenceNo.Rows.Count == 0) throw new Exception($"在连续号管理中未找到{SequenceNoMin}到{SequenceNoMax}的记录");
|
|
|
|
if (dtLast.Rows.Count != dtSequenceNo.Rows.Count)
|
|
{
|
|
iscontinue = false;
|
|
}
|
|
else
|
|
{
|
|
foreach (DataRow drSequenceNo in dtSequenceNo.Rows)
|
|
{
|
|
DataRow[] drs = dtLast.Select($"[ProductionNo]='{drSequenceNo["ProductionNo"]}'");
|
|
if (drs.Length == 0)
|
|
{
|
|
iscontinue = false;
|
|
break;
|
|
}
|
|
|
|
if (drs[0]["SequenceNo"].ToString().ToUpper() != drSequenceNo["SequenceNo"].ToString().ToUpper()) iscontinue = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iscontinue == false)
|
|
{
|
|
//if (MyMessageBox.ShowQuestion($"{SequenceNoMin}到{SequenceNoMax}之间不连续,是否要继续打印?"))
|
|
//{
|
|
// ret = true;
|
|
//}
|
|
|
|
throw new Exception($"{SequenceNoMin}到{SequenceNoMax}之间不连续");
|
|
}
|
|
else
|
|
{
|
|
ret = true;
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
private void txtState_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.txtState.SelectedValue.ToString() != "System.Data.DataRowView")
|
|
{
|
|
if(this.txtState.SelectedValue.ToString() == "未打印")
|
|
{
|
|
this.txtD1.Enabled = false;
|
|
this.txtD2.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
this.txtD1.Enabled = true;
|
|
this.txtD2.Enabled = true;
|
|
}
|
|
|
|
Search();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void AutoUpdate()
|
|
{
|
|
if (chAutoUpdate.Checked)
|
|
{
|
|
this.lblShow.Text = "自动刷新中...";
|
|
this.Update();
|
|
|
|
Search();
|
|
|
|
this.lblShow.Text = MyDateTime.Format(DateTime.Now, MyDateTimeType.Time) + " 自动刷新完成,下次刷新 " + Convert.ToString(this.timer1.Interval / 1000) + " 秒以后";
|
|
}
|
|
else
|
|
{
|
|
this.lblShow.Text = "自动刷新关闭";
|
|
}
|
|
}
|
|
|
|
private void chAutoUpdate_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
AutoUpdate();
|
|
}
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
{
|
|
AutoUpdate();
|
|
}
|
|
|
|
|
|
public override void UpdateGridView()
|
|
{
|
|
base.UpdateGridView();
|
|
|
|
string dateWhere = "";
|
|
if (m_Base.dateWhere != "")
|
|
{
|
|
this.txtD1.Visible = true;
|
|
this.txtD2.Visible = true;
|
|
|
|
if (this.txtState.SelectedValue.ToString() != "未打印")
|
|
{
|
|
dateWhere = m_Base.dateWhere;
|
|
|
|
dateWhere = string.Format(dateWhere, this.txtD1.Value.ToString("yyyyMMdd0000"), this.txtD2.Value.ToString("yyyyMMdd2359"));
|
|
|
|
dateWhere = " and (" + dateWhere + ")";
|
|
}
|
|
}
|
|
|
|
m_Base.BindPageData("(" + strWhere + ") " + dateWhere);
|
|
m_Base.GetView(this.dgrdView);
|
|
|
|
this.lblStateRecord.Text = "记录数:" + this.dgrdView.Rows.Count;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|