From 967055778f23a4a0ae9a2840d4a3ec84f35803f5 Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Fri, 25 Oct 2024 17:58:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=98=E7=82=B9=E5=8D=95=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20=E6=8A=A5=E8=A1=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/RedisBackGround.cs | 17 +++- .../Consts/ModuleConsts.cs | 6 +- .../Inputs/WmsInventorycheckSubmitInput.cs | 29 +++++++ .../WmsInventorycheckService.cs | 86 +++++++++++++++++++ .../WmsPDACarryBindService.cs | 3 +- .../Tnb.WarehouseMgr/WmsStockReportService.cs | 7 +- 6 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WmsInventorycheckSubmitInput.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr/WmsInventorycheckService.cs diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index e2431145..1bc003b7 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -2390,6 +2390,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA WmsCarryH wmsCarryH = items[0]; + if (wmsCarryH.carry_status == "0") + { + LoggerFloor4DMJ2MJX.LogWarning($"【四楼待灭菌仓到灭菌线】 载具{wmsCarryH.carry_code}状态为空闲,而当前业务中载具应该为占用状态,请检查数据"); + break; + } + //锁定起点库位 await db_Floor4DMJ2MJX.Updateable().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == wmsCarryH.location_id).ExecuteCommandAsync(); //锁定终点库位 @@ -2501,6 +2507,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA LoggerFloor4MJX2MJC.LogWarning($"【四楼灭菌线到解析仓】 托盘号{carry_code}在系统中不存在"); continue; } + if (wmsCarryH.carry_status == "0") + { + LoggerFloor4DMJ2MJX.LogWarning($"【四楼灭菌线到解析仓】 载具{wmsCarryH.carry_code}状态为空闲,而当前业务中载具应该为占用状态,请检查数据"); + break; + } //锁定起点库位 await db_Floor4MJX2MJC.Updateable().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == startlocation.id).ExecuteCommandAsync(); //锁定终点库位 @@ -2634,7 +2645,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA await semaphoreSlim_CPK.WaitAsync(); WmsCarryH wmsCarryH = await db_Floor4DMC2CPK.Queryable().Where(r => r.id == wmsSterilizationInstockH.carry_id).FirstAsync(); - + if (wmsCarryH.carry_status == "0") + { + LoggerFloor4DMJ2MJX.LogWarning($"【四楼灭菌仓到成品库】 载具{wmsCarryH.carry_code}状态为空闲,而当前业务中载具应该为占用状态,请检查数据"); + break; + } if (wmsCarryH.location_id != wmsSterilizationInstockH.location_id) { LoggerFloor4DMC2CPK.LogWarning($"【四楼灭菌仓到成品库】载具{wmsCarryH.carry_code}实际位置与灭菌入库记录位置不一致"); diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs index e56c9c70..c9a653eb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs @@ -119,7 +119,11 @@ public class ModuleConsts /// /// 模块标识-载具更换 /// - public const string MODULE_WMSCARRYREPLACE_ID = "26188532491557";//26188532491557 + public const string MODULE_WMSCARRYREPLACE_ID = "26188532491557"; + /// + /// 模块标识-盘点 + /// + public const string MODULE_WmsInventorycheck_ID = "37804588973589"; /// /// 模块标识-人工扫码入库记录 todo /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WmsInventorycheckSubmitInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WmsInventorycheckSubmitInput.cs new file mode 100644 index 00000000..607a6067 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WmsInventorycheckSubmitInput.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tnb.WarehouseMgr.Entities.Consts; + +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +{ + public class WmsInventorycheckSubmitInput + { + public string erp_line_pk { get; set; } + + public List details { get; set; } + } + + public class WmsInventorycheckSubmitDetailInput + { + public string carry_code { get; set; } + + public string material_id { get; set; } + + public string code_batch { get; set; } + + public string actual_qty { get; set; } + + public string location_id { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInventorycheckService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInventorycheckService.cs new file mode 100644 index 00000000..e6939215 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInventorycheckService.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using JNPF.Common.Core.Manager; +using JNPF.Common.Enums; +using JNPF.EventBus; +using JNPF.FriendlyException; +using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Npgsql; +using SqlSugar; +using Tnb.BasicData.Interfaces; +using Tnb.ProductionMgr.Interfaces; +using Tnb.WarehouseMgr.Entities; +using Tnb.WarehouseMgr.Entities.Consts; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; +using Tnb.WarehouseMgr.Entities.Entity; +using Tnb.WarehouseMgr.Entities.Enums; +using Tnb.WarehouseMgr.Interfaces; + +namespace Tnb.WarehouseMgr +{ + [OverideVisualDev(ModuleConsts.MODULE_WmsInventorycheck_ID)] + public class WmsInventorycheckService : BaseWareHouseService + { + private readonly ISqlSugarClient _db; + private readonly IDictionaryDataService _dictionaryDataService; + private readonly IUserManager _userManager; + private readonly IWareHouseService _wareHouseService; + private readonly IBillRullService _billRullService; + private readonly IPrdInstockService _prdInstockService; + private readonly IThirdApiRecordService _thirdApiRecordService; + private static Dictionary _dicBillCodes = new(); + public WmsInventorycheckService( + ISqlSugarRepository repository, + IDictionaryDataService dictionaryDataService, + IUserManager userManager, + IBillRullService billRullService, + IWareHouseService wareHouseService, + IPrdInstockService prdInstockService, + IThirdApiRecordService thirdApiRecordService, + IEventPublisher eventPublisher + ) + { + _db = repository.AsSugarClient(); + _dictionaryDataService = dictionaryDataService; + _userManager = userManager; + _billRullService = billRullService; + _wareHouseService = wareHouseService; + _thirdApiRecordService = thirdApiRecordService; + _prdInstockService = prdInstockService; + } + + /// + /// 盘点单提交 + /// + /// + /// + [HttpPost] + public async Task Submit(WmsInventorycheckSubmitInput input) + { + try + { + + + return await ToApiResult(HttpStatusCode.OK, "成功"); + } + catch (PostgresException ex) + { + Logger.LogError(ex.Message); + Logger.LogError(ex.StackTrace); + throw new AppFriendlyException($"{ex.Message}", 500); + } + catch (Exception ex) + { + Logger.LogInformation(ex.Message); + Logger.LogInformation(ex.StackTrace); + return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message); + } + } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs index 40e58ff2..85e33fb6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs @@ -198,8 +198,9 @@ namespace Tnb.WarehouseMgr } await _db.Ado.BeginTranAsync(); //入库取终点 //出库起点 - InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_MJC_ID, Size = 1 }; + InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_MJC_ID, Size = 9999 }; List endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); + endLocations = endLocations.Where(r => r.location_code.Contains("MJWC-C")).ToList(); if (endLocations.Count == 0) { throw new AppFriendlyException("没有可用的入库库位", 500); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs index 49a76303..a0b40cd0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs @@ -218,11 +218,14 @@ namespace Tnb.WarehouseMgr } IEnumerable result = null; - + result = await _db.Queryable() .InnerJoin((a, b) => a.id == b.bill_d_id) .InnerJoin((a, b, c) => a.warehouse_id == c.id) - .Select((a,b,c) => new + .InnerJoin((a, b, c, d) => b.material_id == d.id) + .WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d) => b.code_batch.Contains(code_batch)) + .WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d) => b.material_specification.Contains(material_specification)) + .Select((a, b, c) => new { act_start_date = a.act_start_date, act_end_date = a.act_end_date,