Ejemplo n.º 1
0
        private void timer1_Tick_1(object sender, EventArgs e)
        {
            try
            {
                BLL.T_Verifying t_Verifying = new BLL.T_Verifying();
                DataTable       dt          = t_Verifying.GetPrintHZOrderList();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow item in dt.Rows)
                    {
                        TimingPrintOrder timingPrintOrder = new TimingPrintOrder();
                        timingPrintOrder.PrintEntruckOrderNew(item);
                        t_Verifying.MarkHZOrder(item["HZOrderGID"].ToString(), 1);
                    }
                    GC.Collect();//强行销毁
                }

                //if (dt != null)
                //{
                //    if (dt.Rows.Count > 0)
                //    {
                //        //string path = @"D:\1.xlsx";
                //        //if (!System.IO.File.Exists(path))
                //        //{
                //        //    MessageBox.Show("未找到模板地址");

                //        //}

                //        TimingPrintOrder timingPrintOrder = new TimingPrintOrder();
                //        string result = timingPrintOrder.PrintEntruckOrderNew();
                //        //MessageBox.Show(result);
                //        if (!string.IsNullOrEmpty((result)))
                //        {
                //            t_Verifying.MarkHZOrder(result, 1);
                //        }
                //        GC.Collect();//强行销毁
                //    }
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (this.comboBox1.SelectedItem == null)
            {
                MessageBox.Show("请选择打印机");
                return;
            }

            string printNames = this.comboBox1.SelectedItem.ToString();

            if (string.IsNullOrEmpty((printNames)))
            {
                MessageBox.Show("请选择打印机");
                return;
            }
            string produtNo = textBox1.Text;

            if (!string.IsNullOrEmpty(produtNo))
            {
                string result = printHzOrders.PrintHZOrders(produtNo, printNames);
                if (!string.IsNullOrEmpty(result))
                {
                    t_Verifying.MarkHZOrder(result, 1);
                    MessageBox.Show("打印成功");
                }
                else
                {
                    MessageBox.Show("补打失败,可能没有找到合装信息");
                }
            }
            else
            {
                MessageBox.Show("请输入生产号");
            }
            GC.Collect();//强行销毁
            //string printer = printNames;// XML.XmlConfig.PrintName; //XML.XmlConfig.GetIPXML();
            //BLL.T_Verifying t_Verifying = new BLL.T_Verifying();
            //if (!string.IsNullOrEmpty(printer))
            //{
            //    PrintHzOrders printHzOrders = new PrintHzOrders();
            //    string path = @"D:\合装单打印模板.xlsx";

            //    string produtNo = textBox1.Text;
            //    if (!string.IsNullOrEmpty(produtNo))
            //    {
            //        string result = printHzOrders.PrintHZOrders(path, produtNo, printNames);
            //        if (!string.IsNullOrEmpty(result))
            //        {
            //            t_Verifying.MarkHZOrder(result, 1);
            //            MessageBox.Show("打印成功");
            //        }
            //        else
            //        {
            //            MessageBox.Show(result);
            //        }
            //    }
            //    else
            //    {
            //        MessageBox.Show("请输入生产号");
            //    }
            //    GC.Collect();//强行销毁
            //}
            //else
            //{
            //    MessageBox.Show("请先选择一个有效的打印机");
            //}
        }
Ejemplo n.º 3
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
            {
            }
        }