1
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Reflection;
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading.Channels;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Aspose.Cells.Drawing;
|
using Aspose.Cells.Drawing;
|
||||||
using JNPF;
|
using JNPF;
|
||||||
@@ -32,6 +33,7 @@ using Tnb.WarehouseMgr.Entities;
|
|||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||||
using Tnb.WarehouseMgr.Entities.Entity;
|
using Tnb.WarehouseMgr.Entities.Entity;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
@@ -44,6 +46,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
private static Dictionary<string, IWHStorageService> _stroageMap = new(StringComparer.OrdinalIgnoreCase);
|
private static Dictionary<string, IWHStorageService> _stroageMap = new(StringComparer.OrdinalIgnoreCase);
|
||||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
|
private readonly ChannelWriter<NotifyMessage> _channelWriter;
|
||||||
|
|
||||||
|
public BaseWareHouseService(ChannelWriter<NotifyMessage>? channelWriter = default)
|
||||||
|
{
|
||||||
|
_channelWriter = channelWriter;
|
||||||
|
}
|
||||||
|
|
||||||
static BaseWareHouseService()
|
static BaseWareHouseService()
|
||||||
{
|
{
|
||||||
@@ -93,7 +101,18 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
return Task.FromResult(isMatch);
|
return Task.FromResult(isMatch);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 发布消息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="taskName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[NonAction]
|
||||||
|
protected async Task Publish(string taskName)
|
||||||
|
{
|
||||||
|
NotifyMessage message = new() { TaskName = taskName };
|
||||||
|
if (_channelWriter != null)
|
||||||
|
await _channelWriter.WriteAsync(message);
|
||||||
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
protected async Task DoUpdate(WareHouseUpInput input)
|
protected async Task DoUpdate(WareHouseUpInput input)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading.Channels;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
@@ -21,6 +22,7 @@ using Tnb.WarehouseMgr.Entities;
|
|||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
@@ -39,6 +41,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
private readonly IWareHouseService _wareHouseService;
|
private readonly IWareHouseService _wareHouseService;
|
||||||
private readonly IBillRullService _billRullService;
|
private readonly IBillRullService _billRullService;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly ChannelWriter<NotifyMessage> _channelWriter;
|
||||||
|
|
||||||
|
|
||||||
public WmsCarryMoveInStockService(
|
public WmsCarryMoveInStockService(
|
||||||
@@ -47,7 +50,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
IVisualDevService visualDevService,
|
IVisualDevService visualDevService,
|
||||||
IWareHouseService wareHouseService,
|
IWareHouseService wareHouseService,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IBillRullService billRullService)
|
IBillRullService billRullService,
|
||||||
|
ITaskMessageNotify taskMessageNotify
|
||||||
|
) : base(taskMessageNotify.Writer)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_runService = runService;
|
_runService = runService;
|
||||||
@@ -55,6 +60,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
_wareHouseService = wareHouseService;
|
_wareHouseService = wareHouseService;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_billRullService = billRullService;
|
_billRullService = billRullService;
|
||||||
|
|
||||||
OverideFuncs.CreateAsync = CarryMoveIn;
|
OverideFuncs.CreateAsync = CarryMoveIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +173,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//向队列写入消息
|
||||||
|
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||||
|
}
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
IVisualDevService visualDevService,
|
IVisualDevService visualDevService,
|
||||||
IWareHouseService wareHouseService,
|
IWareHouseService wareHouseService,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IBillRullService billRullService)
|
IBillRullService billRullService,
|
||||||
|
ITaskMessageNotify taskMessageNotify) : base(taskMessageNotify.Writer)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_runService = runService;
|
_runService = runService;
|
||||||
@@ -124,10 +125,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
preTask.create_time = DateTime.Now;
|
preTask.create_time = DateTime.Now;
|
||||||
return preTask;
|
return preTask;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
if (loc.is_sign ==0 ) {
|
if (loc.is_sign == 0)
|
||||||
|
{
|
||||||
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||||
}
|
}
|
||||||
var isOk = await _wareHouseService.GenPreTask(preTasks,null!);
|
var isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
var preTaskUpInput = new GenPreTaskUpInput();
|
var preTaskUpInput = new GenPreTaskUpInput();
|
||||||
@@ -142,7 +144,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Updateable<WmsMoveOutstock>().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
await _db.Updateable<WmsMoveOutstock>().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||||
|
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||||
it => new WmsCarryH { is_lock = 1},
|
it => new WmsCarryH { is_lock = 1 },
|
||||||
it => new BasLocation { is_lock = 1 });
|
it => new BasLocation { is_lock = 1 });
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -157,6 +159,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||||
|
}
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
}
|
}
|
||||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
IVisualDevService visualDevService,
|
IVisualDevService visualDevService,
|
||||||
IRunService runService,
|
IRunService runService,
|
||||||
IBillRullService billRullService,
|
IBillRullService billRullService,
|
||||||
IUserManager userManager)
|
IUserManager userManager,
|
||||||
|
ITaskMessageNotify taskMessageNotify
|
||||||
|
) : base(taskMessageNotify.Writer)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_warehouseService = wareHouseService;
|
_warehouseService = wareHouseService;
|
||||||
@@ -218,6 +220,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||||
|
}
|
||||||
return Task.FromResult(row);
|
return Task.FromResult(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
IBasLocationService basLocationService,
|
IBasLocationService basLocationService,
|
||||||
IWareHouseService wareHouseService,
|
IWareHouseService wareHouseService,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IBillRullService billRullService
|
IBillRullService billRullService,
|
||||||
)
|
ITaskMessageNotify taskMessageNotify
|
||||||
|
) : base(taskMessageNotify.Writer)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_runService = runService;
|
_runService = runService;
|
||||||
@@ -191,6 +192,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||||
|
}
|
||||||
return await Task.FromResult(true);
|
return await Task.FromResult(true);
|
||||||
}
|
}
|
||||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IBillRullService billRullService,
|
IBillRullService billRullService,
|
||||||
ITaskMessageNotify taskMesageNotify
|
ITaskMessageNotify taskMesageNotify
|
||||||
)
|
) : base(taskMesageNotify.Writer)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_runService = runService;
|
_runService = runService;
|
||||||
@@ -188,8 +188,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
//向队列写入消息
|
//向队列写入消息
|
||||||
NotifyMessage message = new() { TaskName = nameof(IWareHouseService.GenTaskExecute) };
|
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||||
await _channelWriter.WriteAsync(message);
|
|
||||||
}
|
}
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
IVisualDevService visualDevService,
|
IVisualDevService visualDevService,
|
||||||
IWareHouseService wareHouseService,
|
IWareHouseService wareHouseService,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IBillRullService billRullService)
|
IBillRullService billRullService,
|
||||||
|
ITaskMessageNotify taskMessageNotify
|
||||||
|
) : base(taskMessageNotify.Writer)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_runService = runService;
|
_runService = runService;
|
||||||
@@ -77,7 +79,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
//判断目标库位是否自动签收
|
//判断目标库位是否自动签收
|
||||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
|
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||||
//出库取起点,获取所有符合输入的载具规格的载具
|
//出库取起点,获取所有符合输入的载具规格的载具
|
||||||
var OutStockStrategyInput = new OutStockStrategyQuery {
|
var OutStockStrategyInput = new OutStockStrategyQuery
|
||||||
|
{
|
||||||
carrystd_id = input.data[nameof(OutStockStrategyQuery.carrystd_id)].ToString(),
|
carrystd_id = input.data[nameof(OutStockStrategyQuery.carrystd_id)].ToString(),
|
||||||
warehouse_id = input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString(),
|
warehouse_id = input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString(),
|
||||||
|
|
||||||
@@ -211,6 +214,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||||
|
}
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IBillRullService billRullService,
|
IBillRullService billRullService,
|
||||||
IWareHouseService wareHouseService,
|
IWareHouseService wareHouseService,
|
||||||
IPrdInstockService prdInstockService
|
IPrdInstockService prdInstockService,
|
||||||
)
|
ITaskMessageNotify taskMessageNotify
|
||||||
|
) : base(taskMessageNotify.Writer)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_dictionaryDataService = dictionaryDataService;
|
_dictionaryDataService = dictionaryDataService;
|
||||||
@@ -70,11 +71,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
public async Task<dynamic> GetInStockDetailsListById([FromRoute] string billId)
|
public async Task<dynamic> GetInStockDetailsListById([FromRoute] string billId)
|
||||||
{
|
{
|
||||||
var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID);
|
var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID);
|
||||||
var items = await _db.Queryable<WmsInstockD>().LeftJoin<BasWarehouse>((a,b)=>a.warehouse_id == b.id)
|
var items = await _db.Queryable<WmsInstockD>().LeftJoin<BasWarehouse>((a, b) => a.warehouse_id == b.id)
|
||||||
.Select((a, b) => new WmsInstockD
|
.Select((a, b) => new WmsInstockD
|
||||||
{
|
{
|
||||||
warehouse_name = b.whname
|
warehouse_name = b.whname
|
||||||
},true)
|
}, true)
|
||||||
.Where(a => a.bill_id == billId).ToListAsync();
|
.Where(a => a.bill_id == billId).ToListAsync();
|
||||||
_db.ThenMapper(items,
|
_db.ThenMapper(items,
|
||||||
it => it.line_status = dic.ContainsKey(it.line_status) ? dic[it.line_status]?.ToString()! : "");
|
it => it.line_status = dic.ContainsKey(it.line_status) ? dic[it.line_status]?.ToString()! : "");
|
||||||
@@ -474,6 +475,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
//return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
//return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||||
|
}
|
||||||
return isSuccessFul;
|
return isSuccessFul;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
IVisualDevService visualDevService,
|
IVisualDevService visualDevService,
|
||||||
IWareHouseService wareHouseService,
|
IWareHouseService wareHouseService,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IBillRullService billRullService)
|
IBillRullService billRullService,
|
||||||
|
ITaskMessageNotify taskMessageNotify
|
||||||
|
) : base(taskMessageNotify.Writer)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_runService = runService;
|
_runService = runService;
|
||||||
@@ -214,6 +216,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
await Publish(nameof(IWareHouseService.GenTaskExecute));
|
||||||
|
}
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,7 +234,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
if (kittingOut != null)
|
if (kittingOut != null)
|
||||||
{
|
{
|
||||||
var locaion = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == kittingOut.location_id);
|
var locaion = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == kittingOut.location_id);
|
||||||
if (locaion !=null && locaion.is_type.ToEnum<EnumLocationType>() != EnumLocationType.存储库位)
|
if (locaion != null && locaion.is_type.ToEnum<EnumLocationType>() != EnumLocationType.存储库位)
|
||||||
{
|
{
|
||||||
kittingOut.status = WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID;
|
kittingOut.status = WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user