Beispiel #1
0
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                produtionNumber += e.KeyChar.ToString().Replace("\r", "");

                if (e.KeyChar == 13)
                {
                    T_KuWei t_KuWei    = new BLL.T_KuWei();
                    string  locationNo = t_KuWei.IsInStock(produtionNumber);

                    if (!string.IsNullOrEmpty(locationNo))
                    {
                        this.label3.Text = "该合装单已入库库位信息为:" + locationNo;
                    }
                    else
                    {
                        if (t_KuWei.SaveKuWeiInfo(produtionNumber) == false)
                        {
                            HZ hZ = new HZ("库位已占满");
                        }
                        else
                        {
                            DataTable kuwei = t_KuWei.GetKuWeiInfo(produtionNumber);
                            //if (kuwei.Rows.Count == 1)
                            //{
                            label3.Text = ("扫描成功,请将物品送至 :" + kuwei.Rows[0]["LocationNo"] + "区域中");
                            t_KuWei.SaveKuWeiState(produtionNumber, 1);
                            //}
                            //else
                            //{
                            //    HZ hZ = new HZ("未找到库位信息,或者该生产号已有库位");
                            //    hZ.ShowDialog();
                            //}
                        }
                    }
                    produtionNumber = "";
                    textBox1.Text   = "";
                    textBox1.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        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
            {
            }
        }