erp转库单同步
This commit is contained in:
@@ -5,6 +5,7 @@ using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
@@ -365,7 +366,7 @@ namespace Tnb.WarehouseMgr
|
||||
string Code = await _billRuleService.GetBillNumber("MaterialTransfer");
|
||||
wmsMaterialTransfer.bill_code = Code;
|
||||
wmsMaterialTransfer.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
wmsMaterialTransfer.bill_date = input.bill_date;
|
||||
wmsMaterialTransfer.bill_date = DateTime.Now;
|
||||
wmsMaterialTransfer.warehouse_outstock = warehouse_outstock.id;
|
||||
wmsMaterialTransfer.warehouse_instock = warehouse_instock.id;
|
||||
wmsMaterialTransfer.biller_out = input.biller_out;
|
||||
|
||||
@@ -2157,11 +2157,13 @@ namespace Tnb.WarehouseMgr
|
||||
is_lock = 0,
|
||||
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))
|
||||
{
|
||||
loc.is_use = ((int)EnumCarryStatus.占用).ToString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 如果是出入库位 完成后解除占用
|
||||
string? is_type = locTypeMap.ContainsKey(endLocId) ? locTypeMap[endLocId].ToString() : "";
|
||||
if (is_type == ((int)EnumLocationType.出入库位).ToString())
|
||||
|
||||
@@ -393,19 +393,34 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Ado.BeginTranAsync();
|
||||
try
|
||||
{
|
||||
|
||||
WmsCarryH wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).First();
|
||||
if (wmsCarryH == null)
|
||||
{
|
||||
Logger.Error($"【FinishproductOutstockSign】请扫描正确的载具条码");
|
||||
throw new AppFriendlyException($"请扫描正确的载具条码", 500);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(wmsCarryH.location_id))
|
||||
{
|
||||
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code}没有当前库位 不能签收!");
|
||||
throw new AppFriendlyException("FinishproductOutstockSign】载具 {input.carry_code}没有当前库位 不能签收!", 500);
|
||||
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code}没有当前库位 不能签收!可能是重复签收");
|
||||
throw new AppFriendlyException($"载具 {input.carry_code}没有当前库位 不能签收!可能是重复签收", 500);
|
||||
}
|
||||
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
|
||||
BasLocation location = _db.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).First();
|
||||
if (string.IsNullOrEmpty(location.location_code))
|
||||
{
|
||||
is_lock = 0,
|
||||
carry_status = "0"
|
||||
}).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
|
||||
Logger.Error($"【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!");
|
||||
throw new AppFriendlyException($"库位id {wmsCarryH.location_id}没有对应的库位基础资料!", 500);
|
||||
}
|
||||
|
||||
WmsDistaskH wmsDistaskH = _db.Queryable<WmsDistaskH>().Where(r => r.carry_code == input.carry_code && r.endlocation_id == location.id
|
||||
&& r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID && r.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID).First();
|
||||
if (wmsDistaskH != null)
|
||||
{
|
||||
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code} 库位 {location.location_code}有正在执行的任务,不允许签收!");
|
||||
throw new AppFriendlyException($"载具 {input.carry_code} 库位 {location.location_code}有正在执行的任务,不允许签收!", 500);
|
||||
}
|
||||
|
||||
await _db.Updateable<BasLocation>().SetColumns(r => new BasLocation
|
||||
{
|
||||
@@ -413,12 +428,15 @@ namespace Tnb.WarehouseMgr
|
||||
is_use = "0"
|
||||
}).Where(r => r.id == wmsCarryH.location_id).ExecuteCommandAsync();
|
||||
|
||||
BasLocation location = _db.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).First();
|
||||
if (string.IsNullOrEmpty(location.location_code))
|
||||
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
|
||||
{
|
||||
Logger.Error($"【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!");
|
||||
throw new AppFriendlyException("【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!", 500);
|
||||
}
|
||||
location_id = "",
|
||||
location_code = "",
|
||||
is_lock = 0,
|
||||
carry_status = "0"
|
||||
}).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
|
||||
|
||||
await _db.Updateable<WmsPointH>().SetColumns(r => new WmsPointH
|
||||
{
|
||||
is_lock = 0
|
||||
@@ -430,9 +448,10 @@ namespace Tnb.WarehouseMgr
|
||||
if (result.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
||||
{
|
||||
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code}解绑失败!");
|
||||
throw new AppFriendlyException("【FinishproductOutstockSign】载具 {input.carry_code}解绑失败!", 500);
|
||||
throw new AppFriendlyException($"载具 {input.carry_code}解绑失败!", 500);
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
Logger.LogInformation($"【FinishproductOutstockSign】载具签收成功 载具:{input.carry_code} 库位:{location.location_code}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user