任务单调整 更换设备模具产线 任务单操作记录
This commit is contained in:
@@ -87,7 +87,7 @@ public static class DictConst
|
||||
/// </summary>
|
||||
public const string ComplatedEnCode = "Complated";
|
||||
/// <summary>
|
||||
/// 任务单状态-待排产
|
||||
/// 任务单状态-待下发
|
||||
/// </summary>
|
||||
public const string ToBeScheduledEncode = "ToBeScheduled";
|
||||
/// <summary>
|
||||
|
||||
@@ -203,4 +203,9 @@ public partial class EqpEquipment : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string? responsibler_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 二维码
|
||||
/// </summary>
|
||||
public string? qrcode { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -23,5 +23,12 @@ namespace Tnb.EquipMgr.Interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetWorklineAndEquipTree(Dictionary<string,string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 根据二维码查设备
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
public Task<EqpEquipment> GetEntityByQrcode(Dictionary<string, string> dic);
|
||||
}
|
||||
}
|
||||
@@ -233,5 +233,12 @@ namespace Tnb.EquipMgr
|
||||
["list"] = list1,
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<EqpEquipment> GetEntityByQrcode(Dictionary<string, string> dic)
|
||||
{
|
||||
string qrcode = dic["qrcode"];
|
||||
return await _repository.GetSingleAsync(x => x.qrcode == qrcode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -114,6 +114,14 @@ namespace Tnb.ProductionMgr.Entities
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string workline_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工位编号
|
||||
/// </summary>
|
||||
public string? station_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工序编号
|
||||
/// </summary>
|
||||
public string? process_code { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
|
||||
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
|
||||
var station = await db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == input.station_id);
|
||||
var process = await db.Queryable<BasMaterial>().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<EqpEquipment>().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>(prdFeedingH).ExecuteCommandAsync();
|
||||
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||
await db.Insertable<PrdTaskLog>(taskLog).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -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<WorkOrderAdjustmentListOutput>.SqlSugarPageResult(result);
|
||||
@@ -1924,5 +1929,145 @@ namespace Tnb.ProductionMgr
|
||||
.Where(x => x.workline_id == id && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更换机台
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> ChangeEquip(ChangeEquipInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||
if (moTask.eqp_id == input.equip_id)
|
||||
{
|
||||
throw new Exception("与原机台相同");
|
||||
}
|
||||
|
||||
await db.Updateable<PrdMoTask>().SetColumns(x => x.eqp_id == input.equip_id)
|
||||
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
|
||||
var mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
|
||||
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
|
||||
var process = await db.Queryable<BasMaterial>().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<EqpEquipment>().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<PrdTaskLog>(taskLog).ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更换模具
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> ChangeMold(ChangeMoldInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||
if (moTask.mold_id == input.mold_id)
|
||||
{
|
||||
throw new Exception("与原模具相同");
|
||||
}
|
||||
|
||||
await db.Updateable<PrdMoTask>().SetColumns(x => x.mold_id == input.mold_id)
|
||||
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
|
||||
var mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
|
||||
var mold = await db.Queryable<ToolMolds>().SingleAsync(x => x.id == input.mold_id);
|
||||
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
|
||||
var process = await db.Queryable<BasMaterial>().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<PrdTaskLog>(taskLog).ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更换产线
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> ChangeWorkline(ChangeWorklineInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||
if (moTask.workline_id == input.workline_id)
|
||||
{
|
||||
throw new Exception("与原产线相同");
|
||||
}
|
||||
|
||||
|
||||
await db.Updateable<PrdMoTask>().SetColumns(x => x.workline_id == input.workline_id)
|
||||
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
|
||||
var mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
|
||||
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
|
||||
var process = await db.Queryable<BasMaterial>().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<PrdTaskLog>(taskLog).ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user