private void Forwarding_KeyPress(object sender, KeyPressEventArgs e) { productionNo += e.KeyChar.ToString().Replace("\r", ""); BLL.T_JISA t_JISA = new BLL.T_JISA(); if (e.KeyChar == 13) { BLL.T_Verifying t_Verifying = new BLL.T_Verifying(); DataTable dt = t_Verifying.GetHZOrder(); List <string> product = dt.AsEnumerable().Select(d => d.Field <string>("ProductNo")).ToList(); if (product.Contains(productionNo)) { DataTable tt = t_JISA.GetJISA(2); string p = tt.Rows[0]["ProductionNumber"].ToString(); if (p == productionNo) { t_JISA.SaveJISA(p, 2); ShowEDIInfo(); } } else { HZ hZ = new HZ("未找到生产号"); hZ.ShowDialog(); } } this.scanTitle.Focus(); }
private void AllEntruck_KeyPress(object sender, KeyPressEventArgs e) { try { produtionNumber += e.KeyChar.ToString().Replace("\r", ""); if (e.KeyChar == 13) { string part = produtionNumber.Substring(0, 1); if (produtionNumber.Length == 7) { LoadList(produtionNumber); } else { if (produtionNumber.Length > 10 && produtionNumber.Length < 20) { if (part == "B")//整点 { DicEn[整垫].ThisCode = produtionNumber; } else if (part == "C")//40 { DicEn[背40].ThisCode = produtionNumber; } if (part == "A")//60 { DicEn[背60].ThisCode = produtionNumber; } } else if (produtionNumber.Length > 20) { switch (part) { case "A": //左前 DicEn[左前].ThisCode = produtionNumber; break; case "E": //右前 DicEn[右前].ThisCode = produtionNumber; break; case "L": //整垫 DicEn[整垫].ThisCode = produtionNumber; break; case "P": //整背 DicEn[整背].ThisCode = produtionNumber; break; case "N": //背40 DicEn[背40].ThisCode = produtionNumber; break; case "M": //背60 DicEn[背60].ThisCode = produtionNumber; break; } ////string part2 = produtionNumber.Substring(0, 2); //if (part == "A") //左前 //{ // DicEn[左前].ThisCode = produtionNumber; //} //else if (part == "E") //右前 //{ // DicEn[右前].ThisCode = produtionNumber; //} } if (yanZheng() == true) { bool isTGresult = true; foreach (var item in DicEn) { if (!item.Value.IsTG()) { isTGresult = false; break; } } //bool b1 = DicEn[左前].IsTG(); //bool b2 = DicEn[右前].IsTG(); //bool b3 = DicEn[整垫].IsTG(); //bool b4 = DicEn[背40].IsTG(); //bool b5 = DicEn[背60].IsTG(); //bool b6 = DicEn[整背].IsTG(); //if (b1 && b2 && b3 && b4 && b5) if (isTGresult) { BLL.T_Verifying t_Verifying = new BLL.T_Verifying(); //合装验证成功逻辑 string productNo = this.scanBox.Text; DataTable data = t_Verifying.GetHZOrder(productNo); if (data.Rows.Count > 0) { string HZOrderID = data.Rows[0]["HZOrderGID"].ToString(); BLL.T_KuWei t_KuWei = new BLL.T_KuWei(); if (t_KuWei.SaveKuWeiInfo(productNo) == false) { HZ hZ = new HZ("库位已占满"); hZ.ShowDialog(); } else { t_Verifying.MarkHZOrder(HZOrderID, 2, DateTime.Now); DataTable kuwei = t_KuWei.GetKuWeiInfo(productNo); if (kuwei.Rows.Count == 1) { HZ hZ = new HZ("合装验证成功,请将物品送至 :" + kuwei.Rows[0]["LocationNo"].ToString() + "区域中"); hZ.ShowDialog(); t_KuWei.SaveKuWeiState(productNo, 1); } else { HZ hZ = new HZ("未找到库位信息,或者该生产号已有库位"); hZ.ShowDialog(); } this.scanDes.Controls.Clear(); produtionNumber = ""; Model.EntruckModel.ScanedBarCode = null; } //清空等待扫码 scanDes.Controls.Clear(); this.scanBox.Text = ""; } else { MessageBox.Show("未找到合装单信息"); } } } } produtionNumber = ""; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { } }
public void LoadList(string shengchanhao) { StreamReader sr = new StreamReader("D:\\Clist.txt", Encoding.Default); String line; List <string> Clist = new List <string>(); while ((line = sr.ReadLine()) != null) { Clist.Add(line.ToString()); } BLL.T_Verifying t_Verifying = new BLL.T_Verifying(); BLL.T_EOL t_EOL = new BLL.T_EOL(); DataTable dt = t_Verifying.GetHZOrder(shengchanhao); DataTable dt1 = t_Verifying.GetHZOrderP(shengchanhao); DicEn.Clear(); this.scanDes.Controls.Clear(); if (dt1.Rows.Count > 0) { HZ hZ = new HZ("此合装单已合装完成"); hZ.ShowDialog(); return; } this.scanBox.Text = shengchanhao; int locationY = 0; string MasterBarCodeL = dt.Rows[0]["MasterBarCodeL"].ToString(); string MasterBarCodeR = dt.Rows[0]["MasterBarCodeR"].ToString(); string MasterBarCodeC = dt.Rows[0]["MasterBarCodeC"].ToString(); string MasterBarCode40 = dt.Rows[0]["MasterBarCode40"].ToString(); string MasterBarCode60 = dt.Rows[0]["MasterBarCode60"].ToString(); string MasterBarCodeB = dt.Rows[0]["MasterBarCodeB"].ToString(); CarType = dt.Rows[0]["CarType"].ToString(); EntruckControl e1 = new EntruckControl(); int mj1 = t_Verifying.GetMJResult(MasterBarCodeL); e1.Is40Or60 = false; e1.IsZ177B = false; e1.TrueCode = MasterBarCodeL; e1.ThisCode = ""; e1.MJR = (mj1 == 1 ? true : false); e1.ZJR = t_Verifying.GetZJResult(MasterBarCodeL); e1.DJR = t_EOL.GetEOLResult(MasterBarCodeL); e1.SetInfo(this.scanDes.Width, this.scanDes.Height, "请扫码左前条码"); e1.Location = new Point(0, locationY); this.scanDes.Controls.Add(e1); locationY += e1.Height; DicEn.Add(左前, e1); EntruckControl e2 = new EntruckControl(); int mj2 = t_Verifying.GetMJResult(MasterBarCodeR); e2.Is40Or60 = false; e2.IsZ177B = false; e2.TrueCode = MasterBarCodeR; e2.ThisCode = ""; e2.MJR = mj2 == 1 ? true : false; e2.ZJR = t_Verifying.GetZJResult(MasterBarCodeR); e2.DJR = t_EOL.GetEOLResult(MasterBarCodeR); e2.SetInfo(this.scanDes.Width, this.scanDes.Height, "请扫码右前条码"); e2.Location = new Point(0, locationY); this.scanDes.Controls.Add(e2); locationY += e2.Height; DicEn.Add(右前, e2); EntruckControl e3 = new EntruckControl(); int mj3 = t_Verifying.GetMJResult(MasterBarCodeC); if (CarType == "X156") { e3.Is40Or60 = true; e3.IsZ177B = false;; } else if (CarType == "Z177") { if (Clist.Contains(MasterBarCodeC.Substring(0, 6))) { e3.Is40Or60 = true; e3.IsZ177B = false;; } else { e3.Is40Or60 = false; e3.IsZ177B = true; } } e3.TrueCode = MasterBarCodeC; e3.ThisCode = ""; e3.MJR = mj3 == 1 ? true : false; e3.ZJR = t_Verifying.GetZJResult(MasterBarCodeC); e3.DJR = t_EOL.GetRearEOLResult(MasterBarCodeC); e3.SetInfo(this.scanDes.Width, this.scanDes.Height, "请扫码整垫"); e3.Location = new Point(0, locationY); this.scanDes.Controls.Add(e3); locationY += e3.Height; DicEn.Add(整垫, e3); if (CarType == "X156") { EntruckControl e4 = new EntruckControl(); int m4 = t_Verifying.GetMJResult(MasterBarCode40); e4.Is40Or60 = true; e4.IsZ177B = false; e4.TrueCode = MasterBarCode40; e4.ThisCode = ""; e4.MJR = m4 == 1 ? true : false; e4.ZJR = t_Verifying.GetZJResult(MasterBarCode40); e4.DJR = t_EOL.GetEOLResult(MasterBarCode40); e4.SetInfo(this.scanDes.Width, this.scanDes.Height, "请扫码40"); e4.Location = new Point(0, locationY); this.scanDes.Controls.Add(e4); locationY += e4.Height; DicEn.Add(背40, e4); EntruckControl e5 = new EntruckControl(); e5.Is40Or60 = true; e5.IsZ177B = false; int m5 = t_Verifying.GetMJResult(MasterBarCode60); e5.TrueCode = MasterBarCode60; e5.ThisCode = ""; e5.MJR = m5 == 1 ? true : false; e5.ZJR = t_Verifying.GetZJResult(MasterBarCode60); e5.DJR = t_EOL.GetEOLResult(MasterBarCode60); e5.SetInfo(this.scanDes.Width, this.scanDes.Height, "请扫码60"); e5.Location = new Point(0, locationY); this.scanDes.Controls.Add(e5); locationY += e5.Height; DicEn.Add(背60, e5); } else if (CarType == "Z177") { EntruckControl e4 = new EntruckControl(); int m4 = t_Verifying.GetMJResult(MasterBarCodeB); e4.Is40Or60 = true; e4.IsZ177B = false; e4.TrueCode = MasterBarCodeB; e4.ThisCode = ""; e4.MJR = m4 == 1 ? true : false; e4.ZJR = t_Verifying.GetZJResult(MasterBarCodeB); e4.DJR = t_EOL.GetRearEOLResult(MasterBarCodeB); e4.SetInfo(this.scanDes.Width, this.scanDes.Height, "请扫码整背"); e4.Location = new Point(0, locationY); this.scanDes.Controls.Add(e4); locationY += e4.Height; DicEn.Add(整背, e4); } }