From ca3d04cb836c061f75fba77d11f6f5ef6ea89b3c Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 14 Aug 2023 09:12:10 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=B0=86=E5=8E=9F=E5=BA=93=E4=BD=8D=E6=9B=B4=E6=96=B0=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B0=83=E6=95=B4=E4=B8=BA=E6=89=B9=E9=87=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WareHouseService.cs | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 2110d885..d43b80c0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -498,10 +498,11 @@ namespace Tnb.WarehouseMgr await _db.Updateable(eles).ReSetValue(it => it.task_nums--).ExecuteCommandAsync(); //更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位 - var multiList = disTasks.Select(it => (it.carry_id, it.endlocation_id, it.endlocation_code)).ToList(); + var multiList = disTasks.Select(it => (it.carry_id, it.carry_status, it.endlocation_id, it.endlocation_code)).ToList(); var locWhIdMap = await _db.Queryable().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id); List carryIts = new(); List carryCodeIts = new(); + List locIts = new(); for (int i = 0; i < multiList.Count; i++) { WmsCarryH carry = new() @@ -520,8 +521,14 @@ namespace Tnb.WarehouseMgr carryIts.Add(carry); carryCodeIts.Add(carryCode); + BasLocation loc = new(); + loc.is_lock = 0; + if (multiList[i].carry_status.ToEnum() == EnumCarryStatus.空闲) + { + loc.is_use = ((int)EnumCarryStatus.占用).ToString(); + } + locIts.Add(loc); //await _db.Updateable().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync(); - ////更新条码的库位和仓库信息 //var carryCodes = await _db.Queryable().Where(it => it.id == multiList[i].carry_id).ToListAsync(); //if (carryCodes?.Count > 0) //{ @@ -529,19 +536,21 @@ namespace Tnb.WarehouseMgr //} } await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync(); + //更新条码的库位和仓库信息 await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync(); //更新库位信息,使用状态为 使用,锁定状态为未锁定 - var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList(); - for (int i = 0; i < multis.Count; i++) - { - var carryStatus = multis[i].carry_status; - if (multis[i].carry_status == ((int)EnumCarryStatus.空闲).ToString()) - { - carryStatus = ((int)EnumCarryStatus.占用).ToString(); - } - var cStatus = carryStatus.ParseToInt(); - await _db.Updateable().SetColumns(it => new BasLocation { is_use = cStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); - } + await _db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ExecuteCommandAsync(); + //var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList(); + //for (int i = 0; i < multis.Count; i++) + //{ + // var carryStatus = multis[i].carry_status; + // if (multis[i].carry_status == ((int)EnumCarryStatus.空闲).ToString()) + // { + // carryStatus = ((int)EnumCarryStatus.占用).ToString(); + // } + // var cStatus = carryStatus.ParseToInt(); + // await _db.Updateable().SetColumns(it => new BasLocation { is_use = cStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); + //} //更新业务主表的单据状态 foreach (var dt in disTasks) From 962ab7cab901ac8da67e0cfd054ba7e6fdf53a28 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 14 Aug 2023 09:14:07 +0800 Subject: [PATCH 2/4] 1 --- .../Tnb.WarehouseMgr/WareHouseService.cs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 05a1a2a4..e6a50e70 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -529,30 +529,13 @@ namespace Tnb.WarehouseMgr loc.is_use = ((int)EnumCarryStatus.占用).ToString(); } locIts.Add(loc); - //await _db.Updateable().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync(); - //var carryCodes = await _db.Queryable().Where(it => it.id == multiList[i].carry_id).ToListAsync(); - //if (carryCodes?.Count > 0) - //{ - // await _db.Updateable().SetColumns(it => new WmsCarryCode { warehouse_id = locWhIdMap[multiList[i].endlocation_id].ToString(), location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync(); - //} + } await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync(); //更新条码的库位和仓库信息 await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync(); //更新库位信息,使用状态为 使用,锁定状态为未锁定 await _db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ExecuteCommandAsync(); - //var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList(); - //for (int i = 0; i < multis.Count; i++) - //{ - // var carryStatus = multis[i].carry_status; - // if (multis[i].carry_status == ((int)EnumCarryStatus.空闲).ToString()) - // { - // carryStatus = ((int)EnumCarryStatus.占用).ToString(); - // } - // var cStatus = carryStatus.ParseToInt(); - // await _db.Updateable().SetColumns(it => new BasLocation { is_use = cStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); - //} - //更新业务主表的单据状态 foreach (var dt in disTasks) { From 4c1e3c8c408b76a061ec6f05a7b0bbf7b21708bc Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 14 Aug 2023 09:15:24 +0800 Subject: [PATCH 3/4] 1 --- WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index e6a50e70..67d3f20b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -504,7 +504,7 @@ namespace Tnb.WarehouseMgr List carryIts = new(); List carryCodeIts = new(); List locIts = new(); - for (int i = 0; i < multiList.Count; i++) + for (int i = 0, cnt = multiList.Count; i < cnt; i++) { WmsCarryH carry = new() { @@ -529,7 +529,7 @@ namespace Tnb.WarehouseMgr loc.is_use = ((int)EnumCarryStatus.占用).ToString(); } locIts.Add(loc); - + } await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync(); //更新条码的库位和仓库信息 From a9461977eed1f472ba6a0083f993d0f41a3843f5 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Mon, 14 Aug 2023 10:48:05 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=8F=90=E6=8A=A5=E6=8A=A5=E5=BA=9F?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E5=8F=8D=E5=86=99=E5=88=B0=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/PrdMo.cs | 5 ++ .../Tnb.ProductionMgr/PrdMoTaskService.cs | 87 ++++++++++++++++++- 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs index 6b12ce6d..97ec51d8 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs @@ -53,6 +53,11 @@ public partial class PrdMo : BaseEntity /// 已完工数量 /// public int? complete_qty { get; set; } + + /// + /// 已报工数量 + /// + public int? reported_work_qty { get; set; } /// /// 报废数量 diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 326cb5fa..ab5ad11d 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1364,6 +1364,7 @@ namespace Tnb.ProductionMgr var row = -1; var report = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); var prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); + var prdMo = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); var mbomProcess = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mbom_process_id); if (prdMoTask.mo_task_status == DictConst.MoStatusPauseCode) @@ -1444,6 +1445,35 @@ namespace Tnb.ProductionMgr .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); } + if (prdMoTask.schedule_type==1) + { + if (prdMo.reported_work_qty == null) + { + await db.Updateable() + .SetColumns(x => x.reported_work_qty == input.reported_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } + else + { + await db.Updateable() + .SetColumns(x => x.reported_work_qty == x.reported_work_qty + input.reported_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } + + if (prdMo.complete_qty == null) + { + await db.Updateable() + .SetColumns(x => x.complete_qty == input.reported_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } + else + { + await db.Updateable() + .SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } + } + if (prdMoTask.schedule_type == 2 && !string.IsNullOrEmpty(prdMoTask.mbom_process_id)) { if (mbomProcess.is_last==1 && prdMoTask != null && !string.IsNullOrEmpty(prdMoTask.parent_id)) @@ -1462,6 +1492,32 @@ namespace Tnb.ProductionMgr // .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode) .Where(x => x.id == prdMoTask.parent_id).ExecuteCommandAsync(); } + + if (prdMo.reported_work_qty == null) + { + await db.Updateable() + .SetColumns(x => x.reported_work_qty == input.reported_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } + else + { + await db.Updateable() + .SetColumns(x => x.reported_work_qty == x.reported_work_qty + input.reported_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } + + if (prdMo.complete_qty == null) + { + await db.Updateable() + .SetColumns(x => x.complete_qty == input.reported_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } + else + { + await db.Updateable() + .SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } } } @@ -1595,6 +1651,7 @@ namespace Tnb.ProductionMgr { List destDefects = new(); var batch = DateTime.Now.ToString("yyyyMMddHHmmss"); + var prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); foreach (var categoryItem in input.categoryItems) { @@ -1619,7 +1676,7 @@ namespace Tnb.ProductionMgr { #region 质检模块 //质检模块 - var prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); + TriggerPlanEntity entity = new TriggerPlanEntity(); entity.materialid = prdMoTask.material_id; entity.processid = prdMoTask.process_id; @@ -1640,6 +1697,34 @@ namespace Tnb.ProductionMgr await db.Updateable(defectRecord).ExecuteCommandAsync(); } var reportMaster = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); + var prdMo = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); + + if (prdMo.reported_work_qty == null) + { + await db.Updateable() + .SetColumns(x => x.scrap_qty == input.scrap_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } + else + { + await db.Updateable() + .SetColumns(x => x.scrap_qty == x.scrap_qty + input.scrap_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } + + if (prdMo.complete_qty == null) + { + await db.Updateable() + .SetColumns(x => x.complete_qty == input.scrap_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } + else + { + await db.Updateable() + .SetColumns(x => x.complete_qty == x.complete_qty + input.scrap_qty) + .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); + } + if (reportMaster != null) { reportMaster.completed_qty += input.scrap_qty;