服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
15 小时以前 d254250296297f391ae8bc1128122e3c9a71243e
Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs
@@ -290,13 +290,13 @@
            var action = new ApiAction<BIZ_WMS_PREP_DTL>();
            if (!CurPrepDtl.IsNullOrEmpty())
            {
               var prepDtl = MainDB.Queryable<BIZ_WMS_PREP_DTL>().Where(q => q.ID == CurPrepDtl.ID).First();
               prepDtl.Suggests = Suggests;
                var prepDtl = MainDB.Queryable<BIZ_WMS_PREP_DTL>().Where(q => q.ID == CurPrepDtl.ID).First();
                prepDtl.Suggests = Suggests;
                prepDtl.Deliverys = MainDB.Queryable<BIZ_WMS_PREP_SN>().Where(q => q.ORDER_NO == CurPrepDtl.ORDER_NO && q.ORDER_LINE == CurPrepDtl.ORDER_LINE && q.STATUS == WMS_ITEM.STATUSs.OffShelf.GetValue()).ToList();
                CurPrepDtl = prepDtl;
               CurPREP.Order.Details.RemoveAll(q => q.ID == CurPrepDtl.ID);
               CurPREP.Order.Details.Add(CurPrepDtl);
               action.Data = CurPrepDtl;
                CurPREP.Order.Details.RemoveAll(q => q.ID == CurPrepDtl.ID);
                CurPREP.Order.Details.Add(CurPrepDtl);
                action.Data = CurPrepDtl;
            }
            return action;
        }
@@ -471,7 +471,8 @@
                //    return action;
                //}
                CurInvItem = inv;
                CurSn = CurInvItem.Items.Select(q => new BIZ_WMS_PREP_SN() {
                CurSn = CurInvItem.Items.Select(q => new BIZ_WMS_PREP_SN()
                {
                    ORDER_NO = CurPREP.Order.ORDER_NO,
                    ORDER_LINE = CurPrepDtl.ORDER_LINE,
                    SN = q.SN,
@@ -527,13 +528,13 @@
                    //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, CurPREP.BizType.GetActReqQty(CurPrepDtl), actQty, CurSn.Sum(q => q.QTY_DLVY));
                    action.Data.Command = "ConfirmExceed";
                    action.Data.Data = new
                    action.Data.Data = new
                    {
                        isExceed,
                        isNeedCut,
                        CurSn,
                    };
                }
                }
                else
                {
                    input.Data = CurSn.ToJson();
@@ -686,7 +687,7 @@
                whUnit = whUnit.IsNullOrEmpty(await MainDB.Queryable<V_WH_UNIT>().Where(t => (t.SHELF_CODE.ToUpper() == Code || t.LOCATION_CODE.ToUpper() == Code) && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync());
                // 扫描货架代码,且为智能货架
                if (!whUnit.IsNullOrEmpty() && whUnit.SHELF_CODE  == Code)
                if (!whUnit.IsNullOrEmpty() && whUnit.SHELF_CODE == Code)
                {
                    CurScanShelf.Shelf = whUnit.Shelf;
                    CurScanShelf.WarehouseCode = whUnit.WH_CODE;
@@ -728,7 +729,7 @@
                    CurScanShelf.Location = whUnit.Location;
                    CurScanShelf.WarehouseCode = whUnit.WH_CODE;
                    CurScanShelf.RegionCode = whUnit.REGION_CODE;
                    CurScanShelf.ShelfCode = whUnit .SHELF_CODE;
                    CurScanShelf.ShelfCode = whUnit.SHELF_CODE;
                    CurScanShelf.LocationCode = whUnit.LOCATION_CODE;
                    CurScanShelf.IsSmartRack = false;
                }
@@ -753,6 +754,38 @@
                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanShelf.ScanException", Code));
            }
            return action;
        }
        /// <summary>
        /// 生成截料条码
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<ApiAction<ScanOutput>> GenerateSNs(BaseInput input)
        {
            var action = new ApiAction<ScanOutput>(new ScanOutput());
            try
            {
                var snlist = input.Options["Snlist"].ToString().JsonToObject<List<BIZ_WMS_PREP_SN>>();
                List<string> SnList = new();
                foreach (var sn in snlist)
                {
                    var metaSn = $"{DI.Resolve<ICodeRuleCache>()["CuttingBarcode"]?.Generate(sn.SN, "/").Data.ToString() ?? ""}" ;
                    SnList.Add(metaSn);
                    sn.ReserveSN = sn.SN;
                    sn.DeliverySN = metaSn;
                }
                // 返回数据
                action.Data.Data = new { Snlist = snlist, Sns = SnList };
                action.LocaleMsg = Biz.L("生成截料条码成功");
            }
            catch (Exception ex)
            {
                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.Scan.ScanException", input.SN));
            }
            return SetOutPutMqttMsg(action, input.Locale);
        }
        /// <summary>
@@ -802,7 +835,7 @@
            var range = input.Data.ToInt32().GetEnum<BIZ_WMS_PREP_BTH.BATCH_RANGEs>();
            //从数据库更新当前单据的所有信息
            CurPREP.Order = MainDB.Queryable<BIZ_WMS_PREP>().Where(q => q.ID == CurPREP.Order.ID).IncludesAllFirstLayer().First();
            var action = await CurPREP.Order.BIZ_TYPE.GetEnum<BIZ_WMS_PREP.BIZ_TYPEs>() .GenerateDlvyBatch(this, range);
            var action = await CurPREP.Order.BIZ_TYPE.GetEnum<BIZ_WMS_PREP.BIZ_TYPEs>().GenerateDlvyBatch(this, range);
            return action;
        }