生产管理模块代码调整
This commit is contained in:
@@ -438,13 +438,37 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
//根据工单号获取当前工单包含的已排产数
|
||||
var schedQty = db.Queryable<PrdMoTask>().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty);
|
||||
//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产
|
||||
if (mo != null && schedQty.HasValue && schedQty.Value >= mo.plan_qty)
|
||||
{
|
||||
mo.mo_status = DictConst.AlreadyId;
|
||||
row = await db.Updateable(mo).ExecuteCommandAsync();
|
||||
|
||||
if (mo != null)
|
||||
{//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产
|
||||
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;
|
||||
}
|
||||
}
|
||||
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.status = DictConst.ToBeScheduledEncode;
|
||||
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;
|
||||
|
||||
await db.Insertable(taskLog).ExecuteCommandAsync();
|
||||
//将生产任务插入到自检报废记录表
|
||||
var sacipRecord = new PrdMoTaskDefectRecord();
|
||||
sacipRecord.id = SnowflakeIdHelper.NextId();
|
||||
|
||||
Reference in New Issue
Block a user