出库签收业务回更,分拣出库
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 载具移入服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IWmsCarryMoveInStockService
|
||||||
|
{
|
||||||
|
Task<dynamic> CarryMoveIn(VisualDevModelDataCrInput input);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[OverideVisualDev(ModuleConsts.MODULE_CARRYMOVEINSTOCK_ID)]
|
[OverideVisualDev(ModuleConsts.MODULE_CARRYMOVEINSTOCK_ID)]
|
||||||
[ServiceModule(BizTypeId)]
|
[ServiceModule(BizTypeId)]
|
||||||
public class WmsCarryMoveInStockService : BaseWareHouseService
|
public class WmsCarryMoveInStockService : BaseWareHouseService, IWmsCarryMoveInStockService
|
||||||
{
|
{
|
||||||
private const string BizTypeId = "26121988909861";
|
private const string BizTypeId = "26121988909861";
|
||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
@@ -58,7 +58,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
OverideFuncs.CreateAsync = CarryMoveIn;
|
OverideFuncs.CreateAsync = CarryMoveIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<dynamic> CarryMoveIn(VisualDevModelDataCrInput input)
|
[NonAction]
|
||||||
|
public async Task<dynamic> CarryMoveIn(VisualDevModelDataCrInput input)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
private readonly IWareHouseService _wareHouseService;
|
private readonly IWareHouseService _wareHouseService;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
private readonly IBillRullService _billRullService;
|
private readonly IBillRullService _billRullService;
|
||||||
|
private readonly IWmsCarryMoveInStockService _wmsCarryMoveInStockService;
|
||||||
|
private readonly IWmsCarryService _wareCarryService;
|
||||||
|
|
||||||
|
|
||||||
public WmsOutStockService(
|
public WmsOutStockService(
|
||||||
ISqlSugarRepository<WmsOutstockD> repository,
|
ISqlSugarRepository<WmsOutstockD> repository,
|
||||||
@@ -48,7 +51,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
IVisualDevService visualDevService,
|
IVisualDevService visualDevService,
|
||||||
IWareHouseService wareHouseService,
|
IWareHouseService wareHouseService,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IBillRullService billRullService)
|
IBillRullService billRullService,
|
||||||
|
IWmsCarryMoveInStockService wmsCarryMoveInStockService,
|
||||||
|
IWmsCarryService wareCarryService)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_dictionaryDataService = dictionaryDataService;
|
_dictionaryDataService = dictionaryDataService;
|
||||||
@@ -57,6 +62,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
_wareHouseService = wareHouseService;
|
_wareHouseService = wareHouseService;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_billRullService = billRullService;
|
_billRullService = billRullService;
|
||||||
|
_wmsCarryMoveInStockService = wmsCarryMoveInStockService;
|
||||||
|
_wareCarryService = wareCarryService;
|
||||||
OverideFuncs.CreateAsync = OutStockApplyFor;
|
OverideFuncs.CreateAsync = OutStockApplyFor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +268,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task Testxx()
|
public async Task Testxx()
|
||||||
{
|
{
|
||||||
var carryCodePropNames = typeof(WmsCarryCode).GetProperties().Select(p => p.Name);
|
var carryCodePropNames = typeof(WmsDistaskCode).GetProperties().Select(p => p.Name);
|
||||||
var outStockCodePropNames = typeof(WmsOutstockCode).GetProperties().Select(p => p.Name);
|
var outStockCodePropNames = typeof(WmsOutstockCode).GetProperties().Select(p => p.Name);
|
||||||
var intersects = carryCodePropNames.Intersect(outStockCodePropNames).ToList();
|
var intersects = carryCodePropNames.Intersect(outStockCodePropNames).ToList();
|
||||||
var excepts = carryCodePropNames.Except(outStockCodePropNames).ToList();
|
var excepts = carryCodePropNames.Except(outStockCodePropNames).ToList();
|
||||||
@@ -326,13 +333,65 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||||
//如果是自动单据,需要回更上层系统
|
//如果是自动单据,需要回更上层系统
|
||||||
}
|
}
|
||||||
|
await _wareCarryService.UpdateNullCarry(carry);
|
||||||
}
|
}
|
||||||
else if (outStatus == EnumOutStatus.分拣出)
|
else if (outStatus == EnumOutStatus.分拣出)
|
||||||
{
|
{
|
||||||
|
if (input.distaskCodes?.Count > 0)
|
||||||
|
{
|
||||||
|
var osCodes = input.distaskCodes.Adapt<List<WmsOutstockCode>>();
|
||||||
|
osCodes.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
||||||
|
await _db.Insertable(osCodes).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => input.carryIds.Contains(it.carry_id)).ToListAsync();
|
||||||
|
var dicCodeQty = carryCodes.GroupBy(g => g.barcode).ToDictionary(x => x.Key, x => x.First().codeqty);
|
||||||
|
var dicUpdate = new Dictionary<string, decimal>();
|
||||||
|
var delBarcodes = new List<string>();
|
||||||
|
foreach (var dtc in input.distaskCodes)
|
||||||
|
{
|
||||||
|
if (dicCodeQty.ContainsKey(dtc.barcode))
|
||||||
|
{
|
||||||
|
if (dtc.codeqty < dicCodeQty[dtc.barcode])
|
||||||
|
{
|
||||||
|
dicUpdate[dtc.barcode] = dicCodeQty[dtc.barcode] - dtc.codeqty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delBarcodes.Add(dtc.barcode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dicUpdate.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var pair in dicUpdate)
|
||||||
|
{
|
||||||
|
WmsCarryCode carryCode = new();
|
||||||
|
carryCode.codeqty = pair.Value;
|
||||||
|
await _db.Updateable(carryCode).UpdateColumns(it => it.codeqty).Where(it => it.barcode == pair.Key).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.正常).ToString() }).Where(it => input.carryIds.Contains(it.id)).ExecuteCommandAsync();
|
||||||
|
await _db.Deleteable<WmsCarryMat>().Where(it => input.carryIds.Contains(it.carry_id)).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
if (delBarcodes.Count > 0)
|
||||||
|
{
|
||||||
|
await _db.Deleteable<WmsCarryCode>().Where(it => delBarcodes.Contains(it.barcode)).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
//载具移入
|
||||||
|
var outStockH = await _db.Queryable<WmsOutstockH>().SingleAsync(it => it.id == input.requireId);
|
||||||
|
var visulDevInput = new VisualDevModelDataCrInput();
|
||||||
|
visulDevInput.data = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
[nameof(InStockStrategyQuery.warehouse_id)] = outStockH.warehouse_id,
|
||||||
|
[nameof(WmsPointH.location_id)] = outStockH.location_id,
|
||||||
|
[nameof(WmsCarryD.carry_id)] = input.carryIds.First(),
|
||||||
|
[nameof(WmsHandleH.biz_type)] = input.bizTypeId,
|
||||||
|
[nameof(WmsHandleH.bill_code)] = outStockH.bill_code,
|
||||||
|
};
|
||||||
|
await _wmsCarryMoveInStockService.CarryMoveIn(visulDevInput);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新执行任务已签收
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -30,12 +30,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IWmsCarryService _wareCarryService;
|
private readonly IWmsCarryService _wareCarryService;
|
||||||
private readonly IDictionaryDataService _dictionaryDataService;
|
private readonly IDictionaryDataService _dictionaryDataService;
|
||||||
|
private readonly IWmsCarryMoveInStockService _wmsCarryMoveInStockService;
|
||||||
private static Dictionary<string, object> _dicBizType = new();
|
private static Dictionary<string, object> _dicBizType = new();
|
||||||
public WmsSignForDeliveryService(ISqlSugarRepository<WmsDistaskH> repository, IWmsCarryService wareCarryService, IDictionaryDataService dictionaryDataService)
|
public WmsSignForDeliveryService(ISqlSugarRepository<WmsDistaskH> repository, IWmsCarryService wareCarryService, IDictionaryDataService dictionaryDataService, IWmsCarryMoveInStockService wmsCarryMoveInStockService)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_wareCarryService = wareCarryService;
|
_wareCarryService = wareCarryService;
|
||||||
_dictionaryDataService = dictionaryDataService;
|
_dictionaryDataService = dictionaryDataService;
|
||||||
|
_wmsCarryMoveInStockService = wmsCarryMoveInStockService;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据载具ID获取,对应的执行任务记录
|
/// 根据载具ID获取,对应的执行任务记录
|
||||||
@@ -87,6 +89,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List<string> { input.carryId } };
|
WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List<string> { input.carryId } };
|
||||||
await DoUpdate(upInput); //回更业务
|
await DoUpdate(upInput); //回更业务
|
||||||
await _wareCarryService.UpdateNullCarry(carry);
|
await _wareCarryService.UpdateNullCarry(carry);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "载具移出":
|
case "载具移出":
|
||||||
@@ -98,6 +101,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
disTask.is_sign = 1;
|
||||||
|
await _db.Updateable(disTask).UpdateColumns(it => it.is_sign).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
|
|||||||
Reference in New Issue
Block a user