调拨入库地址修改

This commit is contained in:
2024-08-27 09:24:14 +08:00
parent 240a5e1fc1
commit f90318a50d
2 changed files with 53 additions and 49 deletions

View File

@@ -1226,46 +1226,9 @@ namespace Tnb.ProductionMgr
// } // }
// } // }
if (prdTaskList.Where(p => p.mo_task_status == "Pause").Count() > 0 && behavior==PrdTaskBehavior.Start)
{
TimerPoolHelper.GetInstance().StartTimer(TimeCallback,prdTaskList.Where(p => p.mo_task_status == "Pause").ToList(),TimeSpan.FromHours(1),Timeout.InfiniteTimeSpan);
}else if (prdTaskList.Where(p => p.mo_task_status == "ToBeStarted").Count() > 0 && behavior == PrdTaskBehavior.Start)
{
foreach (PrdMoTask? task in prdTaskList.Where(p => p.mo_task_status == "ToBeStarted").ToList())
{
ToolMolds toolMolds = await _db.Queryable<ToolMolds>().SingleAsync(x=>x.id==task.mold_id);
TriggerPlanEntity entity = new()
{
materialid = task.material_id,
processid = task.process_id,
workid = task.workstation_id,
triggerevent = EnumTriggerEvent.,
plan_check_type = WmsWareHouseConst.SHOUJIAN_ID,
mo_task_code = task.mo_task_code,
newpronum = toolMolds?.mold_cavity
};
await _qcCheckPlanService.CreateTask(entity);
}
}
if (behavior == PrdTaskBehavior.Start)
{
TimerPoolHelper.GetInstance().StartTimer(TimeCallback2,prdTaskList.Where(p => p.mo_task_status == "Pause" || p.mo_task_status == "ToBeStarted").ToList(),TimeSpan.FromHours(2),Timeout.InfiniteTimeSpan,false);
}
if (behavior == PrdTaskBehavior.Pause)
{
foreach (PrdMoTask? task in prdTaskList.Where(p => p.mo_task_status == "ToBeStarted").ToList())
{
TimerPoolHelper.GetInstance().DisposeTimer(new Dictionary<string,string>()
{
["key"] = task.timer_key
});
}
}
#endregion #endregion
foreach (PrdMoTask item in prdTaskList) foreach (PrdMoTask item in prdTaskList)
{ {
switch (behavior) switch (behavior)
@@ -1281,7 +1244,7 @@ namespace Tnb.ProductionMgr
{ {
throw Oops.Bah("已开始的不能再开始"); throw Oops.Bah("已开始的不能再开始");
} }
if (item.schedule_type == 2) if (item.schedule_type == 2)
{ {
if (await db.Queryable<PrdMoTask>().AnyAsync(x => x.workline_id == item.workline_id && x.mo_task_status == DictConst.InProgressEnCode && x.id != item.id)) if (await db.Queryable<PrdMoTask>().AnyAsync(x => x.workline_id == item.workline_id && x.mo_task_status == DictConst.InProgressEnCode && x.id != item.id))
@@ -1297,7 +1260,7 @@ namespace Tnb.ProductionMgr
throw Oops.Bah("该设备已有生产中的任务单"); throw Oops.Bah("该设备已有生产中的任务单");
} }
} }
if (item.mo_task_status is not DictConst.ToBeStartedEnCode and not DictConst.MoStatusPauseCode) if (item.mo_task_status is not DictConst.ToBeStartedEnCode and not DictConst.MoStatusPauseCode)
{ {
throw Oops.Bah("状态错误无法开始"); throw Oops.Bah("状态错误无法开始");
@@ -1312,7 +1275,7 @@ namespace Tnb.ProductionMgr
{ {
throw Oops.Bah("状态错误无法暂停"); throw Oops.Bah("状态错误无法暂停");
} }
item.pause_reason = input.PauseReeson; item.pause_reason = input.PauseReeson;
break; break;
case PrdTaskBehavior.Compled: case PrdTaskBehavior.Compled:
@@ -1333,7 +1296,7 @@ namespace Tnb.ProductionMgr
break; break;
} }
} }
prdTaskList.ForEach(x => x.mo_task_status = status); prdTaskList.ForEach(x => x.mo_task_status = status);
if (behavior == PrdTaskBehavior.Start) if (behavior == PrdTaskBehavior.Start)
{ {
@@ -1439,7 +1402,7 @@ namespace Tnb.ProductionMgr
{ {
row = await db.Insertable(taskLogEntities).ExecuteCommandAsync(); row = await db.Insertable(taskLogEntities).ExecuteCommandAsync();
} }
List<PrdReportRecord> prdReportLogs = new(); List<PrdReportRecord> prdReportLogs = new();
List<PrdMoTaskDefectRecord> prdTaskDefectLogs = new(); List<PrdMoTaskDefectRecord> prdTaskDefectLogs = new();
if (taskReportLogs?.Count > 0) if (taskReportLogs?.Count > 0)
@@ -1463,7 +1426,7 @@ namespace Tnb.ProductionMgr
record.mo_code = mo?.mo_code ?? ""; record.mo_code = mo?.mo_code ?? "";
//record.completed_qty = (await db.Queryable<PrdReport>().Where(it => it.mo_task_code == taskInfo.mo_task_code).SumAsync(it => it.reported_work_qty)).Value; //record.completed_qty = (await db.Queryable<PrdReport>().Where(it => it.mo_task_code == taskInfo.mo_task_code).SumAsync(it => it.reported_work_qty)).Value;
prdReportLogs.Add(record); prdReportLogs.Add(record);
//组装自检报废对象 //组装自检报废对象
PrdMoTaskDefectRecord sacipRecord = new() PrdMoTaskDefectRecord sacipRecord = new()
{ {
@@ -1540,7 +1503,7 @@ namespace Tnb.ProductionMgr
OrganizeEntity organizeEntity = await _db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == item.workline_id); OrganizeEntity organizeEntity = await _db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == item.workline_id);
string batch = $"{organizeEntity.EnCode.Substring(organizeEntity.EnCode.Length - 2, 2)}{DateTime.Now.ToString("yyMMdd")}"; string batch = $"{organizeEntity.EnCode.Substring(organizeEntity.EnCode.Length - 2, 2)}{DateTime.Now.ToString("yyMMdd")}";
PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == item.parent_id); PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == item.parent_id);
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id); BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id);
BasMbom basMbom = await _db.Queryable<BasMbom>().SingleAsync(x => x.id == item.bom_id); BasMbom basMbom = await _db.Queryable<BasMbom>().SingleAsync(x => x.id == item.bom_id);
@@ -1586,6 +1549,45 @@ namespace Tnb.ProductionMgr
} }
} }
} }
if (prdTaskList.Where(p => p.mo_task_status == "Pause").Count() > 0 && behavior==PrdTaskBehavior.Start)
{
TimerPoolHelper.GetInstance().StartTimer(TimeCallback,prdTaskList.Where(p => p.mo_task_status == "Pause").ToList(),TimeSpan.FromMinutes(1),Timeout.InfiniteTimeSpan);
}else if (prdTaskList.Where(p => p.mo_task_status == "ToBeStarted").Count() > 0 && behavior == PrdTaskBehavior.Start)
{
foreach (PrdMoTask? task in prdTaskList.Where(p => p.mo_task_status == "ToBeStarted").ToList())
{
ToolMolds toolMolds = await _db.Queryable<ToolMolds>().SingleAsync(x=>x.id==task.mold_id);
TriggerPlanEntity entity = new()
{
materialid = task.material_id,
processid = task.process_id,
workid = task.workstation_id,
triggerevent = EnumTriggerEvent.,
plan_check_type = WmsWareHouseConst.SHOUJIAN_ID,
mo_task_code = task.mo_task_code,
newpronum = toolMolds?.mold_cavity
};
await _qcCheckPlanService.CreateTask(entity);
}
}
if (behavior == PrdTaskBehavior.Start)
{
TimerPoolHelper.GetInstance().StartTimer(TimeCallback2,prdTaskList.Where(p => p.mo_task_status == "Pause" || p.mo_task_status == "ToBeStarted").ToList(),TimeSpan.FromMinutes(1),Timeout.InfiniteTimeSpan,false);
}
if (behavior == PrdTaskBehavior.Pause)
{
foreach (PrdMoTask? task in prdTaskList.Where(p => p.mo_task_status == "ToBeStarted").ToList())
{
TimerPoolHelper.GetInstance().DisposeTimer(new Dictionary<string,string>()
{
["key"] = task.timer_key
});
}
}
} }
await db.Ado.CommitTranAsync(); await db.Ado.CommitTranAsync();
@@ -1621,7 +1623,8 @@ namespace Tnb.ProductionMgr
workid = task.workstation_id, workid = task.workstation_id,
triggerevent = EnumTriggerEvent., triggerevent = EnumTriggerEvent.,
mo_task_code = task.mo_task_code, mo_task_code = task.mo_task_code,
newpronum = toolMolds?.mold_cavity newpronum = toolMolds?.mold_cavity,
plan_check_type = WmsWareHouseConst.XUNJIAN_ID
// check_type = WmsWareHouseConst.FULLREVIEW_CODE // check_type = WmsWareHouseConst.FULLREVIEW_CODE
}; };
await _qcCheckPlanService.CreateTask(entity); await _qcCheckPlanService.CreateTask(entity);
@@ -1657,7 +1660,8 @@ namespace Tnb.ProductionMgr
workid = task.workstation_id, workid = task.workstation_id,
triggerevent = EnumTriggerEvent., triggerevent = EnumTriggerEvent.,
mo_task_code = task.mo_task_code, mo_task_code = task.mo_task_code,
newpronum = toolMolds?.mold_cavity newpronum = toolMolds?.mold_cavity,
plan_check_type = WmsWareHouseConst.XUNJIAN_ID
// check_type = WmsWareHouseConst.FULLREVIEW_CODE // check_type = WmsWareHouseConst.FULLREVIEW_CODE
}; };
await _qcCheckPlanService.CreateTask(entity); await _qcCheckPlanService.CreateTask(entity);

View File

@@ -184,8 +184,8 @@ namespace Tnb.WarehouseMgr
thirdWebapiRecord.third_name = WmsWareHouseConst.BIP; thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
thirdWebapiRecord.name = "调拨入库"; thirdWebapiRecord.name = "调拨入库";
thirdWebapiRecord.method = "POST"; thirdWebapiRecord.method = "POST";
thirdWebapiRecord.url = config.value + "uapws/rest/transIn/save"; // thirdWebapiRecord.url = config.value + "uapws/rest/transIn/save";
// thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save"; thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save";
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(requestData); thirdWebapiRecord.request_data = JsonConvert.SerializeObject(requestData);
thirdWebapiRecord.create_time = DateTime.Now; thirdWebapiRecord.create_time = DateTime.Now;
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync(); await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();