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.
310 lines
13 KiB
310 lines
13 KiB
//using System;
|
|
//using System.Collections.Generic;
|
|
//using System.Linq;
|
|
//using System.Windows.Forms;
|
|
//using QM.Common;
|
|
//using QMAPP.FJC.Entity;
|
|
//using QMAPP.FJC.Entity.Basic;
|
|
//using QMAPP.FJC.Entity.Injection;
|
|
//using QMAPP.ServicesAgent;
|
|
//using QMAPP.WinForm.Common;
|
|
//using QMAPP.Entity;
|
|
//using QMAPP.MD.Entity;
|
|
//namespace QMAPP.WinForm.Forms.Injection
|
|
//{
|
|
// /// <summary>
|
|
// /// 模块编号:M12-1
|
|
// /// 作 用:投料记录
|
|
// /// 作 者:王庆男
|
|
// /// 编写日期:2015年06月08日
|
|
// ///</summary>
|
|
// public partial class InjectionMoldingNEWEditForm : Form
|
|
// {
|
|
// InjectionRecorder recorder = new InjectionRecorder();//编辑保存实体
|
|
|
|
// /// <summary>
|
|
// /// 新建
|
|
// /// </summary>
|
|
// public InjectionMoldingNEWEditForm()
|
|
// {
|
|
// InitializeComponent();
|
|
|
|
// }
|
|
|
|
// /// <summary>
|
|
// /// 编辑
|
|
// /// </summary>
|
|
// /// <param name="pid"></param>
|
|
// public InjectionMoldingNEWEditForm(string pid)
|
|
// {
|
|
// recorder.PID = pid;
|
|
// InitializeComponent();
|
|
// }
|
|
|
|
// /// <summary>
|
|
// /// 窗体加载
|
|
// /// </summary>
|
|
// /// <param name="sender"></param>
|
|
// /// <param name="e"></param>
|
|
// private void Form_Load(object sender, EventArgs e)
|
|
// {
|
|
// new KeyEvent().SetKeyToTxt(this);
|
|
// #region 绑定下拉列表
|
|
// BasicData basicData = new BasicData();
|
|
// //加载是否有条码列表
|
|
// //this.comIsHadNo.Items.Add(new ListItem("1", "有"));
|
|
// //this.comIsHadNo.Items.Add(new ListItem("0", "无"));
|
|
|
|
// //this.comIsHadNo.SelectedIndex = 0;
|
|
// //this.ActiveControl = this.txtMaterialCode;
|
|
// //this.txtMaterialCode.Focus();
|
|
// //加载注塑设备列表
|
|
// this.comMachineCode.DataSource = basicData.GetMachineInfoList(new string[] { EnumGeter.ProcessType_M.Injection.GetHashCode().ToString()}, false);
|
|
// this.comMachineCode.DisplayMember = "MACHINENAME";
|
|
// this.comMachineCode.ValueMember = "MACHINECODDE";
|
|
// if (ClientContext.MachineInfo != null)
|
|
// this.comMachineCode.SelectedValue = ClientContext.MachineInfo.MACHINECODDE;
|
|
// //this.comMachineCode.SelectedValue = ClientContext.MachineInfo.MACHINECODDE;//默认当前设备
|
|
// //加载物料列表
|
|
// this.comMaterialCode.DataSource = basicData.GetMaterielInfoList("RAW_INJECT", true);
|
|
// this.comMaterialCode.DisplayMember = "MATERIAL_NAME";
|
|
// this.comMaterialCode.ValueMember = "MATERIAL_CODE";
|
|
// //加载操作人列表
|
|
// this.comOpreator.DataSource = basicData.GetOperatorInfoList(EnumGeter.MACHINETYPE.zhusu.GetHashCode().ToString(), true); ;
|
|
// this.comOpreator.DisplayMember = "OPERATOR";
|
|
// this.comOpreator.ValueMember = "PID";
|
|
// //加载物料类别列表
|
|
// this.comMaterialType.DataSource = basicData.GetMaterialTypeList(new MD.Entity.MaterialClass { UpTypeCodes = "('IP_PLASTICPART','DP_PLASTICPART')" }, false);
|
|
// this.comMaterialType.DisplayMember = "MATERIAL_TYPE_NAME";
|
|
// this.comMaterialType.ValueMember = "MATERIAL_TYPE_CODE";
|
|
|
|
// //加载产品列表
|
|
// this.cbProject.DataSource = basicData.GetProjectList(false);
|
|
// this.cbProject.DisplayMember = "PROJECT_NAME";
|
|
// this.cbProject.ValueMember = "PROJECT_CODE";
|
|
// #endregion
|
|
|
|
// #region 加载编辑
|
|
// //判断是否为编辑加载编辑数据
|
|
// if (string.IsNullOrEmpty(recorder.PID) == false)
|
|
// {
|
|
// QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
|
// recorder = agent.InvokeServiceFunction<InjectionRecorder>(B9BasicService.InjectionRecorderBLL_Get.ToString(), recorder);
|
|
// //一定是存在的物料
|
|
// //this.comIsHadNo.SelectedIndex = 1;
|
|
// //this.txtMaterialCode.Visible = false;
|
|
// this.comMaterialCode.Visible = true;
|
|
// //this.txtMaterialCode.Text = "";
|
|
|
|
// this.comMaterialCode.SelectedValue = recorder.MATERIALCODE;
|
|
|
|
// //this.comMaterialType.SelectedValue = recorder.MATERIALTYPE;
|
|
// this.txtMeterialWeight.Text = recorder.METERIALWEIGHT.ToString("0");
|
|
// this.comOpreator.SelectedValue = recorder.CREATEUSER.Trim();
|
|
// this.txtMaterialBatch.Text = recorder.MATERIALBATCH;
|
|
|
|
// foreach (var m in (recorder.MACHINECODDE + "").Split(','))
|
|
// {
|
|
// var machinelist = comMachineCode.Items.Cast<MachineInfo>();
|
|
// var machine = machinelist.FirstOrDefault(p => p.MACHINECODDE == m);
|
|
// var index = comMachineCode.Items.IndexOf(machine);
|
|
// if (index >= 0)
|
|
// {
|
|
// this.comMachineCode.SetItemChecked(index, true);
|
|
// }
|
|
// }
|
|
// var project_A_mtypes = (recorder.MATERIALTYPE + "").Split(';');
|
|
// if (project_A_mtypes.Length == 2)
|
|
// {
|
|
// foreach (var p in project_A_mtypes[0].Split(','))
|
|
// {
|
|
// var projectlist = cbProject.Items.Cast<Project>();
|
|
// var project = projectlist.FirstOrDefault(o => o.PROJECT_CODE == p);
|
|
// var index = cbProject.Items.IndexOf(project);
|
|
// if (index >= 0)
|
|
// {
|
|
// this.cbProject.SetItemChecked(index, true);
|
|
// }
|
|
// }
|
|
|
|
// foreach (var t in project_A_mtypes[1].Split(','))
|
|
// {
|
|
// var typelist = comMaterialType.Items.Cast<MaterialClass>();
|
|
// var mtype = typelist.FirstOrDefault(o => o.MATERIAL_TYPE_NAME == t);
|
|
// var index = comMaterialType.Items.IndexOf(mtype);
|
|
// if (index >= 0)
|
|
// {
|
|
// this.comMaterialType.SetItemChecked(index, true);
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// }
|
|
// #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 加载保存信息
|
|
// //判断是否有物料号
|
|
|
|
// recorder.MATERIALCODE = this.comMaterialCode.SelectedValue.ToString();
|
|
|
|
// //原材料信息
|
|
// var mateial = (this.comMaterialCode.DataSource as List<MD.Entity.Material>).Where(m => m.MATERIAL_CODE == recorder.MATERIALCODE);
|
|
// if (mateial.Count<MD.Entity.Material>() > 0)
|
|
// {
|
|
// MD.Entity.Material materielInfo = mateial.First();
|
|
// recorder.MATERIALNAME = materielInfo.MATERIAL_NAME;
|
|
|
|
// }
|
|
|
|
// string projects = string.Join(",", cbProject.CheckedItems.Cast<Project>().Select(p => p.PROJECT_CODE).ToArray());
|
|
// string materialtypes = string.Join(",", comMaterialType.CheckedItems.Cast<MaterialClass>().Select(p => p.MATERIAL_TYPE_NAME).ToArray());
|
|
// recorder.MATERIALTYPE = projects + ";" + materialtypes;
|
|
// //获取设备信息
|
|
// var selectmachines = this.comMachineCode.CheckedItems.Cast<MachineInfo>();
|
|
// recorder.MACHINECODDE = string.Join(",", selectmachines.Select(p => p.MACHINECODDE));
|
|
// recorder.MACHINENAME = string.Join(",", selectmachines.Select(p => p.MACHINENAME_SHORT));
|
|
// recorder.MACHINETYPE = EnumGeter.MACHINETYPE.zhusu.GetHashCode().ToString();
|
|
// //工序类别
|
|
// recorder.PROCESSTYPE = EnumGeter.MACHINETYPE.zhusu.GetHashCode().ToString();
|
|
// //投料信息
|
|
// //recorder.MATERIALTYPE = this.comMaterialType.SelectedValue.ToString();
|
|
// //重量
|
|
// recorder.METERIALWEIGHT = Convert.ToInt32(this.txtMeterialWeight.Text);
|
|
// //批次
|
|
// recorder.MATERIALBATCH = this.txtMaterialBatch.Text;
|
|
// recorder.PRODUCELINE = EnumGeter.PRODUCELINE.B9.ToString();
|
|
// //操作人
|
|
// recorder.CREATEUSER = this.comOpreator.SelectedValue.ToString().Trim();
|
|
// recorder.PRODUCESHIFTNAME = ClientContext.produceShift.PRODUCESHIFTNAME;//班组
|
|
// recorder.PRODUCESHIFTTCODE = ClientContext.produceShift.PRODUCESHIFTTCODE;//班组
|
|
// #endregion
|
|
|
|
// #region 保存
|
|
// QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
|
// DataResult<int> result;//判断是否成功
|
|
// if (string.IsNullOrEmpty(recorder.PID) == true)
|
|
// {
|
|
// result = agent.InvokeServiceFunction<DataResult<int>>(B9BasicService.InjectionRecorderBLL_Insert.ToString(), recorder);
|
|
// }
|
|
// else
|
|
// {
|
|
// result = agent.InvokeServiceFunction<DataResult<int>>(B9BasicService.InjectionRecorderBLL_Update.ToString(), recorder);
|
|
// }
|
|
// //保存成功
|
|
// 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.comMaterialCode.SelectedValue == null || this.comMaterialCode.SelectedValue == string.Empty)
|
|
// {
|
|
// strMessage += Resource1.MaterialCodeNullValidate + "\r\n";
|
|
// }
|
|
|
|
// //设备
|
|
// if (this.comMachineCode.CheckedItems.Count <= 0)
|
|
// {
|
|
// strMessage += Resource1.InjectionMachineNullValidate + "\r\n";
|
|
// }
|
|
// //物料类别
|
|
// if (this.comMaterialType.CheckedItems.Count <= 0)
|
|
// {
|
|
// strMessage += "零件类别不能为空!" + "\r\n";
|
|
// }
|
|
// //产品
|
|
// if (this.cbProject.CheckedItems.Count <= 0)
|
|
// {
|
|
// strMessage += "请选择产品!" + "\r\n";
|
|
// }
|
|
|
|
// //操作人
|
|
// if (this.comOpreator.SelectedValue == null || this.comOpreator.SelectedValue == string.Empty)
|
|
// {
|
|
// strMessage += Resource1.OpreatorNullValidate + "\r\n";
|
|
// }
|
|
// //批次
|
|
// if (this.txtMaterialBatch.Text == string.Empty)
|
|
// {
|
|
// strMessage += Resource1.MaterialBatchNullValidate + "\r\n";
|
|
// }
|
|
|
|
|
|
|
|
|
|
// return strMessage;
|
|
// #endregion
|
|
// }
|
|
|
|
// private void comMaterialCode_SelectedIndexChanged(object sender, EventArgs e)
|
|
// {
|
|
// if (this.comMaterialCode.SelectedValue != null && this.comMaterialCode.SelectedValue != string.Empty)
|
|
// {
|
|
// this.txtMeterialWeight.Text = (this.comMaterialCode.SelectedItem as MD.Entity.Material).WEIGHT.ToString();
|
|
// }
|
|
// }
|
|
|
|
// private void comMaterialType_SelectedIndexChanged(object sender, EventArgs e)
|
|
// {
|
|
// if (this.comMaterialType.SelectedValue != null && this.comMaterialType.SelectedValue.Equals(EnumGeter.MATERIALTYPE.jinshuzhijia.GetHashCode().ToString()))
|
|
// {
|
|
// //this.comIsHadNo.SelectedIndex = 0;
|
|
// //this.comIsHadNo.Enabled = false;
|
|
// this.label13.Visible = false;
|
|
// this.txtMaterialBatch.Visible = false;
|
|
// this.label9.Text = "数量(个):";
|
|
// this.label12.Visible = false;
|
|
// }
|
|
// else
|
|
// {
|
|
// //this.comIsHadNo.Enabled = true;
|
|
// this.label13.Visible = true;
|
|
// this.txtMaterialBatch.Visible = true;
|
|
// this.label9.Text = "重量(KG):";
|
|
// this.label12.Visible = true;
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
|