From 4a81df87b07b00f5f8e485ac76218e3353dd95b2 Mon Sep 17 00:00:00 2001
From: zhoukeda <1315948824@qq.com>
Date: Thu, 10 Aug 2023 11:58:41 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8D=95=E8=B0=83?=
=?UTF-8?q?=E6=95=B4=20=E6=9B=B4=E6=8D=A2=E8=AE=BE=E5=A4=87=E6=A8=A1?=
=?UTF-8?q?=E5=85=B7=E4=BA=A7=E7=BA=BF=20=E4=BB=BB=E5=8A=A1=E5=8D=95?=
=?UTF-8?q?=E6=93=8D=E4=BD=9C=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Consts/DictConst.cs | 2 +-
.../Entity/EqpEquipment.cs | 5 +
.../IEquipmentService.cs | 7 +
EquipMgr/Tnb.EquipMgr/EquipmentService.cs | 7 +
.../Dto/PrdManage/ChangeEquipInput.cs | 8 +
.../Dto/PrdManage/ChangeMoldInput.cs | 8 +
.../Dto/PrdManage/ChangeWorklineInput.cs | 8 +
.../WorkOrderAdjustmentListOutput.cs | 4 +
.../Entity/PrdTaskLog.cs | 8 +
.../Tnb.ProductionMgr/PrdFeedingService.cs | 21 +++
.../Tnb.ProductionMgr/PrdMoTaskService.cs | 145 ++++++++++++++++++
11 files changed, 222 insertions(+), 1 deletion(-)
create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeEquipInput.cs
create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeMoldInput.cs
create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeWorklineInput.cs
diff --git a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
index bfc6fcf5..f14fefef 100644
--- a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
+++ b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
@@ -87,7 +87,7 @@ public static class DictConst
///
public const string ComplatedEnCode = "Complated";
///
- /// 任务单状态-待排产
+ /// 任务单状态-待下发
///
public const string ToBeScheduledEncode = "ToBeScheduled";
///
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs
index fc78a08f..aeb2e3b9 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs
@@ -203,4 +203,9 @@ public partial class EqpEquipment : BaseEntity
///
public string? responsibler_id { get; set; }
+ ///
+ /// 二维码
+ ///
+ public string? qrcode { get; set; }
+
}
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs
index 3473dbf8..803272f5 100644
--- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs
@@ -23,5 +23,12 @@ namespace Tnb.EquipMgr.Interfaces
///
///
public Task GetWorklineAndEquipTree(Dictionary dic);
+
+ ///
+ /// 根据二维码查设备
+ ///
+ ///
+ ///
+ public Task GetEntityByQrcode(Dictionary dic);
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EquipmentService.cs b/EquipMgr/Tnb.EquipMgr/EquipmentService.cs
index 610e4002..f73e11f5 100644
--- a/EquipMgr/Tnb.EquipMgr/EquipmentService.cs
+++ b/EquipMgr/Tnb.EquipMgr/EquipmentService.cs
@@ -233,5 +233,12 @@ namespace Tnb.EquipMgr
["list"] = list1,
});
}
+
+ [HttpPost]
+ public async Task GetEntityByQrcode(Dictionary dic)
+ {
+ string qrcode = dic["qrcode"];
+ return await _repository.GetSingleAsync(x => x.qrcode == qrcode);
+ }
}
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeEquipInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeEquipInput.cs
new file mode 100644
index 00000000..9906a0d5
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeEquipInput.cs
@@ -0,0 +1,8 @@
+namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
+{
+ public class ChangeEquipInput
+ {
+ public string mo_task_id { get; set; }
+ public string equip_id { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeMoldInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeMoldInput.cs
new file mode 100644
index 00000000..dc5e1a41
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeMoldInput.cs
@@ -0,0 +1,8 @@
+namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
+{
+ public class ChangeMoldInput
+ {
+ public string mo_task_id { get; set; }
+ public string mold_id { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeWorklineInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeWorklineInput.cs
new file mode 100644
index 00000000..e945bfe2
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ChangeWorklineInput.cs
@@ -0,0 +1,8 @@
+namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
+{
+ public class ChangeWorklineInput
+ {
+ public string mo_task_id { get; set; }
+ public string workline_id { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/WorkOrderAdjustmentListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/WorkOrderAdjustmentListOutput.cs
index c5ca9609..cb0fd31a 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/WorkOrderAdjustmentListOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/WorkOrderAdjustmentListOutput.cs
@@ -9,14 +9,18 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
public string mo_task_code { get; set; }
public string mo_task_status { get; set; }
public string material_id { get; set; }
+ public string material_id_id { get; set; }
public string mold_id { get; set; }
+ public string mold_id_id { get; set; }
public int? plan_qty { get; set; }
public int? complete_qty { get; set; }
public int? scheduled_qty { get; set; }
public string workline_id { get; set; }
+ public string workline_id_id { get; set; }
public string estimated_start_date { get; set; }
public string estimated_end_date { get; set; }
public string eqp_id { get; set; }
+ public string eqp_id_id { get; set; }
public string create_time { get; set; }
}
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTaskLog.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTaskLog.cs
index 28792475..f9785a42 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTaskLog.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTaskLog.cs
@@ -114,6 +114,14 @@ namespace Tnb.ProductionMgr.Entities
[SugarColumn(IsIgnore = true)]
public string workline_code { get; set; }
+ ///
+ /// 工位编号
+ ///
+ public string? station_code { get; set; }
+ ///
+ /// 工序编号
+ ///
+ public string? process_code { get; set; }
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
index 545d70eb..8b634316 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
@@ -23,6 +23,7 @@ using Tnb.ProductionMgr.Entities.Consts;
using Tnb.WarehouseMgr;
using Tnb.WarehouseMgr.Entities;
using Tnb.BasicData;
+using Tnb.EquipMgr.Entities;
namespace Tnb.ProductionMgr
{
@@ -141,9 +142,29 @@ namespace Tnb.ProductionMgr
throw new Exception("没有签收物料");
}
+ var mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id);
+ var material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id);
+ var station = await db.Queryable().SingleAsync(x => x.Id == input.station_id);
+ var process = await db.Queryable().SingleAsync(x => x.id == input.process_id);
+ var taskLog = new PrdTaskLog();
+ taskLog.id = SnowflakeIdHelper.NextId();
+ taskLog.mo_code = mo?.mo_code!;
+ taskLog.eqp_code = (await db.Queryable().FirstAsync(it => it.id == input.equip_id))?.code!;
+ taskLog.mold_code = "";
+ taskLog.item_code = material?.code!;
+ taskLog.item_standard = material?.material_standard!;
+ taskLog.status = "生产投料";
+ taskLog.operator_name = _userManager.RealName;
+ taskLog.create_id = _userManager.UserId;
+ taskLog.create_time = DateTime.Now;
+ taskLog.mo_task_id = moTask.id;
+ taskLog.mo_task_code = moTask.mo_task_code;
+ taskLog.station_code = station?.EnCode;
+ taskLog.process_code = process.code;
await db.Insertable(prdFeedingH).ExecuteCommandAsync();
await db.Insertable(list).ExecuteCommandAsync();
+ await db.Insertable(taskLog).ExecuteCommandAsync();
});
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 9305e7eb..b3ba41d2 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -1820,20 +1820,25 @@ namespace Tnb.ProductionMgr
(a, b, c, d) => a.workline_id == eqpId || a.eqp_id == eqpId)
.WhereIF(worklineIds.Count > 0, (a, b, c, d) => worklineIds.Contains(a.workline_id))
.WhereIF(equipIds.Count > 0, (a, b, c, d) => equipIds.Contains(a.eqp_id))
+ .Where((a)=>a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_code==DictConst.ToBeScheduledEncode || a.mo_task_code==DictConst.MoStatusPauseCode)
.Select((a, b, c, d,e,f,g,h) => new WorkOrderAdjustmentListOutput
{
id = a.id,
mo_task_code = a.mo_task_code,
material_id = b.code+"/"+b.name,
+ material_id_id = a.material_id,
mold_id = e.mold_code+"/"+e.mold_name,
+ mold_id_id = a.mold_id,
mo_task_status = d.FullName,
plan_qty = f.plan_qty,
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0) + SqlFunc.IsNull(a.scrap_qty,0),
scheduled_qty = a.scheduled_qty,
workline_id = a.workline_id==null ? "" :g.EnCode+"/"+g.FullName,
+ workline_id_id = a.workline_id,
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"),
eqp_id = a.eqp_id==null ? "" : h.code+"/"+h.name,
+ eqp_id_id = a.eqp_id,
create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult.SqlSugarPageResult(result);
@@ -1924,5 +1929,145 @@ namespace Tnb.ProductionMgr
.Where(x => x.workline_id == id && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync();
}
+ ///
+ /// 更换机台
+ ///
+ ///
+ [HttpPost]
+ public async Task ChangeEquip(ChangeEquipInput input)
+ {
+ var db = _repository.AsSugarClient();
+ DbResult result = await db.Ado.UseTranAsync(async () =>
+ {
+ var moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id);
+ if (moTask.eqp_id == input.equip_id)
+ {
+ throw new Exception("与原机台相同");
+ }
+
+ await db.Updateable().SetColumns(x => x.eqp_id == input.equip_id)
+ .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
+
+ var mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id);
+ var material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id);
+ var process = await db.Queryable().SingleAsync(x => x.id == moTask.process_id);
+ var taskLog = new PrdTaskLog();
+ taskLog.id = SnowflakeIdHelper.NextId();
+ taskLog.mo_code = mo?.mo_code!;
+ taskLog.eqp_code = (await db.Queryable().FirstAsync(it => it.id == input.equip_id))?.code!;
+ taskLog.mold_code = "";
+ taskLog.item_code = material?.code!;
+ taskLog.item_standard = material?.material_standard!;
+ taskLog.status = "更换机台";
+ taskLog.operator_name = _userManager.RealName;
+ taskLog.create_id = _userManager.UserId;
+ taskLog.create_time = DateTime.Now;
+ taskLog.mo_task_id = moTask.id;
+ taskLog.mo_task_code = moTask.mo_task_code;
+ taskLog.station_code = "";
+ taskLog.process_code = process?.code;
+
+ await db.Insertable(taskLog).ExecuteCommandAsync();
+ });
+
+ if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
+ return result.IsSuccess ? "延期成功" : result.ErrorMessage;
+
+ }
+
+ ///
+ /// 更换模具
+ ///
+ ///
+ [HttpPost]
+ public async Task ChangeMold(ChangeMoldInput input)
+ {
+ var db = _repository.AsSugarClient();
+ DbResult result = await db.Ado.UseTranAsync(async () =>
+ {
+ var moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id);
+ if (moTask.mold_id == input.mold_id)
+ {
+ throw new Exception("与原模具相同");
+ }
+
+ await db.Updateable().SetColumns(x => x.mold_id == input.mold_id)
+ .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
+
+ var mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id);
+ var mold = await db.Queryable().SingleAsync(x => x.id == input.mold_id);
+ var material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id);
+ var process = await db.Queryable().SingleAsync(x => x.id == moTask.process_id);
+ var taskLog = new PrdTaskLog();
+ taskLog.id = SnowflakeIdHelper.NextId();
+ taskLog.mo_code = mo?.mo_code!;
+ taskLog.eqp_code = "";
+ taskLog.mold_code = mold?.mold_code;
+ taskLog.item_code = material?.code!;
+ taskLog.item_standard = material?.material_standard!;
+ taskLog.status = "更换模具";
+ taskLog.operator_name = _userManager.RealName;
+ taskLog.create_id = _userManager.UserId;
+ taskLog.create_time = DateTime.Now;
+ taskLog.mo_task_id = moTask.id;
+ taskLog.mo_task_code = moTask.mo_task_code;
+ taskLog.station_code = "";
+ taskLog.process_code = process?.code;
+
+ await db.Insertable(taskLog).ExecuteCommandAsync();
+ });
+
+ if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
+ return result.IsSuccess ? "延期成功" : result.ErrorMessage;
+
+ }
+
+ ///
+ /// 更换产线
+ ///
+ ///
+ [HttpPost]
+ public async Task ChangeWorkline(ChangeWorklineInput input)
+ {
+ var db = _repository.AsSugarClient();
+ DbResult result = await db.Ado.UseTranAsync(async () =>
+ {
+ var moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id);
+ if (moTask.workline_id == input.workline_id)
+ {
+ throw new Exception("与原产线相同");
+ }
+
+
+ await db.Updateable().SetColumns(x => x.workline_id == input.workline_id)
+ .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
+
+ var mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id);
+ var material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id);
+ var process = await db.Queryable().SingleAsync(x => x.id == moTask.process_id);
+ var taskLog = new PrdTaskLog();
+ taskLog.id = SnowflakeIdHelper.NextId();
+ taskLog.mo_code = mo?.mo_code!;
+ taskLog.eqp_code = "";
+ taskLog.mold_code = "";
+ taskLog.item_code = material?.code!;
+ taskLog.item_standard = material?.material_standard!;
+ taskLog.status = "更换产线";
+ taskLog.operator_name = _userManager.RealName;
+ taskLog.create_id = _userManager.UserId;
+ taskLog.create_time = DateTime.Now;
+ taskLog.mo_task_id = moTask.id;
+ taskLog.mo_task_code = moTask.mo_task_code;
+ taskLog.station_code = "";
+ taskLog.process_code = process?.code;
+
+ await db.Insertable(taskLog).ExecuteCommandAsync();
+ });
+
+ if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
+ return result.IsSuccess ? "延期成功" : result.ErrorMessage;
+
+ }
+
}
}
From b25ab2c526c8ed8b5d9a7aff9df7f0d03b7bfd13 Mon Sep 17 00:00:00 2001
From: zhoukeda <1315948824@qq.com>
Date: Fri, 11 Aug 2023 09:59:39 +0800
Subject: [PATCH 2/6] bug
---
.../Dto/PrdManage/PrdTaskOperOutput.cs | 5 +++++
ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs | 6 +++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperOutput.cs
index 0e651046..365d18c9 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperOutput.cs
@@ -16,5 +16,10 @@ namespace Tnb.ProductionMgr.Entities.Dto
///任务单操作状态
///
public string statusName { get; set; }
+
+ ///
+ /// 排产类型:1、注塑、挤出2、组装、包装
+ ///
+ public int? schedule_type { get; set; }
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index b3ba41d2..08616bb7 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -226,7 +226,11 @@ namespace Tnb.ProductionMgr
var list = await _repository.AsSugarClient().Queryable().Where(it => it.mo_task_id == taskId).ToListAsync();
var data = list.Adapt>();
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
- _repository.AsSugarClient().ThenMapper(data, x => x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : "");
+ _repository.AsSugarClient().ThenMapper(data, x =>
+ {
+ x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : x.status;
+ x.schedule_type = _repository.AsSugarClient().Queryable().Single(y => y.id == x.mo_task_id).schedule_type;
+ });
return data;
}
///
From ae41d3e056313885563eb71513d4548a36609876 Mon Sep 17 00:00:00 2001
From: alex
Date: Fri, 11 Aug 2023 16:24:45 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=E6=B6=88=E9=99=A4=E9=83=A8=E5=88=86warning?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs b/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs
index 8eb61c17..55ba81df 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs
@@ -32,7 +32,7 @@ namespace Tnb.WarehouseMgr
///
public class TimedTaskBackgroundService : BackgroundService
{
- private IEventPublisher _eventPublisher;
+ private IEventPublisher _eventPublisher = default!;
protected override Task ExecuteAsync(CancellationToken stoppingToken) => Task.Run(() =>
{
From 2afaa0cb248a7b7ba37f5147006a552d4297c814 Mon Sep 17 00:00:00 2001
From: qianjiawei <1184704771@qq.com>
Date: Fri, 11 Aug 2023 16:32:11 +0800
Subject: [PATCH 4/6] 1
---
.../Dto/PrdManage/PrdMoTaskOutput.cs | 39 ++++++++++++++
.../Tnb.ProductionMgr/PrdInstockService.cs | 52 ++++++++++++++++++-
.../Permission/DepartmentService.cs | 33 ++++++++++++
3 files changed, 122 insertions(+), 2 deletions(-)
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs
index aa48d3b7..e3e66deb 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
+using JNPF.Common.Security;
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
{
@@ -86,7 +87,45 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
public string process_name { get; set;}
public string create_time { get; set; }
+ }
+ public class PrdMoTaskTreeOutput : TreeModel
+ {
+ ///
+ /// 生产任务单号
+ ///
+ public string? mo_task_code { get; set; }
+ public string? material_id { get; set; }
+ public string? mold_id { get; set; }
+ public string? eqp_id { get; set; }
+
+ ///
+ /// 物料
+ ///
+ public string? material_id_id { get; set; }
+ ///
+ /// 模具
+ ///
+ public string? mold_id_id { get; set; }
+ ///
+ /// 设备
+ ///
+ public string? eqp_id_id { get; set; }
+
+ ///
+ /// 预计开始时间
+ ///
+ public string? estimated_start_date { get; set; }
+
+ ///
+ /// 预计结束时间
+ ///
+ public string? estimated_end_date { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public string? create_time { get; set; }
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs
index 2e0b5b3c..64429b5e 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs
@@ -21,6 +21,12 @@ using Tnb.ProductionMgr.Interfaces;
using Tnb.WarehouseMgr;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.BasicData;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
+using Tnb.EquipMgr.Entities;
+using Tnb.ProductionMgr.Entities.Dto.PrdManage;
+using JNPF.Common.Filter;
+using JNPF.Common.Security;
namespace Tnb.ProductionMgr
{
@@ -29,11 +35,13 @@ namespace Tnb.ProductionMgr
///
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
- public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient
+ [OverideVisualDev(ModuleId)]
+ public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient, IOverideVisualDevService
{
private readonly ISqlSugarRepository _repository;
private readonly IUserManager _userManager;
-
+ private const string ModuleId = "25572529329173";
+ public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public PrdInstockService(
ISqlSugarRepository repository,
@@ -42,6 +50,46 @@ namespace Tnb.ProductionMgr
{
_repository = repository;
_userManager = userManager;
+ OverideFuncs.GetListAsync = GetList;
+ }
+
+ private async Task GetList(VisualDevModelListQueryInput input)
+ {
+ Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary();
+ string moCode = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
+ var list = await _repository.AsSugarClient().Queryable()
+ .LeftJoin((a, b) => a.material_id == b.id)
+ .LeftJoin((a, b, c) => a.mold_id == c.id)
+ .LeftJoin((a, b, c, d) => a.eqp_id == d.id)
+ .WhereIF(!string.IsNullOrEmpty(moCode), (a, b, c, d) => a.mo_task_code!.Contains(moCode))
+ .Select((a, b, c, d) => new PrdMoTaskTreeOutput()
+ {
+ id = a.id,
+ parentId = string.IsNullOrEmpty(a.parent_id) ? "0" : a.parent_id,
+ mo_task_code = a.mo_task_code,
+ material_id = b.name,
+ material_id_id = b.id,
+ mold_id = c.mold_name,
+ mold_id_id = c.id,
+ eqp_id = d.name,
+ eqp_id_id = d.id,
+ estimated_start_date = a.estimated_start_date!.ToString(),
+ estimated_end_date = a.estimated_end_date.ToString(),
+ create_time = a.create_time.ToString()
+ }).ToListAsync();
+ var treeList = list.ToTree();
+ treeList= treeList.Skip((input.currentPage-1)* input.pageSize).Take(input.pageSize).ToList();
+ SqlSugarPagedList pagedList = new()
+ {
+ list = treeList,
+ pagination = new Pagination
+ {
+ CurrentPage = input.currentPage,
+ PageSize = input.pageSize,
+ Total = treeList.Count
+ }
+ };
+ return PageResult.SqlSugarPageResult(pagedList);
}
[HttpPost]
diff --git a/system/Tnb.Systems/Permission/DepartmentService.cs b/system/Tnb.Systems/Permission/DepartmentService.cs
index 47949942..872c5ce1 100644
--- a/system/Tnb.Systems/Permission/DepartmentService.cs
+++ b/system/Tnb.Systems/Permission/DepartmentService.cs
@@ -536,6 +536,20 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
isOK = await _repository.AsSugarClient().Updateable().SetColumns(it => new EqpEquipment { station_code = "" }).Where(it => unbindEqpIds.Contains(it.id)).ExecuteCommandAsync();
}
}
+ await _repository.AsSugarClient().Deleteable(p => p.OrganizeId == id && p.ObjectType == "Eqp").ExecuteCommandAsync();
+ var OrganizeRelationEntitys = new List();
+ foreach (var item in eqpIds)
+ {
+ OrganizeRelationEntity organizeRelationEntity = new OrganizeRelationEntity();
+ organizeRelationEntity.Id = SnowflakeIdHelper.NextId();
+ organizeRelationEntity.OrganizeId = id;
+ organizeRelationEntity.ObjectType = "Eqp";
+ organizeRelationEntity.ObjectId = item;
+ organizeRelationEntity.CreatorTime = DateTime.Now;
+ organizeRelationEntity.CreatorUserId = _userManager.UserId;
+ OrganizeRelationEntitys.Add(organizeRelationEntity);
+ }
+ await _repository.AsSugarClient().Insertable(OrganizeRelationEntitys).ExecuteCommandAsync();
}
var processVal = jsonObj.GetValue("rowprocess");
if (processVal is not null)
@@ -570,6 +584,25 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
isOK = await _repository.AsSugarClient().Updateable(it => new BasProcessStation { station_id = "", station_code = "" }).Where(it => curProcIds.Contains(it.process_id)).ExecuteCommandAsync();
}
}
+ var correlation= jsonObj.GetValue("correlation");
+ if (correlation is not null)
+ {
+ await _repository.AsSugarClient().Deleteable(p => p.OrganizeId == id && p.ObjectType == "User").ExecuteCommandAsync();
+ var OrganizeRelationEntitys=new List();
+ for (int i = 0; i < correlation.Count(); i++)
+ {
+ OrganizeRelationEntity organizeRelationEntity = new OrganizeRelationEntity();
+ organizeRelationEntity.Id = SnowflakeIdHelper.NextId();
+ organizeRelationEntity.OrganizeId = id;
+ organizeRelationEntity.ObjectType = "User";
+ organizeRelationEntity.ObjectId = correlation[i].ToString();
+ organizeRelationEntity.CreatorTime = DateTime.Now;
+ organizeRelationEntity.CreatorUserId = _userManager.UserId;
+ OrganizeRelationEntitys.Add(organizeRelationEntity);
+ }
+ await _repository.AsSugarClient().Insertable(OrganizeRelationEntitys).ExecuteCommandAsync();
+ }
+
if (!(isOK > 0)) throw Oops.Oh(ErrorCode.COM1001);
}
From 53db402c7a115afb251d6e70b6936f735a3930c6 Mon Sep 17 00:00:00 2001
From: zhoukeda <1315948824@qq.com>
Date: Fri, 11 Aug 2023 17:04:05 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E6=8F=90=E6=8A=A5=E8=AE=B0=E5=BD=95?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B7=A5=E5=BA=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Tnb.ProductionMgr.Entities/Entity/PrdReport.cs | 6 ++++++
ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs
index 8128efe1..f6875100 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs
@@ -113,4 +113,10 @@ public partial class PrdReport : BaseEntity
/// 物料单位
///
public string? unit_id { get; set; }
+
+ ///
+ /// 工序id
+ ///
+ public string? process_id { get; set; }
+
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 08616bb7..326cb5fa 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 mbomProcess = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mbom_process_id);
if (prdMoTask.mo_task_status == DictConst.MoStatusPauseCode)
{
@@ -1409,6 +1410,7 @@ namespace Tnb.ProductionMgr
report.status = 0;
report.material_id = prdMoTask.material_id;
report.unit_id = prdMoTask.unit_id;
+ report.process_id = mbomProcess?.process_id ?? "";
row = await db.Insertable(report).ExecuteCommandAsync();
@@ -1444,7 +1446,6 @@ namespace Tnb.ProductionMgr
if (prdMoTask.schedule_type == 2 && !string.IsNullOrEmpty(prdMoTask.mbom_process_id))
{
- var mbomProcess = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mbom_process_id);
if (mbomProcess.is_last==1 && prdMoTask != null && !string.IsNullOrEmpty(prdMoTask.parent_id))
{
var parentMoTask = await db.Queryable().SingleAsync(x => x.id == prdMoTask.parent_id);
From 8894ca77e6c957a37bd8b934df19edab7d2b4136 Mon Sep 17 00:00:00 2001
From: alex
Date: Fri, 11 Aug 2023 17:47:45 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=AE=8C=E6=88=90?=
=?UTF-8?q?=EF=BC=8C=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4=E5=B0=86=E6=9B=B4?=
=?UTF-8?q?=E6=96=B0=E8=BD=BD=E5=85=B7=E3=80=81=E8=BD=BD=E5=85=B7=E6=9D=A1?=
=?UTF-8?q?=E7=A0=81=E6=94=B9=E4=B8=BA=E6=89=B9=E9=87=8F=E6=9B=B4=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, 27 insertions(+), 8 deletions(-)
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
index d2093b7f..2110d885 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
@@ -499,18 +499,37 @@ namespace Tnb.WarehouseMgr
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
var multiList = disTasks.Select(it => (it.carry_id, 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();
for (int i = 0; i < multiList.Count; i++)
{
- 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)
+ WmsCarryH carry = new()
{
- var loc = await _db.Queryable().SingleAsync(it => it.id == multiList[i].endlocation_id);
- await _db.Updateable().SetColumns(it => new WmsCarryCode { warehouse_id = loc.wh_id, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
- }
- }
+ id = multiList[i].carry_id,
+ is_lock = 0,
+ location_id = multiList[i].endlocation_id,
+ location_code = multiList[i].endlocation_code
+ };
+ WmsCarryCode carryCode = new()
+ {
+ warehouse_id = locWhIdMap[multiList[i].endlocation_id].ToString(),
+ location_id = multiList[i].endlocation_id,
+ location_code = multiList[i].endlocation_code
+ };
+ carryIts.Add(carry);
+ carryCodeIts.Add(carryCode);
+ //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();
//更新库位信息,使用状态为 使用,锁定状态为未锁定
var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList();
for (int i = 0; i < multis.Count; i++)