零部件最终检验
This commit is contained in:
@@ -1621,7 +1621,7 @@ namespace Tnb.ProductionMgr
|
||||
/// <br/>}
|
||||
/// </remarks>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PrdReport(PrdReportCrInput input)
|
||||
public async Task<string> PrdReport(PrdReportCrInput input)
|
||||
{
|
||||
await prdreportSemaphore.WaitAsync();
|
||||
try
|
||||
@@ -1723,21 +1723,8 @@ namespace Tnb.ProductionMgr
|
||||
report.material_box_code = input.material_box_code;
|
||||
if (prdMoTask.schedule_type == 2)
|
||||
{
|
||||
// if (dic.TryGetValue(prdMoTask.workline_id, out string value))
|
||||
// {
|
||||
// materialBoxCode = await _redisData.GetHash("value", "WBZX_x1_take_tp");
|
||||
// if (materialBoxCode == null || materialBoxCode.IsEmpty())
|
||||
// {
|
||||
// throw Oops.Bah("托盘条码信息未空");
|
||||
// }
|
||||
report.material_box_code = input.material_box_code;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// throw Oops.Bah("未找到对应产线");
|
||||
// }
|
||||
report.material_box_code = input.material_box_code;
|
||||
|
||||
// report.warehouse_id = WmsWareHouseConst.WAREHOUSE_JXK_ID;
|
||||
report.warehouse_id = WmsWareHouseConst.WAREHOUSE_DMJC_ID;
|
||||
Dictionary<string, string> worklineWarehouseDic = new Dictionary<string, string>()
|
||||
{
|
||||
@@ -1804,22 +1791,52 @@ namespace Tnb.ProductionMgr
|
||||
report.unit_id = prdMoTask.unit_id;
|
||||
report.process_id = mbomProcess?.process_id ?? "";
|
||||
|
||||
row = await db.Insertable(report).ExecuteCommandAsync();
|
||||
|
||||
WmsCarryH wmsCarryH = await db.Queryable<WmsCarryH>().SingleAsync((x => x.carry_code == materialBoxCode));
|
||||
if (wmsCarryH == null)
|
||||
throw Oops.Bah($"未找到{materialBoxCode}载具");
|
||||
if (wmsCarryH.carry_status == ((int)EnumCarryStatus.占用).ToString())
|
||||
{
|
||||
throw Oops.Bah($"提报失败,载具已绑定");
|
||||
}
|
||||
List<WmsCarryCode> wmsCarryCodes = await db.Queryable<WmsCarryCode>().Where(x=>x.carry_id==wmsCarryH.id).ToListAsync();
|
||||
if (wmsCarryCodes != null && wmsCarryCodes.Count > 0)
|
||||
{
|
||||
Log.Error($"载具{materialBoxCode}状态为{wmsCarryH.carry_status},但有条码{JsonConvert.SerializeObject(wmsCarryCodes)}");
|
||||
throw Oops.Bah($"提报失败,载具异常");
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 质检模块
|
||||
//质检模块
|
||||
// TriggerPlanEntity entity = new()
|
||||
// {
|
||||
// materialid = prdMoTask.material_id,
|
||||
// processid = prdMoTask.process_id,
|
||||
// workid = prdMoTask.workstation_id
|
||||
// };
|
||||
// int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
|
||||
// int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
|
||||
// entity.oldpronum = reported + scrap;
|
||||
// entity.newpronum = input.reported_qty;
|
||||
// entity.triggerevent = EnumTriggerEvent.生产检定量;
|
||||
// await _qcCheckPlanService.CreateTask(entity);
|
||||
|
||||
if (wmsCarryH.is_check == 0)
|
||||
{
|
||||
TriggerPlanEntity entity = new()
|
||||
{
|
||||
materialid = prdMoTask.material_id,
|
||||
processid = prdMoTask.process_id,
|
||||
workid = prdMoTask.workstation_id
|
||||
};
|
||||
int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
|
||||
int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
|
||||
entity.oldpronum = reported + scrap;
|
||||
entity.newpronum = input.reported_qty;
|
||||
// entity.triggerevent = EnumTriggerEvent.生产检定量;
|
||||
entity.triggerevent = EnumTriggerEvent.零部件最终检验事件;
|
||||
await _qcCheckPlanService.CreateTask(entity);
|
||||
await _db.Ado.CommitTranAsync();
|
||||
return "生成质检任务";
|
||||
}else if (wmsCarryH.is_check==1)
|
||||
{
|
||||
return "检验中,请稍后提报";
|
||||
}
|
||||
else
|
||||
{
|
||||
row = await db.Insertable(report).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
_ = prdMoTask.reported_work_qty == null
|
||||
? await db.Updateable<PrdMoTask>()
|
||||
@@ -2012,24 +2029,6 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
|
||||
|
||||
// Dictionary<string, object> header = new()
|
||||
// {
|
||||
// ["Authorization"] = App.HttpContext != null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
// };
|
||||
// BasFactoryConfig config = await _repository.AsSugarClient().Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
|
||||
WmsCarryH wmsCarryH = await db.Queryable<WmsCarryH>().SingleAsync((x => x.carry_code == materialBoxCode));
|
||||
if (wmsCarryH == null)
|
||||
throw Oops.Bah($"未找到{materialBoxCode}载具");
|
||||
if (wmsCarryH.carry_status == ((int)EnumCarryStatus.占用).ToString())
|
||||
{
|
||||
throw Oops.Bah($"提报失败,载具已绑定");
|
||||
}
|
||||
List<WmsCarryCode> wmsCarryCodes = await db.Queryable<WmsCarryCode>().Where(x=>x.carry_id==wmsCarryH.id).ToListAsync();
|
||||
if (wmsCarryCodes != null && wmsCarryCodes.Count > 0)
|
||||
{
|
||||
Log.Error($"载具{materialBoxCode}状态为{wmsCarryH.carry_status},但有条码{JsonConvert.SerializeObject(wmsCarryCodes)}");
|
||||
throw Oops.Bah($"提报失败,载具异常");
|
||||
}
|
||||
|
||||
BindCarryCodeInput bindCarryCodeInput = new BindCarryCodeInput();
|
||||
bindCarryCodeInput.carry_id = wmsCarryH.id;
|
||||
@@ -2299,7 +2298,7 @@ namespace Tnb.ProductionMgr
|
||||
//
|
||||
// }
|
||||
|
||||
return true;
|
||||
return "提报成功";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user