服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-12-26 09318297f1a2b732d343ccebce4a514dffc4d495
基础上架更新
已修改2个文件
123 ■■■■ 文件已修改
Tiger.Business.MES/iERP/U9C_MES.cs 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.WMS/Transaction/In_Default.cs 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/iERP/U9C_MES.cs
@@ -86,8 +86,8 @@
            }
            Logger.Scheduler.Info($"物料信息存入实体中,总数:[{items.Count}]");
            db = Biz.Db;
            var dbTran = db.UseTran(() =>
            {
            //var dbTran = db.UseTran(() =>
            //{
                if (items.Any())
                {
                    if (items.Count > 100)
@@ -131,12 +131,12 @@
                        s.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand();
                    }
                }
            });
            if (!dbTran.IsSuccess)
            {
                action.CatchExceptionWithLog(dbTran.ErrorException, $"数据处理失败");
                Logger.Scheduler.Error(action.Message);
            }
            //});
            //if (!dbTran.IsSuccess)
            //{
            //    action.CatchExceptionWithLog(dbTran.ErrorException, $"数据处理失败");
            //    Logger.Scheduler.Error(action.Message);
            //}
            Logger.Scheduler.Info($"物料信息存入数据库,总数:[{items.Count}]");
            action.Message = $"物料信息存入数据库,总数:[{items.Count}]";
            return action;
@@ -340,8 +340,8 @@
            }
            Logger.Scheduler.Info($"客户信息存入实体中,总数:[{items.Count}]");
            db = Biz.Db;
            var dbTran = db.UseTran(() =>
                {
            //var dbTran = db.UseTran(() =>
            //    {
                    if (items.Any())
                    {
                        if (items.Count > 100)
@@ -365,12 +365,12 @@
                        }
                    }
                });
            if (!dbTran.IsSuccess)
            {
                action.CatchExceptionWithLog(dbTran.ErrorException, $"数据处理失败");
                Logger.Scheduler.Error(action.Message);
            }
            //    });
            //if (!dbTran.IsSuccess)
            //{
            //    action.CatchExceptionWithLog(dbTran.ErrorException, $"数据处理失败");
            //    Logger.Scheduler.Error(action.Message);
            //}
            Logger.Scheduler.Info($"客户信息存入数据库,总数:[{items.Count}]");
            action.Message = $"客户信息存入数据库,总数:[{items.Count}]";
            return action;
@@ -414,8 +414,8 @@
            }
            Logger.Scheduler.Info($"供应商信息存入实体中,总数:[{items.Count}]");
            db = Biz.Db;
            var dbTran = db.UseTran(() =>
            {
            //var dbTran = db.UseTran(() =>
            // {
                if (items.Any())
                {
                    if (items.Count > 100)
@@ -439,12 +439,12 @@
                    }
                }
            });
            if (!dbTran.IsSuccess)
            {
                action.CatchExceptionWithLog(dbTran.ErrorException, $"数据处理失败");
                Logger.Scheduler.Error(action.Message);
            }
            //});
            //if (!dbTran.IsSuccess)
            //{
            //    action.CatchExceptionWithLog(dbTran.ErrorException, $"数据处理失败");
            //    Logger.Scheduler.Error(action.Message);
            //}
            Logger.Scheduler.Info($"供应商信息存入数据库,总数:[{items.Count}]");
            action.Message = $"供应商信息存入数据库,总数:[{items.Count}]";
            return action;
Tiger.Business.WMS/Transaction/In_Default.cs
@@ -97,26 +97,26 @@
                        action.LocaleMsg = result.LocaleMsg;
                        return action;
                    }
                    CurInvItem = result.Data as Inventory;
                    var inv = result.Data as Inventory;
                    //验证条码是否正确
                    if (new[] { WMS_ITEM.STATUSs.InStore, WMS_ITEM.STATUSs.Loaded, WMS_ITEM.STATUSs.UseUp }.Contains(CurInvItem.Status))
                    if (new[] { WMS_ITEM.STATUSs.InStore, WMS_ITEM.STATUSs.Loaded, WMS_ITEM.STATUSs.UseUp }.Contains(inv.Status))
                    {
                        action.IsSuccessed = false;
                        //action.LocaleMsg = Biz.L("状态[{0}]异常,请重新扫描");
                        action.LocaleMsg = Biz.L("WMS.Default.ScanItem.StatusException", string.Join(',', CurInvItem.StatusList.Select(q => q.GetDesc())));
                        action.LocaleMsg = Biz.L("WMS.Default.ScanItem.StatusException", string.Join(',', inv.StatusList.Select(q => q.GetDesc())));
                        return action;
                    }
                    //物料验证
                    if (CurInvItem.ItemInfo.IsNullOrEmpty() || CurInvItem.ItemInfo.IS_ACTIVE == "N")
                    if (inv.ItemInfo.IsNullOrEmpty() || inv.ItemInfo.IS_ACTIVE == "N")
                    {
                        action.IsSuccessed = false;
                        //action.LocaleMsg = Biz.L("物料编码[{0}]不存在或者该物料未启用");
                        action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ItemCodeNotExistsOrNotActive", CurInvItem.ItemInfo.ITEM_CODE.IsNullOrEmpty(CurInvItem.Barcode.ItemCode));
                        action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ItemCodeNotExistsOrNotActive", inv.ItemInfo.ITEM_CODE.IsNullOrEmpty(inv.Barcode.ItemCode));
                        return action;
                    }
                    if (CurInvItem.Items.Count == 0)
                    if (inv.Items.Count == 0)
                    {
                        List<WMS_ITEM_HIS> ItemHistorys = new List<WMS_ITEM_HIS>();
                        WMS_ITEM Item;
@@ -124,63 +124,63 @@
                        Item = new()
                        {
                            SN = CurInvItem.Barcode.SN,
                            ITEM_CODE = CurInvItem.Barcode.ItemCode,
                            SN = inv.Barcode.SN,
                            ITEM_CODE = inv.Barcode.ItemCode,
                            AUTH_ORG = input.AuthOption.CurOrg,
                            STATUS = WMS_ITEM.STATUSs.WaitIn.GetValue(),
                            QTY = CurInvItem.Barcode.Qty.ToDecimal(),
                            PROD_DATE = CurInvItem.Barcode.DateCode.ToDateTime(),
                            QTY = inv.Barcode.Qty.ToDecimal(),
                            PROD_DATE = inv.Barcode.DateCode.ToDateTime(),
                            ERP_WH = CurScanShelf.WarehouseCode,
                            UNIT = CurInvItem.Barcode.Unit,
                            UNIT = inv.Barcode.Unit,
                        };
                        WMS_ITEM_HIS his = new(Item, $"标准上架入库");
                        ItemHistorys.Add(his);
                        ItemPkgs = new()
                        {
                            SN = CurInvItem.Barcode.SN,
                            SN = inv.Barcode.SN,
                            AUTH_ORG = input.AuthOption.CurOrg,
                            ITEM_CODE = CurInvItem.Barcode.ItemCode,
                            QTY = CurInvItem.Barcode.Qty.ToDecimal(),
                            ITEM_CODE = inv.Barcode.ItemCode,
                            QTY = inv.Barcode.Qty.ToDecimal(),
                            ERP_WH = CurScanShelf.WarehouseCode,
                            UNIT = CurInvItem.Barcode.Unit,
                            UNIT = inv.Barcode.Unit,
                        };
                        var noExt = CurInvItem.Items.Where(q => !CurInvItem.ItemsExt.Any(s => s.SN == q.SN)).ToList();
                        var noExt = inv.Items.Where(q => !inv.ItemsExt.Any(s => s.SN == q.SN)).ToList();
                        //扩展表不存在时新建
                        foreach (var item in noExt)
                        {
                            CurInvItem.ItemsExt.Add(new()
                            inv.ItemsExt.Add(new()
                            {
                                SN = item.SN,
                                META_SN = CurInvItem.Barcode.MetaSn,
                                QR_CODE = CurInvItem.Barcode.MetaSn
                                META_SN = inv.Barcode.MetaSn,
                                QR_CODE = inv.Barcode.MetaSn
                            });
                        }
                        CurInvItem.Items.Add(Item);
                        CurInvItem.History.Add(his);
                        CurInvItem.Packages.Add(ItemPkgs);
                        inv.Items.Add(Item);
                        inv.History.Add(his);
                        inv.Packages.Add(ItemPkgs);
                    }
                    else if (CurInvItem.Items.Count == 1)
                    else if (inv.Items.Count == 1)
                    {
                        CurInvItem.Items.First().QTY = CurInvItem.Barcode.Qty.ToDecimal();
                        CurInvItem.Items.First().ERP_WH = CurScanShelf.WarehouseCode;
                        CurInvItem.Items.First().AUTH_ORG = input.AuthOption.CurOrg;
                        inv.Items.First().QTY = inv.Barcode.Qty.ToDecimal();
                        inv.Items.First().ERP_WH = CurScanShelf.WarehouseCode;
                        inv.Items.First().AUTH_ORG = input.AuthOption.CurOrg;
                        CurInvItem.Packages.First().QTY = CurInvItem.Barcode.Qty.ToDecimal();
                        CurInvItem.Packages.First().ERP_WH = CurScanShelf.WarehouseCode;
                        CurInvItem.Packages.First().AUTH_ORG = input.AuthOption.CurOrg;
                        inv.Packages.First().QTY = inv.Barcode.Qty.ToDecimal();
                        inv.Packages.First().ERP_WH = CurScanShelf.WarehouseCode;
                        inv.Packages.First().AUTH_ORG = input.AuthOption.CurOrg;
                    }
                    //如果扫描外箱的不能更新数量
                    else
                    {
                        foreach (var item in CurInvItem.Items)
                        foreach (var item in inv.Items)
                        {
                            item.ERP_WH = CurScanShelf.WarehouseCode;
                            item.AUTH_ORG = input.AuthOption.CurOrg;
                        }
                        foreach (var item in CurInvItem.Packages)
                        foreach (var item in inv.Packages)
                        {
                            item.ERP_WH = CurScanShelf.WarehouseCode;
                            item.AUTH_ORG = input.AuthOption.CurOrg;
@@ -188,27 +188,28 @@
                    }
                    //检查物料数量,如果没有则查询雅达条码主档,把数量返回前端确认
                    if (CurInvItem.Items.Any(q => q.QTY <= 0))
                    if (inv.Items.Any(q => q.QTY <= 0))
                    {
                        var qtyList = Biz.DataSource["YadaU9C"].Client.Queryable<mes_MaterialBarCode>().Where(q => CurInvItem.Items.Select(q => q.SN).Contains(q.Code)).ToList();
                        var qtyList = Biz.DataSource["YadaU9C"].Client.Queryable<mes_MaterialBarCode>().Where(q => inv.Items.Select(q => q.SN).Contains(q.Code)).ToList();
                        foreach (var qty in qtyList)
                        {
                            var item = CurInvItem.Items.First(q => q.SN == qty.Code);
                            var item = inv.Items.First(q => q.SN == qty.Code);
                            item.QTY = qty.WhQty;
                        }
                        action.Data.Data = CurInvItem.Items.Select(q => new { q.SN, q.QTY });
                        action.Data.Data = inv.Items.Select(q => new { q.SN, q.QTY });
                        action.Data.Command = Command = "ComfirmQty";
                        //action.LocaleMsg = Biz.L("请确认条码[{0}]的数量是否正确");
                        action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ComfirmQty", input.SN);
                        return action;
                    }
                    CurInvItem = inv;
                }
                //更新已确认物料数量
                if (Command == "ComfirmQty")
                {
                    var qtyList = (input.Data ?? "").JsonToObject<List<WMS_ITEM>>() ?? new List<WMS_ITEM>();
                    if (qtyList.Any(q => q.QTY <= 0))
                    if (!qtyList.Any() || qtyList.Any(q => q.QTY <= 0))
                    {
                        action.IsSuccessed = false;
                        action.Data.Data = CurInvItem.Items.Select(q => new { q.SN, q.QTY });
@@ -278,6 +279,7 @@
                    action.IsSuccessed = false;
                    //action.LocaleMsg = Biz.L("储位[{0}]只能存放一个物料");
                    action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationSingleFailure", nLocation.LOCATION_CODE);
                    CurInvItem = null;
                    return action;
                }
@@ -292,6 +294,7 @@
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = putonResult.LocaleMsg;
                    CurInvItem = null;
                    return action;
                }
                PutOnInfo putOnInfo = putonResult.Data;