private bool DoBucketNo() { string bucketNo = bucketNoBox.Text; zaiKo = DbAccess.GetZaiKoByBucketNo(bucketNo); if (zaiKo == null) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); msgBox.Text = "没有库存数据"; itemCodeBox.Text = string.Empty; itemName1Box.Text = string.Empty; itemName2Box.Text = string.Empty; itemName3Box.Text = string.Empty; colorCodeBox.Text = string.Empty; planCountBox.Text = string.Empty; planWeightBox.Text = string.Empty; unitWeightBox.Text = string.Empty; return(false); } else { if (zaiKo.STORAGE_PLACE_FLAG == "0") //非平库 { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); msgBox.Text = "库存已存在"; return(false); } zKey = DbAccess.GetManagedZKey(zaiKo.ZAIKEY); if (zKey == null) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); msgBox.Text = "没有此Item主数据"; return(false); } else { msgBox.Clear(); itemCodeBox.Text = zKey.ZAIKEY; itemName1Box.Text = zKey.ZKNAME1; itemName2Box.Text = zKey.ZKNAME2; itemName3Box.Text = zKey.ZKNAME3; colorCodeBox.Text = zaiKo.COLOR_CODE; planCountBox.Text = zaiKo.PLAN_QTY.ToString(); planWeightBox.Text = zaiKo.PLAN_WEIGHT.ToString(); unitWeightBox.Text = zaiKo.REAL_UNIT_WEIGHT.ToString(); plasticBagStatusBox.Text = zaiKo.BAG_FLAG.Trim() == "1" ? "有" : "无"; fixedWeightBox.Text = (GlobalAccess.FixedWeight * 1000).ToString(); DoRange(zaiKo); //处理原单位,入库许可上下限 return(true); } } }
private void ShowInfo(string systemId) { FNZAIKOEntity zaiKo = DbAccess.GetZaiKoBySystemId(systemId); if (zaiKo == null) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); msgBox.Text = "没有库存数据"; return; } bucketNoBox.Text = zaiKo.BUCKET_NO; ticketNoBox.Text = zaiKo.TICKET_NO; itemCodeBox.Text = zaiKo.ZAIKEY; colorCodeBox.Text = zaiKo.COLOR_CODE; lineBox.Text = zaiKo.MADE_LINE; sectionBox.Text = zaiKo.MADE_SECTION; }
private void itemCountBox_KeyPress(object sender, KeyPressEventArgs e) { try { switch (e.KeyChar) { case '\r': if (zaiKo == null) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); msgBox.Text = "没有库存数据"; 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; } }
private void weightLoadBtn_Click(object sender, EventArgs e) { try { if (statusBox.Text == "系统Offline") { return; } if (isOperating == false) { return; } if (statusBox.Text == "正常") { if (zaiKo == null) { msgBox.Text = "请输入TicketNo"; return; } if (zKey == null) { msgBox.Text = "没有此Item主数据"; return; } if (bucket == null) { msgBox.Text = "Bucket未登录"; return; } if (string.IsNullOrEmpty(unitWeightBox.Text)) { msgBox.Text = "请先获得单位重量"; return; } if (decimal.Parse(unitWeightBox.Text) == 0) { msgBox.Text = "单位重量必须大于0"; return; } } weightLoadBtn.Enabled = false; decimal weight = GetWeight(); //称重,错误返回-1 weightLoadBtn.Enabled = true; if (weight == -2) { msgBox.Text = "无法取得安定的计量器数值"; itemWeightBox.Text = string.Empty; itemCountBox.Value = itemCountBox.Minimum; return; } if (weight != -1) { if (bucket != null) { decimal temp = weight - bucket.PACKING_WEIGHT - GlobalAccess.FixedWeight; if (plasticBagStatusBox.Text == "有") { temp -= GlobalAccess.BagWeight; } itemWeightBox.Text = temp < 0 ? "0" : temp.ToString(); } else { itemWeightBox.Text = weight < 0 ? "0" : weight.ToString(); } if (statusBox.Text == "正常") { int count = Convert.ToInt32(decimal.Truncate(decimal.Parse(itemWeightBox.Text) / decimal.Parse(unitWeightBox.Text))); itemCountBox.Value = count; //计算误差 if (zaiKo.PLAN_QTY > 0) { decimal error = decimal.Round((count * 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 = "超出范围"; isRangeError = true; //manCheck.Checked = true; } else { msgBox.Text = string.Empty; } } else { itemWeightErrorBox.Text = "100"; } } } else { msgBox.Text = "通信错误"; return; } } catch (Exception ex) { weightLoadBtn.Enabled = true; msgBox.Text = ex.Message; } }
private bool DoTouCyaKu(FNTOUCYAKUEntity touCyaKu) { bucketNoBox.Text = touCyaKu.BUCKET_NO.Trim().ToUpper() == "BR" ? string.Empty : touCyaKu.BUCKET_NO; if (touCyaKu.BUCKET_NO.Trim().ToUpper() == "BR") { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); setStatusBox("条码未读取"); setUIOnExport(); isOperating = true; return(false); } FNHANSOEntity hanSo = DbAccess.GetHanSo(touCyaKu.MCKEY); if (hanSo == null) { setStatusBox("排出"); touCyaKu.SYORIFLG = "1"; touCyaKu.Save(); setUIOnExport(); isOperating = true; return(false); } if (touCyaKu.HEIGHT_FLAG == "3") //货形高低异常 { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Height_Error); setStatusBox("Bucket高度异常"); setUIOnExport(); isOperating = true; return(false); } FNSTATIONEntity station = DbAccess.GetStation(GlobalAccess.StationNo); if (station == null) { return(false); } if (station.NYUSYUMODE == Nyusyumode.Empty_Bucket) { setStatusBox("空箱登录模式"); isOperating = true; return(true); } if (station.NYUSYUMODE == Nyusyumode.Normal) //入库模式 { bucket = DbAccess.GetBucket(touCyaKu.BUCKET_NO); if (bucket == null) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); setStatusBox("空箱未登录"); setUIOnExport(); isOperating = true; return(false); } bucketWeightBox.Text = bucket.PACKING_WEIGHT.ToString(); if (bucket.HEIGHT_FLAG != touCyaKu.HEIGHT_FLAG) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Height_Error); setStatusBox("Bucket高度异常"); setUIOnExport(); isOperating = true; return(false); } if (DbAccess.IsBucketInLocation(bucket.BUCKET_NO)) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); setStatusBox("Bucket重复"); setUIOnExport(); isOperating = true; return(false); } zaiKo = DbAccess.GetZaiKoByBucketNo(bucket.BUCKET_NO); if (zaiKo == null) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); setStatusBox("Bucket未设定"); setUIOnExport(); isOperating = true; return(false); } msgBox.Clear(); setStatusBox("正常"); isOperating = true; ticketNoBox.Text = zaiKo.TICKET_NO; return(DoBucketNo()); } return(false); }
private void unitWeightLoadBtn_Click(object sender, EventArgs e) { try { if (statusBox.Text == "系统Offline") { return; } if (statusBox.Text == "通过") { return; } if (_isOperating == false) { return; } if (_zaiKo == null) { msgBox.Text = "请输入TicketNo"; return; } if (_zKey == null) { msgBox.Text = "没有此Item主数据"; return; } int count = 0;; try { count = Convert.ToInt32(checkCountBox.Value); } catch (Exception) { msgBox.Text = "请输入检查数量"; return; } unitWeightLoadBtn.Enabled = false; decimal weight = GetUnitWeight(); //称重,取单位重量,错误返回-1 unitWeightLoadBtn.Enabled = true; if (weight == -2) { msgBox.Text = "无法取得安定的计量器数值"; unitWeightBox.Text = string.Empty; return; } if (weight != -1) { msgBox.Text = ""; decimal unitWeight = decimal.Round(weight / count, 7, MidpointRounding.AwayFromZero); unitWeightBox.Text = unitWeight.ToString(); //计算误差 if (_zKey.MASTER_UNIT_WEIGHT > 0) { decimal error = decimal.Round((unitWeight * 100 / (_zKey.MASTER_UNIT_WEIGHT * 1000)), 1, MidpointRounding.AwayFromZero); unitWeightErrorBox.Text = error.ToString(); if (error > Convert.ToDecimal(unitWeightRangeLimitToBox.Text) || error < Convert.ToDecimal(unitWeightRangeLimitFromBox.Text)) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Range_Error); OutOfRangeWarning frm = new OutOfRangeWarning("原单位重量", unitWeightErrorBox.Text, unitWeightRangeLimitFromBox.Text, unitWeightRangeLimitToBox.Text); frm.ShowDialog(this); msgBox.Text = "超出范围"; this.setBtn.Enabled = false; } else { msgBox.Text = string.Empty; this.setBtn.Enabled = true; } } else { unitWeightErrorBox.Text = "100"; } } else { msgBox.Text = "通信错误"; return; } } catch (Exception ex) { unitWeightLoadBtn.Enabled = true; msgBox.Text = ex.Message; } }
private void DoTicketNo() { string ticketNo = ticketNoBox.Text; if (string.IsNullOrEmpty(ticketNo.Trim())) { return; } _zaiKo = DbAccess.GetZaiKoByTicketNo(ticketNo); if (_zaiKo == null) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); msgBox.Text = "库存未登录"; itemCodeBox.Text = string.Empty; itemNameBox1.Text = string.Empty; itemNameBox2.Text = string.Empty; itemNameBox3.Text = string.Empty; colorCodeBox.Text = string.Empty; sectionBox.Text = string.Empty; lineBox.Text = string.Empty; planCountBox.Text = string.Empty; planWeightBox.Text = string.Empty; unitWeightBox.Text = string.Empty; measureFlagBox.Text = string.Empty; ticketNoBox.Focus(); ticketNoBox.SelectAll(); return; } if (_zaiKo.STORAGE_PLACE_FLAG == "0") //非平库 { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); msgBox.Text = "库存已存在"; itemCodeBox.Text = string.Empty; itemNameBox1.Text = string.Empty; itemNameBox2.Text = string.Empty; itemNameBox3.Text = string.Empty; colorCodeBox.Text = string.Empty; sectionBox.Text = string.Empty; lineBox.Text = string.Empty; planCountBox.Text = string.Empty; planWeightBox.Text = string.Empty; unitWeightBox.Text = string.Empty; measureFlagBox.Text = string.Empty; ticketNoBox.Focus(); ticketNoBox.SelectAll(); return; } _zKey = DbAccess.GetManagedZKey(_zaiKo.ZAIKEY); if (_zKey == null) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); msgBox.Text = "没有此Item主数据"; itemCodeBox.Text = string.Empty; itemNameBox1.Text = string.Empty; itemNameBox2.Text = string.Empty; itemNameBox3.Text = string.Empty; colorCodeBox.Text = string.Empty; sectionBox.Text = string.Empty; lineBox.Text = string.Empty; planCountBox.Text = string.Empty; planWeightBox.Text = string.Empty; unitWeightBox.Text = string.Empty; measureFlagBox.Text = string.Empty; ticketNoBox.Focus(); ticketNoBox.SelectAll(); return; } msgBox.Clear(); itemCodeBox.Text = _zKey.ZAIKEY; itemNameBox1.Text = _zKey.ZKNAME1; itemNameBox2.Text = _zKey.ZKNAME2; itemNameBox3.Text = _zKey.ZKNAME3; colorCodeBox.Text = _zaiKo.COLOR_CODE; sectionBox.Text = _zaiKo.MADE_SECTION; lineBox.Text = _zaiKo.MADE_LINE; planCountBox.Text = _zaiKo.PLAN_QTY.ToString(); planWeightBox.Text = _zaiKo.PLAN_WEIGHT.ToString(); unitWeightBox.Text = (_zKey.MASTER_UNIT_WEIGHT * 1000).ToString(); checkCountBox.Value = _zKey.MEASURE_QTY; measureFlagBox.Text = _zKey.MEASURE_FLAG.Trim() == "0" ? "不要" : "要"; memoBox.Text = _zaiKo.MEMO; chkUsingPlasticBag.Checked = _zKey.BAG_FLAG.Trim() == "1"; fixedWeightBox.Text = (GlobalAccess.FixedWeight * 1000).ToString(); DoRange(_zaiKo); //处理原单位,入库许可上下限 if (_preZaiKey != _zKey.ZAIKEY || _preColorCode != _zaiKo.COLOR_CODE) { if (_zKey.MEASURE_FLAG.Trim() != "0") { unitWeightBox.Text = string.Empty; } } else { unitWeightBox.Text = _preUnitWeight.ToString(); } }
private bool DoTouCyaKu(FNTOUCYAKUEntity touCyaKu) { bucketNoBox.Text = touCyaKu.BUCKET_NO.Trim().ToUpper() == "BR" ? string.Empty : touCyaKu.BUCKET_NO; if (touCyaKu.BUCKET_NO.Trim().ToUpper() == "BR") { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); setStatusBox("条码未读取"); setUIOnExport(); _isOperating = true; return(false); } FNHANSOEntity hanSo = DbAccess.GetHanSo(touCyaKu.MCKEY); if (hanSo == null) { setStatusBox("排出"); touCyaKu.SYORIFLG = "1"; touCyaKu.Save(); setUIOnExport(); _isOperating = true; return(false); } if (hanSo.SAGYOKBN == Sagyokbn.ReInput) //再入库 { setStatusBox("通过"); ShowInfo(hanSo.SYSTEMID); return(false); } if (touCyaKu.HEIGHT_FLAG == "3") //货形高低异常 { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Height_Error); setStatusBox("Bucket高度异常"); setUIOnExport(); _isOperating = true; return(false); } FNSTATIONEntity station = DbAccess.GetStation(GlobalAccess.StationNo); if (station == null) { return(false); } if (station.NYUSYUMODE == Nyusyumode.Empty_Bucket) { setStatusBox("空箱登录模式"); _isOperating = true; return(true); } if (station.NYUSYUMODE == Nyusyumode.Normal) //入库模式 { _bucket = DbAccess.GetBucket(touCyaKu.BUCKET_NO); if (_bucket == null) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); setStatusBox("空箱未登录"); setUIOnExport(); _isOperating = true; return(false); } bucketWeightBox.Text = _bucket.PACKING_WEIGHT.ToString(); if (_bucket.HEIGHT_FLAG != touCyaKu.HEIGHT_FLAG) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Height_Error); setStatusBox("Bucket高度异常"); setUIOnExport(); _isOperating = true; return(false); } if (DbAccess.IsBucketInAutoWarehouse(_bucket.BUCKET_NO) || DbAccess.IsBucketInLocation(_bucket.BUCKET_NO)) { DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error); setStatusBox("Bucket重复"); setUIOnExport(); _isOperating = true; return(false); } msgBox.Clear(); setStatusBox("正常"); _isOperating = true; } return(false); }