From 8957dd96284a046d231271251f9641eced84daca Mon Sep 17 00:00:00 2001
From: zhou keda <1315948824@qq.com>
Date: Tue, 18 Jun 2024 16:54:30 +0800
Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E5=B7=A5=E5=8D=95=E5=88=86?=
=?UTF-8?q?=E9=85=8D=E5=91=98=E5=B7=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Consts/FactoryConfigConst.cs | 5 +++
.../Entity/PrdMoTask.cs | 4 +++
.../Tnb.ProductionMgr/PrdFeedingService.cs | 2 +-
.../Tnb.ProductionMgr/PrdMoTaskService.cs | 29 +++++++++++++++++
.../Tnb.ProductionMgr/PrdPackReportService.cs | 32 +++++++++++--------
.../Tnb.ProductionMgr/TimeWorkService.cs | 9 ++++--
6 files changed, 64 insertions(+), 17 deletions(-)
diff --git a/BasicData/Tnb.BasicData.Entities/Consts/FactoryConfigConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/FactoryConfigConst.cs
index 8d256f63..bf87f596 100644
--- a/BasicData/Tnb.BasicData.Entities/Consts/FactoryConfigConst.cs
+++ b/BasicData/Tnb.BasicData.Entities/Consts/FactoryConfigConst.cs
@@ -19,5 +19,10 @@ namespace Tnb.BasicData
/// 域名
///
public const string DOMAIN = "domain";
+
+ ///
+ /// 空载具出库数量
+ ///
+ public const string EmptyCarryOutNum = "EmptyCarryOutNum";
}
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs
index 56af072f..4add2ad2 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs
@@ -206,5 +206,9 @@ public partial class PrdMoTask : BaseEntity
/// 暂停原因
///
public string? pause_reason { get; set; }
+ ///
+ /// 分配员工id
+ ///
+ public string worker_id { get; set; }
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
index 0cd621b9..700bf989 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
@@ -233,7 +233,7 @@ namespace Tnb.ProductionMgr
{
if (!inputMaterials.Contains(item["material_id"]))
{
- throw new Exception("该物料不是生产bom投入物料,不能签收");
+ throw new Exception("该物料不是生产bom投入物料,不能投料");
}
PrdMaterialReceiptD? detail = await db.Queryable()
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 70fa8355..3ba7560e 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -1098,6 +1098,18 @@ namespace Tnb.ProductionMgr
string status = SetTaskStatus(behavior);
List? list = await db.Queryable().Where(it => input.TaskIds.Contains(it.id)).Select(it => it).ToListAsync();
+
+ if (behavior == PrdTaskBehavior.Release)
+ {
+ foreach(PrdMoTask item in list)
+ {
+ if (string.IsNullOrEmpty(item.worker_id))
+ {
+ throw Oops.Bah("请先分配员工");
+ }
+ }
+ }
+
if (behavior == PrdTaskBehavior.Compled)
{
// if (list?.Count > 0)
@@ -3315,6 +3327,23 @@ namespace Tnb.ProductionMgr
Log.Information($"视觉设备判定参数:{JsonConvert.SerializeObject(input)}");
return $"接收到参数:{JsonConvert.SerializeObject(input)}";
}
+
+ ///
+ /// 分配员工
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task BindUser(Dictionary input)
+ {
+ string id = input.GetOrDefault("id");
+ string workerId = input.GetOrDefault("worker_id");
+ int row = await _db.Updateable()
+ .SetColumns(x => x.worker_id == workerId)
+ .Where(x => x.id == id)
+ .ExecuteCommandAsync();
+ return row>0 ? "分配成功" : "分配失败";
+ }
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
index 83e79e43..d33d96b1 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
@@ -1,4 +1,5 @@
-using JNPF.Common.Enums;
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Enums;
using JNPF.Common.Extension;
using JNPF.Common.Filter;
using JNPF.Common.Security;
@@ -34,10 +35,14 @@ namespace Tnb.ProductionMgr
{
private readonly ISqlSugarClient _db;
private readonly IDictionaryDataService _dictionaryDataService;
+ private readonly IUserManager _userManager;
private static Dictionary> _dicWorkLine = new();
- public PrdPackReportService(ISqlSugarRepository repository, IDictionaryDataService dictionaryDataService)
+ public PrdPackReportService(ISqlSugarRepository repository,
+ IUserManager userManager,
+ IDictionaryDataService dictionaryDataService)
{
_db = repository.AsSugarClient();
+ _userManager = userManager;
_dictionaryDataService = dictionaryDataService;
}
///
@@ -363,20 +368,20 @@ namespace Tnb.ProductionMgr
}
///
- /// pda端根据工位获取任务单列表
+ /// PAD,pda端根据工位获取任务单列表
///
///
[HttpPost]
public async Task GetPadPrdMoTaskList(PrdMoTaskListOutput input)
{
- if (string.IsNullOrEmpty(input.stationId))
- {
- return new
- {
- pagination = new PageResult(),
- list = Array.Empty()
- };
- }
+ // if (string.IsNullOrEmpty(input.stationId))
+ // {
+ // return new
+ // {
+ // pagination = new PageResult(),
+ // list = Array.Empty()
+ // };
+ // }
Dictionary queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary() : input.queryJson.ToObject>();
string? mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
@@ -408,7 +413,7 @@ namespace Tnb.ProductionMgr
input.sidx = "create_time";
input.sort = "desc";
}
-
+
SqlSugarPagedList result = await _db.Queryable()
.LeftJoin((a, b) => a.material_id == b.id)
.LeftJoin((a, b, c) => a.process_id == c.id)
@@ -421,7 +426,8 @@ namespace Tnb.ProductionMgr
.LeftJoin((a, b, c, d, e, f, g, h, i, j) => a.mo_id == j.id)
.LeftJoin((a, b, c, d, e, f, g, h, i, j, k) => a.material_id == k.material_id && k.auxiliary_unit_id == "kg")
.LeftJoin((a, b, c, d, e, f, g, h, i, j, k, l) => a.eqp_id == l.equip_id && l.enabled == 1 && l.label_name.Contains("允许称重"))//注塑空满箱请求
- .Where((a, b) => a.workstation_id == input.stationId)
+ // .Where((a, b) => a.workstation_id == input.stationId)
+ .Where((a, b) => a.worker_id == _userManager.UserId)
.WhereIF(!string.IsNullOrEmpty(mo_task_code), a => a.mo_task_code.Contains(mo_task_code))
//.WhereIF(!string.IsNullOrEmpty(mo_task_status),a=>a.mo_task_status==mo_task_status)
.WhereIF(statusList.Count > 0, a => statusList.Contains(a.mo_task_status))
diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs
index 3dc77241..f905df1d 100644
--- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs
@@ -139,12 +139,13 @@ namespace Tnb.ProductionMgr
public async Task EmptyCarryOutStkCtu1()
{
string msg = "";
+ BasFactoryConfig config = await _db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.EmptyCarryOutNum);
MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput();
input.org_id = WmsWareHouseConst.AdministratorOrgId;
input.location_code = "SSX-021-001";
input.warehouse_id = WmsWareHouseConst.WAREHOUSE_ZC_ID;
input.carrystd_id = WmsWareHouseConst.LIAOXIANGID;
- input.qty = 1;
+ input.qty = int.Parse(config?.value ?? "5");
input.create_id = WmsWareHouseConst.AdministratorUserId;
Log.Information($"【EmptyCarryOutStk】ctu1空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}");
Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input);
@@ -167,12 +168,13 @@ namespace Tnb.ProductionMgr
public async Task EmptyCarryOutStkCtu3()
{
string msg = "";
+ BasFactoryConfig config = await _db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.EmptyCarryOutNum);
MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput();
input.org_id = WmsWareHouseConst.AdministratorOrgId;
input.location_code = "SSX-021-003";
input.warehouse_id = WmsWareHouseConst.WAREHOUSE_ZC_ID;
input.carrystd_id = WmsWareHouseConst.LIAOXIANGID;
- input.qty = 1;
+ input.qty = int.Parse(config?.value ?? "5");
input.create_id = WmsWareHouseConst.AdministratorUserId;
Log.Information($"【EmptyCarryOutStk】ctu3空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}");
Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input);
@@ -195,12 +197,13 @@ namespace Tnb.ProductionMgr
public async Task EmptyCarryOutStkCtu6()
{
string msg = "";
+ BasFactoryConfig config = await _db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.EmptyCarryOutNum);
MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput();
input.org_id = WmsWareHouseConst.AdministratorOrgId;
input.location_code = "SSX-011-006";
input.warehouse_id = WmsWareHouseConst.WAREHOUSE_ZC_ID;
input.carrystd_id = WmsWareHouseConst.LIAOXIANGID;
- input.qty = 1;
+ input.qty = int.Parse(config?.value ?? "5");
input.create_id = WmsWareHouseConst.AdministratorUserId;
Log.Information($"【EmptyCarryOutStk】ctu6空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}");
Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input);