private void LSdataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (this.LSdataGridView.CurrentCell.OwningColumn.Name == "删除") { int tmtmid = Convert.ToInt32(this.LSdataGridView.CurrentRow.Cells["投料条码代码"].Value); //MES_RETURN_UI res = ServicModel.PD_TLGL.DELETE(tmtmid, getToken()); //if (res.TYPE.Equals("S")) //{ int id = Convert.ToInt32(this.LSdataGridView.CurrentRow.Cells["序号"].Value); Tmlist.RemoveAt(id - 1); for (int i = 0; i < Tmlist.Count; i++) { Tmlist[i].Xh = (i + 1).ToString(); } int a = LSdataGridView.Columns.Count; if (Tmlist.Count == 0) { LSdataGridView.DataSource = new List <TMDataGrid>(); LSdataGridView.Columns["删除"].DisplayIndex = 4; } else { LSdataGridView.DataSource = Tmlist.ToArray(); LSdataGridView.Columns["删除"].DisplayIndex = 4; } //} //else //{ // MessageBox.Show(res.MESSAGE, "消息框"); //} } }
private void getTMList(SELECT_MES_TM_TMINFO_BYTM model, int first) { for (int x = 0; x < model.MES_TM_TMINFO_LIST.Length; x++) { IList <TMDataGrid> nodes = new List <TMDataGrid>(); TMDataGrid node = new TMDataGrid(); if (model.MES_TM_TMINFO_LIST.Length <= 0) { //MessageBox.Show("扫描的是无效的条码", "消息框"); ShowMeg(q(Msg_Type.msgscantminvalid)); SMtextBox.Clear(); return; } node.Tm = model.MES_TM_TMINFO_LIST[x].TM; node.Wlxx = model.MES_TM_TMINFO_LIST[x].WLH + "/" + model.MES_TM_TMINFO_LIST[x].WLMS; node.Wllb = model.MES_TM_TMINFO_LIST[x].WLLBNAME; //node.Bz = model.MES_TM_TMINFO_LIST[0].REMARK; node.Wllbdm = model.MES_TM_TMINFO_LIST[x].WLLB; node.Gc = model.MES_TM_TMINFO_LIST[0].GC; node.Tltmid = model.MES_TM_TMINFO_LIST[x].TLTMID; //node.Tmid = model.MES_TM_TMINFO_LIST[0].TM; //bool isBom = false; if (_bomList.ET_BOM != null) { for (int i = 0; i < _bomList.ET_BOM.Length; i++) { if (_bomList.ET_BOM[i].WLLB == node.Wllbdm) { BOMdataGridView.Rows[i].Cells[q(Msg_Type.fieldstatus)].Style.BackColor = Color.FromArgb(187, 255, 102);//"状态" } } } else { } //if (isBom == false) //{ // if (MessageBox.Show("你扫描的条码不是物料的BOM组成部分!!", "消息框", MessageBoxButtons.OK) == DialogResult.OK) // { // SMtextBox.Clear(); // } // return; //} bool replace = false; if (Tmlist.Count > 0) { for (int i = 0; i < Tmlist.Count; i++) { if (node.Wllbdm == Tmlist[i].Wllbdm) { replace = true; Tmlist[i] = node; } } if (replace == false) { Tmlist.Add(node); } } else { Tmlist.Add(node); } for (int i = 0; i < Tmlist.Count; i++) { Tmlist[i].Xh = (i + 1).ToString(); } if (RigthType == Rigth_Type.mfqqingxi) { pctextBox.Text = model.MES_TM_TMINFO_LIST[x].PC; } LSdataGridView.DataSource = Tmlist.ToList(); LSdataGridView.ClearSelection(); LSdataGridView.Columns[q(Msg_Type.fielddelete)].DisplayIndex = 4;//"删除" } if (first == 1) { if (model.MES_TM_TMINFO_LIST.Length == 1) { //MessageBox.Show("投料成功!!!", "消息框"); ShowMeg(q(Msg_Type.msgtlsuccess), 1500);//"投料成功" } } SMtextBox.Clear(); SMtextBox.Select(); }
private void LSdataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { if (this.LSdataGridView.CurrentCell.OwningColumn.Name == q(Msg_Type.fielddelete)) //"删除" { int tmtmid = Convert.ToInt32(this.LSdataGridView.CurrentRow.Cells[q(Msg_Type.fieldtltmdm)].Value); //"投料条码代码" //MES_RETURN_UI res = ServicModel.PD_TLGL.DELETE(tmtmid, getToken()); //if (res.TYPE.Equals("S")) //{ int id = Convert.ToInt32(this.LSdataGridView.CurrentRow.Cells[q(Msg_Type.fieldxh)].Value); //"序号" Tmlist.RemoveAt(id - 1); for (int i = 0; i < Tmlist.Count; i++) { Tmlist[i].Xh = (i + 1).ToString(); } int a = LSdataGridView.Columns.Count; if (Tmlist.Count == 0) { LSdataGridView.DataSource = new List <TMDataGrid>(); LSdataGridView.Columns[q(Msg_Type.fielddelete)].DisplayIndex = 4; //"删除" } else { LSdataGridView.DataSource = Tmlist.ToArray(); LSdataGridView.Columns[q(Msg_Type.fielddelete)].DisplayIndex = 4; // } LSdataGridView.ClearSelection(); //BOMdataGridView.Rows[0].Cells["状态"].Style.BackColor = Color.Red; //BOMdataGridView.Rows[1].Cells["状态"].Style.BackColor = Color.Red; //for (int i = 0; i < unRequireArr.Count; i++) //{ // BOMdataGridView.Rows[unRequireArr[i]].Cells["状态"].Style.BackColor = Color.White; //} for (int i = 0; i < BOMdataGridView.Rows.Count; i++) { BOMdataGridView.Rows[i].Cells[q(Msg_Type.fieldstatus)].Style.BackColor = Color.Red; //"状态" for (int j = 0; j < unRequireArr.Count; j++) { if (i == unRequireArr[j]) { BOMdataGridView.Rows[i].Cells[q(Msg_Type.fieldstatus)].Style.BackColor = Color.White; //"状态" } } } for (int i = 0; i < _bomList.ET_BOM.Length; i++) { for (int j = 0; j < Tmlist.Count; j++) { //if (_bomList.ET_BOM[i].ZSBS.Equals("Y")) //{ // if (_bomList.ET_BOM[i].IDNRK == Tmlist[j].Wlxx.Split('/')[0]) // { // BOMdataGridView.Rows[i].Cells["状态"].Style.BackColor = Color.FromArgb(187, 255, 102); // } //} //else //{ if (_bomList.ET_BOM[i].WLLB == Tmlist[j].Wllbdm) { BOMdataGridView.Rows[i].Cells[q(Msg_Type.fieldstatus)].Style.BackColor = Color.FromArgb(187, 255, 102); //"状态" } //} } } //} //else //{ // MessageBox.Show(res.MESSAGE, "消息框"); //} } } }
private void getTMList(SELECT_MES_TM_TMINFO_BYTM model) { for (int x = 0; x < model.MES_TM_TMINFO_LIST.Length; x++) { IList <TMDataGrid> nodes = new List <TMDataGrid>(); TMDataGrid node = new TMDataGrid(); if (model.MES_TM_TMINFO_LIST.Length <= 0) { //MessageBox.Show("扫描的是无效的条码", "消息框"); ShowMeg(q(Msg_Type.msgscantminvalid)); SMtextBox.Clear(); SMtextBox.Select(); return; } node.Tm = model.MES_TM_TMINFO_LIST[x].TM; node.Wlxx = model.MES_TM_TMINFO_LIST[x].WLH + "/" + model.MES_TM_TMINFO_LIST[x].WLMS; node.Wllb = model.MES_TM_TMINFO_LIST[x].WLLBNAME; //node.Bz = model.MES_TM_TMINFO_LIST[0].REMARK; node.Wllbdm = model.MES_TM_TMINFO_LIST[x].WLLB; node.Gc = model.MES_TM_TMINFO_LIST[0].GC; node.Tltmid = model.MES_TM_TMINFO_LIST[x].TLTMID; //node.Tmid = model.MES_TM_TMINFO_LIST[0].TM; bool isBom = false; for (int i = 0; i < _bomList.ET_BOM.Length; i++) { //if (_bomList.ET_BOM[i].ZSBS.Equals("Y")) //{ // if (_bomList.ET_BOM[i].IDNRK == node.Wlxx.Split('/')[0]) // { // isBom = true; // BOMdataGridView.Rows[i].Cells["状态"].Style.BackColor = Color.FromArgb(187, 255, 102); // } //} //else //{ if (_bomList.ET_BOM[i].WLLB == node.Wllbdm) { isBom = true; BOMdataGridView.Rows[i].Cells[q(Msg_Type.fieldstatus)].Style.BackColor = Color.FromArgb(187, 255, 102); } //} } if (isBom == false) { if (MessageBox.Show(q(Msg_Type.msgbominvalid), q(Msg_Type.msgtitle), MessageBoxButtons.OK) == DialogResult.OK) { SMtextBox.Clear(); SMtextBox.Select(); } return; } bool replace = false; if (Tmlist.Count > 0) { for (int i = 0; i < Tmlist.Count; i++) { if (node.Tm == Tmlist[i].Tm) { replace = true; } } if (replace == false) { Tmlist.Add(node); } else { //ShowMeg("条码" + SMtextBox.Text + "不允许重复添加"); ShowMeg(string.Format(q(Msg_Type.msgtmcf), SMtextBox.Text)); return; } } else { Tmlist.Add(node); } for (int i = 0; i < Tmlist.Count; i++) { Tmlist[i].Xh = (i + 1).ToString(); } LSdataGridView.DataSource = Tmlist.ToList(); LSdataGridView.ClearSelection(); LSdataGridView.Columns[q(Msg_Type.fielddelete)].DisplayIndex = 4; } if (model.MES_TM_TMINFO_LIST.Length == 1) { //MessageBox.Show("投料成功!!!", "消息框"); ShowMeg(q(Msg_Type.msgtlsuccess), 1500); } SMtextBox.Clear(); SMtextBox.Select(); }
private void getTMList(SELECT_MES_TM_TMINFO_BYTM model) { for (int x = 0; x < model.MES_TM_TMINFO_LIST.Length; x++) { IList <TMDataGrid> nodes = new List <TMDataGrid>(); TMDataGrid node = new TMDataGrid(); if (model.MES_TM_TMINFO_LIST.Length <= 0) { MessageBox.Show("扫描的是无效的条码", "消息框"); SMtextBox.Clear(); return; } node.Tm = model.MES_TM_TMINFO_LIST[x].TM; node.Wlxx = model.MES_TM_TMINFO_LIST[x].WLH + "/" + model.MES_TM_TMINFO_LIST[x].WLMS; node.Wllb = model.MES_TM_TMINFO_LIST[x].WLLBNAME; //node.Bz = model.MES_TM_TMINFO_LIST[0].REMARK; node.Wllbdm = model.MES_TM_TMINFO_LIST[x].WLLB; node.Gc = model.MES_TM_TMINFO_LIST[0].GC; node.Tltmid = model.MES_TM_TMINFO_LIST[x].TLTMID; //node.Tmid = model.MES_TM_TMINFO_LIST[0].TM; bool isBom = false; for (int i = 0; i < _bomList.ET_BOM.Length; i++) { if (_bomList.ET_BOM[i].ZSBS.Equals("Y")) { if (_bomList.ET_BOM[i].IDNRK == node.Wlxx.Split('/')[0]) { isBom = true; //BOMdataGridView.Rows[i].DefaultCellStyle.BackColor = Color.Cyan; //BOMdataGridView.Columns["状态"].DefaultCellStyle.BackColor = Color.Red; BOMdataGridView.Rows[i].Cells["状态"].Style.BackColor = Color.FromArgb(187, 255, 102); } } else { if (_bomList.ET_BOM[i].WLLB == node.Wllbdm) { isBom = true; BOMdataGridView.Rows[i].Cells["状态"].Style.BackColor = Color.FromArgb(187, 255, 102); } } } if (isBom == false) { if (MessageBox.Show("你扫描的条码不是物料的BOM组成部分!!", "消息框", MessageBoxButtons.OK) == DialogResult.OK) { SMtextBox.Clear(); } return; } bool replace = false; if (Tmlist.Count > 0) { for (int i = 0; i < Tmlist.Count; i++) { if (node.Wllbdm == Tmlist[i].Wllbdm) { replace = true; Tmlist[i] = node; } } if (replace == false) { Tmlist.Add(node); } } else { Tmlist.Add(node); } for (int i = 0; i < Tmlist.Count; i++) { Tmlist[i].Xh = (i + 1).ToString(); } LSdataGridView.DataSource = Tmlist.ToList(); LSdataGridView.ClearSelection(); LSdataGridView.Columns["删除"].DisplayIndex = 4; } if (model.MES_TM_TMINFO_LIST.Length == 1) { MessageBox.Show("投料成功!!!", "消息框"); } SMtextBox.Clear(); }