diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasDefect/DefectOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasDefect/DefectOutput.cs new file mode 100644 index 00000000..dcf2811c --- /dev/null +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasDefect/DefectOutput.cs @@ -0,0 +1,9 @@ +namespace Tnb.BasicData.Entities.Dto +{ + public class DefectOutput + { + public string id { get; set; } + public string defect_code { get; set; } + public string defect_name { get; set; } + } +} \ No newline at end of file diff --git a/BasicData/Tnb.BasicData/BasDefectService.cs b/BasicData/Tnb.BasicData/BasDefectService.cs index 2ee6d6ba..01cd4c26 100644 --- a/BasicData/Tnb.BasicData/BasDefectService.cs +++ b/BasicData/Tnb.BasicData/BasDefectService.cs @@ -5,6 +5,7 @@ using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using Microsoft.AspNetCore.Mvc; using SqlSugar; +using Tnb.BasicData.Entities.Dto; using Tnb.BasicData.Entities; using Tnb.BasicData.Interfaces; @@ -33,11 +34,22 @@ namespace Tnb.BasicData public async Task GetDefectListByProcessId(Dictionary dic) { string processId = dic["processId"]; - return await _repository.AsSugarClient().Queryable() - .LeftJoin((a, b) => a.process_id == b.id) - .LeftJoin((a, b, c) => a.defective_id == c.id) - .Where((a, b, c) => a.process_id == processId) - .Select((a, b, c) => c).ToListAsync(); + var db = _repository.AsSugarClient(); + List defectIds = await db.Queryable().Where(x=>x.process_id==processId).Select(x=>x.defective_id).ToListAsync(); + List defectTypeIds = await db.Queryable().Where(x=>defectIds.Contains(x.id) && x.enabled==1).Select(x=>x.defect_type_id).ToListAsync(); + return await _repository.AsSugarClient().Queryable() + .Where((a) => defectTypeIds.Contains(a.id)) + .Select(a => new + { + defect_type_id = a.id, + defect_type_name = a.defect_type_name, + children = SqlFunc.Subqueryable().Where(x=>x.defect_type_id==a.id && defectIds.Contains(x.id)).ToList(x=>new DefectOutput() + { + id = x.id, + defect_code = x.defect_code, + defect_name = x.defect_name, + }) + }).ToListAsync(); } } } \ No newline at end of file diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index cb297a26..609c1d26 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -224,7 +224,20 @@ namespace Tnb.WarehouseMgr } } } - var isOk = await _wareHouseService.GenPreTask(preTasks, null); + List pretaskCodes = new(); + foreach (var pt in preTasks) + { + var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); + var curPreTaskCodes = partCodes.Adapt>(); + curPreTaskCodes.ForEach(x => + { + x.id=SnowflakeIdHelper.NextId(); + x.bill_id = pt.id; + x.create_time = DateTime.Now; + }); + pretaskCodes.AddRange(curPreTaskCodes); + } + var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); GenPreTaskUpInput genPreTaskAfterUpInput = new(); genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList(); genPreTaskAfterUpInput.LocationIds = new HashSet(locIds).ToList(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs index 34cccb55..1806caf7 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs @@ -79,27 +79,35 @@ namespace Tnb.WarehouseMgr { if (_dicBizType.ContainsKey(disTask.biz_type)) { - switch (_dicBizType[disTask.biz_type]) - { - case "空载具出库": - case "寄存出库": - case "齐套出库": - case "一般出库": - { - WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List { input.carryId } }; - await DoUpdate(upInput); //回更业务 - + WareHouseUpInput upInput = new() { + loginType = "web", + bizTypeId = disTask.biz_type, + requireId = disTask.require_id, + carryIds = new List { input.carryId }, + distaskCodes = input.distaskCodes }; + await DoUpdate(upInput); //回更业务 + //switch (_dicBizType[disTask.biz_type]) + //{ + // case "空载具出库": + // case "寄存出库": + // case "齐套出库": + // case "一般出库": + // { - } - break; - case "载具移出": - { - WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List { input.carryId } }; - await DoUpdate(upInput); //回更业务 - } - break; + // WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List { input.carryId }, distaskCodes = input.distaskCodes }; + // await DoUpdate(upInput); //回更业务 - } + + // } + // break; + // case "载具移出": + // { + // WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List { input.carryId }, distaskCodes = input.distaskCodes }; + // await DoUpdate(upInput); //回更业务 + // } + // break; + + //} } disTask.is_sign = 1; await _db.Updateable(disTask).UpdateColumns(it => it.is_sign).ExecuteCommandAsync();