public override void StopInventory() { if (isInventory) { Invoke(new Action(() => { lblWorkStatus.Text = "停止扫描"; })); isInventory = false; reader.StopInventory(); HLACommonView.Model.CheckResult result = CheckData(); UploadBoxInfo box = GetUploadBox(result); if (result.InventoryResult) { if (box.Box.Details != null && box.Box.Details.Count > 0) { PrintHelper.PrintRightTag(box.Box.LH, box.Box.Details.First().ZSATNR, box.Box.Details.First().ZCOLSN, box.Box.Details.First().ZSIZTX, box.Box.QTY, box.Box.HU, SysConfig.PrinterName, box.Box.LIFNR); } if (!result.IsRecheck) { if (currentBoxList == null) { currentBoxList = new List <PBBoxInfo>(); } currentBoxList.RemoveAll(i => i.HU == box.Box.HU); currentBoxList.Add(box.Box); } } else { PrintHelper.PrintErrorTag(result.Message, lblHu.Text, tagDetailList, SysConfig.PrinterName); } AddBoxDetailGrid(box.Box); if (!result.IsRecheck) { EnqueueUploadData(box); } } }
private UploadBoxInfo GetUploadBox(HLACommonView.Model.CheckResult result) { UploadBoxInfo box = new UploadBoxInfo(); box.EQUIP_HLA = SysConfig.DeviceInfo.EQUIP_HLA; box.LGNUM = SysConfig.LGNUM; box.LOUCENG = SysConfig.DeviceInfo.LOUCENG; box.SUBUSER = SysConfig.CurrentLoginUser.UserId; box.Box = new PBBoxInfo(); box.Box.EQUIP = SysConfig.DeviceInfo.EQUIP_HLA; box.Box.HU = lblHu.Text; box.Box.LH = cboLh.Text; box.Box.QTY = mainEpcNumber; box.Box.RESULT = result.InventoryResult ? "S" : "E"; box.Box.MSG = result.Message; box.Box.MX = IsFull ? "X" : ""; box.Box.LIFNR = lifnr; box.Box.Details = new List <PBBoxDetailInfo>(); if (tagDetailList != null) { foreach (TagDetailInfo tag in tagDetailList) { PBBoxDetailInfo item = new PBBoxDetailInfo(); item.BARCD = tag.BARCD; item.EPC = tag.EPC; item.HU = lblHu.Text; item.MATNR = tag.MATNR; item.ZCOLSN = tag.ZCOLSN; item.ZSATNR = tag.ZSATNR; item.ZSIZTX = tag.ZSIZTX; item.IsAdd = tag.IsAddEpc ? 1 : 0; box.Box.Details.Add(item); } } return(box); }
public override HLACommonView.Model.CheckResult CheckData() { HLACommonView.Model.CheckResult result = new HLACommonView.Model.CheckResult(); if (btnStart.Enabled) { result.UpdateMessage("未开始检货"); result.InventoryResult = false; } else { if (errorEpcNumber > 0) { result.UpdateMessage(EPC_WEI_ZHU_CE); result.InventoryResult = false; } if (mainEpcNumber != addEpcNumber && addEpcNumber > 0) { result.UpdateMessage(TWO_NUMBER_ERROR); result.InventoryResult = false; } if (boxNoList.Count > 0) { boxNoList.Clear(); result.UpdateMessage(XIANG_MA_BU_YI_ZHI); result.InventoryResult = false; } if (string.IsNullOrEmpty(lblHu.Text.Trim())) { result.UpdateMessage(WEI_SAO_DAO_XIANG_MA); result.InventoryResult = false; string hu = LocalDataService.GetNewErrorHu(SysConfig.DeviceNO); Invoke(new Action(() => { lblHu.Text = hu; })); } if (epcList.Count == 0) { result.UpdateMessage(WEI_SAO_DAO_EPC); result.InventoryResult = false; } else { //判断是否重投 object lastResult = GetLastCheckResult(lblHu.Text); if (lastResult != null && lastResult.ToString().ToUpper() == "S") { //上次检测结果为正常, bool isAllSame = true; bool isAllNotSame = true; List <PBBoxDetailInfo> lastCheckDetail = GetBoxDetailByHU(lblHu.Text); if (lastCheckDetail != null && lastCheckDetail.Count > 0) { if (lastCheckDetail.Count != epcList.Count) { isAllSame = false; } foreach (PBBoxDetailInfo item in lastCheckDetail) { if (!epcList.Contains(item.EPC)) { isAllSame = false; break; } else { isAllNotSame = false; } } } else { isAllSame = false; isAllNotSame = true; } if (isAllSame) { result.IsRecheck = true; //result.InventoryResult = false; } else if (isAllNotSame) { //两批EPC对比,完全不一样,示为箱码重复使用 result.UpdateMessage(XIANG_MA_CHONG_FU_SHI_YONG); result.InventoryResult = false; } if (lastCheckDetail.Count > 0 && !isAllSame && !isAllNotSame) { result.UpdateMessage(EPC_YI_SAO_MIAO); result.InventoryResult = false; } } else { if (ExistsSameEpc()) { result.UpdateMessage(EPC_YI_SAO_MIAO); result.InventoryResult = false; } //判断是否只有一个SKU if (IsOneSku()) { if (tagDetailList != null && tagDetailList.Count > 0) { TagDetailInfo tag = tagDetailList.First(); ReturnTypeInfo rt = null; if (cboLh.Text.ToUpper() == "TH") { if (tag.LIFNRS?.Count > 1) { result.UpdateMessage(Consts.Default.JIAO_JIE_HAO_BU_YI_ZHI); result.InventoryResult = false; } else { lifnr = tag.LIFNRS?.FirstOrDefault(); } } if (returnTypeList != null) { rt = returnTypeList.Find(i => i.ZPRDNR == tag.ZSATNR && i.ZCOLSN == tag.ZCOLSN_WFG); } MaterialInfo material = materialList.Find(i => i.MATNR == tag.MATNR); int pxqty = 0; if (material != null) { if (material.PUT_STRA == "ADM1") { pxqty = material.PXQTY; } else { pxqty = material.PXQTY_FH; } } if (IsUseBoxStandard()) { //按箱规收货 if (pxqty != mainEpcNumber) { result.UpdateMessage(BU_FU_HE_XIANG_GUI + string.Format("({0})", pxqty)); result.InventoryResult = false; } else { IsFull = true; } } else { if (pxqty < mainEpcNumber) { result.UpdateMessage(SHU_LIANG_DA_YU_XIANG_GUI); result.InventoryResult = false; } } if (rt == null || string.IsNullOrEmpty(rt.THTYPE) || (rt.THTYPE.ToUpper() != "TH02" && rt.THTYPE.ToUpper() != "TH03")) { //退货类型为空值 List <AuthInfo> auth = authList != null?authList.FindAll(i => i.AUTH_VALUE_DES == material.PUT_STRA) : null; if (material != null) { if (auth != null) { if (!auth.Exists(i => i.AUTH_VALUE == cboLh.Text)) { string authPrint = ""; auth.ForEach(i => { authPrint += i.AUTH_VALUE + ","; }); if (authPrint.EndsWith(",")) { authPrint = authPrint.Remove(authPrint.Length - 1, 1); } result.UpdateMessage(LOU_HAO_BU_FU + string.Format("({0})", authPrint)); result.InventoryResult = false; } } else { result.UpdateMessage(LOU_HAO_BU_FU); result.InventoryResult = false; } } } else { if (rt.THTYPE.ToUpper() == "TH02" || rt.THTYPE.ToUpper() == "TH03") { if (!lhList.Exists(i => i.Lh == cboLh.Text && i.ReturnType == rt.THTYPE)) { List <LhInfo> l = lhList.FindAll(i => i.ReturnType == rt.THTYPE); string lh = ""; if (l != null && l.Count > 0) { l.ForEach(i => { lh += i.Lh + ","; }); if (lh.EndsWith(",")) { lh = lh.Remove(lh.Length - 1, 1); } } result.UpdateMessage(LOU_HAO_BU_FU + string.Format("({0})", lh)); result.InventoryResult = false; } } } } } else { result.UpdateMessage(DUO_GE_SHANG_PIN); result.InventoryResult = false; } } } } if (result.IsRecheck || result.InventoryResult) { result.UpdateMessage(result.IsRecheck ? CHONG_TOU : RIGHT); SetInventoryResult(1); } else { SetInventoryResult(3); } return(result); }