| | |
| | | using Tiger.Business.WMS.Common; |
| | | using Org.BouncyCastle.Ocsp; |
| | | using Tiger.Model.Sharetronic.Shelf; |
| | | using MailKit.Search; |
| | | using Tiger.Business.WMS.Extensions; |
| | | |
| | | namespace Tiger.Business.WMS.Transaction |
| | | { |
| | |
| | | } |
| | | |
| | | #region Propertys & Variables |
| | | private Preparation CurPREP; |
| | | public Preparation CurPREP { get; set; } |
| | | private List<BIZ_WMS_PREP_SN> CurSn = new(); |
| | | private BIZ_WMS_PREP_DTL CurPrepDtl = new(); |
| | | public List<SuggestItem> Suggests { get; set; } = new(); |
| | |
| | | { |
| | | var action = new ApiAction<BIZ_WMS_PREP>(); |
| | | CurPREP.Order = MainDB.Queryable<BIZ_WMS_PREP>().Where(q => q.ID == CurPREP.Order.ID).IncludesAllFirstLayer().First(); |
| | | |
| | | action.Data = CurPREP.Order; |
| | | return action; |
| | | } |
| | |
| | | action.LocaleMsg = Biz.L("WMS.Out_BIZ_WMS_PREP.ScanItem.NotSelectItem"); |
| | | return action; |
| | | } |
| | | if (prepDtl.QTY_PREP > GetActReqQty(prepDtl)) |
| | | if (prepDtl.QTY_PREP > CurPREP.BizType.GetActReqQty(prepDtl)) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("当前选择物料行[{0}]已备料数量[{1}],以满足实际需求数量[{2}],无需继续备料"); |
| | | action.LocaleMsg = Biz.L("WMS.Out_BIZ_WMS_PREP.SelectItem.PrepFinish", prepDtl.ITEM_CODE, prepDtl.QTY_PREP, GetActReqQty(prepDtl)); |
| | | action.LocaleMsg = Biz.L("WMS.Out_BIZ_WMS_PREP.SelectItem.PrepFinish", prepDtl.ITEM_CODE, prepDtl.QTY_PREP, CurPREP.BizType.GetActReqQty(prepDtl)); |
| | | return action; |
| | | } |
| | | //删除物料池中上一次分配的物料 |
| | |
| | | if (Suggests.Count > 0) |
| | | { |
| | | var inv = Suggests.First(); |
| | | var actQty = CurPrepDtl.QTY_PREP > GetActReqQty(CurPrepDtl) ? 0 : (GetActReqQty(CurPrepDtl) - CurPrepDtl.QTY_PREP); |
| | | var actQty = CurPrepDtl.QTY_PREP > CurPREP.BizType.GetActReqQty(CurPrepDtl) ? 0 : (CurPREP.BizType.GetActReqQty(CurPrepDtl) - CurPrepDtl.QTY_PREP); |
| | | if (inv != null && actQty > 0) |
| | | { |
| | | inv.poolItem = inv.Item.GetPoolItem(OrgCode, nameof(CurPREP.Order), CurPrepDtl.ORDER_NO, CurPrepDtl.ORDER_LINE, actQty, true); |
| | |
| | | if (CurPREP.Order.CurBatch.DLVY_MODE == BIZ_WMS_PREP_BTH.DLVY_MODEs.Supply.GetValue()) |
| | | { |
| | | //推荐物料 |
| | | var actQty = CurPrepDtl.QTY_PREP > GetActReqQty(CurPrepDtl) ? 0 : (GetActReqQty(CurPrepDtl) - CurPrepDtl.QTY_PREP); |
| | | var actQty = CurPrepDtl.QTY_PREP > CurPREP.BizType.GetActReqQty(CurPrepDtl) ? 0 : (CurPREP.BizType.GetActReqQty(CurPrepDtl) - CurPrepDtl.QTY_PREP); |
| | | Result<List<SuggestItem>> result = Suggest(CurPrepDtl.ORDER_NO, CurPrepDtl.ITEM_CODE, null, inputDtl.WH_ID, inputDtl.REGION_ID, inputDtl.SHELF_ID, input.AuthOption, actQty); |
| | | action.LocaleMsg = result.LocaleMsg; |
| | | if (result.IsException) |
| | |
| | | //判断是否超发 |
| | | isExceed = false; |
| | | //计算剩余需求数量和条码中的发出数量 |
| | | var actQty = CurPrepDtl.QTY_PREP > GetActReqQty(CurPrepDtl) ? 0 : (GetActReqQty(CurPrepDtl) - CurPrepDtl.QTY_PREP); |
| | | var actQty = CurPrepDtl.QTY_PREP > CurPREP.BizType.GetActReqQty(CurPrepDtl) ? 0 : (CurPREP.BizType.GetActReqQty(CurPrepDtl) - CurPrepDtl.QTY_PREP); |
| | | if (actQty < CurInvItem.CurPkg.QTY) |
| | | { |
| | | isExceed = true; |
| | |
| | | { |
| | | //action.LocaleMsg = Biz.L($"条码[{0}]扫描成功,备料物料[{1}]需求[{2}]还需备料[{3}],条码需要截料,发出数量[{4}]"); |
| | | //action.LocaleMsg = Biz.L($"条码[{0}]扫描成功,备料物料[{1}]需求[{2}]还需备料[{3}],请选择要超发还是截料?"); |
| | | action.LocaleMsg = Biz.L($"WMS.Out_BIZ_WMS_PREP.ScanItem.Success{(isNeedCut ? "" : "Confirm")}", CurInvItem.SN, CurInvItem.ItemInfo.ITEM_CODE, GetActReqQty(CurPrepDtl), actQty); |
| | | action.LocaleMsg = Biz.L($"WMS.Out_BIZ_WMS_PREP.ScanItem.Success{(isNeedCut ? "" : "Confirm")}", CurInvItem.SN, CurInvItem.ItemInfo.ITEM_CODE, CurPREP.BizType.GetActReqQty(CurPrepDtl), actQty); |
| | | action.Data.Command = "ConfirmExceed"; |
| | | action.Data.Data = new |
| | | { |
| | |
| | | var sns = (input.Data ?? "").JsonToObject<List<BIZ_WMS_PREP_SN>>() ?? new List<BIZ_WMS_PREP_SN>(); |
| | | if (!sns.Any()) |
| | | { |
| | | var actQty = CurPrepDtl.QTY_PREP > GetActReqQty(CurPrepDtl) ? 0 : (GetActReqQty(CurPrepDtl) - CurPrepDtl.QTY_PREP); |
| | | var actQty = CurPrepDtl.QTY_PREP > CurPREP.BizType.GetActReqQty(CurPrepDtl) ? 0 : (CurPREP.BizType.GetActReqQty(CurPrepDtl) - CurPrepDtl.QTY_PREP); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L($"条码[{0}]扫描成功,备料物料[{1}]需求[{2}]还需备料[{3}],条码需要截料,发出数量[{4}]"); |
| | | //action.LocaleMsg = Biz.L($"条码[{0}]扫描成功,备料物料[{1}]需求[{2}]还需备料[{3}],请选择要超发还是截料?"); |
| | | action.LocaleMsg = Biz.L($"WMS.Out_BIZ_WMS_PREP.ScanItem.Success{(isNeedCut ? "" : "Confirm")}", CurInvItem.SN, CurInvItem.ItemInfo.ITEM_CODE, GetActReqQty(CurPrepDtl), actQty); |
| | | action.LocaleMsg = Biz.L($"WMS.Out_BIZ_WMS_PREP.ScanItem.Success{(isNeedCut ? "" : "Confirm")}", CurInvItem.SN, CurInvItem.ItemInfo.ITEM_CODE, CurPREP.BizType.GetActReqQty(CurPrepDtl), actQty); |
| | | action.Data.Command = "ConfirmExceed"; |
| | | action.Data.Data = new |
| | | { |
| | |
| | | CurPrepDtl.QTY_PREP += CurSn.Sum(q => q.QTY_DLVY); |
| | | CurPREP.Order.STATUS = BIZ_WMS_PREP.STATUSs.Picking.GetValue(); |
| | | CurPREP.Order.CurBatch.STATUS = BIZ_WMS_PREP_BTH.STATUSs.Picking.GetValue(); |
| | | CurPREP.Order.CurBatch.PICK_TIME = DateTime.Now; |
| | | CurPREP.Order.CurBatch.PICK_TIME = CurPREP.Order.CurBatch.PICK_TIME < new DateTime(2000, 1, 1) ? DateTime.Now : CurPREP.Order.CurBatch.PICK_TIME; |
| | | |
| | | //创建变量克隆对象用于传入DBSubmitAction中保存当前需要暂存的数据值 |
| | | var _CurSn = CurSn.Clone(); |
| | |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", input.SN)); |
| | | } |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 实际需求数量计算方法 |
| | | /// </summary> |
| | | /// <param name="dtl"></param> |
| | | /// <returns></returns> |
| | | private double GetActReqQty(BIZ_WMS_PREP_DTL dtl) |
| | | { |
| | | return dtl.QTY_REQ; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return SetOutPutMqttMsg(action, locale); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 调用发料单据的ERP接口 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction> CommitToERP(BaseInput input) |
| | | { |
| | | var action = await CurPREP.Order.BIZ_TYPE.GetEnum<BIZ_WMS_PREP.BIZ_TYPEs>() .CommitToERP(this, input); |
| | | return action; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |