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.
338 lines
16 KiB
338 lines
16 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Windows.Forms;
|
|
using QM.Common;
|
|
using QMAPP.FJC.Entity;
|
|
using QMAPP.FJC.Entity.Basic;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMAPP.ServicesAgent;
|
|
using QMAPP.WinForm.Common;
|
|
using QMAPP.Entity;
|
|
using QMAPP.MD.Entity;
|
|
using QMAPP.FJC.DAL.Operation;
|
|
using QMAPP.FJC.Entity.FIS;
|
|
namespace QMAPP.WinForm.Forms.Injection
|
|
{
|
|
/// <summary>
|
|
/// 模块编号:M12-2
|
|
/// 作 用:注塑条码打印
|
|
/// 作 者:王庆男
|
|
/// 编写日期:2015年05月28日
|
|
///</summary>
|
|
public partial class InjectionMoldingPrintEditForm : Form
|
|
{
|
|
Product recorder = new Product();
|
|
|
|
/// <summary>
|
|
/// 新建
|
|
/// </summary>
|
|
public InjectionMoldingPrintEditForm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑
|
|
/// </summary>
|
|
/// <param name="pid"></param>
|
|
public InjectionMoldingPrintEditForm(string pid)
|
|
{
|
|
recorder.PID = pid;
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 窗体加载
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void Form_Load(object sender, EventArgs e)
|
|
{
|
|
#region 绑定下拉列表
|
|
BasicData basicData = new BasicData();
|
|
//加载注塑设备列表
|
|
//this.comMachineCode.DataSource = basicData.GetMachineInfoList(new string[] { EnumGeter.ProcessType.gujiazhusu.GetHashCode().ToString(), EnumGeter.ProcessType.fengdaozhusu.GetHashCode().ToString(), EnumGeter.ProcessType.qinangzhijiazhusu.GetHashCode().ToString(), EnumGeter.ProcessType.zhongkongzhijiazhusu.GetHashCode().ToString(), EnumGeter.ProcessType.HUDfengdaozhusu.GetHashCode().ToString() }, true);
|
|
string ordertype = "INJECT";
|
|
this.comMachineCode.DataSource = basicData.GetMachineList(ordertype, true);
|
|
this.comMachineCode.DisplayMember = "MACHINENAME";
|
|
this.comMachineCode.ValueMember = "MACHINECODDE";
|
|
//加载物料类型分类
|
|
MaterialClass searchModelType = new MaterialClass();
|
|
this.materialType.DataSource = basicData.GetMaterialTypeList(ordertype, true);
|
|
this.materialType.DisplayMember = "MATERIAL_TYPE_NAME";
|
|
this.materialType.ValueMember = "MATERIAL_TYPE_CODE";
|
|
|
|
|
|
|
|
|
|
|
|
//产品类型
|
|
//ProductBasic searchModelList = new ProductBasic();
|
|
//searchModelList.PRODUCTMAINTYPE = EnumGeter.PRODUCTMAINTYPE.zhusu.GetHashCode().ToString();
|
|
//searchModelList.PRODUCTUNIT = EnumGeter.PRODUCTUNIT.SINGLE.GetHashCode().ToString();
|
|
|
|
//this.comProType.DataSource = basicData.GetProductBasicList(searchModelList, true);
|
|
//this.comProType.DisplayMember = "PRODUCTNAME";
|
|
//this.comProType.ValueMember = "PRODUCTTYPE";
|
|
|
|
#endregion
|
|
//加工日期
|
|
this.dtpDate.Text = DateTime.Now.ToString();
|
|
|
|
#region 编辑
|
|
//判断是否为编辑加载编辑数据
|
|
//if (string.IsNullOrEmpty(recorder.PID) == false)
|
|
//{
|
|
// QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
|
// recorder = agent.InvokeServiceFunction<Product>(B9BasicService.ProductBLL_Get.ToString(), recorder);
|
|
// this.txtProductCode.Text = recorder.PRODUCTCODE;
|
|
//}
|
|
#endregion
|
|
}
|
|
|
|
/// <summary>
|
|
/// 窗体保存事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void tsbSave_Click(object sender, EventArgs e)
|
|
{
|
|
//窗体数据校验
|
|
string errorMessae = ErrorCheck();
|
|
if (errorMessae != "")
|
|
{
|
|
MessageBox.Show(errorMessae, Resource1.ConfirmTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
#region 加载保存信息
|
|
Product product = new Product();
|
|
ProductBasic basic = this.materialType.SelectedItem as ProductBasic;
|
|
MachineInfo machine = this.comMachineCode.SelectedItem as MachineInfo;
|
|
MaterialClass materialtype = this.materialType.SelectedItem as MaterialClass;
|
|
Material material = this.materialCode.SelectedItem as Material;
|
|
string proCode = "";
|
|
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
|
DataResult<OrderPlan> pageresult = new DataResult<OrderPlan>();
|
|
OrderPlan ordermodel = new OrderPlan();
|
|
ordermodel.MATERIAL_CODE = material.MATERIAL_CODE;
|
|
ordermodel.MACHINECODDE = machine.MACHINECODDE;
|
|
pageresult = agent.InvokeServiceFunction<DataResult<OrderPlan>>("OrderPlanBLL_Get", ordermodel);
|
|
DataResult<int> updateresult = new DataResult<int>();
|
|
if (pageresult.IsSuccess)
|
|
{
|
|
updateresult = agent.InvokeServiceFunction<DataResult<int>>("OrderPlanBLL_ChangeOrderPlan", ordermodel);
|
|
}
|
|
|
|
#region 注释
|
|
//if (basic.PRODUCTTYPE.Equals(EnumGeter.ProductType.gujia.GetHashCode().ToString()))
|
|
//{
|
|
// proCode = "B9A";
|
|
// product.CURRENTPROCESS = EnumGeter.ProcessType.huoyanjiagong.GetHashCode().ToString();//需要读取该类别最后的一道工序
|
|
//}
|
|
//else if (basic.PRODUCTTYPE.Equals(EnumGeter.ProductType.qinangzhijia.GetHashCode().ToString()))
|
|
//{
|
|
// proCode = "FJC";
|
|
// product.CURRENTPROCESS = EnumGeter.ProcessType.hongwaihanjie.GetHashCode().ToString();//需要读取该类别最后的一道工序
|
|
//}
|
|
//else if (basic.PRODUCTTYPE.Equals(EnumGeter.ProductType.fengdao.GetHashCode().ToString()))
|
|
//{
|
|
// proCode = "B9B";
|
|
// product.CURRENTPROCESS = EnumGeter.ProcessType.maojie.GetHashCode().ToString();//需要读取该类别最后的一道工序
|
|
//}
|
|
//else if (basic.PRODUCTTYPE.Equals(EnumGeter.ProductType.HUDfengdao.GetHashCode().ToString()))
|
|
//{
|
|
// proCode = "B9C";
|
|
// product.CURRENTPROCESS = EnumGeter.ProcessType.maojie.GetHashCode().ToString();//需要读取该类别最后的一道工序
|
|
//}
|
|
//else if (basic.PRODUCTTYPE.Equals(EnumGeter.ProductType.kaiguanzhijia.GetHashCode().ToString()))
|
|
//{
|
|
// proCode = "B9E";
|
|
// product.CURRENTPROCESS = EnumGeter.ProcessType.chaoshengbohanjie.GetHashCode().ToString();//需要读取该类别最后的一道工序
|
|
//}
|
|
|
|
//DateTime opDate = new DateTime();
|
|
//if (basic.PRODUCTTYPE.Equals(EnumGeter.ProductType.qinangzhijia.GetHashCode().ToString()))
|
|
//{
|
|
// if (string.IsNullOrEmpty(this.dtpDate.Text.Trim()))
|
|
// {
|
|
// proCode += DateTime.Now.ToString("yyMMddHHmmss");
|
|
// opDate = DateTime.Now;
|
|
// }
|
|
// else
|
|
// {
|
|
// proCode += Convert.ToDateTime(this.dtpDate.Text.Trim()).ToString("yyMMddHHmmss");
|
|
// opDate = Convert.ToDateTime(this.dtpDate.Text.Trim());
|
|
// }
|
|
// proCode += string.IsNullOrEmpty(ClientContext.LoginInfo.EmployeeNo) == false ? ClientContext.LoginInfo.EmployeeNo : "01";
|
|
// proCode += machine.MACHINENUM;
|
|
// proCode += Convert.ToDateTime(DateTime.Now).ToString("ff"); ;//获取流水已经精确到秒了还要流水?
|
|
//}
|
|
//else
|
|
//{
|
|
// if (string.IsNullOrEmpty(this.dtpDate.Text.Trim()))
|
|
// {
|
|
// proCode += DateTime.Now.ToString("yyMMddHHmm");
|
|
// opDate = DateTime.Now;
|
|
// }
|
|
// else
|
|
// {
|
|
// proCode += Convert.ToDateTime(this.dtpDate.Text.Trim()).ToString("yyMMddHHmm");
|
|
// opDate = Convert.ToDateTime(this.dtpDate.Text.Trim());
|
|
// }
|
|
|
|
|
|
// proCode += machine.MACHINENUM;
|
|
// proCode += string.IsNullOrEmpty(this.materialCode.SelectedValue.ToString()) == false ? this.materialCode.SelectedValue.ToString() : "01";
|
|
|
|
// proCode += DateTime.Now.ToString("ssff"); ;//获取流水已经精确到秒了还要流水?
|
|
//}
|
|
#endregion
|
|
|
|
DateTime opDate = new DateTime();
|
|
MaterialCodeInit codeInit = new MaterialCodeInit();
|
|
codeInit = agent.InvokeServiceFunction<MaterialCodeInit>("MaterialBLL_GetProductType", materialtype.MATERIAL_TYPE_CODE);
|
|
if (string.IsNullOrEmpty(codeInit.PRODUCT_TYPES) == false)
|
|
{
|
|
proCode += codeInit.PRODUCT_TYPES;
|
|
product.WORKCELL_CODE = codeInit.WORKCELL_CODE;
|
|
}
|
|
if (string.IsNullOrEmpty(this.dtpDate.Text.Trim()))
|
|
{
|
|
proCode += DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
opDate = DateTime.Now;
|
|
}
|
|
else
|
|
{
|
|
proCode += Convert.ToDateTime(this.dtpDate.Text.Trim()).ToString("yyyyMMddHHmmss");
|
|
opDate = Convert.ToDateTime(this.dtpDate.Text.Trim());
|
|
}
|
|
//int no = new ProductDAL().GetNum(product);
|
|
//proCode += string.IsNullOrEmpty(no.ToString()) == false ? this.materialCode.SelectedValue.ToString() : "01";
|
|
//proCode += DateTime.Now.ToString("ssff");
|
|
|
|
|
|
product.PRODUCTTYPE = DBNull.Value.ToString();
|
|
|
|
product.PRODUCTCODE = proCode;//需要生成条码
|
|
//骨架注塑条码规则,列如条码号B9A14081403301664950,其中B9A表示骨架注塑,140814表示日期,0330表示时间精确到秒,1表示机器号,66表示操作员号,4950表示流水号。
|
|
//气囊支架注塑条码规则,列如条码号B9D14081403301664950,其中B9D表示气囊支架注塑,140814表示日期,0330表示时间精确到秒,1表示机器号,66表示操作员号,4950表示流水号。
|
|
//开关支架包装盒条码规则:例如2015060908012511,其中2015表示年,06表示月,09表示日期,08表示小时,01表示分钟,25表示秒,11表示操作者号。
|
|
//风道注塑条码规则,例如条码号B9B14081403301664950,其中B9B表示风道注塑,140814表示日期,0330表示时间精确到分钟,1表示机器号,66表示操作员号,4950表示流水号。
|
|
//HUD风道注塑条码规则,例如条码号B9C14081403301664950,其中B9C表示HUD风道注塑,140814表示日期,0330表示时间精确到分钟,1表示机器号,66表示操作员号,4950表示流水号。
|
|
product.MACHINECODDE = machine.MACHINECODDE;//暂时用这个码
|
|
product.MACHINENAME = machine.MACHINENAME;
|
|
product.PRODUCESHIFTNAME = ClientContext.produceShift.PRODUCESHIFTNAME;//班组
|
|
product.PRODUCESHIFTTCODE = ClientContext.produceShift.PRODUCESHIFTTCODE;//班组
|
|
product.STATUS = EnumGeter.PRODUCTSTAUTS.QUALIFIED.GetHashCode().ToString();
|
|
product.PRODUCELINE = EnumGeter.PRODUCELINE.B9.ToString();
|
|
product.OUTFLAG = EnumGeter.PRODUCTOUTFLAG.INLIBRARY.GetHashCode().ToString();
|
|
product.USINGSTATE = EnumGeter.PRODUCTUSESTATE.UNUSED.GetHashCode().ToString();
|
|
product.CAPACITY = 1;
|
|
product.USINGCOUNT = 0;
|
|
product.MATERIAL_TYPE = materialtype.MATERIAL_TYPE_CODE;
|
|
product.MATERIAL_CODE = material.MATERIAL_CODE;
|
|
product.PRODUCTSOURCE = EnumGeter.PRODUCTSOURCE.SELFMADE.GetHashCode().ToString();
|
|
product.CREATEDATE = opDate;
|
|
product.CREATEUSER = ClientContext.LoginInfo.UserID;
|
|
product.UPDATEUSER = ClientContext.LoginInfo.UserID;
|
|
#endregion
|
|
|
|
|
|
#region 保存
|
|
//QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
|
DataResult<int> result;//判断是否成功
|
|
if (string.IsNullOrEmpty(product.PID) == true)
|
|
{
|
|
result = agent.InvokeServiceFunction<DataResult<int>>(B9BasicService.ProductBLL_InsertInjection.ToString(), product, machine);
|
|
}
|
|
else
|
|
{
|
|
result = agent.InvokeServiceFunction<DataResult<int>>(B9BasicService.ProductBLL_Update.ToString(), product);
|
|
}
|
|
MessageBox.Show(result.Msg);
|
|
//保存成功
|
|
if (result.IsSuccess)
|
|
{
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
/// <summary>
|
|
/// 窗体关闭
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void tsbClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
///<summary>
|
|
///错误检测
|
|
///</summary>
|
|
///<returns></returns>
|
|
private string ErrorCheck()
|
|
{
|
|
#region
|
|
string strMessage = "";
|
|
//判断条码是否为空
|
|
|
|
//设备
|
|
if (this.comMachineCode.SelectedValue == null || this.comMachineCode.SelectedValue == string.Empty)
|
|
{
|
|
strMessage += Resource1.SlushMachineNullValidate + "\r\n";
|
|
}
|
|
//物料类别
|
|
if (this.materialType.SelectedValue == null || this.materialType.SelectedValue == string.Empty)
|
|
{
|
|
strMessage += Resource1.MaterialTypeNullValidate + "\r\n";
|
|
}
|
|
//物料
|
|
if (this.materialCode.SelectedValue == null || this.materialCode.SelectedValue == string.Empty)
|
|
{
|
|
strMessage += Resource1.MaterialCodeNullValidate + "\r\n";
|
|
}
|
|
//时间
|
|
if (this.dtpDate.Text == null || this.dtpDate.Text == string.Empty)
|
|
{
|
|
strMessage += Resource1.WorktimeValidate + "\r\n";
|
|
}
|
|
|
|
//调用服务判断产品类型
|
|
|
|
//判断是否重复
|
|
//Product product = new Product();
|
|
//product.PRODUCTCODE = this.txtProductCode.Text.Trim();
|
|
//QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
|
//bool result = agent.InvokeServiceFunction<bool>(B9BasicService.ProductBLL_ExistsProduct.ToString(), product);
|
|
//if (result)
|
|
//{
|
|
// strMessage += Resource1.ProductCodeRepeartValidate + "\r\n";
|
|
//}
|
|
|
|
return strMessage;
|
|
#endregion
|
|
}
|
|
|
|
/// <summary>
|
|
/// (物料类别联动)物料号下拉
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void materialType_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
//加载物料
|
|
BasicData basicData = new BasicData();
|
|
if (this.materialType.SelectedValue != null && !string.IsNullOrEmpty(this.materialType.SelectedValue.ToString()))
|
|
{
|
|
this.materialCode.DataSource = basicData.GetmaterialCodeList(this.materialType.SelectedValue.ToString(), true); ;
|
|
this.materialCode.DisplayMember = "MATERIAL_NAME";
|
|
this.materialCode.ValueMember = "MATERIAL_CODE";
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|