diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs index a2a45e06..3a28f090 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs @@ -28,6 +28,13 @@ namespace Tnb.ProductionMgr.Interfaces /// Task GetPrdMoTaskInfoByStationId(Dictionary dic); + /// + /// 根据工位获取进行中待开工暂停的任务单信息 + /// + /// + /// + Task> GetPrdMoTaskListByStationId(Dictionary dic); + /// /// 外包装根据工位id获取喷码数据 /// diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index ad0bbe82..567eca46 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -2739,6 +2739,33 @@ namespace Tnb.ProductionMgr return prdMoTask; } + /// + /// 根据工位获取进行中待开工暂停的任务单信息 + /// + /// + /// + [HttpPost] + public async Task> GetPrdMoTaskListByStationId(Dictionary dic) + { + string station_id = dic.ContainsKey("station_id") ? dic["station_id"] : ""; + if (string.IsNullOrEmpty(station_id)) + { + throw Oops.Bah("工位错误"); + } + + List list = await _db.Queryable().Where(x => x.workstation_id == station_id && x.parent_id != null && (x.mo_task_status == DictConst.InProgressEnCode || x.mo_task_status == DictConst.ToBeStartedEnCode || x.mo_task_status == DictConst.MoStatusPauseCode )).ToListAsync(); + if (list != null && list.Count>0) + { + foreach (var prdMoTask in list) + { + BasMaterial basMaterial = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.material_id); + prdMoTask.material_name = basMaterial.name; + } + } + + return list; + } + /// /// 外包装根据工位id获取喷码数据 /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAuditType.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAuditType.cs index 27c45e47..2133be7c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAuditType.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAuditType.cs @@ -11,4 +11,4 @@ namespace Tnb.WarehouseMgr.Entities.Enums 反审核 = 0, 审核 = 1, } -} +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs index 1ced5f17..50ddc332 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs @@ -11,6 +11,9 @@ using JNPF.FriendlyException; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.Common.Utils; +using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities.Enums; +using Tnb.QcMgr.Interfaces; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; @@ -30,11 +33,13 @@ namespace Tnb.WarehouseMgr private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; private static Dictionary s_materialMap = new(); + private readonly IQcCheckPlanService _qcCheckPlanService; - public WmsPurchaseAndSaleCommonService(ISqlSugarRepository repo, IUserManager userManager) + public WmsPurchaseAndSaleCommonService(ISqlSugarRepository repo, IUserManager userManager, IQcCheckPlanService qcCheckPlanService) { _db = repo.AsSugarClient(); _userManager = userManager; + _qcCheckPlanService = qcCheckPlanService; } protected async Task> PurchaseAndSaleUpdate(PurchaseAndReceiveUpInput input) @@ -120,6 +125,16 @@ namespace Tnb.WarehouseMgr return await _db.Updateable().SetColumns(it => it.audit_status == (int)input.auditType).Where(it => input.ids.Contains(it.id)).ExecuteCommandHasChangeAsync(); } + protected Task SyncMesData(string maintableId,List materialIds,EnumTriggerEvent triggerEvent) + { + CreateTaskEntity ctEntity = new(); + ctEntity.maintableid = maintableId; + ctEntity.materialids = materialIds; + ctEntity.triggerevent = triggerEvent; + return _qcCheckPlanService.CreateWmsTask(ctEntity); + + } + protected async Task UpdateChackStatus(MesCheckdCallbackUpinput input) where TEntity : BaseEntity, InOutCheckStatusUpdateEntity, new() { var stock = await _db.Queryable().SingleAsync(it => it.id == input.maintableid); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs index 70a14f5f..ba36e7ce 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs @@ -37,13 +37,11 @@ namespace Tnb.WarehouseMgr { private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; - private readonly IQcCheckPlanService _qcCheckPlanService; public WmsPurchaseService(ISqlSugarRepository repo, IUserManager userManager, IQcCheckPlanService qcCheckPlanService) - : base(repo, userManager) + : base(repo, userManager, qcCheckPlanService) { _db = repo.AsSugarClient(); _userManager = userManager; - _qcCheckPlanService = qcCheckPlanService; } private async Task xxx(VisualDevModelDataCrInput input) @@ -89,11 +87,7 @@ namespace Tnb.WarehouseMgr await _db.Insertable(instockDs).ExecuteCommandAsync(); } //通知Mes接口 - CreateTaskEntity ctEntity = new(); - ctEntity.maintableid = instock.id; - ctEntity.materialids = instockDs.Select(x => x.material_id).ToList(); - ctEntity.triggerevent = EnumTriggerEvent.入厂检按物料编号; - _ = _qcCheckPlanService.CreateWmsTask(ctEntity); + _ = SyncMesData(instock.id, instockDs.Select(x => x.material_id).ToList(), EnumTriggerEvent.入厂检按物料编号); await _db.Ado.CommitTranAsync(); } catch (Exception ex) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs index d11fa558..1cc47e88 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs @@ -27,8 +27,9 @@ namespace Tnb.WarehouseMgr private readonly IWmsOutStockService _wmsOutStockService; private readonly IQcCheckPlanService _qcCheckPlanService; - public WmsSaleService(ISqlSugarRepository repo, IUserManager userManager, IWmsOutStockService wmsOutStockService, IQcCheckPlanService qcCheckPlanService) - : base(repo, userManager) + public WmsSaleService(ISqlSugarRepository repo, IUserManager userManager, + IWmsOutStockService wmsOutStockService, IQcCheckPlanService qcCheckPlanService) + : base(repo, userManager, qcCheckPlanService) { _wmsOutStockService = wmsOutStockService; _qcCheckPlanService = qcCheckPlanService; @@ -50,12 +51,7 @@ namespace Tnb.WarehouseMgr visualDevModelDataInput.data["location_code"] = "YCL01-01-01"; (string pkId, List outStockDList) multi = await _wmsOutStockService.OutStockApplyFor(visualDevModelDataInput); - - CreateTaskEntity ctEntity = new(); - ctEntity.maintableid = multi.pkId; - ctEntity.materialids = multi.outStockDList?.Select(x => x.material_id!).ToList() ?? Array.Empty().ToList(); - ctEntity.triggerevent = EnumTriggerEvent.出厂检按入厂频次; - _ = _qcCheckPlanService.CreateWmsTask(ctEntity); + _ = SyncMesData(multi.pkId, multi.outStockDList?.Select(x => x.material_id!).ToList() ?? Array.Empty().ToList(), EnumTriggerEvent.出厂检按入厂频次); return await Task.FromResult(1); }