Ejemplo n.º 1
0
 private void btn_OK_Click(object sender, EventArgs e)
 {
     if (this.txt_MaterialNo.Text.Trim().Length > 0 &&
         this.txt_MaterialName.Text.Trim().Length > 0 &&
         RegularHelper.isNumericString(this.txt_MaterialPos.Text.Trim()) &&
         RegularHelper.isNumericString(this.txt_CountPerBox.Text.Trim()) &&
         RegularHelper.isNumericString(this.txt_UsageTime.Text.Trim()))
     {
         if (MaterialInfoBLL.UpdateMaterial(this.txt_MaterialNo.Text.Trim(), this.txt_MaterialName.Text.Trim(),
                                            byte.Parse(this.txt_MaterialPos.Text.Trim()), int.Parse(this.txt_CountPerBox.Text.Trim()), int.Parse(this.txt_UsageTime.Text.Trim())))
         {
             ShowLoginTip("零件信息更新成功.");
             updateCurrentRow();
         }
         else if (MaterialInfoBLL.InsertMaterial(this.txt_MaterialNo.Text.Trim(), this.txt_MaterialName.Text.Trim(),
                                                 byte.Parse(this.txt_MaterialPos.Text.Trim()), int.Parse(this.txt_CountPerBox.Text.Trim()), int.Parse(this.txt_UsageTime.Text.Trim())))
         {
             ShowLoginTip("零件信息添加成功.");
             Load_lsv_MaterialInfo();
         }
         else
         {
             SpMessageBox.Show(this.txt_MaterialName.Text.Trim() + "信息更新失败.", "零件信息维护");
         }
     }
 }
        private void btn_EmergSupplyOK_Click(object sender, EventArgs e)
        {
            if (this.comboMaterialNo.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.txtMaterialCount.Text.Trim()))
            {
                try
                {
                    //调用tcp/ip 协议,发送紧急备料请求到库房App
                    //Server.
                    MainForm.CheckConnectionWithServer();
                    Program.S.SendMessageToWS(Login.CurrentProductionLineNumber.ToString(),
                                              this.comboMaterialNo.Text.Trim(),
                                              AH.Network.MsgType.Emerg);
                }
                catch (Exception excpt)
                {
                    SpMessageBox.Show("告警:" + excpt.Message, "通信-库房");
                }

                SystemLogs.WriteSystemLog(Login.UserName, "Sending urgent request for material " + this.comboMaterialNo.Text.Trim() + " at " + Login.CurrentProductionLine, DateTime.Now);

                ShowLoginTip("紧急Call料请求已发送.");
            }
            else
            {
                SpMessageBox.Show("请检查订单号,产品号,和订单数量的输入", "订单查询");
            }
        }
        private void CheckOrder()
        {
            List <MaterialInfo> materialsList = new List <MaterialInfo>();

            if ((this.textProdNo.Text.Trim().Length > 0) && (RegularHelper.isNumericString(this.textOrderCount.Text.Trim().ToString())))
            {
                OrderInfo.CheckOrderExsit(this.txtOrderNo.Text.Trim(), this.textProdNo.Text.Trim(), int.Parse(this.textOrderCount.Text.Trim().ToString()));
            }
            else
            {
                SpMessageBox.Show("请检查是否输入了产品号和订单数量?", "订单查询");
            }
        }
        private void UpdateProductionLineInfo()
        {
            if ((this.textProdNo.Text.Trim().Length > 0) && (RegularHelper.isNumericString(this.textOrderCount.Text.Trim().ToString())))
            {//string _orderNo, byte _productLineNo, string _productNo, int _orderCount
                ProductionLine.CheckProductionLineExsit(this.txtOrderNo.Text.Trim(), Login.CurrentProductionLineNumber, this.textProdNo.Text.Trim(), int.Parse(this.textOrderCount.Text.Trim().ToString()));

                if (!ProductionLineInfoBLL.CheckThisProductionLineInfo(Login.CurrentProductionLineNumber, this.txtOrderNo.Text.Trim()))  //如果当前产线号存在 productionline表里,需要double check order号是否也一样? 如果一样则OK, 如果不一样,则需要告警:还没切线呢
                {
                    SpMessageBox.Show("当前产线还未切线,不能输入进行新订单生产,请先执行切线操作", "订单查询");
                }
            }
            else
            {
                SpMessageBox.Show("请检查是否输入了正确的订单号和产品号.", "订单查询");
            }
        }
        private void btn_AddOrder_Click(object sender, EventArgs e)
        {
            if ((this.txtAddOrderNo.Text.Trim().Length > 0) && (this.txtAddProdNo.Text.Trim().Length > 0) && (RegularHelper.isNumericString(this.txtAddOrderCount.Text.Trim())))
            {
                DialogResult diaresult = SpMessageBox.Show("确定要补充该订单吗?", "订单补充", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (diaresult == DialogResult.OK)
                {
                    if (OrderInfoBLL.OrderAlreadyExsit(this.txtAddOrderNo.Text.Trim()))
                    {
                        if (OrderInfo.UpdateOrderCount(this.txtAddOrderNo.Text.Trim(), this.txtAddProdNo.Text.Trim(), int.Parse(this.txtAddOrderCount.Text.Trim())))
                        {
                            SpMessageBox.Show("该订单数量补充完成", "订单补充");
                        }
                    }
                    else
                    {
                        SpMessageBox.Show("该订单号不存在,请检查该订单号是否生效", "订单补充");
                    }


                    SystemLogs.WriteSystemLog(Login.UserName, "add order count:" + this.txtAddOrderCount.Text.Trim() + " for order " + this.txtAddOrderNo.Text.Trim() + " at " + Login.CurrentProductionLine, DateTime.Now);
                }
            }
            else
            {
                SpMessageBox.Show("请检查订单号,产品号,和订单数量的输入", "订单补充");
            }
        }
Ejemplo n.º 6
0
        static void Main()
        {
//#if DEBUG
//#else
//            KeyboardHook key = new KeyboardHook();
//            key.KeyMaskStop();
//            key.KeyMaskStart();
//            key.DisableTaskMgr(true);
//            key.HWindows();
//            key.HStar();
//#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Process instance = RunningInstance();

            if (instance == null)
            {
                try
                {
                    ConfigHelper _xmlconfigfile = new ConfigHelper();
                    _xmlconfigfile.FileName = "AutoTestConfig.xml";

                    string dataSrc = _xmlconfigfile.GetValue(@"Settings", @"DataSource");

                    if (dataSrc != "")
                    {
                        GP.MAGICL6800.ORM.ConnectStringHelper.ConnectString = dataSrc;
                    }
                    if (!CheckSqlServerService())
                    {
                        Application.Exit();

                        return;
                    }


                    Login login = new Login();
                    login.ControlBox = false;

                    if (login.ShowDialog() != DialogResult.OK)
                    {
                        //SpMessageBox.Show("Please input the correct username and password!", "Muber BT Test System Login");
                        return;
                    }

                    MainForm autoTestForm = new MainForm();
                    autoTestForm.ControlBox = false;
                    //autoTestForm.Show();

                    //read config file


                    serverIP4Client  = _xmlconfigfile.GetValue(@"Settings", @"IP_Port/ServerIpAddress");
                    clientPortListen = _xmlconfigfile.GetValue(@"Settings", @"IP_Port/ClientPortListen");

                    if (!RegularHelper.isNumericString(clientPortListen))
                    {
                        SpMessageBox.Show("Read Config file AutoTestConfig.xml ClientPortListen error, please check the format.");
                        return;
                    }

                    //string PLCPortListen = _xmlconfigfile.GetValue(@"Settings", @"IP_Port/PLCPortListen");
                    //if (!RegularHelper.isNumericString(PLCPortListen))
                    //{
                    //    SpMessageBox.Show("Read Config file AutoTestConfig.xml PLCPortListen error, please check the format.");
                    //    return;
                    //}

                    //string OutBufferListen = _xmlconfigfile.GetValue(@"Settings", @"IP_Port/OutBufferListen");
                    //if (!RegularHelper.isNumericString(OutBufferListen))
                    //{
                    //    SpMessageBox.Show("Read Config file AutoTestConfig.xml OutBufferListen error, please check the format.");
                    //    return;
                    //}

                    //string hostName = Dns.GetHostName();   //获取本机名
                    //IPHostEntry localhost = Dns.GetHostEntry(hostName);   //获取IPv6地址
                    //IPAddress localaddr = localhost.AddressList[0];
                    //string hostIpAddr = localaddr.ToString();


                    {
                        // S.InitServer(serverIP4Client, serverIP4PLC, int.Parse(clientPortListen), int.Parse(PLCPortListen), int.Parse(OutBufferListen), true);
                        S.InitClient(serverIP4Client, int.Parse(clientPortListen));

                        S.SendMessageToWS(Login.CurrentProductionLineNumber.ToString(),
                                          "register message",
                                          AH.Network.MsgType.Register);
                    }


                    Application.Run(autoTestForm);
                }
                catch (Exception ex)
                {
                    SpMessageBox.Show(ex.Message + ", Please contact the Administrator.", "App启动");
                    //LogerHelper.ToLog(ex.ToString(), false);
                }
            }
            else
            {
                HandleRunningInstance(instance);
            }
        }
        private void btnOrderOK_Click(object sender, EventArgs e)
        {
            if ((this.txtOrderNo.Text.Trim().Length > 0) && (this.textProdNo.Text.Trim().Length > 0) && (RegularHelper.isNumericString(this.textOrderCount.Text.Trim().ToString())))
            {
                //check the order and product in db? if yes, just query the BOM list, else insert the order to db first, then query the BOM list
                CheckOrder();

                UpdateProductionLineInfo();
                //this.listView_CurrentOrder.Items.Clear();
                Load_Lsv_BOMList();
                CurrentProductOrder = this.txtOrderNo.Text.Trim();
                SystemLogs.WriteSystemLog(Login.UserName, "Scanning order " + this.txtOrderNo.Text.Trim() + " at " + Login.CurrentProductionLine, DateTime.Now);
            }
            else
            {
                SpMessageBox.Show("请检查订单号,产品号,和订单数量的输入.", "订单查询");
            }
        }
Ejemplo n.º 8
0
        private void btnNewOrderOK_Click(object sender, EventArgs e)
        {
            //query BOM list according to Product No.
            if ((this.txtNewOrderNo.Text.Trim().Length > 0) && (this.textProdNo.Text.Trim().Length > 0) && (RegularHelper.isNumericString(this.textNewOrderCount.Text.Trim().ToString())))
            {
                //check the order and product in db? if yes, just query the BOM list, else insert the order to db first, then query the BOM list
                CheckOrder();

                Load_Lsv_NewOrderBOM();

                SystemLogs.WriteSystemLog(Login.UserName, "Scanning new order " + this.txtNewOrderNo.Text.Trim() + " at " + Login.CurrentProductionLine, DateTime.Now);

                if (this.comboBox_Prepare.SelectedIndex == 0)
                {
                    sendMaterialReq(); //发送备料请求到库房App
                    ShowLoginTip("新订单备料请求已发送到库房.");
                }
            }
            else
            {
                SpMessageBox.Show("请检查订单号,产品号,和订单数量的输入", "订单查询");
            }
        }
        private void btn_Add_Click(object sender, EventArgs e)
        {
            //product info add
            if (this.txt_ProductNo.Text.Trim().Length > 0 && this.txt_ProductName.Text.Trim().Length > 0)
            {
                try
                {
                    if (ProductBOMBLL.InsertProductBOMInfo(this.txt_ProductNo.Text.Trim(), this.txt_ProductName.Text.Trim(),
                                                           this.textBox1.Text.Trim().Length > 0 ? this.textBox1.Text.Trim() : null, (this.comboBox1.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox1.Text.Trim())) ? byte.Parse(this.comboBox1.Text.Trim()) : (byte)0,
                                                           this.textBox2.Text.Trim().Length > 0 ? this.textBox2.Text.Trim() : null, (this.comboBox2.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox2.Text.Trim())) ? byte.Parse(this.comboBox2.Text.Trim()) : (byte)0,
                                                           this.textBox3.Text.Trim().Length > 0 ? this.textBox3.Text.Trim() : null, (this.comboBox3.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox3.Text.Trim())) ? byte.Parse(this.comboBox3.Text.Trim()) : (byte)0,
                                                           this.textBox4.Text.Trim().Length > 0 ? this.textBox4.Text.Trim() : null, (this.comboBox4.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox4.Text.Trim())) ? byte.Parse(this.comboBox4.Text.Trim()) : (byte)0,
                                                           this.textBox5.Text.Trim().Length > 0 ? this.textBox5.Text.Trim() : null, (this.comboBox5.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox5.Text.Trim())) ? byte.Parse(this.comboBox5.Text.Trim()) : (byte)0,
                                                           this.textBox6.Text.Trim().Length > 0 ? this.textBox6.Text.Trim() : null, (this.comboBox6.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox6.Text.Trim())) ? byte.Parse(this.comboBox6.Text.Trim()) : (byte)0,
                                                           this.textBox7.Text.Trim().Length > 0 ? this.textBox7.Text.Trim() : null, (this.comboBox7.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox7.Text.Trim())) ? byte.Parse(this.comboBox7.Text.Trim()) : (byte)0,
                                                           this.textBox8.Text.Trim().Length > 0 ? this.textBox8.Text.Trim() : null, (this.comboBox8.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox8.Text.Trim())) ? byte.Parse(this.comboBox8.Text.Trim()) : (byte)0,
                                                           this.textBox9.Text.Trim().Length > 0 ? this.textBox9.Text.Trim() : null, (this.comboBox9.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox9.Text.Trim())) ? byte.Parse(this.comboBox9.Text.Trim()) : (byte)0,
                                                           this.textBox10.Text.Trim().Length > 0 ? this.textBox10.Text.Trim() : null, (this.comboBox10.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox10.Text.Trim())) ? byte.Parse(this.comboBox10.Text.Trim()) : (byte)0,
                                                           this.textBox11.Text.Trim().Length > 0 ? this.textBox11.Text.Trim() : null, (this.comboBox11.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox11.Text.Trim())) ? byte.Parse(this.comboBox11.Text.Trim()) : (byte)0,
                                                           this.textBox12.Text.Trim().Length > 0 ? this.textBox12.Text.Trim() : null, (this.comboBox12.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox12.Text.Trim())) ? byte.Parse(this.comboBox12.Text.Trim()) : (byte)0,
                                                           this.textBox13.Text.Trim().Length > 0 ? this.textBox13.Text.Trim() : null, (this.comboBox13.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox13.Text.Trim())) ? byte.Parse(this.comboBox13.Text.Trim()) : (byte)0,
                                                           this.textBox14.Text.Trim().Length > 0 ? this.textBox14.Text.Trim() : null, (this.comboBox14.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox14.Text.Trim())) ? byte.Parse(this.comboBox14.Text.Trim()) : (byte)0,
                                                           this.textBox15.Text.Trim().Length > 0 ? this.textBox15.Text.Trim() : null, (this.comboBox15.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox15.Text.Trim())) ? byte.Parse(this.comboBox15.Text.Trim()) : (byte)0,
                                                           this.textBox16.Text.Trim().Length > 0 ? this.textBox16.Text.Trim() : null, (this.comboBox16.Text.Trim().Length > 0 && RegularHelper.isNumericString(this.comboBox16.Text.Trim())) ? byte.Parse(this.comboBox16.Text.Trim()) : (byte)0

                                                           ))
                    {
                        ShowLoginTip("产品信息添加成功.");
                    }
                    else
                    {
                        SpMessageBox.Show(this.txt_ProductName.Text.Trim() + "信息添加失败.", "产品信息维护");
                    }
                }
                catch
                {
                }
            }
        }