现场问题处理,电梯逻辑处理

This commit is contained in:
2024-09-10 17:42:47 +08:00
parent ddae9f34d7
commit fc57a19cf8
20 changed files with 410 additions and 90 deletions

View File

@@ -179,57 +179,113 @@ namespace Tnb.WarehouseMgr
List<WmsCarryCode> _wmsCarryCodes = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).ToList();
await _db.Updateable<WmsCarryH>().SetColumns(r => r.carry_status == (_wmsCarryCodes.Count == 0 ? "0" : r.carry_status)).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
switch (carryLoc.wh_id)
await _db.Updateable(wmsCarryCodes).ExecuteCommandAsync();
wmsMaterialSignH.warehouse_sign_id = carryLoc.wh_id;
if (_wmsCarryCodes.Count > 0)
{
case WmsWareHouseConst.WAREHOUSE_YCL_ID:
{
await _db.Updateable(wmsCarryCodes).ExecuteCommandAsync();
await _wareHouseService.s_taskExecuteSemaphore_YCLInstock.WaitAsync();
wmsMaterialSignH.warehouse_sign_id = WmsWareHouseConst.WAREHOUSE_YCL_ID;
wmsMaterialSignH.warehouse_instock_id = WmsWareHouseConst.WAREHOUSE_YCL_ID;
try
switch (carryLoc.wh_id)
{
case WmsWareHouseConst.WAREHOUSE_YCL_ID:
{
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = "1", Size = 1, AvoidBusyPassage = true, Region_id = WmsWareHouseConst.REGION_YCLCache_ID };
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
if (endLocations.Count == 0)
try
{
throw new AppFriendlyException("没有可以回库的库位", 500);
await _wareHouseService.s_taskExecuteSemaphore_YCLInstock.WaitAsync();
wmsMaterialSignH.warehouse_instock_id = WmsWareHouseConst.WAREHOUSE_YCL_ID;
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = "1", Size = 1, AvoidBusyPassage = true, Region_id = WmsWareHouseConst.REGION_YCLCache_ID };
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
if (endLocations.Count == 0)
{
throw new AppFriendlyException("没有可以回库的库位", 500);
}
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
commonCreatePretaskInput.startlocation_id = carryLoc.id;
commonCreatePretaskInput.endlocation_id = endLocations[0].id;
commonCreatePretaskInput.carry_id = wmsCarryH.id;
commonCreatePretaskInput.carry_code = wmsCarryH.carry_code;
commonCreatePretaskInput.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
commonCreatePretaskInput.biz_type = WmsWareHouseConst.BIZTYPE_WmsMaterialSign_ID;
Logger.LogInformation($"【MaterialSign】 开始生成原材料仓回库任务 起点{carryLoc.location_code} 终点{endLocations[0].location_code} 托盘 {wmsCarryH.carry_code}");
Entities.Dto.Outputs.Result res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput, _db);
if (res.code != HttpStatusCode.OK)
{
throw new AppFriendlyException(res.msg, 500);
}
}
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
commonCreatePretaskInput.startlocation_id = carryLoc.id;
commonCreatePretaskInput.endlocation_id = endLocations[0].id;
commonCreatePretaskInput.carry_id = wmsCarryH.id;
commonCreatePretaskInput.carry_code = wmsCarryH.carry_code;
commonCreatePretaskInput.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
commonCreatePretaskInput.biz_type = WmsWareHouseConst.BIZTYPE_WmsMaterialSign_ID;
Logger.LogInformation($"【MaterialSign】 开始生成原材料仓回库任务 起点{carryLoc.location_code} 终点{endLocations[0].location_code} 托盘 {wmsCarryH.carry_code}");
Entities.Dto.Outputs.Result res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput, _db);
if (res.code != HttpStatusCode.OK)
catch (Exception ex)
{
throw new AppFriendlyException(res.msg, 500);
throw;
}
finally
{
_wareHouseService.s_taskExecuteSemaphore_YCLInstock.Release();
}
}
catch (Exception ex)
{
throw;
}
finally
{
_wareHouseService.s_taskExecuteSemaphore_YCLInstock.Release();
}
break;
}
break;
}
}
}
await _db.Insertable(wmsMaterialSignH).ExecuteCommandAsync();
await _db.Insertable(wmsMaterialSignDs).ExecuteCommandAsync();
#region
//switch (wmsDistaskH.biz_type)
//{
// // 原材料调拨出库
// case WmsWareHouseConst.BIZTYPE_WmsRawmatTransferoutstock_ID:
// {
// //WmsRawmatTransferoutstockD wmsRawmatTransferoutstockD = await _db.Queryable<WmsRawmatTransferoutstockD>().Where(r => r.id == wmsDistaskH.source_id).FirstAsync();
// //WmsRawmatTransferoutstockH wmsRawmatTransferoutstockH = await _db.Queryable<WmsRawmatTransferoutstockH>().Where(r => r.id == wmsRawmatTransferoutstockD.bill_id).FirstAsync();
// //WmsTransferOrderH wmsTransferOrderH = await _db.Queryable<WmsTransferOrderH>().Where(r => r.id == wmsRawmatTransferoutstockH.transfer_order_id).FirstAsync();
// break;
// }
// case WmsWareHouseConst.BIZTYPE_WMSMATERIALTRANSFER_ID:
// {
// WmsMaterialTransferD wmsMaterialTransferD = await _db.Queryable<WmsMaterialTransferD>().Where(r => r.id == wmsDistaskH.source_id).FirstAsync();
// WmsMaterialTransfer wmsMaterialTransfer = await _db.Queryable<WmsMaterialTransfer>().Where(r => r.id == wmsMaterialTransferD.bill_id).FirstAsync();
// List<WmsStockReportCode> wmsStockReportCodes = new List<WmsStockReportCode>();
// foreach (var wmsMaterialSignD in wmsMaterialSignDs)
// {
// WmsStockReportCode wmsStockReportCode = new WmsStockReportCode();
// wmsStockReportCode.material_id = wmsMaterialSignD.id;
// wmsStockReportCode.material_code = wmsMaterialSignD.material_code;
// wmsStockReportCode.barcode = wmsMaterialSignD.barcode;
// wmsStockReportCode.code_batch = wmsMaterialSignD.code_batch;
// wmsStockReportCode.codeqty = wmsMaterialSignD.qty - wmsMaterialSignD.sign_qty;
// wmsStockReportCode.unit_id = wmsMaterialSignD.unit_id;
// wmsStockReportCode.create_id = _userManager?.User?.Id;
// wmsStockReportCode.create_time = DateTime.Now;
// wmsStockReportCode.warehouse_id = wmsMaterialTransfer.warehouse_instock;
// wmsStockReportCode.
// wmsStockReportCodes.Add(wmsStockReportCode);
// }
// //// todo 对接其它出库单 出库数量为签收数量
// //if (!_wareHouseService.GetFloor1WXSGWOutstockLocation().Contains(carryLoc.id))
// //{
// // // todo 对接其它入库单 入库数量为签收数量
// //}
// break;
// }
//}
#endregion
#region bip
switch (wmsDistaskH.biz_type)