From 14aa0b2ff4d099914f7cd8348367a4a986c59069 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Wed, 8 Nov 2023 09:31:18 +0800 Subject: [PATCH 1/7] 1 --- EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs | 1 + EquipMgr/Tnb.EquipMgr/EqpDaqService.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs index 1f466b7d..bba88bd4 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs @@ -9,6 +9,7 @@ namespace Tnb.EquipMgr.Entities.Dto public string? data_type { get; set; } public string? enabled { get; set; } public string? equip_id { get; set; } + public string? equip_code { get; set; } public string? label_name { get; set; } public string? label_point { get; set; } public string? remark { get; set; } diff --git a/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs b/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs index a2eb3303..5355f084 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs @@ -53,6 +53,7 @@ namespace Tnb.EquipMgr data_type = a.data_type, enabled = a.enabled == 1 ? "是" : "否", equip_id = a.equip_id, + equip_code = a.equip_code, label_name = a.label_name, label_point = a.label_point, remark = a.remark From 7f6bb604fd1d577658a82005ded0d03cd5455e88 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Wed, 8 Nov 2023 09:59:10 +0800 Subject: [PATCH 2/7] bug --- .../Tnb.ProductionMgr.Entities/Entity/PrdOutstockH.cs | 2 +- ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs | 2 +- ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockH.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockH.cs index 787a4198..5d31f9a8 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockH.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockH.cs @@ -63,7 +63,7 @@ public partial class PrdOutstockH : BaseEntity /// /// 发料工位 /// - public string? workstation { get; set; } + public string? workstation_id { get; set; } /// /// 所属产线 diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 08625689..9a675eb6 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -544,7 +544,7 @@ namespace Tnb.ProductionMgr var queryable2 = db.Queryable() .LeftJoin((a, b) => a.create_id == b.Id) - .Where((a,b)=>a.workstation==input.stationId) + .Where((a,b)=>a.workstation_id==input.stationId) .Select((a, b) => new FeedingRecordListOutput() { id = a.id, diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs index 597ab613..afa9dd37 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs @@ -206,7 +206,7 @@ namespace Tnb.ProductionMgr org_id = _userManager.GetUserInfo().Result.organizeId, bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), create_time = DateTime.Now, - workstation = generalOutstockInput.workstation_id, + workstation_id = generalOutstockInput.workstation_id, workline = workline?.Id ?? "" }; @@ -325,7 +325,7 @@ namespace Tnb.ProductionMgr prdOutstockH.org_id = _userManager.GetUserInfo().Result.organizeId; prdOutstockH.bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); prdOutstockH.create_time = DateTime.Now; - prdOutstockH.workstation = materialOutstockInput.workstation_id; + prdOutstockH.workstation_id = materialOutstockInput.workstation_id; prdOutstockH.workline = workline?.Id ?? ""; List prdOutstockDs = new List(); From 7f15f7c59f103805a84e96b08a00ebe304746978 Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Wed, 8 Nov 2023 10:38:52 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E9=87=87=E8=B4=AD=E6=94=B6=E8=B4=A7?= =?UTF-8?q?=E3=80=81=E9=94=80=E5=94=AE=E5=8F=91=E8=B4=A7=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=AE=A1=E6=A0=B8=E3=80=81=E5=8F=8D=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/Inputs/PurchaseAndSaleAuditUpInput.cs | 25 ++++++ .../Constraints/IPurchaseAndSaleAuitEntity.cs | 16 ++++ .../Entity/WmsPurchaseH.cs | 3 +- .../Entity/WmsSaleH.cs | 3 +- .../Enums/EnumAuditType.cs | 14 ++++ .../Tnb.WarehouseMgr/WmsOutStockService.cs | 13 +++- .../WmsPurchaseAndSaleCommonService.cs | 78 ++++++++----------- .../Tnb.WarehouseMgr/WmsPurchaseService.cs | 19 ++++- .../Tnb.WarehouseMgr/WmsSaleService.cs | 47 +++++++++-- 9 files changed, 161 insertions(+), 57 deletions(-) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/PurchaseAndSaleAuditUpInput.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IPurchaseAndSaleAuitEntity.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAuditType.cs diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/PurchaseAndSaleAuditUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/PurchaseAndSaleAuditUpInput.cs new file mode 100644 index 00000000..34944d0c --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/PurchaseAndSaleAuditUpInput.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tnb.WarehouseMgr.Entities.Enums; + +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +{ + /// + /// 采购收货,销售发货,审核、审核反审核 输入参数 + /// + public class PurchaseAndSaleAuditUpInput + { + /// + /// 要更新的id集合列表 + /// + public List ids { get; set; } + /// + /// 1、审核 2、反审核 + /// + public EnumAuditType auditType { get; set; } + + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IPurchaseAndSaleAuitEntity.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IPurchaseAndSaleAuitEntity.cs new file mode 100644 index 00000000..0e1d9728 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IPurchaseAndSaleAuitEntity.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Entity.Constraints +{ + public interface IPurchaseAndSaleAuitEntity + { + /// + /// 审核状态 + /// + public int? audit_status { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs index 78b24706..fd0c9f7f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs @@ -1,6 +1,7 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; +using Tnb.WarehouseMgr.Entities.Entity.Constraints; namespace Tnb.WarehouseMgr.Entities; @@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities; /// 采购收货主表 /// [SugarTable("wms_purchase_h")] -public partial class WmsPurchaseH : BaseEntity +public partial class WmsPurchaseH : BaseEntity, IPurchaseAndSaleAuitEntity { public WmsPurchaseH() { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSaleH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSaleH.cs index 269fb93c..24e35d0b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSaleH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSaleH.cs @@ -1,6 +1,7 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; +using Tnb.WarehouseMgr.Entities.Entity.Constraints; namespace Tnb.WarehouseMgr.Entities; @@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities; /// 销售发货主表 /// [SugarTable("wms_sale_h")] -public partial class WmsSaleH : BaseEntity +public partial class WmsSaleH : BaseEntity, IPurchaseAndSaleAuitEntity { public WmsSaleH() { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAuditType.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAuditType.cs new file mode 100644 index 00000000..90aeb6b5 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAuditType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Enums +{ + public enum EnumAuditType + { + 审核 = 1, + 反审核 = 2, + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index 355db6b3..95856a78 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -131,10 +131,19 @@ namespace Tnb.WarehouseMgr List carryIds = new(); + var mapKeys = new List { "tablefield120", "details" }; //tablefield120 出库物料明细 - if (input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull()) + if (input.data.Keys.Where(k => mapKeys.Contains(k)).Any()) //input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull() { - List outStockDList = input.data["tablefield120"].ToObject>(); + List outStockDList = new(); + if (input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull()) + { + outStockDList = input.data["tablefield120"].ToObject>(); + } + else + { + outStockDList = input.data["details"].ToObject>(); + } if (outStockDList?.Count > 0) { List carryMats = new(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs index a0288bf5..7e6db845 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs @@ -13,6 +13,7 @@ using Tnb.Common.Utils; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Entity.Constraints; using Tnb.WarehouseMgr.Interfaces; @@ -21,71 +22,53 @@ namespace Tnb.WarehouseMgr /// /// 采购收货、销售发货,通用业务类 /// - /// - public class WmsPurchaseAndSaleCommonService : BaseWareHouseService where TEntity : BaseEntity, IPurchaseAndSaleEntity, IPurchaseAndSaleQueryEntity + /// + public class WmsPurchaseAndSaleCommonService : BaseWareHouseService where TSubEntity : BaseEntity, IPurchaseAndSaleEntity, IPurchaseAndSaleQueryEntity { private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; - private readonly IWmsPDAScanInStockService _wmsPDAScanInStockService; - private readonly IWmsOutStockService _wmsOutStockService; private static Dictionary s_materialMap = new(); - public WmsPurchaseAndSaleCommonService(ISqlSugarRepository repo, IUserManager userManager, IWmsOutStockService? wmsOutStockService = null) + public WmsPurchaseAndSaleCommonService(ISqlSugarRepository repo, IUserManager userManager) { _db = repo.AsSugarClient(); _userManager = userManager; - _wmsOutStockService = wmsOutStockService!; } - protected async Task PurchaseAndSaleUpdate(PurchaseAndReceiveUpInput input) + protected async Task> PurchaseAndSaleUpdate(PurchaseAndReceiveUpInput input) { if (input == null) throw new ArgumentNullException("input"); if (input.details == null) throw new ArgumentNullException(nameof(input.details)); - - var dicMaterialPurchaseArriveQty = input.details.ToDictionary(x => x.material_id, x => x.purchase_arriveqty); var materialIds = input.details.Select(x => x.material_id).ToList(); - var purchaseDs = await _db.Queryable().Where(it => materialIds.Contains(it.material_id)).ToListAsync(); + var purchaseDs = await _db.Queryable().Where(it => materialIds.Contains(it.material_id)).ToListAsync(); if (purchaseDs?.Count > 0) { var errMaterialTipList = new List<(string materialName, decimal purchaseArriveQty, decimal topPurchaseQty)>(); + foreach (var pd in purchaseDs) { - pd.purchase_prqty += dicMaterialPurchaseArriveQty.ContainsKey(pd.material_id) ? dicMaterialPurchaseArriveQty[pd.material_id] : 0; var pdInput = input.details.Find(x => x.material_id == pd.material_id); if (pdInput != null) { + pd.purchase_prqty += pdInput.purchase_arriveqty; + var topPurchaseQty = pd.purchase_qty - pd.purchase_prqty; - if (pdInput.purchase_arriveqty > topPurchaseQty) + if (pdInput.purchase_arriveqty > topPurchaseQty && s_materialMap.ContainsKey(pdInput.material_id) && s_materialMap[pdInput.material_id] != null) { - if (s_materialMap.ContainsKey(pdInput.material_id) && s_materialMap[pdInput.material_id] != null) - { - errMaterialTipList.Add((s_materialMap[pdInput.material_id].ToString()!, pdInput.purchase_arriveqty, topPurchaseQty)); - continue; - } + errMaterialTipList.Add((s_materialMap[pdInput.material_id].ToString()!, pdInput.purchase_arriveqty, topPurchaseQty)); + continue; } } - if (pd.purchase_prqty >= pd.purchase_qty) - { - pd.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID; - } - else - { - pd.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID; - } + + pd.line_status = pd.purchase_prqty >= pd.purchase_qty ? WmsWareHouseConst.BILLSTATUS_COMPLETE_ID : WmsWareHouseConst.BILLSTATUS_ON_ID; } + if (errMaterialTipList.Count > 0) { - var errMsgList = new List(); - if (typeof(TEntity) == typeof(WmsPurchaseD)) - { - errMsgList = errMaterialTipList.Select(x => $"物料:{x.materialName},实际收货数:{x.purchaseArriveQty}已超出可收货数:{x.topPurchaseQty}").ToList(); - } - else - { - errMsgList = errMaterialTipList.Select(x => $"物料:{x.materialName},实际发货数:{x.purchaseArriveQty}已超出可发货数:{x.topPurchaseQty}").ToList(); - } + var itemType = typeof(TSubEntity) == typeof(WmsPurchaseD) ? "收货数" : "发货数"; + var errMsgList = errMaterialTipList.Select(x => $"物料:{x.materialName},实际{itemType}:{x.purchaseArriveQty}已超出可{itemType}:{x.topPurchaseQty}").ToList(); var errMsg = string.Join("\r\n", errMsgList); throw new AppFriendlyException(errMsg, 500); } @@ -95,40 +78,45 @@ namespace Tnb.WarehouseMgr x.modify_id = _userManager.UserId; x.modify_time = DateTime.Now; }); + await _db.Updateable(purchaseDs).ExecuteCommandAsync(); + if (purchaseDs.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) { - var purchase = await _db.Queryable().FirstAsync(it => it.bill_code == input.bill_code); + var purchase = await _db.Queryable().FirstAsync(it => it.id == purchaseDs.First().bill_id); + if (purchase != null) { purchase.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID; purchase.modify_id = _userManager.UserId; purchase.modify_time = DateTime.Now; + await _db.Updateable(purchase).UpdateColumns(it => it.status).ExecuteCommandAsync(); } } } - VisualDevModelDataCrInput visualDevModelDataInput = new(); - visualDevModelDataInput.data = PocoToDictionary.ToDictionary(input) as Dictionary; - if (_wmsOutStockService != null) - { - await _wmsOutStockService.OutStockApplyFor(visualDevModelDataInput); - } - - return await Task.FromResult(true); + + return await Task.FromResult(purchaseDs); } - protected async Task> GetDetailsByPkId(string pkId) + + protected async Task> GetDetailsByPkId(string pkId) { if (s_materialMap.Count == 0) { s_materialMap = await _db.Queryable().ToDictionaryAsync(x => x.id, x => x.name); } - var list = await _db.Queryable().Where(it => it.bill_id == pkId) + var list = await _db.Queryable().Where(it => it.bill_id == pkId) .Mapper(it => it.material_name = s_materialMap.ContainsKey(it.material_id) ? s_materialMap[it.material_id]?.ToString() ?? "" : "") .ToListAsync(); return list; } + + protected async Task Audit(PurchaseAndSaleAuditUpInput input) where TEntity : BaseEntity, IPurchaseAndSaleAuitEntity, new() + { + return await _db.Updateable().SetColumns(it => it.audit_status == (int)input.auditType).Where(it => input.ids.Contains(it.id)).ExecuteCommandHasChangeAsync(); + } + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs index 293ffdb2..a340f849 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs @@ -63,8 +63,8 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - blFlag = await PurchaseAndSaleUpdate(input); - if (blFlag) + var purchaseDs = await PurchaseAndSaleUpdate(input); + if (purchaseDs?.Count > 0) { var instock = input.Adapt(); instock.id = SnowflakeIdHelper.NextId(); @@ -73,7 +73,7 @@ namespace Tnb.WarehouseMgr instock.org_id = _userManager.User.OrganizeId; await _db.Insertable(instock).ExecuteCommandAsync(); - var instockD = input.details.Adapt(); + var instockD = purchaseDs.Adapt(); instockD.create_id = _userManager.UserId; instockD.create_time = DateTime.Now; instockD.org_id = _userManager.User.OrganizeId; @@ -101,5 +101,18 @@ namespace Tnb.WarehouseMgr { return await GetDetailsByPkId(id); } + + /// + /// 审核反审核 + /// + /// + /// + /// + /// + [HttpPost] + public async Task Audit(PurchaseAndSaleAuditUpInput input) + { + return await Audit(input); + } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs index 4c59a752..47b614c5 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs @@ -4,10 +4,14 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using JNPF.Common.Core.Manager; +using JNPF.Common.Dtos.VisualDev; +using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; +using Tnb.Common.Utils; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -17,23 +21,56 @@ namespace Tnb.WarehouseMgr /// public class WmsSaleService : WmsPurchaseAndSaleCommonService { + private readonly IWmsOutStockService _wmsOutStockService; + public WmsSaleService(ISqlSugarRepository repo, IUserManager userManager, IWmsOutStockService wmsOutStockService) - : base(repo, userManager, wmsOutStockService: wmsOutStockService) + : base(repo, userManager) { - + _wmsOutStockService = wmsOutStockService; } - + /// + /// 销售发货 + /// + /// + /// + /// + /// [HttpPost] public async Task Sale(PurchaseAndReceiveUpInput input) { - return await PurchaseAndSaleUpdate(input); + _ = await PurchaseAndSaleUpdate(input); + VisualDevModelDataCrInput visualDevModelDataInput = new(); + visualDevModelDataInput.data = PocoToDictionary.ToDictionary(input) as Dictionary; + visualDevModelDataInput.data["location_id"] = "26412597341221"; + visualDevModelDataInput.data["location_code"] = "YCL01-01-01"; + if (_wmsOutStockService != null) + { + await _wmsOutStockService.OutStockApplyFor(visualDevModelDataInput); + } + return await Task.FromResult(1); } - + /// + /// 根据销售发货主表Id获取子表明细 + /// + /// + /// [HttpGet("id")] public async Task GetSaleDetailsByBillId(string id) { return await GetDetailsByPkId(id); } + /// + /// 审核反审核 + /// + /// + /// + /// + /// + [HttpPost] + public async Task Audit(PurchaseAndSaleAuditUpInput input) + { + return await Audit(input); + } } } From c9d053a6d8906131219fba63008c1b39977aa202 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Wed, 8 Nov 2023 10:50:18 +0800 Subject: [PATCH 4/7] bug --- ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 9a675eb6..29b7c2fe 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -570,7 +570,7 @@ namespace Tnb.ProductionMgr var db = _repository.AsSugarClient(); if (input.type == "0") { - var result = db.Queryable() + var result = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a,b,c)=>c.EnCode==DictConst.MeasurementUnit) .LeftJoin((a,b,c,d)=>d.DictionaryTypeId==c.Id && a.unit_id==d.Id) @@ -588,7 +588,7 @@ namespace Tnb.ProductionMgr } else { - var result = db.Queryable() + var result = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a,b,c)=>c.EnCode==DictConst.MeasurementUnit) .LeftJoin((a,b,c,d)=>d.DictionaryTypeId==c.Id && a.unit_id==d.Id) From 30b40fb28eddcc1375a047a78e988ed60f271f7b Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Wed, 8 Nov 2023 11:01:37 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E9=A2=86=E6=96=99=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8A=B6=E6=80=81=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 29b7c2fe..842c6e30 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -519,6 +519,7 @@ namespace Tnb.ProductionMgr Dictionary queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary() : input.queryJson.ToObject>(); string? code = queryJson.ContainsKey("code") ? queryJson["code"].ToString() : ""; + string? status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : ""; // DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["start_time"]) : null; // DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["end_time"]) : null; @@ -531,6 +532,7 @@ namespace Tnb.ProductionMgr var queryable1 = db.Queryable() .LeftJoin((a, b) => a.create_id == b.Id) .Where((a,b)=>a.workstation_id==input.stationId) + .WhereIF(!string.IsNullOrEmpty(status),a=>a.status==status) .Select((a, b) => new FeedingRecordListOutput() { id = a.id, @@ -545,6 +547,7 @@ namespace Tnb.ProductionMgr var queryable2 = db.Queryable() .LeftJoin((a, b) => a.create_id == b.Id) .Where((a,b)=>a.workstation_id==input.stationId) + .WhereIF(!string.IsNullOrEmpty(status),a=>a.status==status) .Select((a, b) => new FeedingRecordListOutput() { id = a.id, From bd739b3060185e607a578aea6e42a75e4dc92400 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Wed, 8 Nov 2023 14:06:40 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E9=BD=90=E5=A5=97=E5=87=BA=E5=BA=93=20?= =?UTF-8?q?=E4=B8=80=E8=88=AC=E5=87=BA=E5=BA=93=20=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E6=B7=BB=E5=8A=A0=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/DictConst.cs | 35 ++++++++++++++++ .../PrdKittingOutChangeStatusInput.cs | 20 +++++++++ .../IPrdKittingOutService.cs | 9 +++- .../Tnb.ProductionMgr/PrdFeedingService.cs | 38 ++++++++++++++--- .../Tnb.ProductionMgr/PrdKittingOutService.cs | 40 +++++++++++++++++- .../Tnb.ProductionMgr/PrdOutstockService.cs | 42 ++++++++++++------- 6 files changed, 159 insertions(+), 25 deletions(-) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdKittingOutChangeStatusInput.cs diff --git a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs index ab3fad04..8fa89a1b 100644 --- a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs +++ b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs @@ -179,6 +179,41 @@ public static class DictConst /// public const string SHENGCHANBULIAO = "24"; + /// + /// 出入库单据状态code + /// + public const string DOCUMENTSTATU = "DocumentStatu"; + + /// + /// 出库单据状态新增 + /// + public const string OUTSTOCKSTATUSADD = "1"; + + /// + /// 出库单据状态作业中 + /// + public const string OUTSTOCKSTATUSWORKING = "2"; + + /// + /// 出库单据状态已呼叫 + /// + public const string OUTSTOCKSTATUSCALLED = "3"; + + /// + /// 出库单据状态待配送 + /// + public const string OUTSTOCKSTATUSTOBEDELIVERED = "4"; + + /// + /// 出库单据状态取消 + /// + public const string OUTSTOCKSTATUSCANCEL = "7"; + + /// + /// 出库单据状态完成 + /// + public const string OUTSTOCKSTATUSCOMPLETED = "8"; + #endregion diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdKittingOutChangeStatusInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdKittingOutChangeStatusInput.cs new file mode 100644 index 00000000..94cfd047 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdKittingOutChangeStatusInput.cs @@ -0,0 +1,20 @@ +namespace Tnb.ProductionMgr.Entities.Dto +{ + public class PrdKittingOutChangeStatusInput + { + /// + /// 来源单号 + /// + public string code { get; set; } + + /// + /// 0 齐套出库 1 一般出库 2 物料出库 + /// + public string type { get; set; } + + /// + /// 状态 + /// + public string status { get; set; } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs index a9e6babd..91b17a8c 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs @@ -1,3 +1,5 @@ +using Tnb.ProductionMgr.Entities.Dto; + namespace Tnb.ProductionMgr.Interfaces { /// @@ -5,6 +7,11 @@ namespace Tnb.ProductionMgr.Interfaces /// public interface IPrdKittingOutService { - + /// + /// 齐套出库 一般出库 物料出库 改状态 + /// + /// + /// + public Task ChangeStatusById(List inputs); } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 842c6e30..4087a392 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -528,12 +528,35 @@ namespace Tnb.ProductionMgr input.sidx = "create_time"; input.sort = "desc"; } + + List statusList = new(); + if (!string.IsNullOrEmpty(status)) + { + switch (status) + { + case "1": + statusList.Add(DictConst.OUTSTOCKSTATUSADD); + statusList.Add(DictConst.OUTSTOCKSTATUSCALLED); + break; + case "2": + statusList.Add(DictConst.OUTSTOCKSTATUSTOBEDELIVERED); + statusList.Add(DictConst.OUTSTOCKSTATUSWORKING); + break; + case "3": + statusList.Add(DictConst.OUTSTOCKSTATUSCANCEL); + statusList.Add(DictConst.OUTSTOCKSTATUSCOMPLETED); + break; + } + } var queryable1 = db.Queryable() .LeftJoin((a, b) => a.create_id == b.Id) + .LeftJoin((a,b,c)=>a.id==c.source_id) + .LeftJoin((a,b,c,d)=>d.EnCode==DictConst.DOCUMENTSTATU) + .LeftJoin((a,b,c,d,e)=>e.DictionaryTypeId==d.Id && c.status==e.Id) .Where((a,b)=>a.workstation_id==input.stationId) - .WhereIF(!string.IsNullOrEmpty(status),a=>a.status==status) - .Select((a, b) => new FeedingRecordListOutput() + .WhereIF(statusList.Count>0,(a,b,c,d,e)=>statusList.Contains(e.EnCode)) + .Select((a, b,c,d,e) => new FeedingRecordListOutput() { id = a.id, code = a.code, @@ -541,14 +564,17 @@ namespace Tnb.ProductionMgr type = "0", create_name = b.RealName, create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), - status = a.status + status = e.FullName }); var queryable2 = db.Queryable() .LeftJoin((a, b) => a.create_id == b.Id) + .LeftJoin((a,b,c)=>a.id==c.source_id) + .LeftJoin((a,b,c,d)=>d.EnCode==DictConst.DOCUMENTSTATU) + .LeftJoin((a,b,c,d,e)=>e.DictionaryTypeId==d.Id && c.status==e.Id) .Where((a,b)=>a.workstation_id==input.stationId) - .WhereIF(!string.IsNullOrEmpty(status),a=>a.status==status) - .Select((a, b) => new FeedingRecordListOutput() + .WhereIF(statusList.Count>0,(a,b,c,d,e)=>statusList.Contains(e.EnCode)) + .Select((a, b,c,d,e) => new FeedingRecordListOutput() { id = a.id, code = a.bill_code, @@ -556,7 +582,7 @@ namespace Tnb.ProductionMgr type = a.type, create_name = b.RealName, create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), - status = a.status + status = e.FullName }); var result = await db.UnionAll(queryable1,queryable2) .MergeTable() diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs index cbff6ef9..7bc067f5 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs @@ -165,6 +165,7 @@ namespace Tnb.ProductionMgr public async Task KittingOut(KittingOutInput kittingOutInput) { PrdKittingOutH prdKittingOutH = new(); + prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE); try { ISqlSugarClient db = _repository.AsSugarClient(); @@ -184,6 +185,7 @@ namespace Tnb.ProductionMgr collocation_scheme_id = kittingOutInput.collocation_scheme_id, collocation_scheme_code = kittingOutInput.collocation_scheme_code, source_id = prdKittingOutH.id, + source_code = prdKittingOutH.code, create_id = _userManager.UserId, wmsKittingoutDs = new List(), } @@ -205,7 +207,6 @@ namespace Tnb.ProductionMgr } else { - prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE); prdKittingOutH.warehouse_id = kittingOutInput.warehouse_id; prdKittingOutH.location_code = kittingOutInput.location_code; prdKittingOutH.material_id = kittingOutInput.material_id; @@ -274,6 +275,7 @@ namespace Tnb.ProductionMgr public async Task KittingOutNew(KittingOutNewInput kittingOutInput) { PrdKittingOutH prdKittingOutH = new(); + prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE); string warehouse_id = "26103348825381";//二楼缓存仓 try { @@ -310,6 +312,7 @@ namespace Tnb.ProductionMgr collocation_scheme_id = kittingOutInput.collocation_scheme_id, collocation_scheme_code = wmsCollocationSchemeH.bill_code, source_id = prdKittingOutH.id, + source_code = prdKittingOutH.code, create_id = _userManager.UserId, wmsKittingoutDs = new List(), } @@ -344,7 +347,6 @@ namespace Tnb.ProductionMgr } else { - prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE); prdKittingOutH.warehouse_id = warehouse_id; prdKittingOutH.location_code = kittingOutInput.location_code; prdKittingOutH.material_id = basMaterial.id; @@ -358,6 +360,7 @@ namespace Tnb.ProductionMgr prdKittingOutH.create_id = _userManager.UserId; prdKittingOutH.create_time = DateTime.Now; prdKittingOutH.org_id = _userManager.GetUserInfo().Result.organizeId; + prdKittingOutH.status = DictConst.OUTSTOCKSTATUSADD; List prdKittingOutDs = new(); foreach (WmsCollocationSchemeD item in wmsCollocationSchemeDs) { @@ -401,5 +404,38 @@ namespace Tnb.ProductionMgr } } + + /// + /// 齐套出库 一般出库 物料出库 改状态 + /// + /// + /// + [HttpPost] + public async Task ChangeStatusById(List inputs) + { + // if(string.IsNullOrEmpty(input.code) || string.IsNullOrEmpty(input.type) || string.IsNullOrEmpty(input.status)) + // throw Oops.Bah("参数错误"); + if (inputs == null || inputs.Count <= 0) + { + throw Oops.Bah("参数错误"); + } + + ISqlSugarClient db = _repository.AsSugarClient(); + + foreach (var input in inputs) + { + if (input.type == "0") + { + await db.Updateable().SetColumns(x => x.status == input.status) + .Where(x => x.code == input.code).ExecuteCommandAsync(); + }else if (input.type == "1" || input.type == "2") + { + await db.Updateable().SetColumns(x => x.status == input.status) + .Where(x => x.bill_code == input.code).ExecuteCommandAsync(); + } + } + + return true; + } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs index afa9dd37..d677dcf0 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs @@ -147,6 +147,11 @@ namespace Tnb.ProductionMgr string locationId = location.id; + PrdOutstockH prdOutstockH = new() + { + bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE), + }; + input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO; // input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now; input.outstock.bill_date = DateTime.Now; @@ -154,6 +159,8 @@ namespace Tnb.ProductionMgr input.outstock.warehouse_id = warehouse_id; input.outstock.create_id = _userManager.UserId; input.outstock.location_code = location?.location_code ?? ""; + input.outstock.source_code = prdOutstockH.bill_code; + input.outstock.source_id = prdOutstockH.id; OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(generalOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode); List materialIds = generalOutstockInput.details.Select(x => x.material_id).ToList(); @@ -195,20 +202,17 @@ namespace Tnb.ProductionMgr } else { - PrdOutstockH prdOutstockH = new() - { - bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE), - bill_type = DictConst.SHENGCHANLINGLIAO, - type = "1", - warehouse_id = warehouse_id, - location_code = generalOutstockInput.location_code, - create_id = _userManager.UserId, - org_id = _userManager.GetUserInfo().Result.organizeId, - bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), - create_time = DateTime.Now, - workstation_id = generalOutstockInput.workstation_id, - workline = workline?.Id ?? "" - }; + prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO; + prdOutstockH.type = "1"; + prdOutstockH.warehouse_id = warehouse_id; + prdOutstockH.location_code = generalOutstockInput.location_code; + prdOutstockH.create_id = _userManager.UserId; + prdOutstockH.org_id = _userManager.GetUserInfo().Result.organizeId; + prdOutstockH.bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + prdOutstockH.create_time = DateTime.Now; + prdOutstockH.workstation_id = generalOutstockInput.workstation_id; + prdOutstockH.workline = workline?.Id ?? ""; + prdOutstockH.status = DictConst.OUTSTOCKSTATUSADD; List prdOutstockDs = new(); foreach (GeneralOutstockDInput item in generalOutstockInput.details) @@ -266,6 +270,11 @@ namespace Tnb.ProductionMgr BasLocation location = await db.Queryable().Where(x=>x.location_code==materialOutstockInput.location_code).FirstAsync(); if (location == null) throw Oops.Bah("未找到库位"); string locationId = location.id; + + PrdOutstockH prdOutstockH = new() + { + bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE), + }; input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO; // input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now; @@ -274,6 +283,8 @@ namespace Tnb.ProductionMgr input.outstock.warehouse_id = warehouse_id; input.outstock.create_id = _userManager.UserId; input.outstock.location_code = location?.location_code ?? ""; + input.outstock.source_code = prdOutstockH.bill_code; + input.outstock.source_id = prdOutstockH.id; OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(materialOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode); List materialIds = materialOutstockInput.details.Select(x => x.material_id).ToList(); @@ -315,8 +326,6 @@ namespace Tnb.ProductionMgr } else { - PrdOutstockH prdOutstockH = new PrdOutstockH(); - prdOutstockH.bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE); prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO; prdOutstockH.type = "2"; prdOutstockH.warehouse_id = warehouse_id; @@ -327,6 +336,7 @@ namespace Tnb.ProductionMgr prdOutstockH.create_time = DateTime.Now; prdOutstockH.workstation_id = materialOutstockInput.workstation_id; prdOutstockH.workline = workline?.Id ?? ""; + prdOutstockH.status = DictConst.OUTSTOCKSTATUSADD; List prdOutstockDs = new List(); foreach (var item in materialOutstockInput.details) From 6521b98cc87540dc2618e333ed87f8cef1e991e9 Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Wed, 8 Nov 2023 15:54:51 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WmsOutStockService.cs | 2 +- .../Tnb.WarehouseMgr/WmsPurchaseService.cs | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index 95856a78..3b3fa05a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -133,7 +133,7 @@ namespace Tnb.WarehouseMgr List carryIds = new(); var mapKeys = new List { "tablefield120", "details" }; //tablefield120 出库物料明细 - if (input.data.Keys.Where(k => mapKeys.Contains(k)).Any()) //input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull() + if (input.data.Keys.Any(k => mapKeys.Contains(k))) //input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull() { List outStockDList = new(); if (input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull()) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs index a340f849..35225662 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs @@ -62,23 +62,28 @@ namespace Tnb.WarehouseMgr try { await _db.Ado.BeginTranAsync(); - + WmsInstockH? instock = null; var purchaseDs = await PurchaseAndSaleUpdate(input); + List instockDs = new(); if (purchaseDs?.Count > 0) { - var instock = input.Adapt(); + instock = input.Adapt(); instock.id = SnowflakeIdHelper.NextId(); instock.create_id = _userManager.UserId; instock.create_time = DateTime.Now; instock.org_id = _userManager.User.OrganizeId; await _db.Insertable(instock).ExecuteCommandAsync(); - var instockD = purchaseDs.Adapt(); - instockD.create_id = _userManager.UserId; - instockD.create_time = DateTime.Now; - instockD.org_id = _userManager.User.OrganizeId; - await _db.Insertable(instockD).ExecuteCommandAsync(); + instockDs = purchaseDs.Adapt>(); + instockDs.ForEach(instockD => + { + instockD.create_id = _userManager.UserId; + instockD.create_time = DateTime.Now; + instockD.org_id = _userManager.User.OrganizeId; + }); + await _db.Insertable(instockDs).ExecuteCommandAsync(); } + //通知Mes接口 await _db.Ado.CommitTranAsync(); }