模具报废
This commit is contained in:
@@ -127,7 +127,7 @@ namespace Tnb.EquipMgr
|
||||
public async Task<string> RepeatRepair(MaintainRecordRepeatInput input)
|
||||
{
|
||||
ToolMoldMaintainTask toolMoldMaintainTask = await _db.Queryable<ToolMoldMaintainTask>().SingleAsync(x => x.id == input.id);
|
||||
if (toolMoldMaintainTask.status != "YWC")
|
||||
if (toolMoldMaintainTask.status != "FHZ")
|
||||
{
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
@@ -140,6 +140,20 @@ namespace Tnb.EquipMgr
|
||||
.SetColumns(x=>x.repeat_time==DateTime.Now)
|
||||
.Where(x => x.id == input.id)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
if (toolMoldMaintainTask.scrap_qty > 0)
|
||||
{
|
||||
ToolMolds toolMolds = await _db.Queryable<ToolMolds>().SingleAsync(x=>x.id==toolMoldMaintainTask.mold_id);
|
||||
if (toolMolds.mold_cavity < toolMoldMaintainTask.scrap_qty)
|
||||
{
|
||||
throw Oops.Bah("报废数量大于有效模穴数");
|
||||
}
|
||||
|
||||
await _db.Updateable<ToolMolds>()
|
||||
.SetColumns(x => x.mold_cavity == x.mold_cavity - toolMoldMaintainTask.scrap_qty)
|
||||
.Where(x => x.id == toolMolds.id)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
|
||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "复核成功" : result.ErrorMessage;
|
||||
|
||||
Reference in New Issue
Block a user