Exemplo n.º 1
0
 private void itemCountBox_KeyPress(object sender, KeyPressEventArgs e)
 {
     try
     {
         switch (e.KeyChar)
         {
         case '\r':
             if (_zaiKo == null)
             {
                 GlobalAccess.ShowDebugInfo("no fnzaiko data");
                 return;
             }
             if (_zaiKo.PLAN_QTY > 0)
             {
                 decimal error = decimal.Round((itemCountBox.Value * 100 / _zaiKo.PLAN_QTY), 1, MidpointRounding.AwayFromZero);
                 itemWeightErrorBox.Text = error.ToString();
                 if (error > Convert.ToDecimal(itemWeightRangeLimitToBox.Text) || error < Convert.ToDecimal(itemWeightRangeLimitFromBox.Text))
                 {
                     DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Range_Error);
                     OutOfRangeWarning frm = new OutOfRangeWarning("产品重量", itemWeightErrorBox.Text, itemWeightRangeLimitFromBox.Text, itemWeightRangeLimitToBox.Text);
                     frm.ShowDialog(this);
                     msgBox.Text = "超出范围";
                 }
                 else
                 {
                     msgBox.Text = string.Empty;
                 }
             }
             else
             {
                 itemWeightErrorBox.Text = "100";
             }
             break;
         }
     }
     catch (Exception ex)
     {
         msgBox.Text = ex.Message;
     }
 }
Exemplo n.º 2
0
        private void Stockout_Load(object sender, EventArgs e)
        {
            try
            {
                timer2.Start();
                timer2_Tick(null, null);

                userIdBox.Text               = GlobalAccess.UserId;
                userNameBox.Text             = GlobalAccess.UserName;
                GlobalAccess.UseMockWeighter = AppConfig.Get("MockWeighter") == "1";
                FNSTATIONEntity stationEntity = DbAccess.GetStation(GlobalAccess.StationNo);
                if (stationEntity == null)
                {
                    GlobalAccess.ShowDebugInfo("cannot find fnstation data");
                    return;
                }

                if (stationEntity.CHUDANFLG == null)
                {
                    GlobalAccess.ShowDebugInfo("fnstation -> chudanflg is null");
                    return;
                }

                if (stationEntity.CHUDANFLG == "0")
                {
                    setJobStatus("作业开始");
                }
                else
                {
                    setJobStatus("作业中断");
                }
            }
            catch (Exception ex)
            {
                msgBox.Text = ex.Message;
            }
        }
Exemplo n.º 3
0
        private void loginBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(userIdBox.Text))
                {
                    GlobalAccess.IsAuth = false;
                    msgBox.Text         = "请输入用户名";
                    userIdBox.Focus();
                    userIdBox.SelectAll();
                    return;
                }
                if (string.IsNullOrEmpty(passwordBox.Text))
                {
                    passwordBox.Text = " ";
                }


                LOGINUSEREntity user = DbAccess.GetUser(userIdBox.Text, passwordBox.Text);
                if (user == null)
                {
                    GlobalAccess.IsAuth = false;
                    msgBox.Text         = "用户名或密码错误,请重新输入";
                    userIdBox.Focus();
                    userIdBox.SelectAll();
                    return;
                }
                else
                {
                    GlobalAccess.UserId = user.USERID.ToString().Trim();
                    USERATTRIBUTEEntity userAttri = DbAccess.GetUserAttributeByUserId(GlobalAccess.UserId);
                    GlobalAccess.UserName = (userAttri == null || string.IsNullOrEmpty(userAttri.USERNAME)) ? string.Empty : userAttri.USERNAME.Trim();
                }

                TERMINALEntity term   = null;
                IPAddress[]    ipList = getIPAddress();

                for (int i = 0; i < ipList.Length; ++i)
                {
                    term = DbAccess.GetTermByIP(ipList[i].ToString());
                    if (term != null)
                    {
                        break;
                    }
                }

                if (term == null)
                {
                    MessageBox.Show("无法找到对应的终端信息");
                    return;
                }
                else
                {
                    GlobalAccess.StationNo   = term.STNO;
                    GlobalAccess.Proc        = term.PROC;
                    GlobalAccess.TermNo      = term.TERMINALNUMBER;
                    GlobalAccess.PrinterNo   = term.PRINTER_NO;
                    GlobalAccess.FixedWeight = term.FIXED_WEIGHT;
                }

                FNSYSTEMEntity systemInfo = DbAccess.GetSystemInfo();
                GlobalAccess.BagWeight = systemInfo.BAG_WEIGHT;

#if DEBUG
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("Station No:" + GlobalAccess.StationNo);
                sb.AppendLine("Proc Id:" + GlobalAccess.Proc);
                sb.AppendLine("Term No:" + GlobalAccess.TermNo);
                sb.AppendLine("IP Address:" + term.IPADDRESS.Trim());
                GlobalAccess.ShowDebugInfo(sb.ToString());
#endif

                switch (GlobalAccess.Proc)
                {
                case "1":
                    Stockin1 frm1 = new Stockin1();
                    clearAll();
                    frm1.ShowDialog(this);
                    break;

                case "2":
                    Stockin2 frm2 = new Stockin2();
                    clearAll();
                    frm2.ShowDialog(this);
                    break;

                case "3":
                    Stockin3 frm3 = new Stockin3();
                    clearAll();
                    frm3.ShowDialog(this);
                    break;

                case "4":
                    Stockout frm4 = new Stockout();
                    clearAll();
                    frm4.ShowDialog(this);
                    break;

                default:
                    MessageBox.Show("无效的Program区分");
                    break;
                }
            }
            catch (Exception ex)
            {
                msgBox.Text = ex.Message;
            }
        }