From 3249a7871c16df9cb7535049b498d594231398e8 Mon Sep 17 00:00:00 2001 From: FanLian Date: Sun, 25 Jun 2023 09:13:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9PDAfeeding=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/WmsFeedbox.cs | 2 +- .../Entity/WmsFeedingrecordCode.cs | 2 +- .../WmsPDACarryReplaceService.cs | 4 +- .../Tnb.WarehouseMgr/WmsPDAFeedingService.cs | 67 ++++++++++--------- 4 files changed, 41 insertions(+), 34 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedbox.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedbox.cs index d4428231..9ad30236 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedbox.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedbox.cs @@ -47,7 +47,7 @@ public partial class WmsFeedbox : BaseEntity /// /// 理论数量 /// - public int qty { get; set; } + public decimal qty { get; set; } /// /// 当前批次 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedingrecordCode.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedingrecordCode.cs index e04c6909..bba6c031 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedingrecordCode.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedingrecordCode.cs @@ -47,7 +47,7 @@ public partial class WmsFeedingrecordCode : BaseEntity /// /// 条码数量 /// - public int codeqty { get; set; } + public decimal codeqty { get; set; } /// /// 单位ID diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs index 7e82e984..bb06bbc8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs @@ -27,14 +27,14 @@ namespace Tnb.WarehouseMgr /// PDA载具更换 /// [OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACEPDA_ID)] - public class WmsPDACarryService : WmsCarryService ,IPdaStroage + public class WmsPDACarryReplaceService : WmsCarryService ,IPdaStroage { private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; private readonly IBillRullService _billRullService; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; - public WmsPDACarryService( + public WmsPDACarryReplaceService( ISqlSugarRepository repository, IUserManager userManager, IBillRullService billRullService, diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs index 69d89454..203e46cb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs @@ -46,7 +46,7 @@ namespace Tnb.WarehouseMgr _billRullService = billRullService; _runService = runService; _visualDevService = visualDevService; - OverideFuncs.CreateAsync = WmsPDABind; + OverideFuncs.CreateAsync = WmsPDAFeedingRecord; } /// @@ -61,7 +61,7 @@ namespace Tnb.WarehouseMgr /// /// /// - private async Task WmsPDABind(VisualDevModelDataCrInput input) + private async Task WmsPDA(VisualDevModelDataCrInput input) { @@ -73,43 +73,50 @@ namespace Tnb.WarehouseMgr VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSFEEDINGRECORDPDA_ID, true); await _runService.Create(templateEntity, input); - var oldCarryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; - var newCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : ""; - var oldCarry = await _db.Queryable().FirstAsync(it => it.id == oldCarryId); - var newCarry = await _db.Queryable().FirstAsync(it => it.id == newCarryId); - if (oldCarry != null && newCarry != null) + var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; + var feedBoxCode = input.data.ContainsKey("feedbox_code") ? input.data["feedbox_code"]?.ToString() : ""; + var carry = await _db.Queryable().FirstAsync(it => it.id == carryId); + var feedBox = await _db.Queryable().FirstAsync(it => it.id == feedBoxCode); + var carryMaterial = await _db.Queryable().FirstAsync(it => it.carry_id == carryId); + var carryCodes = await _db.Queryable().Where(it=>it.carry_id == carryId).ToListAsync(); + if (carry != null && feedBox != null) { - ExChangeCarryInput carryInput = new() { old_carry_id = oldCarry.id, new_carry_id = newCarry.id }; - isOk = await _updateSubCarry(carryInput); - isOk = await _updateSubCarry(carryInput); - isOk = await _updateSubCarry(carryInput); - - newCarry.status = oldCarry.status; - newCarry.carry_status = oldCarry.carry_status; - newCarry.location_id = oldCarry.location_id; - newCarry.location_code = oldCarry.location_code; - newCarry.is_lock = oldCarry.is_lock; - newCarry.out_status = oldCarry.out_status; - newCarry.is_check = oldCarry.is_check; - newCarry.bale_num = oldCarry.bale_num; - newCarry.collocation_scheme_id = oldCarry.collocation_scheme_id; - newCarry.collocation_scheme_code = oldCarry.collocation_scheme_code; - newCarry.source_id = oldCarry.source_id; - newCarry.source_code = oldCarry.source_code; - newCarry.create_id = _userManager.UserId; - newCarry.create_time = DateTime.Now; - var row = await _db.Updateable(newCarry).ExecuteCommandAsync(); - row = await UpdateNullCarry(oldCarry); + feedBox.material_id = carryMaterial.material_id; + feedBox.material_code = carryMaterial.material_code; + feedBox.qty = carryMaterial.qty; + feedBox.batch = carryMaterial?.code_batch!; + feedBox.status = carry.status; + feedBox.create_id = _userManager.UserId; + feedBox.create_time = DateTime.Now; + var row = await _db.Updateable(feedBox).ExecuteCommandAsync(); + foreach(var carryCode in carryCodes) + { + WmsFeedingrecordCode wmsFeedingrecordCode = new(); + wmsFeedingrecordCode.id = SnowflakeIdHelper.NextId(); + wmsFeedingrecordCode.org_id = _userManager.User.OrganizeId; + wmsFeedingrecordCode.record_id = input.data["ReturnIdentity"]?.ToString()!; + wmsFeedingrecordCode.material_id = carryCode.material_id; + wmsFeedingrecordCode.material_code = carryCode.material_code; + wmsFeedingrecordCode.barcode = carryCode.barcode; + wmsFeedingrecordCode.code_batch = carryCode.code_batch; + wmsFeedingrecordCode.codeqty = carryCode.codeqty; + wmsFeedingrecordCode.unit_id = carryCode.unit_id; + wmsFeedingrecordCode.unit_code = carryCode.unit_code; + wmsFeedingrecordCode.create_id = _userManager.UserId; + wmsFeedingrecordCode.create_time = DateTime.Now; + row = await _db.Insertable(wmsFeedingrecordCode).ExecuteCommandAsync(); + } + row = await UpdateNullCarry(carry); isOk = (row > 0); if (!isOk) throw Oops.Oh(ErrorCode.COM1001); } else { - if (oldCarry == null) + if (carry == null) { throw new AppFriendlyException("没有可用的旧载具", 500); } - if (newCarry == null) + if (feedBox == null) { throw new AppFriendlyException("没有可用的新载具", 500); } From 723343885568773edd9cb862132bb93afb3e6346 Mon Sep 17 00:00:00 2001 From: FanLian Date: Sun, 25 Jun 2023 09:15:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs index 203e46cb..1ecf696c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs @@ -61,7 +61,7 @@ namespace Tnb.WarehouseMgr /// /// /// - private async Task WmsPDA(VisualDevModelDataCrInput input) + private async Task WmsPDAFeedingRecord(VisualDevModelDataCrInput input) {