服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
22 小时以前 2c60540518b5f2071987dcbe6aa237af4b97c77a
Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs
@@ -10,11 +10,7 @@
using Tiger.Model;
using Tiger.IBusiness;
using Tiger.Business.WMS.Common;
using Org.BouncyCastle.Ocsp;
using Tiger.Model.Sharetronic.Shelf;
using MailKit.Search;
using Tiger.Business.WMS.Extensions;
using static Tiger.Model.BIZ_WMS_PREP_BTH;
namespace Tiger.Business.WMS.Transaction
{
@@ -34,7 +30,7 @@
        #region Propertys & Variables
        public Preparation CurPREP { get; set; }
        private List<BIZ_WMS_PREP_SN> CurSn = new();
        private BIZ_WMS_PREP_DTL CurPrepDtl = new();
        private BIZ_WMS_PREP_DTL CurPrepDtl;
        public List<SuggestItem> Suggests { get; set; } = new();
        public List<WMS_ITEM_POOL> CurPoolList => Suggests.Where(q => !q.poolItem.IsNullOrEmpty()).Select(q => q.poolItem).ToList();
        public List<WMS_LOCATION> LocationHis { get; set; } = new();
@@ -51,7 +47,8 @@
            var action = new ApiAction<ScanOutput>(new ScanOutput());
            try
            {
                //Result<List<SuggestItem>> result = Suggest("CurPrepDtl.ORDER_NO", "CurPrepDtl.ITEM_CODE", new SuggestOption(), new(), 100.0);
                //action.LocaleMsg = result.LocaleMsg;
                if (input.Command == "ScanOrder")
                {
                    action = await ScanOrder(input);
@@ -158,8 +155,8 @@
        public async Task<ApiAction<BIZ_WMS_PREP>> GetPrepInfo()
        {
            var action = new ApiAction<BIZ_WMS_PREP>();
            CurPREP.Order = MainDB.Queryable<BIZ_WMS_PREP>().Where(q => q.ID == CurPREP.Order.ID).IncludesAllFirstLayer().First();
            var prepId = CurPREP?.Order?.ID;
            CurPREP.Order = MainDB.Queryable<BIZ_WMS_PREP>().Where(q => q.ID == prepId).IncludesAllFirstLayer().First();
            action.Data = CurPREP.Order;
            return action;
        }
@@ -222,7 +219,7 @@
                        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);
                            inv.poolItem = inv.Item.GetPoolItem(OrgCode, TransID, nameof(CurPREP.Order), CurPrepDtl.ORDER_NO, CurPrepDtl.ORDER_LINE, actQty, true);
                        }
                        else
                        {
@@ -246,12 +243,13 @@
                    }
                    Suggests.Clear();
                    Suggests = result.Data;
                    var remain = actQty;
                    Suggests.ForEach((inv) =>
                    {
                        if (remain > 0)
                        {
                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, nameof(CurPREP.Order), CurPrepDtl.ORDER_NO, CurPrepDtl.ORDER_LINE, remain, false);
                            inv.poolItem = inv.Item.GetPoolItem(OrgCode, TransID, nameof(CurPREP.Order), CurPrepDtl.ORDER_NO, CurPrepDtl.ORDER_LINE, remain, false);
                            remain -= inv.poolItem.ALLOC_QTY;
                        }
                        else
@@ -290,12 +288,15 @@
        public async Task<ApiAction<BIZ_WMS_PREP_DTL>> GetCurPrepItem()
        {
            var action = new ApiAction<BIZ_WMS_PREP_DTL>();
            var prepDtl = MainDB.Queryable<BIZ_WMS_PREP_DTL>().Where(q => q.ID == CurPrepDtl.ID).First();
            prepDtl.Suggests = Suggests;
            CurPrepDtl = prepDtl;
            CurPREP.Order.Details.RemoveAll(q => q.ID == CurPrepDtl.ID);
            CurPREP.Order.Details.Add(CurPrepDtl);
            action.Data = CurPrepDtl;
            if (!CurPrepDtl.IsNullOrEmpty())
            {
               var prepDtl = MainDB.Queryable<BIZ_WMS_PREP_DTL>().Where(q => q.ID == CurPrepDtl.ID).First();
               prepDtl.Suggests = Suggests;
               CurPrepDtl = prepDtl;
               CurPREP.Order.Details.RemoveAll(q => q.ID == CurPrepDtl.ID);
               CurPREP.Order.Details.Add(CurPrepDtl);
               action.Data = CurPrepDtl;
            }
            return action;
        }
@@ -789,7 +790,7 @@
        /// <returns></returns>
        public async Task<ApiAction> GenerateDlvyBatch(BaseInput input)
        {
            var range = input.Data.ToInt32().GetEnum<BATCH_RANGEs>();
            var range = input.Data.ToInt32().GetEnum<BIZ_WMS_PREP_BTH.BATCH_RANGEs>();
            var action = await CurPREP.Order.BIZ_TYPE.GetEnum<BIZ_WMS_PREP.BIZ_TYPEs>() .GenerateDlvyBatch(this, range);
            return action;
        }
@@ -803,7 +804,7 @@
        {
            ResetScan();
            CurPREP = new(MainDB, UserCode, OrgCode);
            CurPrepDtl = new();
            CurPrepDtl = null;
            CurScanShelf = null;
            base.ResetTrans();
        }
@@ -824,7 +825,7 @@
            //CloseLight(LocationHis).Wait();
            if (!(CurPREP?.Order?.ORDER_NO ?? "").IsNullOrEmpty())
            {
                MainDB.Deleteable<WMS_ITEM_POOL>().Where(x => x.TRANS_NO == CurPREP.Order.ORDER_NO).ExecuteCommand();
                MainDB.Deleteable<WMS_ITEM_POOL>().Where(q => q.TRANS_NO == CurPREP.Order.ORDER_NO || q.TRANS_ID == TransID).ExecuteCommand();
            }
            this.IsFinished = true;