外包装入库申请

This commit is contained in:
2023-11-09 10:58:15 +08:00
parent 68efc42e31
commit 746e7f425d
12 changed files with 586 additions and 10 deletions

View File

@@ -1114,9 +1114,12 @@ namespace Tnb.ProductionMgr
throw Oops.Bah("已开始的不能再开始");
}
if (await db.Queryable<PrdMoTask>().AnyAsync(x => x.workstation_id == item.workstation_id && x.mo_task_status == DictConst.InProgressEnCode && x.id != item.id))
if (item.schedule_type == 2)
{
throw Oops.Bah("该工位已有生产中的任务单");
if (await db.Queryable<PrdMoTask>().AnyAsync(x => x.workstation_id == item.workstation_id && x.mo_task_status == DictConst.InProgressEnCode && x.id != item.id))
{
throw Oops.Bah("该工位已有生产中的任务单");
}
}
if (item.mo_task_status is not DictConst.ToBeStartedEnCode and not DictConst.MoStatusPauseCode)
@@ -2735,6 +2738,63 @@ namespace Tnb.ProductionMgr
return prdMoTask;
}
/// <summary>
/// 外包装根据工位id获取喷码数据
/// </summary>
/// <param name="dic"></param>
/// <returns></returns>
[HttpPost]
public async Task<dynamic> GetMarkingInfoByStationId(MarkingLabelInput input)
{
PrdMoTask prdMoTask = await GetPrdMoTaskInfoByStationId(new Dictionary<string, string>()
{
{ "station_id", input.station_id }
});
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
{
is_mark = 0,
is_label = 0,
mo_task_code = prdMoTask.mo_task_code,
material_code = prdMoTask.material_code,
create_time = DateTime.Now,
};
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
return prdMoTask.mo_task_code + "/" + prdMoTask.material_code;
}
/// <summary>
/// 外包装根据工位id获取贴标数据
/// </summary>
/// <param name="dic"></param>
/// <returns></returns>
[HttpPost]
public async Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input)
{
PrdMoTask prdMoTask = await GetPrdMoTaskInfoByStationId(new Dictionary<string, string>()
{
{ "station_id", input.station_id }
});
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
{
is_mark = 0,
is_label = 0,
mo_task_code = prdMoTask.mo_task_code,
material_code = prdMoTask.material_code,
create_time = DateTime.Now,
station_id = input.station_id,
};
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
return prdMoTask.mo_task_code + "/" + prdMoTask.material_code;
}
}