From 977f13844560227c956cfefbf23ee70c29da4408 Mon Sep 17 00:00:00 2001
From: zhou keda <1315948824@qq.com>
Date: Wed, 15 May 2024 11:26:17 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E4=BA=A7=E5=8A=A0=E6=A8=A1=E5=85=B7?=
=?UTF-8?q?=E7=8A=B6=E6=80=81=20=E5=B7=A5=E5=8D=95=E5=8A=A0=E7=89=A9?=
=?UTF-8?q?=E6=96=99=E6=B8=85=E5=8D=95=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dto/PrdManage/MoldListOutput.cs | 4 ++++
.../Dto/PrdManage/PrdMoListOuput.cs | 1 +
.../Tnb.ProductionMgr.Entities/Entity/PrdMo.cs | 5 +++++
ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs | 15 +++++++++++++++
.../Tnb.ProductionMgr/PrdMoTaskService.cs | 4 +++-
5 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoldListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoldListOutput.cs
index 913a85d8..1400ae61 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoldListOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoldListOutput.cs
@@ -30,5 +30,9 @@
///
public int available_stations { get; set; }
public string mold_id { get; set; }
+ ///
+ /// 模具状态
+ ///
+ public string mold_status { get; set; }
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListOuput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListOuput.cs
index 0f733963..fdbafc2a 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListOuput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListOuput.cs
@@ -14,6 +14,7 @@ namespace Tnb.ProductionMgr.Entities.Dto
public int? plan_qty { get; set; }
public string unit_id { get; set; }
public string mo_status { get; set; }
+ public string ebom_version { get; set; }
public string? remark { get; set; }
public string combine_mo_code { get; set; }
public string material_id_id { get; set; }
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs
index 0d445a16..e2c03281 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs
@@ -108,6 +108,11 @@ public partial class PrdMo : BaseEntity
/// BOM版本
///
public string? bom_version { get; set; }
+
+ ///
+ /// 物料清单BOM版本
+ ///
+ public string? ebom_version { get; set; }
///
/// 关联比例
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
index d117a1ff..15396871 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
@@ -164,6 +164,7 @@ namespace Tnb.ProductionMgr
plan_qty = a.plan_qty,
unit_id = d.FullName,
mo_status = e.FullName,
+ ebom_version = a.ebom_version,
remark = a.remark,
children = SqlFunc.Subqueryable()
.LeftJoin((aa, bb) => aa.material_id == bb.id)
@@ -240,8 +241,12 @@ namespace Tnb.ProductionMgr
{
throw new ArgumentException($"{nameof(input.Behavior)},not be null or empty");
}
+
+
ISqlSugarClient db = _repository.AsSugarClient();
+
+
//获取同组工单的Id,一起下发
List combineMoCodes = await db.Queryable().Where(it => input.WorkOrderIds.Contains(it.id)).Select(it => it.combine_mo_code).ToListAsync();
if (combineMoCodes?.Count > 0)
@@ -250,6 +255,16 @@ namespace Tnb.ProductionMgr
input.WorkOrderIds = input.WorkOrderIds.Concat(moIds).ToList();
}
+ List prdMos = await db.Queryable().Where(x => input.WorkOrderIds.Contains(x.id)).ToListAsync();
+
+ foreach (var item in prdMos)
+ {
+ if (!await db.Queryable().AnyAsync(x => x.material_id == item.material_id && x.version == item.ebom_version))
+ {
+ throw Oops.Bah($"系统中无法找到{item.ebom_version}版本");
+ }
+ }
+
static string getMoStatus(MoBehavior behavior)
{
string status = "";
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 40848678..2a8c249d 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -108,8 +108,9 @@ namespace Tnb.ProductionMgr
result = await _db.Queryable()
.InnerJoin((a, b) => a.mold_id == b.id)
.InnerJoin((a, b, c) => a.material_id == c.id)
+ .LeftJoin((a,b,c,d)=>d.Id==b.mold_status)
.Where((a, b, c) => a.material_id == materialId)
- .Select((a, b, c) => new Tnb.ProductionMgr.Entities.Dto.MoldListOutput
+ .Select((a, b, c,d) => new Tnb.ProductionMgr.Entities.Dto.MoldListOutput
{
mold_id = b.id,
mold_code = b.mold_code,
@@ -117,6 +118,7 @@ namespace Tnb.ProductionMgr
mold_type_code = b.mold_type_code,
material_name = c.name,
material_code = c.code,
+ mold_status = d.FullName,
available_stations = SqlFunc.Subqueryable().Where(it => it.mold_id == a.id).Count(),
}).ToListAsync();
return result;