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;
+
+ }
+
}
}