张松男 2 years ago
parent
commit
8c76ce8275
  1. 65
      APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.cs

65
APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.cs

@ -63,7 +63,7 @@ namespace QMAPP.WinForm.Forms.TianJin
comboBox2.ValueMember = "Code"; comboBox2.ValueMember = "Code";
comboBox2.DataSource = listSHIFT; comboBox2.DataSource = listSHIFT;
// tsbPrint.Enabled = false; // tsbPrint.Enabled = false;
} }
#region 加载列表显示设置 #region 加载列表显示设置
@ -117,11 +117,11 @@ namespace QMAPP.WinForm.Forms.TianJin
dataPage.PageSize = int.Parse(cbListRowcount.Text); dataPage.PageSize = int.Parse(cbListRowcount.Text);
dataPage.PageIndex = 1; dataPage.PageIndex = 1;
dataPage.SortExpression = " ROWVALUE ASC"; dataPage.SortExpression = " ROWVALUE ASC";
if (cbRoutes.Text.Contains("018D")) if (cbRoutes.Text.Contains("018D") || cbRoutes.Text.Contains("278D"))
{ {
var count = Convert.ToInt32(cbListRowcount.Text) / 2; var count = Convert.ToInt32(cbListRowcount.Text) / 2;
var orderlist =new List<FJC.Entity.ProductionPlan.WorkOrder>(); var orderlist = new List<FJC.Entity.ProductionPlan.WorkOrder>();
var orderlistF = _agent.InvokeServiceFunction<List<FJC.Entity.ProductionPlan.WorkOrder>>("TJWorkOrderBLL_GetOrderUnPrinted018DF", cbRoutes.SelectedValue.ToString(), cbPlanFilter.SelectedIndex, dataPage, comboBox1.SelectedValue.ToString(), comboBox2.SelectedValue.ToString(), this.dtpCREATEDATESTART.Value.ToString(), this.dtpCREATEDATEEND.Value.ToString()); var orderlistF = _agent.InvokeServiceFunction<List<FJC.Entity.ProductionPlan.WorkOrder>>("TJWorkOrderBLL_GetOrderUnPrinted018DF", cbRoutes.SelectedValue.ToString(), cbPlanFilter.SelectedIndex, dataPage, comboBox1.SelectedValue.ToString(), comboBox2.SelectedValue.ToString(), this.dtpCREATEDATESTART.Value.ToString(), this.dtpCREATEDATEEND.Value.ToString());
var orderlistR = _agent.InvokeServiceFunction<List<FJC.Entity.ProductionPlan.WorkOrder>>("TJWorkOrderBLL_GetOrderUnPrinted018DR", cbRoutes.SelectedValue.ToString(), cbPlanFilter.SelectedIndex, dataPage, comboBox1.SelectedValue.ToString(), comboBox2.SelectedValue.ToString(), this.dtpCREATEDATESTART.Value.ToString(), this.dtpCREATEDATEEND.Value.ToString()); var orderlistR = _agent.InvokeServiceFunction<List<FJC.Entity.ProductionPlan.WorkOrder>>("TJWorkOrderBLL_GetOrderUnPrinted018DR", cbRoutes.SelectedValue.ToString(), cbPlanFilter.SelectedIndex, dataPage, comboBox1.SelectedValue.ToString(), comboBox2.SelectedValue.ToString(), this.dtpCREATEDATESTART.Value.ToString(), this.dtpCREATEDATEEND.Value.ToString());
for (var i = 0; i < count; i++) for (var i = 0; i < count; i++)
@ -151,7 +151,7 @@ namespace QMAPP.WinForm.Forms.TianJin
#endregion #endregion
this.dgvPlan.DataSource = orderlist; this.dgvPlan.DataSource = orderlist;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -207,7 +207,7 @@ namespace QMAPP.WinForm.Forms.TianJin
//BarcodeLib.BarCodeGenerate g = new BarcodeLib.BarCodeGenerate( xmlPath); //BarcodeLib.BarCodeGenerate g = new BarcodeLib.BarCodeGenerate( xmlPath);
//bool b = g.PrintBarCode(_operationServiceParam.main.MAINCODE); //bool b = g.PrintBarCode(_operationServiceParam.main.MAINCODE);
QM.Assist.LabelInfo ll = new QM.Assist.LabelInfo(); QM.Assist.LabelInfo ll = new QM.Assist.LabelInfo();
StringBuilder dataline=new StringBuilder(); StringBuilder dataline = new StringBuilder();
var TMPPath = string.Empty; var TMPPath = string.Empty;
var DATPath = string.Empty; var DATPath = string.Empty;
foreach (var label in labeldata) foreach (var label in labeldata)
@ -240,7 +240,7 @@ namespace QMAPP.WinForm.Forms.TianJin
label.MATERIALCODE,// label.MATERIALCODE,//
label.Remark label.Remark
); );
if (label.OrderNo.Contains("018D")) if (label.OrderNo.Contains("018D") || label.OrderNo.Contains("278D"))
{ {
TMPPath = "PlanLabelTMPPath8D"; TMPPath = "PlanLabelTMPPath8D";
DATPath = "PlanLabelDATPath8D"; DATPath = "PlanLabelDATPath8D";
@ -253,7 +253,7 @@ namespace QMAPP.WinForm.Forms.TianJin
} }
ll.BarCode=dataline.ToString().TrimEnd('\r','\n'); ll.BarCode = dataline.ToString().TrimEnd('\r', '\n');
ll.PrinterName = ""; ll.PrinterName = "";
QM.Assist.PrintUtil.LabelList2.Add(ll); QM.Assist.PrintUtil.LabelList2.Add(ll);
QM.Assist.PrintUtil pu = new QM.Assist.PrintUtil(); QM.Assist.PrintUtil pu = new QM.Assist.PrintUtil();
@ -264,7 +264,7 @@ namespace QMAPP.WinForm.Forms.TianJin
#endregion #endregion
} }
private void PrintPlanLabel_Load(object sender, EventArgs e) private void PrintPlanLabel_Load(object sender, EventArgs e)
{ {
LoadViewSetting(); LoadViewSetting();
@ -493,7 +493,7 @@ namespace QMAPP.WinForm.Forms.TianJin
if (dgvPlan.Rows.Count == 0) if (dgvPlan.Rows.Count == 0)
{ {
MessageBox.Show("当前生产线没有未打印标签的计划工单!"); MessageBox.Show("当前生产线没有未打印标签的计划工单!");
// return; // return;
} }
tsbPrint.Enabled = false; tsbPrint.Enabled = false;
var order1 = (FJC.Entity.ProductionPlan.WorkOrder)dgvPlan.Rows[0].DataBoundItem; var order1 = (FJC.Entity.ProductionPlan.WorkOrder)dgvPlan.Rows[0].DataBoundItem;
@ -505,7 +505,7 @@ namespace QMAPP.WinForm.Forms.TianJin
var orders2 = new List<FJC.Entity.ProductionPlan.WorkOrder>(); var orders2 = new List<FJC.Entity.ProductionPlan.WorkOrder>();
var order2 = (FJC.Entity.ProductionPlan.WorkOrder)dgvPlan.Rows[1].DataBoundItem; var order2 = (FJC.Entity.ProductionPlan.WorkOrder)dgvPlan.Rows[1].DataBoundItem;
orders2.Add(order2); orders2.Add(order2);
if ((orders[0].MATERIAL_NAME.Substring(0, 7) != orders2[0].MATERIAL_NAME.Substring(0, 7))&& !orders[0].MATERIAL_CODE.Contains("018D")) if ((orders[0].MATERIAL_NAME.Substring(0, 7) != orders2[0].MATERIAL_NAME.Substring(0, 7)) && !orders[0].MATERIAL_CODE.Contains("018D") && !orders[0].MATERIAL_CODE.Contains("278D"))
{ {
MessageBox.Show("计划工单即将变换配置,请注意!"); MessageBox.Show("计划工单即将变换配置,请注意!");
} }
@ -527,7 +527,7 @@ namespace QMAPP.WinForm.Forms.TianJin
labeldata.PlanDate = orders[0].PLAN_DATE; labeldata.PlanDate = orders[0].PLAN_DATE;
if (book != null) if (book != null)
{ {
labeldata.Class = " " + book.CarModel.Substring(book.CarModel.Length-3, 3); labeldata.Class = " " + book.CarModel.Substring(book.CarModel.Length - 3, 3);
labeldata.Description = book.Text; labeldata.Description = book.Text;
labeldata.OrderNo = book.CarModel + positioncode + data; labeldata.OrderNo = book.CarModel + positioncode + data;
if (orders[0].MATERIAL_CODE.Contains("018D")) if (orders[0].MATERIAL_CODE.Contains("018D"))
@ -559,18 +559,18 @@ namespace QMAPP.WinForm.Forms.TianJin
InsertProduct(labeldata.OrderNo, orders[0].MATERIAL_CODE, comboBox1.SelectedValue.ToString()); InsertProduct(labeldata.OrderNo, orders[0].MATERIAL_CODE, comboBox1.SelectedValue.ToString());
WriteLog.Write(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 插入结束" + labeldata.OrderNo); WriteLog.Write(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 插入结束" + labeldata.OrderNo);
if (orders[0].MATERIAL_CODE.Contains("018D") && orders[0].MATERIAL_NAME.Contains("前")) if ((orders[0].MATERIAL_CODE.Contains("018D") || orders[0].MATERIAL_CODE.Contains("278D")) && orders[0].MATERIAL_NAME.Contains("前"))
FR = "后"; FR = "后";
else if(orders[0].MATERIAL_CODE.Contains("018D") && orders[0].MATERIAL_NAME.Contains("后")) else if ((orders[0].MATERIAL_CODE.Contains("018D") || orders[0].MATERIAL_CODE.Contains("278D")) && orders[0].MATERIAL_NAME.Contains("后"))
FR = "前"; FR = "前";
BindPlanView(); BindPlanView();
tsbPrint.Enabled = true; tsbPrint.Enabled = true;
} }
catch (Exception ee) catch (Exception ee)
{ {
MessageBox.Show("打印出现异常!"+ee.Message); MessageBox.Show("打印出现异常!" + ee.Message);
} }
} }
public string GetNameCode(string Name) public string GetNameCode(string Name)
@ -578,9 +578,9 @@ namespace QMAPP.WinForm.Forms.TianJin
var Code = ""; var Code = "";
if (!string.IsNullOrEmpty(Name)) if (!string.IsNullOrEmpty(Name))
{ {
if(Name.Contains("左前")) if (Name.Contains("左前"))
Code = "FL"; Code = "FL";
else if(Name.Contains("左后")) else if (Name.Contains("左后"))
Code = "RL"; Code = "RL";
else if (Name.Contains("右前")) else if (Name.Contains("右前"))
Code = "FR"; Code = "FR";
@ -597,7 +597,7 @@ namespace QMAPP.WinForm.Forms.TianJin
/// </summary> /// </summary>
/// <param name="ProductCode"></param> /// <param name="ProductCode"></param>
/// <param name="Material_Code"></param> /// <param name="Material_Code"></param>
public void InsertProduct(string ProductCode,string Material_Code,string prepare) public void InsertProduct(string ProductCode, string Material_Code, string prepare)
{ {
#region 组成新增产品实例 #region 组成新增产品实例
Product newProduct = new Product(); Product newProduct = new Product();
@ -641,7 +641,7 @@ namespace QMAPP.WinForm.Forms.TianJin
newProduct.WORKLOC_CODE = "DP_PREPARELOC1"; newProduct.WORKLOC_CODE = "DP_PREPARELOC1";
} }
newProduct.WORKCENTER_CODE = "WORK770B"; newProduct.WORKCENTER_CODE = "WORK770B";
@ -669,7 +669,7 @@ namespace QMAPP.WinForm.Forms.TianJin
private void toolStripButton1_Click(object sender, EventArgs e) private void toolStripButton1_Click(object sender, EventArgs e)
{ {
var count = 0; var count = 0;
if (dgvPlan.Rows.Count == 0) if (dgvPlan.Rows.Count == 0)
{ {
MessageBox.Show("当前生产线没有未打印标签的计划工单!"); MessageBox.Show("当前生产线没有未打印标签的计划工单!");
@ -678,7 +678,7 @@ namespace QMAPP.WinForm.Forms.TianJin
count = int.Parse(cbListRowcount.Text); count = int.Parse(cbListRowcount.Text);
else else
count = dgvPlan.Rows.Count; count = dgvPlan.Rows.Count;
for (var i = 0; i < count; i++) for (var i = 0; i < count; i++)
{ {
System.Threading.Thread.Sleep(1000); System.Threading.Thread.Sleep(1000);
@ -688,24 +688,24 @@ namespace QMAPP.WinForm.Forms.TianJin
var order1 = (FJC.Entity.ProductionPlan.WorkOrder)dgvPlan.Rows[i].DataBoundItem; var order1 = (FJC.Entity.ProductionPlan.WorkOrder)dgvPlan.Rows[i].DataBoundItem;
orders.Add(order1); orders.Add(order1);
if ((i+1)< count) if ((i + 1) < count)
{ {
var orders2 = new List<FJC.Entity.ProductionPlan.WorkOrder>(); var orders2 = new List<FJC.Entity.ProductionPlan.WorkOrder>();
var order2 = (FJC.Entity.ProductionPlan.WorkOrder)dgvPlan.Rows[i + 1].DataBoundItem; var order2 = (FJC.Entity.ProductionPlan.WorkOrder)dgvPlan.Rows[i + 1].DataBoundItem;
orders2.Add(order2); orders2.Add(order2);
if ((orders[0].MATERIAL_NAME.Substring(0, 7) != orders2[0].MATERIAL_NAME.Substring(0, 7)) && !orders[0].MATERIAL_CODE.Contains("018D")) if ((orders[0].MATERIAL_NAME.Substring(0, 7) != orders2[0].MATERIAL_NAME.Substring(0, 7)) && !orders[0].MATERIAL_CODE.Contains("018D") && !orders[0].MATERIAL_CODE.Contains("278D"))
{ {
MessageBox.Show("计划工单即将变换配置,请注意!"); MessageBox.Show("计划工单即将变换配置,请注意!");
} }
} }
toolStripButton1.Enabled = false; toolStripButton1.Enabled = false;
List<LabelData> labels = new List<LabelData>(); List<LabelData> labels = new List<LabelData>();
var data = DateTime.Now.ToString("yyyyMMddHHmmssfff"); var data = DateTime.Now.ToString("yyyyMMddHHmmssfff");
data = data.Substring(2, data.Length - 2); data = data.Substring(2, data.Length - 2);
string positioncode = GetNameCode(orders[0].MATERIAL_NAME); string positioncode = GetNameCode(orders[0].MATERIAL_NAME);
var book = _agent.InvokeServiceFunction<FJC.Entity.FIS.FISPhraseBook>("FISPhraseBLL_GetFisPhraseBook", orders[0].MATERIAL_CODE + "", positioncode); var book = _agent.InvokeServiceFunction<FJC.Entity.FIS.FISPhraseBook>("FISPhraseBLL_GetFisPhraseBook", orders[0].MATERIAL_CODE + "", positioncode);
@ -722,10 +722,10 @@ namespace QMAPP.WinForm.Forms.TianJin
labeldata.OrderNo = book.CarModel + positioncode + data; labeldata.OrderNo = book.CarModel + positioncode + data;
if (orders[0].MATERIAL_CODE.Contains("018D")) if (orders[0].MATERIAL_CODE.Contains("018D"))
{ {
var bookS = _agent.InvokeServiceFunction<FJC.Entity.FIS.FISPhraseBook>("FISPhraseBLL_GetPHRASEBOOK", orders[0].MATERIAL_CODE.Substring(5,3).Trim()); var bookS = _agent.InvokeServiceFunction<FJC.Entity.FIS.FISPhraseBook>("FISPhraseBLL_GetPHRASEBOOK", orders[0].MATERIAL_CODE.Substring(5, 3).Trim());
labeldata.Remark = bookS.Text; labeldata.Remark = bookS.Text;
} }
} }
var mcresult = _agent.InvokeServiceFunction<DataResult<Material>>("MaterialBLL_Get", new Material { MATERIAL_CODE = orders[0].MATERIAL_CODE }); var mcresult = _agent.InvokeServiceFunction<DataResult<Material>>("MaterialBLL_Get", new Material { MATERIAL_CODE = orders[0].MATERIAL_CODE });
var material = mcresult.IsSuccess ? mcresult.Result : null; var material = mcresult.IsSuccess ? mcresult.Result : null;
@ -746,9 +746,9 @@ namespace QMAPP.WinForm.Forms.TianJin
//WriteLog.Write(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 开始插入记录" + labeldata.OrderNo); //WriteLog.Write(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 开始插入记录" + labeldata.OrderNo);
InsertProduct(labeldata.OrderNo, orders[0].MATERIAL_CODE, comboBox1.SelectedValue.ToString()); InsertProduct(labeldata.OrderNo, orders[0].MATERIAL_CODE, comboBox1.SelectedValue.ToString());
if (orders[0].MATERIAL_CODE.Contains("018D") && orders[0].MATERIAL_NAME.Contains("前")) if ((orders[0].MATERIAL_CODE.Contains("018D") || orders[0].MATERIAL_CODE.Contains("278D")) && orders[0].MATERIAL_NAME.Contains("前"))
FR = "后"; FR = "后";
else if (orders[0].MATERIAL_CODE.Contains("018D") && orders[0].MATERIAL_NAME.Contains("后")) else if ((orders[0].MATERIAL_CODE.Contains("018D") || orders[0].MATERIAL_CODE.Contains("278D")) && orders[0].MATERIAL_NAME.Contains("后"))
FR = "前"; FR = "前";
//WriteLog.Write(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 插入结束" + labeldata.OrderNo); //WriteLog.Write(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 插入结束" + labeldata.OrderNo);
} }
@ -782,7 +782,8 @@ namespace QMAPP.WinForm.Forms.TianJin
BindPlanView(); BindPlanView();
} }
} }
class Direction { class Direction
{
public string Code { get; set; } public string Code { get; set; }
public string Name { get; set; } public string Name { get; set; }
} }

Loading…
Cancel
Save