模具保养管理接口代码提交

This commit is contained in:
DEVICE8\12494
2023-05-17 13:58:59 +08:00
parent d48fc44f33
commit 5e2d1d443f
15 changed files with 588 additions and 21 deletions

View File

@@ -543,23 +543,23 @@ namespace Tnb.ProductionMgr
if (schedQty.HasValue && schedQty.Value >= mo.plan_qty)
{
mo.mo_status = DictConst.AlreadyId;
row = await db.Updateable(mo).ExecuteCommandAsync();
}
else
{
if (schedQty.HasValue)
mo.scheduled_qty = schedQty.Value;
}
row = await db.Updateable(mo).ExecuteCommandAsync();
}
var material = await db.Queryable<BasMaterial>().FirstAsync(it => it.id == moTask.material_id);
var taskLog = new PrdTaskLog();
taskLog.id = SnowflakeIdHelper.NextId();
taskLog.mo_code = (await db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id))?.mo_code;
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == input.eqp_id))?.code;
taskLog.mold_code = (await db.Queryable<Molds>().FirstAsync(it => it.id == input.mold_id))?.mold_code;
taskLog.item_code = material?.code;
taskLog.item_standard = material?.material_standard;
taskLog.mo_code = (await db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id))?.mo_code!;
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == input.eqp_id))?.code!;
taskLog.mold_code = (await db.Queryable<Molds>().FirstAsync(it => it.id == input.mold_id))?.mold_code!;
taskLog.item_code = material?.code!;
taskLog.item_standard = material?.material_standard!;
taskLog.status = DictConst.ToBeScheduledEncode;
taskLog.operator_name = _userManager.RealName;
taskLog.create_id = _userManager.UserId;
@@ -571,10 +571,10 @@ namespace Tnb.ProductionMgr
//将生产任务插入到自检报废记录表
var sacipRecord = new PrdMoTaskDefectRecord();
sacipRecord.id = SnowflakeIdHelper.NextId();
sacipRecord.material_code = material?.code;
sacipRecord.material_name = material?.name;
sacipRecord.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == moTask.eqp_id))?.code;
sacipRecord.mold_name = (await db.Queryable<Molds>().FirstAsync(it => it.id == moTask.mold_id))?.mold_name;
sacipRecord.material_code = material?.code!;
sacipRecord.material_name = material?.name!;
sacipRecord.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == moTask.eqp_id))?.code!;
sacipRecord.mold_name = (await db.Queryable<Molds>().FirstAsync(it => it.id == moTask.mold_id))?.mold_name!;
sacipRecord.estimated_start_date = moTask.plan_start_date;
sacipRecord.estimated_end_date = moTask.plan_end_date;
sacipRecord.plan_qty = moTask.plan_qty;
@@ -719,11 +719,9 @@ namespace Tnb.ProductionMgr
//添加生产任务操作记录日志s
var taskLog = new PrdTaskLog();
taskLog.id = SnowflakeIdHelper.NextId();
taskLog.mo_code = (await _db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id))?.mo_code;
//taskLog.eqp_code = (await _db.Queryable<EqpEquipment>().FirstAsync(it => it.id == input.eqp_id))?.code;
//taskLog.mold_code = (await _db.Queryable<Molds>().FirstAsync(it => it.id == input.mold_id))?.mold_code;
taskLog.item_code = material_h?.code;
taskLog.item_standard = material_h?.material_standard;
taskLog.mo_code = (await _db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id))?.mo_code!;
taskLog.item_code = material_h?.code!;
taskLog.item_standard = material_h?.material_standard!;
taskLog.status = DictConst.ToBeScheduledEncode;
taskLog.operator_name = _userManager.RealName;
taskLog.create_id = _userManager.UserId;
@@ -888,21 +886,21 @@ namespace Tnb.ProductionMgr
{
if (taskItem.mo_id.IsNotEmptyOrNull())
{
taskLog.mo_code = (await db.Queryable<PrdMo>().FirstAsync(it => it.id == taskItem.mo_id))?.mo_code;
taskLog.mo_code = (await db.Queryable<PrdMo>().FirstAsync(it => it.id == taskItem.mo_id))?.mo_code!;
}
if (taskItem.eqp_id.IsNotEmptyOrNull())
{
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == taskItem.eqp_id))?.code;
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == taskItem.eqp_id))?.code!;
}
if (taskItem.mold_id.IsNotEmptyOrNull())
{
taskLog.mold_code = (await db.Queryable<Molds>().FirstAsync(it => it.id == taskItem.mold_id))?.mold_code;
taskLog.mold_code = (await db.Queryable<Molds>().FirstAsync(it => it.id == taskItem.mold_id))?.mold_code!;
}
if (taskItem.material_id.IsNotEmptyOrNull())
{
var material = await db.Queryable<BasMaterial>().FirstAsync(it => it.id == taskItem.material_id);
taskLog.item_code = material?.code;
taskLog.item_standard = material?.material_standard;
taskLog.item_code = material?.code!;
taskLog.item_standard = material?.material_standard!;
}
taskLog.operator_name = _userManager.RealName;
taskLog.status = status;
@@ -952,7 +950,7 @@ namespace Tnb.ProductionMgr
{
var eqpItem = await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == icmoItem.eqp_id);
icmoItem.eqp_id = eqpItem.id;
icmoItem.eqp_type_code = db.Queryable<EqpEquipType>().First(it => it.id == eqpItem.equip_type_id)?.code;
icmoItem.eqp_type_code = db.Queryable<EqpEquipType>().First(it => it.id == eqpItem.equip_type_id)?.code!;
//if (input.scheduled_qty > icmoItem.plan_qty)
//{
// throw new AppFriendlyException("任务单数量不能大于计划数量", 500);