退料到中储仓

This commit is contained in:
2024-06-27 22:17:23 +08:00
parent 91c451cfc5
commit 6284ea4b56
5 changed files with 32 additions and 12 deletions

View File

@@ -518,7 +518,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
if (!result_createPretask) if (!result_createPretask)
{ {
LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败 "); LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败 ");
continue; throw new Exception($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
} }
LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功"); LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功");
@@ -611,7 +611,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
if (!result_createPretask) if (!result_createPretask)
{ {
LoggerYCLGLDPJInstock.LogWarning($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败"); LoggerYCLGLDPJInstock.LogWarning($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
continue; throw new Exception($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
} }
LoggerYCLGLDPJInstock.LogWarning($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功"); LoggerYCLGLDPJInstock.LogWarning($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功");
@@ -699,7 +699,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
if (!result_createPretask) if (!result_createPretask)
{ {
LoggerYCLGLDPJInstock.LogWarning($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败"); LoggerYCLGLDPJInstock.LogWarning($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
continue; throw new Exception($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
} }
LoggerYCLGLDPJInstock.LogWarning($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功"); LoggerYCLGLDPJInstock.LogWarning($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功");
@@ -1190,13 +1190,15 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
.Where((a, b, c, d) => a.wh_id == "33780009364245" && a.is_use == "1" && a.is_lock == 0 && a.is_type == "0" && !string.IsNullOrEmpty(c.id) .Where((a, b, c, d) => a.wh_id == "33780009364245" && a.is_use == "1" && a.is_lock == 0 && a.is_type == "0" && !string.IsNullOrEmpty(c.id)
&& b.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID).OrderBy((a, b, c, d) => d.id).Select((a, b, c, d) => new // 关联载具物料明细表 && b.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID).OrderBy((a, b, c, d) => d.id).Select((a, b, c, d) => new // 关联载具物料明细表
{ {
wmsCarryH = b,
basLocation = a, basLocation = a,
WmsCarryCode_id = d.id WmsCarryCode_id = d.id
}).ToList().GroupBy(r => r.basLocation.location_code).Select(r => }).ToList().GroupBy(r => r.basLocation.location_code).Select(r =>
{ {
var item = r.FirstOrDefault(); var item = r.FirstOrDefault();
// 前面通过OrderBy(d => d.id)对WmsCarryCode_id进行了排序 那么如果第一行有数据则说明存在非空料箱 // 空载具入库: 前面通过OrderBy(d => d.id)对WmsCarryCode_id进行了排序 那么如果第一行有数据则说明存在非空料箱
if (!string.IsNullOrEmpty(item.WmsCarryCode_id)) // 没有物料且没有退料标记的不满足出库条件
if (!string.IsNullOrEmpty(item.WmsCarryCode_id) && (item.wmsCarryH.need_return == 0 || item.wmsCarryH.need_return == null))
{ {
return new BasLocation(); return new BasLocation();
} }
@@ -1257,11 +1259,16 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
await db_Floor2timer送满托到下升降区.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
{
need_return = 0
}).Where(r => r.id == targetCarry.id).ExecuteCommandAsync();
bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery, db_Floor2timer送满托到下升降区); bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery, db_Floor2timer送满托到下升降区);
if (!result) if (!result)
{ {
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
continue; throw new Exception($"【送满托到下升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
} }
} }
await db_Floor2timer送满托到下升降区.Ado.CommitTranAsync(); await db_Floor2timer送满托到下升降区.Ado.CommitTranAsync();
@@ -1473,7 +1480,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
if (!result) if (!result)
{ {
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}"); LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
continue; throw new Exception($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
} }
} }
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.CommitTranAsync(); await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.CommitTranAsync();

View File

@@ -227,7 +227,7 @@ public class ModuleConsts
/// <summary> /// <summary>
/// 模块标识-原材料转库单 /// 模块标识-原材料转库单
/// </summary> /// </summary>
public const string MODULE_WMSMATERIALTRANSFER_ID = "34354738929685"; public const string MODULE_WMSMATERIALTRANSFER_ID = "35129233455125";
/// <summary> /// <summary>
/// 模块标识-生产入库单 /// 模块标识-生产入库单
/// </summary> /// </summary>

View File

@@ -139,5 +139,10 @@ public partial class WmsCarryH : BaseEntity<string>
/// 配送工位 /// 配送工位
/// </summary> /// </summary>
public string? work_station { get; set; } public string? work_station { get; set; }
/// <summary>
/// 需要退料
/// </summary>
public int need_return { get; set; }
} }

View File

@@ -2098,7 +2098,7 @@ namespace Tnb.WarehouseMgr
{ {
id = multiList[i].endlocation_id, id = multiList[i].endlocation_id,
is_lock = 0, is_lock = 0,
is_use = multiList[i].carry_status is_use = string.IsNullOrEmpty(multiList[i].carry_status) ? ((int)EnumCarryStatus.).ToString() : multiList[i].carry_status
}; };
if (!string.IsNullOrEmpty(multiList[i].carry_status) && multiList[i].carry_status.ToEnum<EnumCarryStatus>() == EnumCarryStatus.) if (!string.IsNullOrEmpty(multiList[i].carry_status) && multiList[i].carry_status.ToEnum<EnumCarryStatus>() == EnumCarryStatus.)
{ {
@@ -2119,6 +2119,7 @@ namespace Tnb.WarehouseMgr
_ = await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync(); _ = await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync();
//更新库位信息,使用状态为 使用,锁定状态为未锁定 //更新库位信息,使用状态为 使用,锁定状态为未锁定
_ = await _db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).ExecuteCommandAsync(); _ = await _db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).ExecuteCommandAsync();
Logger.Information($"【TaskComplate】 更新库位 {JsonConvert.SerializeObject(locIts)}");
/* var loginType= _userManager?.LoginType ?? "web"; /* var loginType= _userManager?.LoginType ?? "web";
Log.Information($"_userManager.LoginType={loginType}"); Log.Information($"_userManager.LoginType={loginType}");
*/ //更新业务主表的单据状态 */ //更新业务主表的单据状态
@@ -2151,11 +2152,13 @@ namespace Tnb.WarehouseMgr
// 二楼物料呼叫任务结束后清空工位信息 // 二楼物料呼叫任务结束后清空工位信息
else if (dt.biz_type == "FloorCallMaterial") else if (dt.biz_type == "FloorCallMaterial")
{ {
await _db.Updateable<WmsCarryH>().SetColumns(r => r.work_station == "").Where(r => r.id == dt.carry_id).ExecuteCommandAsync(); await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
{
work_station = ""
}).Where(r => r.id == dt.carry_id).ExecuteCommandAsync();
// require_code是任务单 // require_code是任务单
//string mo_task_code = dt.require_code; //string mo_task_code = dt.require_code;
} }
#endregion #endregion
@@ -2971,7 +2974,7 @@ namespace Tnb.WarehouseMgr
} }
else else
{ {
throw new AppFriendlyException("生成预任务失败", 500); throw new AppFriendlyException("生成预任务失败(可能是因为预任务起点与终点相同)", 500);
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -169,6 +169,9 @@ namespace Tnb.WarehouseMgr
await _db.Ado.BeginTranAsync(); await _db.Ado.BeginTranAsync();
// 标记为退料
await _db.Updateable<WmsCarryH>().SetColumns(r => r.need_return == 1).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
Logger.LogWarning($"【PrdReturn】开始生成预任务"); Logger.LogWarning($"【PrdReturn】开始生成预任务");
CommonCreatePretaskInput commonCreatePretaskInput = new(); CommonCreatePretaskInput commonCreatePretaskInput = new();
commonCreatePretaskInput.startlocation_id = startlocation.id; commonCreatePretaskInput.startlocation_id = startlocation.id;
@@ -268,6 +271,8 @@ namespace Tnb.WarehouseMgr
} }
await _db.Ado.BeginTranAsync(); await _db.Ado.BeginTranAsync();
// 标记为退料
await _db.Updateable<WmsCarryH>().SetColumns(r => r.need_return == 1).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
Logger.LogWarning($"【PrdReturn】开始生成预任务"); Logger.LogWarning($"【PrdReturn】开始生成预任务");
CommonCreatePretaskInput commonCreatePretaskInput = new(); CommonCreatePretaskInput commonCreatePretaskInput = new();