private void pickOutBtn_Click(object sender, EventArgs e) { if (!matchMckey()) { this.Close(); } else { string schno = string.Empty; try { FNPICK_CTLEntity pickCtlEntity = DbAccess.GetPick_Ctl(GlobalAccess.TermNo); if (pickCtlEntity == null) { msgBox.Text = "当前没有作业"; return; } FNHANSOEntity hansoEntity = DbAccess.GetHanSo(pickCtlEntity.MCKEY); if (hansoEntity == null) { msgBox.Text = "没有搬送数据"; return; } if (hansoEntity.HJYOTAIFLG != "6") { msgBox.Text = "Bucket还没有到达"; return; } schno = DbAccess.generateScheduleNo(); FNGSETEntity fngset = new FNGSETEntity(); fngset.SCHNO = schno; fngset.SYORIFLG = "0"; fngset.MOTOSTNO = GlobalAccess.StationNo; fngset.USERID = GlobalAccess.UserId; fngset.USERNAME = GlobalAccess.UserName; fngset.Save(); DbAccess.callProcedure(schno, "stock_back_export"); DbAccess.callAfterStockin(string.Empty); msgBox.Text = "设定成功"; //ClearAll(); this.Close(); } catch (Exception ex) { msgBox.Text = ex.Message; } finally { DbAccess.UpdateFngset(schno); } } }
private bool matchMckey() { FNPICK_CTLEntity pick_ctl = DbAccess.GetPick_Ctl(GlobalAccess.TermNo); if (pick_ctl == null || pick_ctl.MCKEY.Trim() != _mckey.Trim()) { return(false); } return(true); }
private void sendMessageBtn_Click(object sender, EventArgs e) { try { FNPICK_CTLEntity pickCtlEntity = DbAccess.GetPick_Ctl(GlobalAccess.TermNo); if (pickCtlEntity == null) { msgBox.Text = "当前没有作业"; return; } FNHANSOEntity hansoEntity = DbAccess.GetHanSo(pickCtlEntity.MCKEY); if (hansoEntity == null) { msgBox.Text = "没有搬送数据"; return; } if (string.IsNullOrEmpty(unitWeightBox.Text)) { msgBox.Text = "请先获得单位重量"; return; } if (string.IsNullOrEmpty(bucketWeightBox.Text)) { msgBox.Text = "Bucket重量为空"; return; } decimal unitWeight = decimal.Parse(unitWeightBox.Text); decimal bucketWeight = decimal.Parse(bucketWeightBox.Text) * 1000; decimal offsetWeight = GlobalAccess.FixedWeight * 1000; if (chkUsingPlasticBag.Checked) { offsetWeight += GlobalAccess.BagWeight * 1000; } sendMessageBtn.Enabled = false; weightLoadBtn.Enabled = false; Weighter_Big.Instance.SendBucketWeight(Decimal.Round((bucketWeight + offsetWeight) / 5m, 0, MidpointRounding.AwayFromZero) * 5m); Weighter_Big.Instance.SendItemWeight(unitWeight); sendMessageBtn.Enabled = true; weightLoadBtn.Enabled = true; msgBox.Text = string.Empty; alreadySendUnitWeight = true; } catch (Exception ex) { sendMessageBtn.Enabled = true; weightLoadBtn.Enabled = true; msgBox.Text = ex.Message; } }
private void cancelBtn_Click(object sender, EventArgs e) { if (!matchMckey()) { this.Close(); } else { try { ClearAll(); FNPICK_CTLEntity pickCtlEntity = DbAccess.GetPick_Ctl(GlobalAccess.TermNo); if (pickCtlEntity == null) { return; } FNHANSOEntity hansoEntity = DbAccess.GetHanSo(pickCtlEntity.MCKEY); if (hansoEntity == null) { return; } FMBUCKETEntity bucketEntity = DbAccess.GetBucket(hansoEntity.BUCKET_NO); if (_bucket == null) { return; } bucketNoBox.Text = bucketEntity.BUCKET_NO; bucketWeightBox.Text = bucketEntity.PACKING_WEIGHT.ToString(); } catch (Exception ex) { msgBox.Text = ex.Message; } } }
private void setBtn_Click(object sender, EventArgs e) { if (!matchMckey()) { this.Close(); } else { string schno = string.Empty; try { FNPICK_CTLEntity pickCtlEntity = DbAccess.GetPick_Ctl(GlobalAccess.TermNo); if (pickCtlEntity == null) { msgBox.Text = "当前没有作业"; return; } FNHANSOEntity hansoEntity = DbAccess.GetHanSo(pickCtlEntity.MCKEY); if (hansoEntity == null) { msgBox.Text = "没有搬送数据"; return; } if (hansoEntity.HJYOTAIFLG != "6") { msgBox.Text = "Bucket还没有到达"; return; } if (!DoBucket()) { return; } if (itemCountBox.Value == 0) { msgBox.Text = "请先称重或输入Item个数"; itemCountBox.Focus(); itemCountBox.Select(); return; } schno = DbAccess.generateScheduleNo(); FNGSETEntity fngset = new FNGSETEntity(); fngset.SCHNO = schno; fngset.MOTOSTNO = GlobalAccess.StationNo; fngset.UNIT_WEIGHT = Convert.ToDecimal(unitWeightBox.Text) / 1000; fngset.MEASURE_WEIGHT = (itemCountBox.Value * Convert.ToDecimal(unitWeightBox.Text)) / 1000 > 99.9999m ? 99.9999m : (itemCountBox.Value * Convert.ToDecimal(unitWeightBox.Text)) / 1000; fngset.NYUSYUSU = itemCountBox.Value; fngset.MEMO = string.IsNullOrEmpty(remarkBox.Text) ? " " : remarkBox.Text.Trim(); fngset.USERID = GlobalAccess.UserId; fngset.USERNAME = GlobalAccess.UserName; fngset.SYORIFLG = "0"; fngset.TICKET_NO = ticketNoBox.Text; fngset.BUCKET_NO = bucketNoBox.Text; fngset.BAG_FLAG = chkUsingPlasticBag.Checked ? "1" : "0"; fngset.Save(); DbAccess.callProcedure(schno, "stock_back"); DbAccess.callAfterStockin(string.Empty); msgBox.Text = "设定成功"; //ClearAll(); this.Close(); } catch (Exception ex) { msgBox.Text = ex.Message; } finally { DbAccess.UpdateFngset(schno); } } }
private void setBtn_Click(object sender, EventArgs e) { string schno = string.Empty; try { if (isOperating == false) { msgBox.Text = "当前没有作业"; return; } FNPICK_CTLEntity pickCtlEntity = DbAccess.GetPick_Ctl(GlobalAccess.TermNo); if (pickCtlEntity == null) { msgBox.Text = "当前没有作业"; return; } FNHANSOEntity hansoEntity = DbAccess.GetHanSo(pickCtlEntity.MCKEY); if (hansoEntity == null) { msgBox.Text = "没有搬送数据"; return; } if (hansoEntity.HJYOTAIFLG != "6") { msgBox.Text = "Bucket还没有到达"; return; } if (pickingType != PickingType.Abnormal) { if (pickingType != PickingType.Total) { if (string.IsNullOrEmpty(this.newBucketNoBox.Text)) { msgBox.Text = "请输入BucketNo"; newBucketNoBox.Focus(); newBucketNoBox.SelectAll(); return; } else if (DbAccess.GetBucket(this.newBucketNoBox.Text) == null) { msgBox.Text = "空箱未登录"; newBucketNoBox.Focus(); newBucketNoBox.SelectAll(); return; } } if (pickingType != PickingType.Cycle) { if (string.IsNullOrEmpty(this.pickingCountBox.Text)) { msgBox.Text = "Picking数不能为空"; receiveMessageBtn.Focus(); return; } } } schno = DbAccess.generateScheduleNo(); FNGSETEntity fngset = new FNGSETEntity(); fngset.SCHNO = schno; fngset.MOTOSTNO = GlobalAccess.StationNo; if (pickingType != PickingType.Abnormal) { fngset.BUCKET_NO = newBucketNoBox.Text; if (pickingType != PickingType.Cycle) { fngset.NYUSYUSU = Decimal.Parse(this.pickingCountBox.Text); } } fngset.SYORIFLG = "0"; fngset.USERID = GlobalAccess.UserId; fngset.USERNAME = GlobalAccess.UserName; fngset.PRINTER_NO = GlobalAccess.PrinterNo; fngset.Save(); DbAccess.callProcedure(schno, "picking_start"); DbAccess.callAfterStockin(string.Empty); msgBox.Text = "设定成功"; if (pickingType != PickingType.Abnormal) { LabelPublish frm = new LabelPublish(sijis); frm.ShowDialog(this); } ClearAll(); isOperating = false; } catch (Exception ex) { msgBox.Text = ex.Message; } finally { DbAccess.UpdateFngset(schno); } }
private void CheckTask() { pick_ctl = DbAccess.GetPick_Ctl(GlobalAccess.TermNo); if (pick_ctl == null || string.IsNullOrEmpty(pick_ctl.MCKEY == null ? pick_ctl.MCKEY : pick_ctl.MCKEY.Trim())) //无拣选预定 { ClearAll(); return; } FNHANSOEntity hanso = DbAccess.GetHanSo(pick_ctl.MCKEY.Trim()); if (hanso == null) { msgBox.Text = "没有搬送数据"; WriteLog("无法找到Hanso数据,Mckey为" + pick_ctl.MCKEY.Trim()); return; } if (hanso.HJYOTAIFLG != "6") //Bucket未到达 { return; } isOperating = true; //操作状态,不再刷数据库 cancelBtn.Enabled = hanso.SAGYOKBN != "7"; //直行搬送,取消按钮不可按下 try { mcKey = GetTaskMckey(); //取得MCKEY,PickingType,剩余作业数,剩余拣选数 } catch (Exception ex) { throw new Exception("GetTaskMckey出错:" + ex.Message); } if (string.IsNullOrEmpty(mcKey)) { msgBox.Text = "无法获得作业内容"; WriteLog("GetTaskMckey无法找到对应数据"); return; } if (pickingType == PickingType.Return) //如果是回库作业,弹出回库窗口 { StockBack frm = new StockBack(mcKey); frm.ShowDialog(this); isOperating = false; //回库结束,开启刷数据库 return; } sijis = DbAccess.GetSiJis(mcKey); if (sijis == null || sijis.Count == 0) { msgBox.Text = "没有指示数据"; WriteLog(string.Format("无法找到siji数据,mckey{0}", mcKey)); return; } if (sijis[0].ZAIKEY == null) { msgBox.Text = "无法找到siji.zaikey"; WriteLog("无法找到siji.zaikey"); return; } zKey = DbAccess.GetManagedZKey(sijis[0].ZAIKEY); if (zKey == null) { msgBox.Text = "无法找到ZAIKEY数据"; WriteLog(string.Format("无法找到ZAIKEY数据,zkey{0}", zKey)); return; } originalBucketNoBox.Text = hanso.BUCKET_NO; FMBUCKETEntity originalBucket = DbAccess.GetBucket(hanso.BUCKET_NO); originalBucketWeightBox.Text = originalBucket == null ? string.Empty : originalBucket.PACKING_WEIGHT.ToString(); ticketNoBox.Text = sijis[0].TICKET_NO; colorCodeBox.Text = sijis[0].COLOR_CODE; itemCodeBox.Text = zKey.ZAIKEY; itemName1Box.Text = zKey.ZKNAME1; itemName2Box.Text = zKey.ZKNAME2; itemName3Box.Text = zKey.ZKNAME3; zaikoEntity = DbAccess.GetZaiKoBySystemId(hanso.SYSTEMID); unitWeightBox.Text = zaikoEntity == null ? string.Empty : (zaikoEntity.REAL_UNIT_WEIGHT * 1000).ToString(); remainJobBox.Text = remainCount.ToString(); totalStockoutCountBox.Text = remainPickingQty.ToString(); planCount = 0; foreach (FNSIJIEntity siji in sijis) //作业数量 { planCount += siji.NYUSYUSU; } //全拣选时不可输入BucketNo newBucketNoBox.ReadOnly = (pickingType == PickingType.Total); //收、发计量报告按钮在盘库时不可用 sendMessageBtn.Enabled = (pickingType != PickingType.Cycle); receiveMessageBtn.Enabled = (pickingType != PickingType.Cycle); //BucketNo不一致时,出库取消按钮不可用 cancelBtn.Enabled = pick_ctl.BUCKETREADING_FLG != "2"; if (pickingType == PickingType.Total) { msgBox.Clear(); emptyBucketPositionBox.Text = "无设置"; jobTypeBox.Text = "全拣选"; jobCountBox.Text = planCount.ToString(); newBucketNoBox.Text = hanso.BUCKET_NO; //全拣选时自动读出重量,计量器自动送信 if (DoBucketNoOnTotal()) { sendMessageBtn.PerformClick(); } } if (pickingType == PickingType.Reverse) { msgBox.Clear(); emptyBucketPositionBox.Text = "设置在称重机前"; jobTypeBox.Text = "反拣选"; jobCountBox.Text = planCount.ToString(); newBucketNoBox.Focus(); newBucketNoBox.SelectAll(); } if (pickingType == PickingType.Normal || pickingType == PickingType.Subdivided) { msgBox.Clear(); emptyBucketPositionBox.Text = "设置于称重机上"; jobTypeBox.Text = pickingType == PickingType.Normal ? "拣选" : "拣选(细分)"; jobCountBox.Text = planCount.ToString(); newBucketNoBox.Focus(); newBucketNoBox.SelectAll(); } if (pickingType == PickingType.Abnormal) { msgBox.Clear(); emptyBucketPositionBox.Text = "无设置"; if (pick_ctl.BUCKETREADING_FLG == "2") { jobTypeBox.Text = "Bucket不一致"; } } if (pickingType == PickingType.Cycle) { msgBox.Clear(); jobCountBox.Text = "0"; newBucketNoBox.Text = hanso.BUCKET_NO; FMBUCKETEntity bucketEntity = DbAccess.GetBucket(hanso.BUCKET_NO); newBucketWeightBox.Text = bucketEntity == null ? string.Empty : bucketEntity.PACKING_WEIGHT.ToString(); emptyBucketPositionBox.Text = "无设置"; jobTypeBox.Text = "盘库"; } }