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("请检查订单号,产品号,和订单数量的输入", "订单补充"); } }
private void btnLogin_Click(object sender, EventArgs e) { if (this.comboProductionLine.Text.Trim() == string.Empty) { SpMessageBox.Show("请选择产线编号.", "用户登录"); return; } else { CurrentProductionLine = this.comboProductionLine.Text.Trim(); CurrentProductionLineNumber = byte.Parse(System.Text.RegularExpressions.Regex.Replace(Login.CurrentProductionLine, @"[^0-9]+", "")); } if (this.cmbUser.Text.Trim() != string.Empty) { UserName = this.cmbUser.Text.Trim(); if (!CheckUserandPswd(UserName, txtLoginPwd.Text.Trim())) { ShowLoginTip("用户名或密码错误,请重新输入."); return; } this.DialogResult = DialogResult.OK; this.Close(); } //string loginTrace = string.Format("{0}: User {1} Login", DateTime.Now, UserName); //LogerHelper.ToAutoTestLogFile(loginTrace); SystemLogs.WriteSystemLog(UserName, "Login to " + CurrentProductionLine, DateTime.Now); Login.Authority = (LoginAuthority)UserInfos.GetRoleByUser(Login.UserName); this.DialogResult = DialogResult.OK; this.Close(); }
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 btn_SwitchLine_Click(object sender, EventArgs e) { DialogResult diaresult = SpMessageBox.Show("确定要切线吗?", "切线操作", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (diaresult == DialogResult.OK) { if (UserInfos.GetRoleByUser(Login.UserName) == (byte)LoginAuthority.SuperAdmin || UserInfos.GetRoleByUser(Login.UserName) == (byte)LoginAuthority.Administrator) { try { if (ProductionLineMaterial.GetMaterialsTotalRemainConsump(Login.CurrentProductionLineNumber, this.txtOrderNo.Text.Trim()) > 0) //切线前,先判断是否已经扣料了 { SpMessageBox.Show("该订单生产还没有进行扣料,请先进行扣料然后再切线.", "生产切线"); try { Program.S.SendMessageToWS(Login.CurrentProductionLineNumber.ToString(), this.txtOrderNo.Text.Trim() + "|" + this.textProdNo.Text.Trim() + "|" + this.textOrderCount.Text.Trim(), AH.Network.MsgType.Deduct); } catch (Exception excpt) { SpMessageBox.Show("告警:" + excpt.Message, "通信-库房"); } return; } } catch (Exception excpt) { SpMessageBox.Show("告警:" + excpt.Message, "生产切线"); return; } SystemLogs.WriteSystemLog(Login.UserName, "Switch order from " + this.txtOrderNo.Text.Trim() + "to other order at " + Login.CurrentProductionLine, DateTime.Now); ProductionLine.RemoveOrderAndProductionLineInfo(Login.CurrentProductionLineNumber, this.txtOrderNo.Text.Trim()); //切线时,没有必要删除database里这个order..... this.listView_CurrentOrder.Items.Clear(); this.txtOrderNo.Clear(); this.textOrderCount.Clear(); this.textProdNo.Clear(); CurrentOrderMaterialsList.Clear(); // stop the timer when switch orders/producitonline MainForm.timer_ReadSensors.Enabled = false; } else { SpMessageBox.Show("当前用户没有权限执行切线操作,请联系 Administrator.", "切线操作"); } } }
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("请检查订单号,产品号,和订单数量的输入.", "订单查询"); } }
private void addoneuserintoDB() { ListViewItem lv = new ListViewItem(); UserInfo tmpUserInfo = new UserInfo(); //insert data to DB. tmpUserInfo.UserName = txt_UserName.Text; tmpUserInfo.Password = txt_Password.Text.Trim(); //tmpUserInfo.Role = (byte)combo_Authority.SelectedIndex; tmpUserInfo.Role = (byte)((combo_Authority.Text.Trim() == "管理员") ? LoginAuthority.Administrator : ((combo_Authority.Text.Trim() == "超级管理员") ? LoginAuthority.SuperAdmin : ((combo_Authority.Text.Trim() == "操作员") ? LoginAuthority.Operator : LoginAuthority.Unkown))); tmpUserInfo.InsertUserInfoTable(); lsvUser_Load(tmpUserInfo.UserID); SystemLogs.WriteSystemLog(Login.UserName, "Adding User " + tmpUserInfo.UserName + "to database ", DateTime.Now); }
private void sendMaterialReq() { try { //调用tcp/ip 协议,发送备料请求到库房App MainForm.CheckConnectionWithServer(); Program.S.SendMessageToWS(Login.CurrentProductionLineNumber.ToString(), this.txtNewOrderNo.Text.Trim() + "|" + this.textProdNo.Text.Trim() + "|" + this.textNewOrderCount.Text.Trim(), AH.Network.MsgType.NewDut); } catch (Exception e) { SpMessageBox.Show("告警:" + e.Message, "通信-库房"); } //ProductionLine.AddOrderAndProductionLineInfo(Login.CurrentProductionLineNumber, // this.txtNewOrderNo.Text.Trim(), // int.Parse(this.textNewOrderCount.Text.Trim()), // this.textProdNo.Text.Trim()); SystemLogs.WriteSystemLog(Login.UserName, "Sending materials request for new order " + this.txtNewOrderNo.Text.Trim() + " at " + Login.CurrentProductionLine, DateTime.Now); }
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("请检查订单号,产品号,和订单数量的输入", "订单查询"); } }