private void imbt_Confirm_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(cbx_group.Text)) { throw new Exception("请选择制程段"); } if (string.IsNullOrEmpty(cbx_ReasonCode.Text)) { throw new Exception("请选择原因代码"); } if (string.IsNullOrEmpty(cbx_loc.Text)) { throw new Exception("请选择库位"); } string Scrap_No = refWebProcedure.Instance.GetStockInNumber(); Dictionary <string, object> mst = new Dictionary <string, object>(); mst.Add("LOCSTATION", cbx_group.Text); mst.Add("STATIONNAME", cbx_group.Text + "1"); mst.Add("WIPSTATION", cbx_loc.Text); mst.Add("NEXTSTATION", "NA"); mst.Add("STORENUMBER", Scrap_No); mst.Add("USERID", mFrm.gUserInfo.userId); mst.Add("SCRAPFLAG", "1"); mst.Add("ESN", ""); Dictionary <string, object> mst_scrap = new Dictionary <string, object>(); mst_scrap.Add("SCRAP_NO", Scrap_No); mst_scrap.Add("USERID", mFrm.gUserInfo.userId); mst_scrap.Add("WOID", ""); mst_scrap.Add("PARTNUMBER", ""); mst_scrap.Add("PRODUCTNAME", ""); mst_scrap.Add("VERSION_CODE", ""); mst_scrap.Add("ESN", ""); mst_scrap.Add("LINEID", cbx_group.Text); mst_scrap.Add("SECTION_NAME", ""); mst_scrap.Add("LOCSTATION", ""); mst_scrap.Add("STATION_NAME", ""); mst_scrap.Add("REMARK", "NA"); mst_scrap.Add("SCRAP_REASON", txt_reasondesc1.Text); mst_scrap.Add("SCRAP_FLAG", "1"); mst_scrap.Add("SCRAP_KIND", radTurnOut.Checked?"0":"1"); mst_scrap.Add("REASON_CODE", cbx_ReasonCode.Text); mst_scrap.Add("REASON_TYPE", "NA"); mst_scrap.Add("DUTY_STATION", "NA"); mst_scrap.Add("QTY", 1); mst_scrap.Add("GD", "NA"); mst_scrap.Add("LOC", cbx_loc.Text); mst_scrap.Add("PRE_SCRAP_GROUP_NAME", cbx_group.Text); mst_scrap.Add("ITHT", "Y"); foreach (DataGridViewRow dgvr in dgv_showData.Rows) { mst["ESN"] = dgvr.Cells["ESN"].Value.ToString(); mst_scrap["WOID"] = dgvr.Cells["WOID"].Value.ToString(); mst_scrap["PARTNUMBER"] = dgvr.Cells["PARTNUMBER"].Value.ToString(); mst_scrap["PRODUCTNAME"] = dgvr.Cells["PRODUCTNAME"].Value.ToString(); mst_scrap["VERSION_CODE"] = dgvr.Cells["VERSIONCODE"].Value.ToString(); mst_scrap["ESN"] = dgvr.Cells["ESN"].Value.ToString(); mst_scrap["SECTION_NAME"] = dgvr.Cells["SECTIONNAME"].Value.ToString(); mst_scrap["LOCSTATION"] = dgvr.Cells["LOCSTATION"].Value.ToString(); mst_scrap["STATION_NAME"] = dgvr.Cells["STATIONNAME"].Value.ToString(); string _StrErr = reworkdetail.Scrap_SN(mst, mst_scrap); if (_StrErr != "OK") { throw new Exception(string.Format("ESN[{0}] {1}", dgvr.Cells["ESN"].Value.ToString(), _StrErr)); } dgv_showData.FirstDisplayedScrollingRowIndex = Convert.ToInt32(txt_total.Text) - (Convert.ToInt32(LabUpdateCount.Text));//移动DataGridView光标 dgv_showData.Update(); LabUpdateCount.Text = (Convert.ToInt32(LabUpdateCount.Text) - 1).ToString(); LabUpdateCount.Update(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "发生异常", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
private void imbt_Execute_Click(object sender, EventArgs e) { try { if (Convert.ToInt32(txt_total.Text) == 0) { MessageBoxEx.Show("没有需要退站的产品信息", "确认信息"); return; } if (string.IsNullOrEmpty(cbx_GroupName.Text)) { MessageBoxEx.Show("请选择退回站位", "选择站位"); return; } Rework_WOID = dgv_showData.Rows[0].Cells["WOID"].Value.ToString(); Rework_Partnumber = dgv_showData.Rows[0].Cells["PARTNUMBER"].Value.ToString(); FrmReworkInfo ReworkInfo = new FrmReworkInfo(this); if (ReworkInfo.ShowDialog() != DialogResult.OK) { return; } Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("WOID", Rework_WOID); dic.Add("PARTNUMBER", Rework_Partnumber); dic.Add("MEMO", Rework_MEMO); dic.Add("REWORKDESC", Rework_DESC); dic.Add("WORKDATE", DateTime.Now.ToString("yyyyMMdd").ToString()); dic.Add("REWORKNO", txt_UpdateReworkNo.Text); dic.Add("TOTALQTY", Convert.ToInt32(txt_total.Text)); dic.Add("USERID", mFrm.gUserInfo.userId); refWebtReworkDetailInfo.Instance.InsertReworkDetail(FrmBLL.ReleaseData.DictionaryToJson(dic)); List <string> LsKeyParts = new List <string>(); Dictionary <string, object> mst = new Dictionary <string, object>(); if (ListKeyParts.Items.Count > 0) { foreach (string str in ListKeyParts.Items) { LsKeyParts.Add(str); } } if (LsKeyParts.Contains("SN")) { mst.Add("SN", "NA"); } if (LsKeyParts.Contains("MAC")) { mst.Add("MAC", "NA"); } if (LsKeyParts.Contains("IMEI")) { mst.Add("IMEI", "NA"); } if (chk_RemoveTray.Checked) { mst.Add("TRAYNO", "NA"); } if (chk_RemoveCarton.Checked) { mst.Add("CARTONNUMBER", "NA"); mst.Add("MCARTONNUMBER", "NA"); } if (chk_RemovePallet.Checked) { mst.Add("PALLETNUMBER", "NA"); mst.Add("MPALLETNUMBER", "NA"); } if (chk_RemoveStockNo.Checked) { mst.Add("STORENUMBER", "NA"); } if (chk_RemoveFqcNo.Checked) { mst.Add("QA_NO", "NA"); mst.Add("QA_RESULT", "NA"); } mst.Add("LOCSTATION", cbx_GroupName.Text); mst.Add("WIPSTATION", cbx_GroupName.Text); mst.Add("NEXTSTATION", cbx_GroupName.Text); mst.Add("ESN", ""); mst.Add("REWORKNO", txt_UpdateReworkNo.Text); foreach (DataGridViewRow dgvr in dgv_showData.Rows) { mst["ESN"] = dgvr.Cells["ESN"].Value.ToString(); string _StrErr = reworkdetail.Rework_SN(mst, LsKeyParts); if (_StrErr != "OK") { throw new Exception(string.Format("ESN[{0}] {1}", dgvr.Cells["ESN"].Value.ToString(), _StrErr)); } dgv_showData.FirstDisplayedScrollingRowIndex = Convert.ToInt32(txt_total.Text) - (Convert.ToInt32(LabUpdateCount.Text));//移动DataGridView光标 dgv_showData.Update(); LabUpdateCount.Text = (Convert.ToInt32(LabUpdateCount.Text) - 1).ToString(); LabUpdateCount.Update(); } Clear_Control(); MessageBox.Show("执行完成", "执行完成", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "执行异常", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }