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.
972 lines
33 KiB
972 lines
33 KiB
using System;
|
|
using System.Collections;
|
|
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.ProduceManage;
|
|
using QMAPP.ServicesAgent;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMAPP.KB.Entity;
|
|
using QMAPP.FJC.Entity;
|
|
using QMFrameWork.Data;
|
|
using System.Threading;
|
|
using QMAPP.MD.Entity;
|
|
using QMAPP.WinForm.Common;
|
|
|
|
namespace QMAPP.WinForm.Forms.Mend
|
|
{
|
|
public partial class SpecifyForm : Form
|
|
{
|
|
Product product = new Product();
|
|
List<Product> productList = new List<Product>();
|
|
|
|
bool isValid = false;
|
|
|
|
public List<DefectType> getSelectList = new List<DefectType>();
|
|
|
|
public List<DefectType> defectTypeList = new List<DefectType>();
|
|
|
|
BarCodeHook BarCode = new BarCodeHook();
|
|
|
|
BasicData basicData = new BasicData();
|
|
|
|
public static SynchronizationContext SynchContext;
|
|
|
|
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
|
|
|
private string _materialType = "";
|
|
|
|
private string _pid = "";
|
|
|
|
void BarCode_BarCodeEvent(BarCodeHook.BarCodes barCode)
|
|
{
|
|
ShowInfo(barCode);
|
|
}
|
|
|
|
public SpecifyForm()
|
|
{
|
|
InitializeComponent();
|
|
|
|
SynchContext = new SynchronizationContext();
|
|
BarCode.BarCodeEvent += new BarCodeHook.BarCodeDelegate(BarCode_BarCodeEvent);
|
|
BarCode.Start();
|
|
rbScarp.Checked = true;
|
|
comHANDLEMETHODBind();
|
|
comERPBind();
|
|
}
|
|
//明细进入
|
|
public SpecifyForm(string pid, string materialType)
|
|
{
|
|
InitializeComponent();
|
|
tsbSave.Visible = false;
|
|
|
|
comWorkCellBind("");
|
|
comHANDLEMETHODBind();
|
|
comERPBind();
|
|
|
|
ShowDetail(pid);
|
|
txtCode.Enabled = false;
|
|
butDEFECT.Enabled = true;
|
|
_materialType = materialType;
|
|
_pid = pid;
|
|
}
|
|
|
|
private void ShowInfo(BarCodeHook.BarCodes barCode)
|
|
{
|
|
if (!this.txtCode.Focused)
|
|
{
|
|
this.txtCode.Focus();
|
|
}
|
|
}
|
|
|
|
private void SpecifyForm_Load(object sender, EventArgs e)
|
|
{
|
|
DGView.AutoGenerateColumns = false;
|
|
|
|
//string str = this.GetType().Assembly.Location;
|
|
//str = str.Substring(0, str.LastIndexOf("\\"));
|
|
//str = str.Substring(0, str.LastIndexOf("\\"));
|
|
//str = str.Substring(0, str.LastIndexOf("\\"));
|
|
//Image img = Image.FromFile(str+@"\Content\Img\pic.jpg");
|
|
|
|
//flowLayoutPanel1.BackgroundImage = img;
|
|
//flowLayoutPanel1.BackgroundImage = Resource1.GetBitmap("zxhb");
|
|
|
|
|
|
}
|
|
|
|
private void ShowDetail(string pid)
|
|
{
|
|
|
|
MendRecorder mendRecorder = agent.InvokeServiceFunction<MendRecorder>(B9IPCService.MendRecorderBLL_GetMendRecorderInfo.ToString(), new MendRecorder() { PID = pid });
|
|
|
|
txtCode.Text = mendRecorder.PRODUCTCODE;
|
|
|
|
if (mendRecorder.MENDRESULT == "0")
|
|
{
|
|
rbMend.Checked = true;
|
|
}
|
|
else
|
|
{
|
|
rbScarp.Checked = true;
|
|
}
|
|
//是否测试件
|
|
if (mendRecorder.MENDTEST == "是")
|
|
{
|
|
checkBox1.Checked = true;
|
|
}
|
|
//工序
|
|
if (mendRecorder.WORKCELL_CODE != null) comWorkCell.SelectedValue = mendRecorder.WORKCELL_CODE;
|
|
//处理方法
|
|
if (mendRecorder.HANDLEMETHOD != null) comHANDLEMETHOD.SelectedValue = mendRecorder.HANDLEMETHOD;
|
|
|
|
|
|
//ERP数据
|
|
//废品类别
|
|
if (mendRecorder.ERP_MFGCODETYPE != null) comMENDTYPE.SelectedValue = mendRecorder.ERP_MFGCODETYPE;
|
|
//车型代码
|
|
if (mendRecorder.ERP_CAR != null) comCAR.SelectedValue = mendRecorder.ERP_CAR;
|
|
//生产线
|
|
if (mendRecorder.ERP_WORKLINE != null) comWORKLINE.SelectedValue = mendRecorder.ERP_WORKLINE;
|
|
//班组代码
|
|
if (mendRecorder.ERP_SHIFT != null) comERPSHIFT.SelectedValue = mendRecorder.ERP_SHIFT;
|
|
//工序代码
|
|
if (mendRecorder.ERP_WORKCELL != null) comERPWORKCELL.SelectedValue = mendRecorder.ERP_WORKCELL;
|
|
//缺陷归属
|
|
if (mendRecorder.ERP_DEFECTTO != null) comDEFECTTO.SelectedValue = mendRecorder.ERP_DEFECTTO;
|
|
//产品类别
|
|
if (mendRecorder.ERP_PRODUCTTYPE != null) comPRODUCTTYPE.SelectedValue = mendRecorder.ERP_PRODUCTTYPE;
|
|
//缺陷代码
|
|
if (mendRecorder.ERP_DEFECTCODE != null) comDEFECTCODE.SelectedValue = mendRecorder.ERP_DEFECTCODE;
|
|
|
|
//foreach(MenderReason o in mendRecorder.reasonList)
|
|
//{
|
|
// defectTypeList.Add(
|
|
// new DefectType(){
|
|
// DEFECTKEY=o.DEFECTKEY,
|
|
// DEFECTVALUE=o.DEFECTVALUE,
|
|
// POSITION=o.POSITION
|
|
// });
|
|
//}
|
|
|
|
//_shiftCode = mendRecorder.PRODUCESHIFTTCODE;
|
|
//if (mendRecorder.PRODUCESHIFTTCODE == "A")
|
|
//{
|
|
// rA.Checked = true;
|
|
//}
|
|
//else if (mendRecorder.PRODUCESHIFTTCODE == "B")
|
|
//{
|
|
// rB.Checked = true;
|
|
//}
|
|
//else
|
|
//{
|
|
// rC.Checked = true;
|
|
//}
|
|
|
|
//comIndex.Text = mendRecorder.PRODUCESHIFTTCODE;
|
|
|
|
|
|
}
|
|
|
|
//ERP下拉框
|
|
private void comERPBind()
|
|
{
|
|
//废品类别
|
|
var code = "MENDTYPE";
|
|
var CODES = agent.InvokeServiceFunction<List<MendRecorder>>("MendRecorderBLL_GetMFGCODES", code);
|
|
this.comMENDTYPE.DataSource = CODES;
|
|
this.comMENDTYPE.DisplayMember = "ERP_NAME";
|
|
this.comMENDTYPE.ValueMember = "ERP_CODE";
|
|
|
|
//车型代码
|
|
code = "CAR";
|
|
CODES = agent.InvokeServiceFunction<List<MendRecorder>>("MendRecorderBLL_GetMFGCODES", code);
|
|
this.comCAR.DataSource = CODES;
|
|
this.comCAR.DisplayMember = "ERP_NAME";
|
|
this.comCAR.ValueMember = "ERP_CODE";
|
|
//生产线代码
|
|
code = "WORKLINE";
|
|
CODES = agent.InvokeServiceFunction<List<MendRecorder>>("MendRecorderBLL_GetMFGCODES", code);
|
|
this.comWORKLINE.DataSource = CODES;
|
|
this.comWORKLINE.DisplayMember = "ERP_NAME";
|
|
this.comWORKLINE.ValueMember = "ERP_CODE";
|
|
//班组代码
|
|
code = "SHIFT";
|
|
CODES = agent.InvokeServiceFunction<List<MendRecorder>>("MendRecorderBLL_GetMFGCODES", code);
|
|
this.comERPSHIFT.DataSource = CODES;
|
|
this.comERPSHIFT.DisplayMember = "ERP_NAME";
|
|
this.comERPSHIFT.ValueMember = "ERP_CODE";
|
|
//工序代码
|
|
code = "WORKCELL";
|
|
CODES = agent.InvokeServiceFunction<List<MendRecorder>>("MendRecorderBLL_GetMFGCODES", code);
|
|
//CODES.RemoveAt(0);
|
|
this.comERPWORKCELL.DataSource = CODES;
|
|
this.comERPWORKCELL.DisplayMember = "ERP_NAME";
|
|
this.comERPWORKCELL.ValueMember = "ERP_CODE";
|
|
comERPWORKCELL.SelectedIndex = 1;
|
|
//缺陷归属
|
|
code = "DEFECTTO";
|
|
CODES = agent.InvokeServiceFunction<List<MendRecorder>>("MendRecorderBLL_GetMFGCODES", code);
|
|
this.comDEFECTTO.DataSource = CODES;
|
|
this.comDEFECTTO.DisplayMember = "ERP_NAME";
|
|
this.comDEFECTTO.ValueMember = "ERP_CODE";
|
|
//产品类别代码
|
|
code = "PRODUCTTYPE";
|
|
CODES = agent.InvokeServiceFunction<List<MendRecorder>>("MendRecorderBLL_GetMFGCODES", code);
|
|
this.comPRODUCTTYPE.DataSource = CODES;
|
|
this.comPRODUCTTYPE.DisplayMember = "ERP_NAME";
|
|
this.comPRODUCTTYPE.ValueMember = "ERP_CODE";
|
|
//缺陷代码
|
|
code = "DEFECTCODE";
|
|
CODES = agent.InvokeServiceFunction<List<MendRecorder>>("MendRecorderBLL_GetMFGCODES", code);
|
|
this.comDEFECTCODE.DataSource = CODES;
|
|
this.comDEFECTCODE.DisplayMember = "ERP_NAME";
|
|
this.comDEFECTCODE.ValueMember = "ERP_CODE";
|
|
basicData.AdjustComboBoxDropDownListWidth(comDEFECTCODE);
|
|
|
|
}
|
|
|
|
//工序下拉框
|
|
private void comWorkCellBind(string ProductCode)
|
|
{
|
|
//加载工序下拉列表
|
|
if (string.IsNullOrEmpty(ProductCode))
|
|
{
|
|
this.comWorkCell.DataSource = basicData.GetWorkCellList(true);
|
|
}
|
|
else
|
|
{
|
|
this.comWorkCell.DataSource = basicData.GetMainOperationWorkCell(ProductCode);
|
|
}
|
|
this.comWorkCell.DisplayMember = "WORKCELL_NAME";
|
|
this.comWorkCell.ValueMember = "WORKCELL_CODE";
|
|
basicData.AdjustComboBoxDropDownListWidth(comWorkCell);
|
|
}
|
|
//车型代码下拉框定位
|
|
private void comCARBind(string ProjectCode)
|
|
{
|
|
foreach (MendRecorder CAR in comCAR.Items)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(CAR.ERP_NAME))
|
|
{
|
|
var names = CAR.ERP_NAME.Split('/');
|
|
if (ProjectCode.Contains(names[1]))
|
|
{
|
|
comCAR.SelectedValue = CAR.ERP_CODE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//班组代码下拉框定位
|
|
private void comERPSHIFTBind(string TeamCode)
|
|
{
|
|
foreach (MendRecorder Team in comERPSHIFT.Items)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(Team.ERP_NAME))
|
|
{
|
|
//var names = CAR.ERP_NAME.Split('/');
|
|
if (TeamCode==Team.ERP_CODE)
|
|
{
|
|
comERPSHIFT.SelectedValue = Team.ERP_CODE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//处理方法下拉框
|
|
private void comHANDLEMETHODBind()
|
|
{
|
|
//返修结果
|
|
this.comHANDLEMETHOD.DataSource = basicData.GetDictionaryList("HANDLEMETHOD");
|
|
this.comHANDLEMETHOD.DisplayMember = "value";
|
|
this.comHANDLEMETHOD.ValueMember = "key";
|
|
this.comHANDLEMETHOD.SelectedIndex = 3;
|
|
}
|
|
|
|
private void PictureBoxDeal(Image unSelectImage,Image selectImage ,object sender )
|
|
{
|
|
//tsbSave.Visible == false是查看明细
|
|
//if (tsbSave.Visible == false)
|
|
//{
|
|
// return;
|
|
//}
|
|
if (isValid == false)
|
|
{
|
|
//MessageBox.Show("请扫描正确的条码信息!", "提示");
|
|
return;
|
|
}
|
|
|
|
PictureBox pb = (PictureBox)sender;
|
|
string postion = pb.Name.Substring(2);
|
|
if (defectTypeList.Count(o => o.POSITION == postion) > 0)
|
|
{
|
|
//pb.Image = unSelectImage;
|
|
pb.BackgroundImage = null;
|
|
List<DefectType> list = defectTypeList
|
|
.Where(o => o.POSITION != postion).OrderBy(o => o.POSITION)
|
|
.ToList<DefectType>();
|
|
defectTypeList = list;
|
|
}
|
|
else
|
|
{
|
|
ItemForm itemform = new ItemForm();
|
|
itemform.ShowDialog();
|
|
|
|
if (getSelectList.Count > 0)
|
|
{
|
|
//pb.Image = selectImage;
|
|
pb.BackgroundImage = QMAPP.WinForm.Resource1.ok; ;
|
|
foreach (var dt in getSelectList)
|
|
{
|
|
dt.POSITION = postion;
|
|
defectTypeList.Add(dt);
|
|
}
|
|
|
|
defectTypeList = defectTypeList
|
|
.OrderBy(o => o.POSITION)
|
|
.ToList<DefectType>();
|
|
getSelectList = new List<DefectType>();
|
|
}
|
|
}
|
|
|
|
|
|
txtCode.Focus();
|
|
}
|
|
|
|
#region 双击事件
|
|
|
|
private void pB1A_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._1A;
|
|
Image selectImage = QMAPP.WinForm.Resource1._1A_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB1B_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._1B;
|
|
Image selectImage = QMAPP.WinForm.Resource1._1B_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB1C_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._1C;
|
|
Image selectImage = QMAPP.WinForm.Resource1._1C_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB1D_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._1D;
|
|
Image selectImage = QMAPP.WinForm.Resource1._1D_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB1E_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._1E;
|
|
Image selectImage = QMAPP.WinForm.Resource1._1E_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB1F_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._1F;
|
|
Image selectImage = QMAPP.WinForm.Resource1._1F_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB2A_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._2A;
|
|
Image selectImage = QMAPP.WinForm.Resource1._2A_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB2B_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._2B;
|
|
Image selectImage = QMAPP.WinForm.Resource1._2B_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB2C_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._2C;
|
|
Image selectImage = QMAPP.WinForm.Resource1._2C_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB2D_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._2D;
|
|
Image selectImage = QMAPP.WinForm.Resource1._2D_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB2E_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._2E;
|
|
Image selectImage = QMAPP.WinForm.Resource1._2E_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB2F_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._2F;
|
|
Image selectImage = QMAPP.WinForm.Resource1._2F_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB3A_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._3A;
|
|
Image selectImage = QMAPP.WinForm.Resource1._3A_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB3B_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._3B;
|
|
Image selectImage = QMAPP.WinForm.Resource1._3B_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB3C_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._3C;
|
|
Image selectImage = QMAPP.WinForm.Resource1._3C_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB3D_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._3D;
|
|
Image selectImage = QMAPP.WinForm.Resource1._3D_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB3E_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._3E;
|
|
Image selectImage = QMAPP.WinForm.Resource1._3E_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB3F_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._3F;
|
|
Image selectImage = QMAPP.WinForm.Resource1._3F_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB4A_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._4A;
|
|
Image selectImage = QMAPP.WinForm.Resource1._4A_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB4B_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._4B;
|
|
Image selectImage = QMAPP.WinForm.Resource1._4B_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB4C_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._4C;
|
|
Image selectImage = QMAPP.WinForm.Resource1._4C_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB4D_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._4D;
|
|
Image selectImage = QMAPP.WinForm.Resource1._4D_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB4E_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._4E;
|
|
Image selectImage = QMAPP.WinForm.Resource1._4E_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB4F_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._4F;
|
|
Image selectImage = QMAPP.WinForm.Resource1._4F_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB5A_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._5A;
|
|
Image selectImage = QMAPP.WinForm.Resource1._5A_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB5B_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._5B;
|
|
Image selectImage = QMAPP.WinForm.Resource1._5B_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB5C_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._5C;
|
|
Image selectImage = QMAPP.WinForm.Resource1._5C_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB5D_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._5D;
|
|
Image selectImage = QMAPP.WinForm.Resource1._5D_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB5E_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._5E;
|
|
Image selectImage = QMAPP.WinForm.Resource1._5E_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB5F_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._5F;
|
|
Image selectImage = QMAPP.WinForm.Resource1._5F_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB6A_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void pB6B_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void pB6C_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._6C;
|
|
Image selectImage = QMAPP.WinForm.Resource1._6C_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB6D_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._6D;
|
|
Image selectImage = QMAPP.WinForm.Resource1._6D_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB6E_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
Image unSelectImage = QMAPP.WinForm.Resource1._6E;
|
|
Image selectImage = QMAPP.WinForm.Resource1._6E_select;
|
|
|
|
PictureBoxDeal(unSelectImage, selectImage, sender);
|
|
}
|
|
|
|
private void pB6F_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
private void tsbClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void txtCode_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(txtCode.Text))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (e.KeyCode == Keys.Enter)//如果输入的是回车键
|
|
{
|
|
var scode = txtCode.Text.Trim().ToUpper();
|
|
if (System.Text.RegularExpressions.Regex.IsMatch(scode, "^DP\\w+(-\\w+)?-DF[LR][FR]\\w+$"))//扫描输入为门板计划标签
|
|
{
|
|
//从计划标签中截取产品码
|
|
scode = scode.Substring(scode.LastIndexOf('-') + 1);
|
|
}
|
|
DataResult<Product> result =
|
|
agent.InvokeServiceFunction<DataResult<Product>>
|
|
("MendRecorderBLL_CheckProductCodeNew", scode);
|
|
|
|
if (result.IsSuccess == true)
|
|
{
|
|
product = result.Result;
|
|
lblError.Text = product.PRODUCTTYPENAME + scode + " " + "当前工序:" + product.CURRENTPROCESSNAME + " " + "状态:" + product.STATUSNAME;
|
|
//lblError.Text = product.PRODUCTTYPENAME + product.PRODUCTCODE + " " + "当前工序:" + product.CURRENTPROCESSNAME + " " + "状态:" + product.STATUSNAME;
|
|
this.lblError.ForeColor = Color.Black;
|
|
isValid = true;
|
|
//工序
|
|
//comWorkCell.Text = "";
|
|
//comWorkCellBind(scode);
|
|
comWorkCellBind(product.PRODUCTCODE);
|
|
|
|
MainOperation mainoperation = agent.InvokeServiceFunction<MainOperation>("MendRecorderBLL_GetMianOperationInfo", product.PID);
|
|
|
|
//if (product.WORKCELL_CODE != null) comWorkCell.SelectedValue = product.WORKCELL_CODE;
|
|
//车型代码下拉框定位
|
|
if (!string.IsNullOrWhiteSpace(product.PROJECTCODE) && rbScarp.Checked)
|
|
{
|
|
comCARBind(product.PROJECTCODE);
|
|
}
|
|
//班组代码下拉框定位
|
|
if (!string.IsNullOrWhiteSpace(product.TEAM_CODE)&& rbScarp.Checked)
|
|
{
|
|
comERPSHIFTBind(product.TEAM_CODE.Trim());
|
|
}
|
|
//生产线下拉框定位
|
|
if (mainoperation != null)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(mainoperation.ERP_WORKLINE) && rbScarp.Checked)
|
|
{
|
|
comWORKLINE.SelectedValue = mainoperation.ERP_WORKLINE.Trim();
|
|
product.ERP_WORKLINE = "";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
comWORKLINE.SelectedIndex = 1;
|
|
}
|
|
|
|
//是否测试件
|
|
checkBox1.Checked = false;
|
|
if (product.MENDTEST != null)
|
|
{
|
|
if (product.MENDTEST == "是")
|
|
{
|
|
checkBox1.Checked = true;
|
|
}
|
|
}
|
|
|
|
//判断零件号的类型,选择不同图片
|
|
//selectBackgroundImage(product.MATERIAL_TYPE);
|
|
butDEFECT.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
lblError.Text = result.Msg ;
|
|
this.lblError.ForeColor = Color.Red;
|
|
isValid = false;
|
|
}
|
|
|
|
txtCode.Text = "";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tsbSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (isValid == false)
|
|
{
|
|
MessageBox.Show("请扫描正确的条码信息!", "提示");
|
|
return;
|
|
}
|
|
|
|
//if (defectTypeList.Count == 0)
|
|
//{
|
|
// MessageBox.Show("请选择缺陷类型!", "提示");
|
|
// return;
|
|
//}
|
|
|
|
if (product.STATUS == EnumGeter.STATUS.SCRAP.GetHashCode().ToString() && rbScarp.Checked == true)
|
|
{
|
|
MessageBox.Show("该产品已经报废!", "提示");
|
|
return;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(comWorkCell.Text))
|
|
{
|
|
MessageBox.Show("请选择生产工序!", "提示");
|
|
return;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(comHANDLEMETHOD.Text) && rbScarp.Checked)
|
|
{
|
|
MessageBox.Show("请选择处理方法!", "提示");
|
|
return;
|
|
}
|
|
|
|
//erp
|
|
if (comMENDTYPE.SelectedIndex < 1 && rbScarp.Checked)
|
|
{
|
|
MessageBox.Show("请选择废品类别!");
|
|
return;
|
|
}
|
|
if (comCAR.SelectedIndex < 1 && rbScarp.Checked)
|
|
{
|
|
MessageBox.Show("请选择车型代码!");
|
|
return;
|
|
}
|
|
if (comWORKLINE.SelectedIndex < 1 && rbScarp.Checked)
|
|
{
|
|
MessageBox.Show("请选择生产线!");
|
|
return;
|
|
}
|
|
if (comERPSHIFT.SelectedIndex < 1 && rbScarp.Checked)
|
|
{
|
|
MessageBox.Show("请选择班组代码!");
|
|
return;
|
|
}
|
|
if (comERPWORKCELL.SelectedIndex < 0 && rbScarp.Checked)
|
|
{
|
|
MessageBox.Show("请选择工序代码!");
|
|
return;
|
|
}
|
|
if (comDEFECTTO.SelectedIndex < 1)
|
|
{
|
|
MessageBox.Show("请选择缺陷归属!");
|
|
return;
|
|
}
|
|
if (comPRODUCTTYPE.SelectedIndex < 1 && rbScarp.Checked)
|
|
{
|
|
MessageBox.Show("请选择产品类别!");
|
|
return;
|
|
}
|
|
if (comDEFECTCODE.SelectedIndex < 1)
|
|
{
|
|
MessageBox.Show("请选择缺陷代码!");
|
|
return;
|
|
}
|
|
|
|
product.STATUS = (rbScarp.Checked) ? EnumGeter.STATUS.SCRAP.GetHashCode().ToString() : EnumGeter.STATUS.QUALIFIED.GetHashCode().ToString();
|
|
//product.PRODUCESHIFTTCODE = comIndex.Text;
|
|
//if (rA.Checked)
|
|
//{
|
|
// product.PRODUCESHIFTTCODE = "A";
|
|
//}
|
|
//else if (rB.Checked)
|
|
//{
|
|
// product.PRODUCESHIFTTCODE = "B";
|
|
//}
|
|
//else
|
|
//{
|
|
// product.PRODUCESHIFTTCODE = "C";
|
|
//}
|
|
|
|
//product.PRODUCESHIFTTCODE = _shiftCode;
|
|
//是否测试件
|
|
product.MENDTEST = "否";
|
|
if (checkBox1.Checked)
|
|
{
|
|
product.MENDTEST = "是";
|
|
}
|
|
//工序下拉框赋值--change事件里赋值了
|
|
//if (comWorkCell.SelectedValue != null) product.WORKCELL_CODE = comWorkCell.SelectedValue.ToString();
|
|
|
|
//处理方法下拉框赋值
|
|
if (comHANDLEMETHOD.SelectedValue != null) product.HANDLEMETHOD = comHANDLEMETHOD.SelectedValue.ToString();
|
|
|
|
product.MENDNUMBER = 1;
|
|
|
|
//ERP数据
|
|
product.ERP_MFGCODETYPE = comMENDTYPE.SelectedValue.ToString();
|
|
product.ERP_CAR = comCAR.SelectedValue.ToString();
|
|
product.ERP_WORKLINE = comWORKLINE.SelectedValue.ToString();
|
|
product.ERP_SHIFT = comERPSHIFT.SelectedValue.ToString();
|
|
product.ERP_WORKCELL = comERPWORKCELL.SelectedValue.ToString();
|
|
product.ERP_DEFECTTO = comDEFECTTO.SelectedValue.ToString();
|
|
product.ERP_PRODUCTTYPE = comPRODUCTTYPE.SelectedValue.ToString();
|
|
product.ERP_DEFECTCODE = comDEFECTCODE.SelectedValue.ToString();
|
|
|
|
|
|
DataResult<int> result = agent.InvokeServiceFunction<DataResult<int>>("MendRecorderBLL_InsertMendRecordItemNew", product, defectTypeList);
|
|
|
|
if (result.IsSuccess == true)
|
|
{
|
|
DGView.DataSource = null;
|
|
productList.Add(product);
|
|
DGView.DataSource=productList;
|
|
|
|
//成功后初始化控件
|
|
//InitForm();
|
|
checkBox1.Checked = false;
|
|
|
|
comWorkCell.DataSource = null;
|
|
lblError.Text = "保存成功!";
|
|
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(result.Msg, "提示");
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
private void InitForm()
|
|
{
|
|
product = new Product();
|
|
|
|
isValid = false;
|
|
|
|
getSelectList = new List<DefectType>();
|
|
|
|
defectTypeList = new List<DefectType>();
|
|
|
|
|
|
rbScarp.Checked = true;
|
|
|
|
this.comHANDLEMETHOD.SelectedIndex = 4;
|
|
|
|
lblError.Text = "保存成功!";
|
|
|
|
txtCode.Focus();
|
|
|
|
|
|
}
|
|
|
|
private void rbMend_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (rbMend.Checked)
|
|
{
|
|
label19.Visible = false;
|
|
label21.Visible = false;
|
|
label11.Visible = false;
|
|
label16.Visible = false;
|
|
label20.Visible = false;
|
|
label18.Visible = false;
|
|
label10.Visible = false;
|
|
|
|
comCAR.SelectedIndex = 0;
|
|
comMENDTYPE.SelectedIndex = 0;
|
|
comERPSHIFT.SelectedIndex = 0;
|
|
comWORKLINE.SelectedIndex = 0;
|
|
comERPWORKCELL.SelectedIndex = 0;
|
|
comPRODUCTTYPE.SelectedIndex = 0;
|
|
comHANDLEMETHOD.SelectedIndex = 0;
|
|
|
|
txtCode.Focus();
|
|
}
|
|
}
|
|
|
|
private void rbScarp_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (rbScarp.Checked)
|
|
{
|
|
label19.Visible = true;
|
|
label21.Visible = true;
|
|
label11.Visible = true;
|
|
label16.Visible = true;
|
|
label20.Visible = true;
|
|
label18.Visible = true;
|
|
label10.Visible = true;
|
|
|
|
|
|
if (comERPWORKCELL.Items.Count > 0)
|
|
{
|
|
comERPWORKCELL.SelectedIndex = 1;
|
|
}
|
|
|
|
txtCode.Focus();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void comWorkCell_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(comWorkCell.Text.Trim()))
|
|
{
|
|
MainOperation mainOperation = comWorkCell.SelectedItem as MainOperation;
|
|
if (mainOperation != null)
|
|
{
|
|
product.SHIFT_CODE = mainOperation.PRODUCESHIFTTCODE;
|
|
product.BATCH_NO = mainOperation.OPERATEDDATE.ToString("yyyyMMdd");
|
|
product.WORKCELL_CODE = mainOperation.WORKCELL_CODE;
|
|
product.MACHINECODDE = mainOperation.MACHINECODDE;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
private void butDEFECT_Click(object sender, EventArgs e)
|
|
{
|
|
MendRecorderReasonForm form = !string.IsNullOrEmpty(_materialType) ? new MendRecorderReasonForm(_pid, _materialType) : new MendRecorderReasonForm(this, product.MATERIAL_TYPE);
|
|
//butDEFECT.ToString();
|
|
form.ShowDialog();
|
|
}
|
|
|
|
private void comMFGCODETYPE_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void comDEFECTCODE_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
var name = comDEFECTCODE.Text;
|
|
var code = name.Substring(name.Length - 1, 1);
|
|
foreach (MendRecorder DEFECTTO in comDEFECTTO.Items)
|
|
{
|
|
if (code == DEFECTTO.ERP_CODE)
|
|
{
|
|
comDEFECTTO.SelectedValue = code;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|