Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -261,5 +261,9 @@
|
||||
/// 组织Id(天益4厂)
|
||||
/// </summary>
|
||||
public const string AdministratorOrgId = "25193668006933";
|
||||
/// <summary>
|
||||
/// 盘点任务计算状态-未结算
|
||||
/// </summary>
|
||||
public const string CLOSINGSTATUS_WJS_ID = "27674058079509";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.Outputs
|
||||
{
|
||||
/// <summary>
|
||||
/// 盘点任务明细输出类
|
||||
/// </summary>
|
||||
public class CheckTaskDetailOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料编号
|
||||
/// </summary>
|
||||
public string material_code { get; set; }
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string code_batch { get; set; }
|
||||
/// <summary>
|
||||
/// 库位编号
|
||||
/// </summary>
|
||||
public string location_code { get; set; }
|
||||
/// <summary>
|
||||
///载具编号
|
||||
/// </summary>
|
||||
public string carry_code { get; set; }
|
||||
/// <summary>
|
||||
/// 理论库存数量
|
||||
/// </summary>
|
||||
public decimal? pr_qty { get; set; }
|
||||
/// <summary>
|
||||
/// 结算状态
|
||||
/// </summary>
|
||||
public string closing_status { get; set; }
|
||||
/// <summary>
|
||||
/// 已盘点数量
|
||||
/// </summary>
|
||||
public decimal? qty { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.DirectoryServices.Protocols;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.Queries
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据盘点类型获取任务明细查询参数
|
||||
/// </summary>
|
||||
public class CheckDetailQuery
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓库Id
|
||||
/// </summary>
|
||||
public string warehouse_id { get; set; }
|
||||
/// <summary>
|
||||
/// 盘点类型
|
||||
/// </summary>
|
||||
public EnumCheckType CheckType { get; set; }
|
||||
/// <summary>
|
||||
/// 物料Id
|
||||
/// </summary>
|
||||
public string material_id { get; set; }
|
||||
/// <summary>
|
||||
/// 区域ID列表
|
||||
/// </summary>
|
||||
public List<string> regionIds { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,5 +103,12 @@ public partial class WmsCheckstockH : BaseEntity<string>
|
||||
/// 流程引擎Id
|
||||
/// </summary>
|
||||
public string? f_flowid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public string? material_id { get; set; }
|
||||
/// <summary>
|
||||
/// 区域ID
|
||||
/// </summary>
|
||||
public string area_id { get; set; }
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace Tnb.WarehouseMgr
|
||||
//获取所有未下发的预任务申请
|
||||
List<WmsPretaskH> preTasks = await db.Queryable<WmsPretaskH>().InnerJoin<WmsCarryH>((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id)
|
||||
.InnerJoin<WmsAreaH>((a, b, c) => a.area_id == c.id)
|
||||
.InnerJoin<BasLocation>((a, b, c, d) => a.endlocation_id == d.id && d.is_use == "0" && d.is_lock == 0)
|
||||
.InnerJoin<BasLocation>((a, b, c, d) => a.endlocation_id == d.id && d.is_use == "0" )
|
||||
.Where(a => a.status == WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID && !string.IsNullOrWhiteSpace(a.startlocation_id))
|
||||
.OrderBy(a => new { priority = SqlFunc.Desc(a.priority), a.bill_code })
|
||||
.Select((a, b, c, d) => new WmsPretaskH
|
||||
|
||||
@@ -11,12 +11,15 @@ using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Queries;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
@@ -34,6 +37,8 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private static Dictionary<string, object> _carryMap = new();
|
||||
|
||||
public WmsCheckTaskService(
|
||||
ISqlSugarRepository<WmsCheckstockH> repository,
|
||||
IWareHouseService wareHouseService,
|
||||
@@ -122,6 +127,7 @@ namespace Tnb.WarehouseMgr
|
||||
_ = await _db.Insertable(details).ExecuteCommandAsync();
|
||||
break;
|
||||
case EnumCheckType.物料盘点:
|
||||
|
||||
break;
|
||||
case EnumCheckType.批次盘点:
|
||||
break;
|
||||
@@ -129,14 +135,15 @@ namespace Tnb.WarehouseMgr
|
||||
//生成预任务信息
|
||||
if (details.Count > 0 && carryCodes.Count > 0)
|
||||
{
|
||||
// 判断当前仓库是否有盘点签收配置
|
||||
// 判断当前仓库是否有盘点签收配置
|
||||
var wcsConf = await _db.Queryable<WmsCheckSignConfig>().Where(it => it.warehouse_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString() && it.enabled == 1)
|
||||
.FirstAsync();
|
||||
BasLocation[] endLocs = Array.Empty<BasLocation>();
|
||||
int randomIndex = 0;
|
||||
if (wcsConf != null)
|
||||
{
|
||||
if (wcsConf.location_id == null) {
|
||||
if (wcsConf.location_id == null)
|
||||
{
|
||||
throw new AppFriendlyException("盘点签收配置库位为空,请查看配置!", 500);
|
||||
}
|
||||
JArray? jsonArr = null;
|
||||
@@ -147,17 +154,19 @@ namespace Tnb.WarehouseMgr
|
||||
endLocs = await _db.Queryable<BasLocation>().Where(it => it.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString() && locArr.Contains(it.id)).ToArrayAsync();
|
||||
randomIndex = new Random().Next(0, endLocs.GetUpperBound(0));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
throw new AppFriendlyException("盘点签收配置有误,请查看配置!", 500);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
string[] locTypes = new[] { ((int)EnumLocationType.出库库位).ToString(), ((int)EnumLocationType.出入库位).ToString() };
|
||||
endLocs = await _db.Queryable<BasLocation>().Where(it => it.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString() && locTypes.Contains(it.is_type)).ToArrayAsync();
|
||||
endLocs = await _db.Queryable<BasLocation>().Where(it => it.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString() && locTypes.Contains(it.is_type)).ToArrayAsync();
|
||||
randomIndex = new Random().Next(0, endLocs.GetUpperBound(0));
|
||||
}
|
||||
|
||||
|
||||
List<WmsCarryH> carrys = await _db.Queryable<WmsCarryH>().Where(it => carryCodes.Select(x => x.carry_id).Distinct().Contains(it.id)).ToListAsync();
|
||||
List<WmsCheckstockD> curDetails = details.DistinctBy(x => x.carry_id).ToList();
|
||||
List<WmsCarryCode> curCarryCodes = carryCodes.FindAll(x => curDetails.Select(d => d.carry_id).Contains(x.carry_id));
|
||||
@@ -266,5 +275,60 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
return _db.Queryable<WmsDistaskH>().InnerJoin<BasLocation>(joinExp).Where(whereExp).Select<WmsDistaskH>().ToListAsync();
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据盘点类型获取任务明细
|
||||
/// </summary>
|
||||
/// <param name="input">
|
||||
/// <br/>{
|
||||
/// <br/> warehouse_id:仓库ID
|
||||
/// <br/> CheckType:盘点类型 0 全库盘点、1 物料盘点 2 区域盘点
|
||||
/// <br/> material_id:物料ID
|
||||
/// <br/> regionIds: 区域ID列表
|
||||
/// <br/>}
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<dynamic> GetTaskDetailByCheckType([FromQuery] CheckDetailQuery input)
|
||||
{
|
||||
if(_carryMap.Count == 0)
|
||||
{
|
||||
_carryMap = await _db.Queryable<WmsCarryH>().ToDictionaryAsync(x => x.id, x => x.carry_code);
|
||||
}
|
||||
|
||||
var filterExpable = Expressionable.Create<BasLocation, WmsCarryCode, WmsCarryH>()
|
||||
.And((a, b, c) => a.wh_id == input.warehouse_id)
|
||||
.And((a, b, c) => a.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.And((a, b, c) => c.is_lock == 0);
|
||||
|
||||
switch (input.CheckType)
|
||||
{
|
||||
case EnumCheckType.物料盘点:
|
||||
filterExpable.AndIF(!string.IsNullOrEmpty(input.material_id), (a, b, c) => b.material_id == input.material_id);
|
||||
break;
|
||||
case EnumCheckType.批次盘点:
|
||||
filterExpable.AndIF(input.regionIds?.Count> 0, (a, b, c) => input.regionIds.Contains(a.region_id));
|
||||
break;
|
||||
}
|
||||
var carryCodes = await _db.Queryable<BasLocation>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.location_id)
|
||||
.InnerJoin<WmsCarryH>((a, b, c) => b.carry_id == c.id)
|
||||
.Where(filterExpable.ToExpression())
|
||||
.Select<WmsCarryCode>()
|
||||
.ToListAsync();
|
||||
//var carryIds = carryCodes?.Select(x => x.carry_id) ?? Enumerable.Empty<string>();
|
||||
//var checkStockDs = await _db.Queryable<WmsCheckstockD>().Where(it => carryIds.Contains(it.carry_id)).ToListAsync();
|
||||
|
||||
List<CheckTaskDetailOutput> outputs = carryCodes.GroupBy(g => new { g.material_code, g.code_batch, g.location_code, g.carry_id }).Select(x => new CheckTaskDetailOutput
|
||||
{
|
||||
material_code = x.Key.material_code,
|
||||
code_batch = x.Key.code_batch,
|
||||
location_code = x.Key.location_code,
|
||||
carry_code = _carryMap[x.Key.carry_id]?.ToString() ?? string.Empty,
|
||||
pr_qty = x.Sum(d => d.codeqty),
|
||||
closing_status = WmsWareHouseConst.CLOSINGSTATUS_WJS_ID,
|
||||
qty = 0,
|
||||
})
|
||||
.ToList();
|
||||
return outputs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Startup : AppStartup
|
||||
|
||||
//定时任务
|
||||
services.AddHostedService<TimedTaskBackgroundService>();
|
||||
services.AddHostedService<RedisBackGround>();
|
||||
//services.AddHostedService<RedisBackGround>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user