private void timer1_Tick(object sender, EventArgs e) { try { datetimeLb.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm"); if (!DbAccess.IsSystemOnline()) { setStatusBox("系统Offline"); return; } else { if (statusBox.Text == "系统Offline") { setStatusBox(string.Empty); } } if (!isOperating) { checkStockInMode(); touCyaKu = DbAccess.GetTouCyaKu(GlobalAccess.StationNo); if (touCyaKu != null) { if (DoTouCyaKu(touCyaKu)) { weightLoadBtn.PerformClick(); if (!manCheck.Checked && !isRangeError) { if (statusBox.Text == "空箱登录模式" || itemCountBox.Value > 0) { setBtn.PerformClick(); } else { exportBtn.PerformClick(); } } } } else { ClearAll(); } } } catch (Exception ex) { msgBox.Text = ex.Message; } }
private void setBtn_Click(object sender, EventArgs e) { string schno = string.Empty; try { if (parentWindowType == 1) { touCyaKu = DbAccess.GetTouCyaKu(GlobalAccess.StationNo); if (touCyaKu == null) { msgBox.Text = "没有到达报告"; return; } } if (string.IsNullOrEmpty(itemCodeBox.Text)) { msgBox.Text = "Item Name不能为空"; itemCodeBox.Focus(); itemCodeBox.SelectAll(); return; } else if (DoItemCode(itemCodeBox.Text) == false) { return; } else if (string.IsNullOrEmpty(colorCodeBox.Text)) { msgBox.Text = "Color Code不能为空"; colorCodeBox.Focus(); colorCodeBox.SelectAll(); return; } else if (itemCountBox.Value == 0) { msgBox.Text = "Item个数不能为0"; itemCountBox.Focus(); itemCountBox.Select(); return; } schno = DbAccess.generateScheduleNo(); FNGSETEntity fngset = new FNGSETEntity(); fngset.SCHNO = schno; fngset.MOTOSTNO = GlobalAccess.StationNo; fngset.BUCKET_NO = bucketNoBox.Text; fngset.ZAIKEY = itemCodeBox.Text; fngset.COLOR_CODE = colorCodeBox.Text; fngset.NYUSYUSU = itemCountBox.Value; fngset.USERID = GlobalAccess.UserId; fngset.USERNAME = GlobalAccess.UserName; fngset.SYORIFLG = "0"; fngset.Save(); if (parentWindowType == 1) { DbAccess.callProcedure(schno, "unmanaged_stockin_1_start"); } else if (parentWindowType == 2) { DbAccess.callProcedure(schno, "unmanaged_stockin_2_start"); } DbAccess.callAfterStockin(string.Empty); msgBox.Text = "设定成功"; ClearAll(); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { msgBox.Text = ex.Message; } finally { DbAccess.UpdateFngset(schno); } }