| | |
| | | /// <returns></returns> |
| | | public Result<TakeDownInfo> TakeDown(IInventory inventory, AuthOption option, WMS_ITEM.STATUSs status, bool clearLocation = true) |
| | | { |
| | | return TakeDown(inventory, inventory.Items.ToDictionary(k => k.SN, v => v.QTY), option, status, clearLocation); |
| | | var result = new Result<TakeDownInfo>(Result.Flags.Success, new TakeDownInfo()); |
| | | try |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下架 |
| | | /// </summary> |
| | | /// <param name="inventory">要下架的库存对象</param> |
| | | /// <param name="qtyList">要下架的最小包装数量字典,key:sn,value:qty</param> |
| | | /// <param name="option">授权查询选项</param> |
| | | /// <param name="status">下架后状态</param> |
| | | /// <param name="clearLocation">是否清理储区货架储位信息</param> |
| | | /// <returns></returns> |
| | | public Result<TakeDownInfo> TakeDown(IInventory inventory, Dictionary<string, decimal> qtyList, AuthOption option, WMS_ITEM.STATUSs status, bool clearLocation = true) |
| | | { |
| | | var result = new Result<TakeDownInfo>(Result.Flags.Success, new TakeDownInfo()); |
| | | try |
| | | { |
| | | //如果要下架的数量字典为空则认为是全部下架 |
| | | qtyList = qtyList.IsNullOrEmpty(inventory.Items.ToDictionary(k => k.SN, v => v.QTY)); |
| | | |
| | | foreach (var item in inventory.Items) |
| | | { |
| | | if (qtyList.ContainsKey(item.SN) && qtyList[item.SN] > 0) |
| | | { |
| | | var downQty = qtyList[item.SN]; |
| | | if (item.QTY > downQty) |
| | | { |
| | | item.QTY -= downQty; |
| | | var pkg = inventory.Packages.First(q => q.SN == item.SN); |
| | | pkg.QTY = item.QTY; |
| | | } |
| | | else |
| | | { |
| | | item.STATUS = status.GetValue(); |
| | | var pkg = inventory.Packages.First(q => q.SN == item.SN); |
| | | pkg.PARENT_SN = null; |
| | | pkg.Parent = null; |
| | | if (clearLocation) |
| | | { |
| | | //item.WH_ID = null; |
| | | item.REGION_ID = null; |
| | | item.SHELF_ID = null; |
| | | item.LOCATION_ID = null; |
| | | //pkg.WH_ID = null; |
| | | pkg.REGION_ID = null; |
| | | pkg.SHELF_ID = null; |
| | | pkg.LOCATION_ID = null; |
| | | } |
| | | } |
| | | inventory.History.Add(new WMS_ITEM_HIS(item, $"条码[{inventory.SN}]从储位[{inventory?.Location?.LOCATION_CODE}]下架数量[{downQty}]成功,状态[{item.STATUS.GetEnumDesc<WMS_ITEM.STATUSs>()}],操作单据[{item.TRANS_NO}]")); |
| | | } |
| | | } |
| | | inventory.Packages = WMS_ITEM_PKG.UpdateQty(inventory.Packages); |
| | | |
| | | result.Data.Items = inventory.Items; |
| | | result.Data.History = inventory.History; |
| | | result.Data.Packages = inventory.Packages; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.CatchExceptionWithLog(ex, Biz.L("WMS.WmsItem.TakeDown.Exception", inventory.SN, inventory?.Location?.LOCATION_CODE)); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下架物料推荐,返回固定个数的最小包装物料库存列表 |
| | | /// </summary> |
| | | /// <param name="order">领料单号</param> |