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.
206 lines
7.9 KiB
206 lines
7.9 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMAPP.ServicesAgent;
|
|
using QMAPP.MD.Entity;
|
|
using QMAPP.Entity;
|
|
using QMAPP.FJC.Entity;
|
|
|
|
namespace QMAPP.WinForm.Forms.Mend
|
|
{
|
|
public partial class DPLabelRegenerate : Form
|
|
{
|
|
QMAPP.ServicesAgent.ServiceAgent _agent = ClientContext.GetServiceAgent();
|
|
private Product _product;
|
|
|
|
public DPLabelRegenerate()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btnSubmit_Click(object sender, EventArgs e)
|
|
{
|
|
LoadProduct();
|
|
}
|
|
|
|
private void txtPlanLabel_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode != Keys.Enter)//如果输入的是回车键
|
|
{
|
|
return;
|
|
}
|
|
LoadProduct();
|
|
}
|
|
|
|
private void LoadProduct()
|
|
{
|
|
txtNewSN.Text = "";
|
|
txtMaterialCode.Text = "";
|
|
txtMaterialName.Text = "";
|
|
txtSN.Text = "";
|
|
txtMaterialCode.Text = "";
|
|
infolabel.Text = "";
|
|
if (string.IsNullOrWhiteSpace(txtPlanLabel.Text.Trim()))
|
|
{
|
|
infolabel.Text = "请扫描门板本体标签!";
|
|
txtPlanLabel.SelectAll();
|
|
txtPlanLabel.Focus();
|
|
return;
|
|
}
|
|
//1.判断扫描条形码是否存在
|
|
string Code = txtPlanLabel.Text.Trim().ToUpper();
|
|
if (System.Text.RegularExpressions.Regex.IsMatch(Code, "^DP\\w+(-\\w+)?-DF[LR][FR]\\w+$"))//扫描输入为门板计划标签
|
|
{
|
|
//从计划标签中截取产品码
|
|
Code = Code.Substring(Code.LastIndexOf('-') + 1);
|
|
}
|
|
else
|
|
{
|
|
infolabel.Text = "请扫描门板本体标签!";
|
|
txtPlanLabel.SelectAll();
|
|
txtPlanLabel.Focus();
|
|
return;
|
|
}
|
|
|
|
Product product = _agent.InvokeServiceFunction<Product>(B9BasicService.ProductBLL_GetProductInfo.ToString(), new Product { PRODUCTCODE = Code });
|
|
if (product == null)
|
|
{
|
|
infolabel.Text = "输入的产品码不存在!";
|
|
txtPlanLabel.SelectAll();
|
|
txtPlanLabel.Focus();
|
|
return;
|
|
}
|
|
if(product.OUTFLAG!="0")
|
|
{
|
|
infolabel.Text = "此产品码已出库!";
|
|
txtPlanLabel.SelectAll();
|
|
txtPlanLabel.Focus();
|
|
return;
|
|
}
|
|
if (product.STATUS != "0")
|
|
{
|
|
infolabel.Text = "此产品为不合格状态!";
|
|
txtPlanLabel.SelectAll();
|
|
txtPlanLabel.Focus();
|
|
return;
|
|
}
|
|
|
|
var mcresult = _agent.InvokeServiceFunction<DataResult<MaterialClass>>("MaterialClassBLL_Get", new MaterialClass { MATERIAL_TYPE_CODE = product.MATERIAL_TYPE });
|
|
var mc = mcresult.IsSuccess ? mcresult.Result : new MaterialClass { };
|
|
if (!string.Equals(mc.MATERIAL_ATTRIBUTE, "2"))
|
|
{
|
|
infolabel.Text = "输入的产品码不是总成件!";
|
|
txtPlanLabel.SelectAll();
|
|
txtPlanLabel.Focus();
|
|
return;
|
|
}
|
|
FJC.Entity.ProductIn.ProductIn inrecord = _agent.InvokeServiceFunction<FJC.Entity.ProductIn.ProductIn>("ProductInBLL_GetInRecord", product.PRODUCTCODE);
|
|
if (inrecord == null)
|
|
{
|
|
infolabel.Text = "无此产品的退返入库记录!";
|
|
txtPlanLabel.SelectAll();
|
|
txtPlanLabel.Focus();
|
|
return;
|
|
}
|
|
|
|
_product = product;
|
|
txtNewSN.Text = "";
|
|
txtMaterialCode.Text = product.MATERIAL_CODE;
|
|
txtMaterialName.Text = product.MATERIAL_NAME;
|
|
txtSN.Text = product.PRODUCTCODE;
|
|
txtPlanLabel.Text = "";
|
|
txtPlanLabel.SelectAll();
|
|
txtPlanLabel.Focus();
|
|
}
|
|
|
|
private void btnRegenerate_Click(object sender, EventArgs e)
|
|
{
|
|
if (_product == null)
|
|
{
|
|
infolabel.Text = "请扫描门板本体标签!";
|
|
txtPlanLabel.SelectAll();
|
|
txtPlanLabel.Focus();
|
|
return;
|
|
}
|
|
var newCode = _agent.InvokeServiceFunction<Product>("MainCodeChangeBLL_DPRegenerate", _product);
|
|
txtNewSN.Text = newCode.PRODUCTCODE;
|
|
|
|
|
|
txtPlanLabel.SelectAll();
|
|
txtPlanLabel.Focus();
|
|
|
|
FJC.Entity.View.PlanLabel labeldata = new FJC.Entity.View.PlanLabel();
|
|
|
|
labeldata.BOM = "N/A";
|
|
labeldata.PN = _product.MATERIAL_CODE;
|
|
|
|
labeldata.PlanDate = newCode.UPDATEDATE.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
labeldata.SEQ = "N/A";
|
|
labeldata.PlanType = "Re";
|
|
|
|
labeldata.PlanNo = string.Format("DPBR{0:yyyyMMddHHmm}", newCode.UPDATEDATE);
|
|
|
|
labeldata.VIN = "N/A";
|
|
labeldata.KIN = "N/A";
|
|
|
|
var mcresult = _agent.InvokeServiceFunction<DataResult<Material>>("MaterialBLL_Get", new Material { MATERIAL_CODE = newCode.MATERIAL_CODE });
|
|
var material = mcresult.IsSuccess ? mcresult.Result : null;
|
|
if (material != null)
|
|
{
|
|
labeldata.HBType = material.HBTYPE;
|
|
labeldata.ProjectCode = material.PROJECTCODE;
|
|
labeldata.Color = material.COLOR;
|
|
labeldata.ProdName = material.MATERIAL_NAME;
|
|
}
|
|
labeldata.SN = newCode.PRODUCTCODE;
|
|
_product = null;
|
|
PrintLabel(labeldata);
|
|
|
|
}
|
|
|
|
private void PrintLabel(FJC.Entity.View.PlanLabel labeldata)
|
|
{
|
|
#region 计划标签打印
|
|
//string xmlPath = System.Configuration.ConfigurationSettings.AppSettings["XmlName"].ToString(); ;
|
|
//BarcodeLib.BarCodeGenerate g = new BarcodeLib.BarCodeGenerate( xmlPath);
|
|
//bool b = g.PrintBarCode(_operationServiceParam.main.MAINCODE);
|
|
QM.Assist.LabelInfo ll = new QM.Assist.LabelInfo();
|
|
|
|
|
|
//planno,plantype,seq,bom,vin,kin,sn,pn,prodname,plandate,project,hbtype,color
|
|
ll.BarCode = string.Format("'{0},'{1},'{2},'{3},'{4},'{5},'{6},'{7},'{8},'{9},'{10},'{11},'{12}",
|
|
labeldata.PlanNo,//计划号
|
|
labeldata.PlanType,//计划类型(0:FIS,1:STOCK,2:INSERT)
|
|
labeldata.SEQ,//顺序号
|
|
labeldata.BOM,//bom号
|
|
labeldata.VIN,//底盘号
|
|
labeldata.KIN,//车身号
|
|
labeldata.SN,//序号
|
|
labeldata.PN,//总成物料号
|
|
labeldata.ProdName,//总成物料名称
|
|
labeldata.PlanDate,//计划日期
|
|
labeldata.ProjectCode,//项目编号
|
|
labeldata.HBType,//车型配置
|
|
labeldata.Color//颜色
|
|
);
|
|
|
|
|
|
|
|
QM.Assist.PrintUtil.LabelList2.Add(ll);
|
|
QM.Assist.PrintUtil pu = new QM.Assist.PrintUtil();
|
|
pu.PrintLabel2(System.Configuration.ConfigurationManager.AppSettings["proPath"].ToString
|
|
(), System.Configuration.ConfigurationManager.AppSettings["PlanLabelTMPPath"].ToString
|
|
(), System.Configuration.ConfigurationManager.AppSettings["PlanLabelDATPath"].ToString
|
|
());
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
}
|
|
|