Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -4,125 +4,4 @@ public class ModuleConsts
|
||||
{
|
||||
public const string Tag = "PerMgr";
|
||||
public const string Area = "per";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44>쳣ȡ<ECB3A3><C8A1>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSEXCEPTIONCANCELPDA_ID = "26631250691605";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSEXCPTIONREEXCUTEPDA_ID = "26631184673813";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSEXCPTIONCOMPLETEPDA_ID = "26497241038869";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDAͶ<41>ϲ<EFBFBD><CFB2><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSFEEDINGRECORDPDA_ID = "26496913096981";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44><EFBFBD><F3B6A8B2><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSBINDINGPDA_ID = "26496560237333";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44>ؾ߽<D8BE><DFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSCARRYUNBINDPDA_ID = "26479624280613";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44>ؾ߰<D8BE><DFB0><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSCARRYBINDPDA_ID = "26479495084837";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44>ؾ<EFBFBD><D8BE>Ƴ<EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSCARRYMOOUTSTKPDA_ID = "26479437840677";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44>ؾ<EFBFBD><D8BE><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSMOVEINSTKPDA_ID = "26476127634469";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44>ؾ߸<D8BE><DFB8><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSCARRYREPLACEPDA_ID = "26475867493157";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSDELIVERYPDA_ID = "26475604135973";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44><41><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSTRANSFERPDA_ID = "26475492865317";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSINBALEINPDA_ID = "26475412782629";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSINBALEINSTKPDA_ID = "26474954845989";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDA<44><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSKITTINGINSTKPDA_ID = "26474190687781";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-PDAһ<41><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSINSTOCKPDA_ID = "26458832529445";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSOUTBALE_ID = "26192638001445";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSINBALE_ID = "26192480520485";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSOUTSTOCK_ID = "26191983650597";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSINSTOCK_ID = "26191326300453";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D>ؾ߸<D8BE><DFB8><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSCARRYREPLACE_ID = "26188532491557";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD>ּ<D7B7>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSSETSORTING_ID = "26172520979237";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD>׳<EFBFBD><D7B3><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSKITTINGOUTSTK_ID = "26169701736741";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSKITTINGINSTK_ID = "26166785871909";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSDELIVERY_ID = "26126388337189";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSTRANSFER_ID = "26125750270757";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D>ؾ<EFBFBD><D8BE>Ƴ<EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSCARRYMOOUTSTK_ID = "26123262586661";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD>ؾ߳<D8BE><DFB3><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSEPTYOUTSTK_ID = "26122798979365";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D>ؾ<EFBFBD><D8BE><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_CARRYMOVEINSTOCK_ID = "26122102481957";
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD>ؾ<EFBFBD><D8BE><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public const string MODULE_WMSEMPTYINSTOCK_ID = "26120915344165";
|
||||
|
||||
}
|
||||
@@ -94,9 +94,16 @@ public class ModuleConsts
|
||||
/// </summary>
|
||||
public const string MODULE_WMSINSTOCK_ID = "26191326300453";
|
||||
/// <summary>
|
||||
/// 模块标识-载具解绑
|
||||
public const string MODULE_WMSCARRYUNBIND_ID = "26106270092325";
|
||||
/// <summary>
|
||||
/// 模块标识-载具绑定
|
||||
/// </summary>
|
||||
public const string MODULE_WMSCARRYBIND_ID = "26105163614501";
|
||||
/// <summary>
|
||||
/// 模块标识-载具更换
|
||||
/// </summary>
|
||||
public const string MODULE_WMSCARRYREPLACE_ID = "26188532491557";
|
||||
public const string MODULE_WMSCARRYREPLACE_ID = "26188532491557";//26188532491557
|
||||
/// <summary>
|
||||
/// 模块标识-齐套分拣
|
||||
/// </summary>
|
||||
|
||||
@@ -28,6 +28,10 @@ namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
/// 任务执行条码表
|
||||
/// </summary>
|
||||
public List<WmsDistaskCode> distaskCodes { get; set; }
|
||||
/// <summary>
|
||||
/// 载具
|
||||
/// </summary>
|
||||
public List<String> carryIds { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -433,10 +433,10 @@ namespace Tnb.WarehouseMgr
|
||||
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
|
||||
if (disTasks?.Count > 0)
|
||||
{
|
||||
var multiList = disTasks.Select(it => (it.carry_id, it.endlocation_id)).ToList();
|
||||
var multiList = disTasks.Select(it => (it.carry_id, it.endlocation_id, it.endlocation_code)).ToList();
|
||||
for (int i = 0; i < multiList.Count; i++)
|
||||
{
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
//更新库位信息,使用状态为 使用,锁定状态为未锁定
|
||||
@@ -459,7 +459,7 @@ namespace Tnb.WarehouseMgr
|
||||
foreach (var dt in disTasks)
|
||||
{
|
||||
var disTaskCodes = await _db.Queryable<WmsDistaskCode>().Where(it => it.bill_id == dt.id).ToListAsync();
|
||||
var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id, distaskCodes = disTaskCodes };
|
||||
var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id, distaskCodes = disTaskCodes, carryIds = disTasks.Select(x => x.carry_id).ToList() };
|
||||
upInput.loginType = !_userManager.LoginType.IsNullOrEmpty() ? "app" : "web";
|
||||
if (dt.is_sign == 1) //区分出入库操作
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public WmsBindService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
@@ -52,7 +51,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public async Task<dynamic> WmsBind(VisualDevModelDataCrInput input)
|
||||
private async Task<dynamic> WmsBind(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 载具绑定
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACE_ID)]
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYBIND_ID)]
|
||||
public class WmsCarryBindService : BaseWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Utils;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具服务
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class WmsCarryReplaceService : BaseWareHouseService, IWmsCarryService
|
||||
{
|
||||
private const string ModuleId = "26188532491557";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public WmsCarryReplaceService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
OverideFuncs.CreateAsync = CarryReplace;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更换载具
|
||||
/// </summary>
|
||||
/// <param name="input">
|
||||
/// 输入参数:
|
||||
/// <br/>{
|
||||
/// <br/> old_carry_id:老载具id
|
||||
/// <br/> new_carry_id:新载具ID
|
||||
/// <br/>}
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> CarryReplace(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
var oldCarryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||
var newCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
|
||||
var oldCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == oldCarryId);
|
||||
var newCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == newCarryId);
|
||||
if (oldCarry != null && newCarry != null)
|
||||
{
|
||||
ExChangeCarryInput carryInput = new() { old_carry_id = oldCarry.id, new_carry_id = newCarry.id };
|
||||
isOk = await _updateSubCarry<WmsCarryD>(carryInput);
|
||||
isOk = await _updateSubCarry<WmsCarryMat>(carryInput);
|
||||
isOk = await _updateSubCarry<WmsCarryCode>(carryInput);
|
||||
|
||||
newCarry.status = oldCarry.status;
|
||||
newCarry.carry_status = oldCarry.carry_status;
|
||||
newCarry.location_id = oldCarry.location_id;
|
||||
newCarry.location_code = oldCarry.location_code;
|
||||
newCarry.is_lock = oldCarry.is_lock;
|
||||
newCarry.out_status = oldCarry.out_status;
|
||||
newCarry.is_check = oldCarry.is_check;
|
||||
newCarry.bale_num = oldCarry.bale_num;
|
||||
newCarry.collocation_scheme_id = oldCarry.collocation_scheme_id;
|
||||
newCarry.collocation_scheme_code = oldCarry.collocation_scheme_code;
|
||||
newCarry.source_id = oldCarry.source_id;
|
||||
newCarry.source_code = oldCarry.source_code;
|
||||
newCarry.create_id = _userManager.UserId;
|
||||
newCarry.create_time = DateTime.Now;
|
||||
var row = await _db.Updateable(newCarry).ExecuteCommandAsync();
|
||||
WmsCarryReplaceH wmsCarryReplaceH = oldCarry.Adapt<WmsCarryReplaceH>();
|
||||
wmsCarryReplaceH.id = SnowflakeIdHelper.NextId();
|
||||
wmsCarryReplaceH.org_id = oldCarry.org_id;
|
||||
wmsCarryReplaceH.bill_code = await _billRullService.GetBillNumber(WmsCarryConst.WMS_CARRY_REPLACE_ENCODE);
|
||||
wmsCarryReplaceH.carry_id = oldCarry.id;
|
||||
wmsCarryReplaceH.carry_code = oldCarry.carry_code;
|
||||
wmsCarryReplaceH.newcarry_id = newCarry.id;
|
||||
wmsCarryReplaceH.newcarry_code = newCarry.carry_code;
|
||||
row = await _db.Insertable(wmsCarryReplaceH).ExecuteCommandAsync();
|
||||
row = await UpdateNullCarry(oldCarry);
|
||||
isOk = (row > 0);
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldCarry == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的旧载具", 500);
|
||||
}
|
||||
if (newCarry == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的新载具", 500);
|
||||
}
|
||||
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("载具更换失败", ex);
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
|
||||
public async Task<int> UpdateNullCarry(WmsCarryH carryObj)
|
||||
{
|
||||
var row = -1;
|
||||
try
|
||||
{
|
||||
carryObj.status = 0;
|
||||
carryObj.carry_status = "0";
|
||||
carryObj.location_id = null;
|
||||
carryObj.location_code = null;
|
||||
carryObj.out_status = "0";
|
||||
carryObj.is_check = 0;
|
||||
carryObj.status = 1;
|
||||
carryObj.bale_num = null;
|
||||
carryObj.collocation_scheme_id = null;
|
||||
carryObj.collocation_scheme_code = null;
|
||||
carryObj.source_id = null;
|
||||
carryObj.source_code = null;
|
||||
row = await _db.Updateable(carryObj).ExecuteCommandAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
private async Task<bool> _updateSubCarry<T>(ExChangeCarryInput input) where T : BaseEntity<string>, IWmsCarryEntity, new()
|
||||
{
|
||||
var row = -1;
|
||||
var items = await _db.Queryable<T>().Where(it => it.carry_id == input.old_carry_id).ToListAsync();
|
||||
if (items?.Count > 0)
|
||||
{
|
||||
List<T> newItems = DeepCopyHelper<T>.DeepCopyList(items);
|
||||
if (newItems?.Count > 0)
|
||||
{
|
||||
newItems.ForEach(x =>
|
||||
{
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.carry_id = input.new_carry_id;
|
||||
|
||||
});
|
||||
row = await _db.Insertable(newItems).ExecuteCommandAsync();
|
||||
}
|
||||
if (row > 0)
|
||||
{
|
||||
row = await _db.Deleteable(items).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
return (row > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,14 +24,12 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 载具服务
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleId)]
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACE_ID)]
|
||||
public class WmsCarryService : BaseWareHouseService, IWmsCarryService
|
||||
{
|
||||
private const string ModuleId = "26188532491557";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public WmsCarryService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
@@ -52,8 +50,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> ExchangeCarry(VisualDevModelDataCrInput input)
|
||||
private async Task<dynamic> ExchangeCarry(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 载具解绑
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACE_ID)]
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYUNBIND_ID)]
|
||||
public class WmsCarryUnbindService : BaseWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
|
||||
@@ -88,12 +88,12 @@ namespace Tnb.WarehouseMgr
|
||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||
}
|
||||
int i = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
//根据每个载具的起始库位做路径运算
|
||||
for (i = 0; i < setQty.qty; i++)
|
||||
{
|
||||
|
||||
|
||||
if (carrys?.Count > 0)
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carrys[i].location_id);
|
||||
var isOk = false;
|
||||
@@ -133,12 +133,12 @@ namespace Tnb.WarehouseMgr
|
||||
}).ToList();
|
||||
//更新页面
|
||||
//赋值签收状态
|
||||
if (loc.is_sign == 0)
|
||||
if (loc.is_sign == 0)
|
||||
{
|
||||
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||
}
|
||||
isOk = await _wareHouseService.GenPreTask(preTasks, null);
|
||||
|
||||
|
||||
}
|
||||
if (isOk)
|
||||
{
|
||||
@@ -150,12 +150,12 @@ namespace Tnb.WarehouseMgr
|
||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
||||
|
||||
//更新明细表
|
||||
WmsEmptyOutstockD wmsEmptyOutstockD = new ();
|
||||
WmsEmptyOutstockD wmsEmptyOutstockD = new();
|
||||
wmsEmptyOutstockD.id = SnowflakeIdHelper.NextId();
|
||||
wmsEmptyOutstockD.bill_id = input.data[nameof(WmsEmptyOutstockH.bill_code)]?.ToString()!;
|
||||
wmsEmptyOutstockD.bill_id = preTaskUpInput.RquireId;
|
||||
wmsEmptyOutstockD.biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID;
|
||||
wmsEmptyOutstockD.location_id = ePoint.location_id;
|
||||
wmsEmptyOutstockD.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
||||
wmsEmptyOutstockD.status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
||||
wmsEmptyOutstockD.carry_id = carrys[i].id;
|
||||
wmsEmptyOutstockD.carry_code = carrys[i].carry_code;
|
||||
wmsEmptyOutstockD.create_id = _userManager.UserId;
|
||||
@@ -166,11 +166,11 @@ namespace Tnb.WarehouseMgr
|
||||
//根据空载具出库Id,回更单据状态
|
||||
await _db.Updateable<WmsEmptyOutstockH>().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||
it => new WmsCarryH { is_lock = 1},
|
||||
it => new WmsCarryH { is_lock = 1 },
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
@@ -186,8 +186,28 @@ namespace Tnb.WarehouseMgr
|
||||
public async override Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var isOk = await _db.Updateable<WmsEmptyInstock>().SetColumns(it => new WmsEmptyInstock { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
//根据载具更新明细表状态
|
||||
var isOk = await _db.Updateable<WmsEmptyOutstockD>().SetColumns(it => new WmsEmptyOutstockD { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.bill_id == input.requireId && input.carryIds.Contains(it.carry_id)).ExecuteCommandHasChangeAsync();
|
||||
|
||||
var emptyCarrys = await _db.Queryable<WmsEmptyOutstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||
// 判断所有明细是否都完成
|
||||
if (emptyCarrys?.Count > 0 && emptyCarrys.All(x => x.status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||
{
|
||||
isOk = await _db.Updateable<WmsEmptyOutstockH>().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
132
WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs
Normal file
132
WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.SS.Formula;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具绑定
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYBINDPDA_ID)]
|
||||
public class WmsPDACarryBindService : BaseWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public WmsPDACarryBindService(
|
||||
ISqlSugarRepository<WmsCarryH> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService,
|
||||
IUserManager userManager,
|
||||
IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
OverideFuncs.CreateAsync = PDACarryBind;
|
||||
}
|
||||
|
||||
private async Task<dynamic> PDACarryBind(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||
var subCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
||||
var subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == subCarryId);
|
||||
WmsCarrybindH wmsCarrybindH = carry.Adapt<WmsCarrybindH>();
|
||||
if (carry != null && subCarry != null)
|
||||
{
|
||||
wmsCarrybindH.id = SnowflakeIdHelper.NextId();
|
||||
wmsCarrybindH.org_id = carry.org_id;
|
||||
wmsCarrybindH.carry_id = carry.id;
|
||||
wmsCarrybindH.membercarry_id = subCarry.id;
|
||||
wmsCarrybindH.membercarry_code = subCarry.carry_code;
|
||||
wmsCarrybindH.loc = input.data[nameof(WmsCarrybindH.loc)].ParseToInt(1);
|
||||
wmsCarrybindH.create_id = _userManager.UserId;
|
||||
wmsCarrybindH.create_time = DateTime.Now;
|
||||
var row = await _db.Insertable(wmsCarrybindH).ExecuteCommandAsync();
|
||||
carry.carry_status = "1";
|
||||
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||
subCarry.carry_status = "1";
|
||||
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
||||
var items = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == subCarryId).ToListAsync();
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
WmsCarrybindCode wmsCarrybindCode = new();
|
||||
wmsCarrybindCode.id = SnowflakeIdHelper.NextId();
|
||||
wmsCarrybindCode.org_id = subCarry.id;
|
||||
wmsCarrybindCode.carrybind_id = wmsCarrybindH.id;
|
||||
wmsCarrybindCode.material_id = items[i].material_id;
|
||||
wmsCarrybindCode.material_code = items[i].material_code;
|
||||
wmsCarrybindCode.barcode = items[i].barcode;
|
||||
wmsCarrybindCode.code_batch = items[i].code_batch;
|
||||
wmsCarrybindCode.codeqty = items[i].codeqty;
|
||||
wmsCarrybindCode.membercarry_id = subCarry.id;
|
||||
wmsCarrybindCode.membercarry_code = subCarry.carry_code;
|
||||
wmsCarrybindCode.unit_id = items[i].unit_id;
|
||||
wmsCarrybindCode.unit_code = items[i].unit_code;
|
||||
wmsCarrybindCode.create_id = _userManager.UserId;
|
||||
wmsCarrybindCode.create_time = DateTime.Now;
|
||||
row = await _db.Insertable(wmsCarrybindCode).ExecuteCommandAsync();
|
||||
}
|
||||
isOk = (row > 0);
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (carry == null || subCarry == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的主载具", 500);
|
||||
}
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
/* public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var isOk = await _db.Updateable<WmsCarryReplaceH>().SetColumns(it => new WmsCarryReplaceH { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 载具移入
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID)]
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYMOOUTSTKPDA_ID)]
|
||||
[ServiceModule(BizTypeId)]
|
||||
public class WmsPDACarryMoveOutStockService : BaseWareHouseService, IPdaStroage
|
||||
{
|
||||
@@ -63,7 +63,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID, true);
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTKPDA_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
//入库取终点
|
||||
//var OutStockStrategyInput = new OutStockStrategyQuery { carry_id = input.data[nameof(OutStockStrategyQuery.carry_id)].ToString(), Size = 1 };
|
||||
|
||||
@@ -28,11 +28,9 @@ namespace Tnb.WarehouseMgr
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACEPDA_ID)]
|
||||
public class WmsPDACarryReplaceService : BaseWareHouseService, IWmsCarryService, IPdaStroage
|
||||
{
|
||||
//private const string ModuleId = "26188532491557";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public WmsPDACarryReplaceService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
@@ -53,8 +51,8 @@ namespace Tnb.WarehouseMgr
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PDACarryReplace(VisualDevModelDataCrInput input)
|
||||
|
||||
private async Task<dynamic> PDACarryReplace(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
|
||||
108
WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs
Normal file
108
WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.SS.Formula;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具解绑
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYUNBINDPDA_ID)]
|
||||
public class WmsPDACarryUnbindService : BaseWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
public WmsPDACarryUnbindService(
|
||||
ISqlSugarRepository<WmsCarryH> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService,
|
||||
IWareHouseService wareHouseService,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
_userManager = userManager;
|
||||
_wareHouseService = wareHouseService;
|
||||
OverideFuncs.CreateAsync = PDACarryUnbind;
|
||||
}
|
||||
private async Task<dynamic> PDACarryUnbind(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||
var subCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
|
||||
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == carryId);
|
||||
var subCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == subCarryId);
|
||||
//WmsCarryunbindH wmsCarryUnbindH = carry.Adapt<WmsCarryunbindH>();
|
||||
if (carry != null && subCarry != null)
|
||||
{
|
||||
var row = await _db.Deleteable<WmsCarryD>().Where(it => it.carry_id == subCarry.id).ExecuteCommandAsync();
|
||||
carry.carry_status = "0";
|
||||
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||
subCarry.carry_status = "0";
|
||||
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
||||
isOk = (row > 0);
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (carry == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的主载具", 500);
|
||||
}
|
||||
if (subCarry == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的子载具", 500);
|
||||
}
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
/* public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var isOk = await _db.Updateable<WmsCarryReplaceH>().SetColumns(it => new WmsCarryReplaceH { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ namespace Tnb.WarehouseMgr
|
||||
//更新明细表
|
||||
WmsEmptyOutstockD wmsEmptyOutstockD = new();
|
||||
wmsEmptyOutstockD.id = SnowflakeIdHelper.NextId();
|
||||
wmsEmptyOutstockD.bill_id = input.data[nameof(WmsEmptyOutstockH.bill_code)]?.ToString()!;
|
||||
wmsEmptyOutstockD.bill_id = preTaskUpInput.RquireId;
|
||||
wmsEmptyOutstockD.biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID;
|
||||
wmsEmptyOutstockD.location_id = ePoint.location_id;
|
||||
wmsEmptyOutstockD.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
||||
@@ -198,9 +198,29 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var isOk = await _db.Updateable<WmsEmptyInstock>().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
//根据载具更新明细表状态
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
var isOk = await _db.Updateable<WmsEmptyOutstockD>().SetColumns(it => new WmsEmptyOutstockD { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.bill_id == input.requireId && input.carryIds.Contains(it.carry_id)).ExecuteCommandHasChangeAsync();
|
||||
|
||||
var emptyCarrys = await _db.Queryable<WmsEmptyOutstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||
// 判断所有明细是否都完成
|
||||
if (emptyCarrys?.Count > 0 && emptyCarrys.All(x => x.status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||
{
|
||||
await _db.Updateable<WmsEmptyOutstockH>().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,13 +28,12 @@ namespace Tnb.WarehouseMgr
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class WmsPDAFeedingService : BaseWareHouseService, IWmsCarryService, IWmsFeedingService
|
||||
{
|
||||
private const string ModuleId = "26188532491557";
|
||||
private const string ModuleId = "26496913096981";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly WmsCarryService _wmsCarryService;
|
||||
private static Dictionary<string, object> dicMaterial = new Dictionary<string, object>();
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public WmsPDAFeedingService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService,WmsCarryService wmsCarryService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
|
||||
Reference in New Issue
Block a user