Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -8,14 +8,14 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 组织ID
|
/// 组织ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? org_id { get; set; }
|
public string org_id { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具Id
|
/// 载具Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? carry_code { get; set;}
|
public string carry_code { get; set;}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建热Id
|
/// 创建热Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? create_id { get; set; }
|
public string create_id { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,22 +14,22 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 组织ID
|
/// 组织ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? org_id { get; set; }
|
public string org_id { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 库位编号
|
/// 库位编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? location_code { get; set; }
|
public string location_code { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具编号
|
/// 载具编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? carry_code { get; set; }
|
public string carry_code { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建用户
|
/// 创建用户
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? create_id { get; set; }
|
public string create_id { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 入库仓库
|
/// 入库仓库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? warehouse_id { get; set; }
|
public string warehouse_id { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,20 +25,20 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建用户
|
/// 创建用户
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? create_id { get; set; }
|
public string create_id { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 入库仓库
|
/// 入库仓库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? warehouse_id { get; set; }
|
public string warehouse_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具规格编号
|
/// 载具规格编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? carrystd_id { get; set; }
|
public string carrystd_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数量
|
/// 数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? qty { get; set; }
|
public int qty { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所属组织ID
|
/// 所属组织ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? org_id { get; set; }
|
public string org_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出库单创建日期
|
/// 出库单创建日期
|
||||||
@@ -34,37 +34,37 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 库位ID
|
/// 库位ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? location_id { get; set; }
|
public string location_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 库位编号
|
/// 库位编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? location_code { get; set; }
|
public string location_code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具ID
|
/// 载具ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? carry_id { get; set; }
|
public string carry_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具编号
|
/// 载具编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? carry_code { get; set; }
|
public string carry_code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 产品ID
|
/// 产品ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? material_id { get; set; }
|
public string material_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 产品编号
|
/// 产品编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? material_code { get; set; }
|
public string material_code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 齐套搭配方案ID
|
/// 齐套搭配方案ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? collocation_scheme_id { get; set; }
|
public string collocation_scheme_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 齐套搭配方案编号
|
/// 齐套搭配方案编号
|
||||||
@@ -74,7 +74,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 来源单据ID
|
/// 来源单据ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? source_id { get; set; }
|
public string source_id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -85,12 +85,12 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建用户ID
|
/// 创建用户ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? create_id { get; set; }
|
public string create_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MES齐套出库明细表输入
|
/// MES齐套出库明细表输入
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<MESKittingOutStkDInput>? wmsKittingoutDs { get; set; }
|
public List<MESKittingOutStkDInput> wmsKittingoutDs { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -108,33 +108,33 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单位编号
|
/// 单位编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? unit_code { get; set; }
|
public string unit_code { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 产品ID
|
/// 产品ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? material_id { get; set; }
|
public string material_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 产品编号
|
/// 产品编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? material_code { get; set; }
|
public string material_code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 批次
|
/// 批次
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? code_batch { get; set; }
|
public string code_batch { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数量(件数)
|
/// 数量(件数)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal? pr_qty { get; set; }
|
public decimal pr_qty { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 箱数
|
/// 箱数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? box { get; set; }
|
public int box { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,5 +23,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public object data { get; set; }
|
public object data { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,27 +32,26 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[NonUnify]
|
|
||||||
public async Task<dynamic> MESCarryQuery(MESCarryQueryInput input)
|
public async Task<dynamic> MESCarryQuery(MESCarryQueryInput input)
|
||||||
{
|
{
|
||||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||||
var results = new List<CarryQueryOutput>();
|
var data = new List<CarryQueryOutput>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var carrys = await _db.Queryable<WmsCarryH>()
|
var carrys = await _db.Queryable<WmsCarryH>()
|
||||||
.InnerJoin<WmsCollocationSchemeH>((a, b) => a.collocation_scheme_id == b.id)
|
.InnerJoin<WmsCollocationSchemeH>((a, b) => a.collocation_scheme_id == b.id)
|
||||||
.Where((a, b) => a.carry_code.Contains(input.carry_code) || b.bill_name.Contains(input.collocation_scheme_name))
|
.Where((a, b) => a.carry_code.Contains(input.carry_code) || b.bill_name.Contains(input.collocation_scheme_name))
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
data = carrys.Adapt<List<CarryQueryOutput>>();
|
||||||
|
|
||||||
results = carrys.Adapt<List<CarryQueryOutput>>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
|
||||||
}
|
}
|
||||||
return ToApiResult(results);
|
return data;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具查询返回接口
|
/// 载具查询返回接口
|
||||||
@@ -60,25 +59,26 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[NonUnify]
|
//[NonUnify]
|
||||||
public async Task<dynamic> MESCarryQueryResult(MESCarryQueryResultInput input)
|
public async Task<dynamic> MESCarryQueryResult(MESCarryQueryResultInput input)
|
||||||
{
|
{
|
||||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||||
var result = new CarryQueryOutput();
|
var data = new CarryQueryOutput();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code);
|
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code);
|
||||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carry.id).ToListAsync();
|
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carry.id).ToListAsync();
|
||||||
result = carry.Adapt<CarryQueryOutput>();
|
data = carry.Adapt<CarryQueryOutput>();
|
||||||
result.wmsCarryCodes = carryCodes.Adapt<List<CarryCodeQueryOutput>>();
|
data.wmsCarryCodes = carryCodes.Adapt<List<CarryCodeQueryOutput>>();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
return ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, result);
|
//return ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, data);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,14 +88,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[NonUnify]
|
//[NonUnify]
|
||||||
public async Task<dynamic> MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input)
|
public async Task<dynamic> MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input)
|
||||||
{
|
{
|
||||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||||
var results = new List<CollocationSchemeOutput>();
|
var data = new List<CollocationSchemeOutput>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
results = await _db.Queryable<WmsCollocationSchemeH>()
|
data = await _db.Queryable<WmsCollocationSchemeH>()
|
||||||
.Where(a => a.material_id == input.material_id)
|
.Where(a => a.material_id == input.material_id)
|
||||||
.Select(a => new CollocationSchemeOutput
|
.Select(a => new CollocationSchemeOutput
|
||||||
{
|
{
|
||||||
@@ -104,11 +104,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
.Mapper(it => it.CollocationSchemeDs = it.list?.Adapt<List<CollocationSchemeDOutput>>())
|
.Mapper(it => it.CollocationSchemeDs = it.list?.Adapt<List<CollocationSchemeDOutput>>())
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
|
||||||
}
|
}
|
||||||
return await ToApiResult(results);
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,10 +87,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
if (sPoint != null && ePoint != null)
|
if (sPoint != null && ePoint != null)
|
||||||
{
|
{
|
||||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
|
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||||
if (points?.Count > 0)
|
else
|
||||||
{
|
{
|
||||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
|
||||||
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||||
{
|
{
|
||||||
var sPoint = it.FirstOrDefault();
|
var sPoint = it.FirstOrDefault();
|
||||||
@@ -153,6 +153,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("起始库位不可用或无可用的目标库位", 500);
|
||||||
|
}
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
@@ -169,9 +173,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[NonUnify]
|
|
||||||
public async Task<dynamic> MesEmptyCarryInStock(MESEmptyCarryInStockInput input)
|
public async Task<dynamic> MesEmptyCarryInStock(MESEmptyCarryInStockInput input)
|
||||||
{
|
{
|
||||||
|
var isSuccessful = false;
|
||||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -203,15 +207,15 @@ namespace Tnb.WarehouseMgr
|
|||||||
data = dic
|
data = dic
|
||||||
};
|
};
|
||||||
await WmsEmptyIn(visualDevModelDataCrInput);
|
await WmsEmptyIn(visualDevModelDataCrInput);
|
||||||
|
isSuccessful = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
return ToApiResult();
|
return isSuccessful;
|
||||||
|
|
||||||
}
|
}
|
||||||
public async override Task ModifyAsync(WareHouseUpInput input)
|
public async override Task ModifyAsync(WareHouseUpInput input)
|
||||||
|
|||||||
@@ -89,25 +89,23 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsPointH? ePoint = null;
|
WmsPointH? ePoint = null;
|
||||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
||||||
{
|
{
|
||||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString() && it.is_lock == 0);
|
||||||
}
|
}
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//根据每个载具的起始库位做路径运算
|
//根据每个载具的起始库位做路径运算
|
||||||
for (i = 0; i < setQty.qty; i++)
|
for (int i = 0; i < setQty.qty; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (carrys?.Count > 0)
|
if (carrys?.Count > 0)
|
||||||
|
{
|
||||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carrys[i].location_id);
|
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carrys[i].location_id);
|
||||||
|
}
|
||||||
var isOk = false;
|
var isOk = false;
|
||||||
if (sPoint != null && ePoint != null)
|
if (sPoint != null && ePoint != null)
|
||||||
{
|
{
|
||||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
|
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||||
if (points?.Count > 0)
|
else
|
||||||
{
|
{
|
||||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
|
||||||
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||||
{
|
{
|
||||||
var sPoint = it.FirstOrDefault();
|
var sPoint = it.FirstOrDefault();
|
||||||
@@ -142,7 +140,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||||
}
|
}
|
||||||
isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
@@ -174,6 +171,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
it => new BasLocation { is_lock = 1 });
|
it => new BasLocation { is_lock = 1 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("无可出库的空载具或目标库位不存在或者目标库位被锁", 500);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,30 +221,29 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[NonUnify]
|
|
||||||
public async Task<dynamic> MESEmptyCarryOutStk(MESEmptyCarryOutStkInput input)
|
public async Task<dynamic> MESEmptyCarryOutStk(MESEmptyCarryOutStkInput input)
|
||||||
{
|
{
|
||||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code);
|
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code);
|
||||||
var dic = new Dictionary<string, object>();
|
var dic = new Dictionary<string, object>();
|
||||||
dic[nameof(WmsEmptyOutstockH.id)] = SnowflakeIdHelper.NextId();
|
dic[nameof(WmsEmptyOutstockH.id)] = SnowflakeIdHelper.NextId();
|
||||||
dic[nameof(WmsEmptyOutstockH.org_id)] = input.org_id;
|
dic[nameof(WmsEmptyOutstockH.org_id)] = input.org_id;
|
||||||
dic[nameof(WmsEmptyOutstockH.location_id)] = location.id;
|
dic[nameof(WmsEmptyOutstockH.location_id)] = location.id;
|
||||||
dic[nameof(WmsEmptyOutstockH.carrystd_id)] = input.carrystd_id;
|
dic[nameof(WmsEmptyOutstockH.carrystd_id)] = input.carrystd_id;
|
||||||
dic[nameof(WmsEmptyOutstockH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYOUTSTK_ENCODE).GetAwaiter().GetResult();
|
dic[nameof(WmsEmptyOutstockH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYOUTSTK_ENCODE).GetAwaiter().GetResult();
|
||||||
dic[nameof(WmsEmptyOutstockH.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
dic[nameof(WmsEmptyOutstockH.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||||
dic[nameof(WmsEmptyOutstockH.qty)] = input.qty;
|
dic[nameof(WmsEmptyOutstockH.qty)] = input.qty;
|
||||||
dic[nameof(WmsEmptyOutstockH.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID;
|
dic[nameof(WmsEmptyOutstockH.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID;
|
||||||
dic[nameof(WmsEmptyOutstockH.create_id)] = input.create_id;
|
dic[nameof(WmsEmptyOutstockH.create_id)] = input.create_id;
|
||||||
dic[nameof(WmsEmptyOutstockH.create_time)] = DateTime.Now;
|
dic[nameof(WmsEmptyOutstockH.create_time)] = DateTime.Now;
|
||||||
|
|
||||||
VisualDevModelDataCrInput visualDevModelDataCrInput = new VisualDevModelDataCrInput
|
VisualDevModelDataCrInput visualDevModelDataCrInput = new VisualDevModelDataCrInput
|
||||||
{
|
{
|
||||||
data = dic,
|
data = dic,
|
||||||
};
|
};
|
||||||
await PDAWmsEmptyOut(visualDevModelDataCrInput);
|
await PDAWmsEmptyOut(visualDevModelDataCrInput);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -257,9 +257,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[NonUnify]
|
|
||||||
public async Task<dynamic> MESCreateInstock(MESCreateInstockInput input)
|
public async Task<dynamic> MESCreateInstock(MESCreateInstockInput input)
|
||||||
{
|
{
|
||||||
|
var isSuccessFul = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
@@ -445,6 +445,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync();
|
await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync();
|
||||||
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync();
|
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
isSuccessFul = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -453,11 +454,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
isSuccessFul = false;
|
||||||
JNPF.Logging.Log.Error(ex.Message);
|
JNPF.Logging.Log.Error(ex.Message);
|
||||||
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);
|
||||||
}
|
}
|
||||||
return await ToApiResult();
|
return isSuccessFul;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,9 +96,19 @@ namespace Tnb.WarehouseMgr
|
|||||||
List<WmsCarryCode> carryCodes = new();
|
List<WmsCarryCode> carryCodes = new();
|
||||||
foreach (var os in outStockDList)
|
foreach (var os in outStockDList)
|
||||||
{
|
{
|
||||||
|
var whereExpr = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
|
||||||
|
.And((a, b, c) => b.material_id == os.material_id)
|
||||||
|
.And((a, b, c) => a.is_lock == 0)
|
||||||
|
.And((a, b, c) => !string.IsNullOrEmpty(a.location_id))
|
||||||
|
.And((a, b, c) => a.status == (int)EnumCarryStatus.占用)
|
||||||
|
.And((a, b, c) => c.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||||
|
.And((a, b, c) => a.out_status == "0")
|
||||||
|
.And((a, b, c) => c.wh_id == input.data[nameof(WmsOutstockH.warehouse_id)].ToString())
|
||||||
|
.AndIF(!string.IsNullOrEmpty(os.code_batch), (a, b, c) => b.code_batch == os.code_batch)
|
||||||
|
.ToExpression();
|
||||||
|
|
||||||
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||||
.Where((a, b, c) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.占用 && c.is_type == ((int)EnumLocationType.存储库位).ToString())
|
.Where(whereExpr)
|
||||||
.WhereIF(!string.IsNullOrEmpty(os.code_batch), (a, b) => b.code_batch == os.code_batch)
|
|
||||||
.Select<WmsCarryCode>()
|
.Select<WmsCarryCode>()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (carryCodesPart?.Count > 0)
|
if (carryCodesPart?.Count > 0)
|
||||||
@@ -201,9 +211,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsPretaskH preTask = new()
|
WmsPretaskH preTask = new()
|
||||||
{
|
{
|
||||||
org_id = _userManager.User.OrganizeId,
|
org_id = _userManager.User.OrganizeId,
|
||||||
startlocation_id = sPoint?.location_id!,
|
startlocation_id = sPoint?.location_id ?? string.Empty,
|
||||||
startlocation_code = sPoint?.location_code!,
|
startlocation_code = sPoint?.location_code ?? string.Empty,
|
||||||
endlocation_id = ePoint?.location_id!,
|
endlocation_id = ePoint?.location_id ?? string.Empty,
|
||||||
endlocation_code = ePoint?.location_code!,
|
endlocation_code = ePoint?.location_code!,
|
||||||
start_floor = sPoint?.floor.ToString(),
|
start_floor = sPoint?.floor.ToString(),
|
||||||
end_floor = ePoint?.floor.ToString(),
|
end_floor = ePoint?.floor.ToString(),
|
||||||
@@ -213,13 +223,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID,
|
task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID,
|
||||||
carry_id = carry.id,
|
carry_id = carry.id,
|
||||||
carry_code = carry.carry_code,
|
carry_code = carry.carry_code,
|
||||||
area_id = sPoint?.area_id!,
|
area_id = sPoint?.area_id ?? string.Empty,
|
||||||
area_code = it.Key,
|
area_code = it.Key,
|
||||||
require_id = input.data["ReturnIdentity"].ToString()
|
require_id = input.data["ReturnIdentity"].ToString(),
|
||||||
|
require_code = input.data[nameof(preTask.bill_code)]?.ToString()!,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now
|
||||||
};
|
};
|
||||||
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
|
||||||
preTask.create_id = _userManager.UserId;
|
|
||||||
preTask.create_time = DateTime.Now;
|
|
||||||
return preTask;
|
return preTask;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
if (loc.is_sign == 0)
|
if (loc.is_sign == 0)
|
||||||
@@ -245,10 +255,17 @@ namespace Tnb.WarehouseMgr
|
|||||||
pretaskCodes.AddRange(curPreTaskCodes);
|
pretaskCodes.AddRange(curPreTaskCodes);
|
||||||
}
|
}
|
||||||
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
||||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
if (isOk)
|
||||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
{
|
||||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
outStockDList.ForEach(x => x.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID);
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
|
await _db.Updateable(outStockDList).UpdateColumns(it => it.line_status).ExecuteCommandAsync();
|
||||||
|
await _db.Updateable<WmsOutstockH>().SetColumns(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).Where(it => it.id == input.data["ReturnIdentity"].ToString()).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||||
|
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||||
|
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
||||||
|
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else throw new AppFriendlyException("库存不足", 500);
|
else throw new AppFriendlyException("库存不足", 500);
|
||||||
}
|
}
|
||||||
@@ -288,7 +305,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[NonUnify]
|
//[NonUnify]
|
||||||
public async Task<dynamic> MESCreateOutstock(MESCreateOutstockInput input)
|
public async Task<dynamic> MESCreateOutstock(MESCreateOutstockInput input)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -306,7 +323,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
//报错, 提示数据不全。
|
//报错, 提示数据不全。
|
||||||
throw new AppFriendlyException("数据不全!", 500);
|
throw new AppFriendlyException("数据不全!", 500);
|
||||||
}
|
}
|
||||||
// 生成入库申请数据,添加其他数据 主表
|
// 生成出库申请数据,添加其他数据 主表
|
||||||
outstock.id = SnowflakeIdHelper.NextId();
|
outstock.id = SnowflakeIdHelper.NextId();
|
||||||
outstock.location_id = location.id;
|
outstock.location_id = location.id;
|
||||||
outstock.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTSTOCK_ID;
|
outstock.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTSTOCK_ID;
|
||||||
@@ -439,10 +456,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsPretaskH preTask = new()
|
WmsPretaskH preTask = new()
|
||||||
{
|
{
|
||||||
org_id = _userManager.User.OrganizeId,
|
org_id = _userManager.User.OrganizeId,
|
||||||
startlocation_id = sPoint?.location_id!,
|
startlocation_id = sPoint?.location_id ?? string.Empty,
|
||||||
startlocation_code = sPoint?.location_code!,
|
startlocation_code = sPoint?.location_code ?? string.Empty,
|
||||||
endlocation_id = ePoint?.location_id!,
|
endlocation_id = ePoint?.location_id ?? string.Empty,
|
||||||
endlocation_code = ePoint?.location_code!,
|
endlocation_code = ePoint?.location_code ?? string.Empty,
|
||||||
start_floor = sPoint?.floor.ToString(),
|
start_floor = sPoint?.floor.ToString(),
|
||||||
end_floor = ePoint?.floor.ToString(),
|
end_floor = ePoint?.floor.ToString(),
|
||||||
bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(),
|
bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(),
|
||||||
@@ -451,13 +468,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID,
|
task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID,
|
||||||
carry_id = carry.id,
|
carry_id = carry.id,
|
||||||
carry_code = carry.carry_code,
|
carry_code = carry.carry_code,
|
||||||
area_id = sPoint?.area_id!,
|
area_id = sPoint?.area_id ?? string.Empty,
|
||||||
area_code = it.Key,
|
area_code = it.Key,
|
||||||
require_id = outstock.id.ToString()
|
require_id = outstock.id.ToString(),
|
||||||
|
require_code = outstock.bill_code?.ToString(),
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now
|
||||||
};
|
};
|
||||||
preTask.require_code = outstock.bill_code?.ToString()!;
|
|
||||||
preTask.create_id = _userManager.UserId;
|
|
||||||
preTask.create_time = DateTime.Now;
|
|
||||||
return preTask;
|
return preTask;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
if (location.is_sign == 0)
|
if (location.is_sign == 0)
|
||||||
@@ -483,10 +501,17 @@ namespace Tnb.WarehouseMgr
|
|||||||
pretaskCodes.AddRange(curPreTaskCodes);
|
pretaskCodes.AddRange(curPreTaskCodes);
|
||||||
}
|
}
|
||||||
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
||||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
if (isOk)
|
||||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
{
|
||||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
outstockDs.ForEach(x => x.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID);
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
|
await _db.Updateable(outstockDs).UpdateColumns(it => it.line_status).ExecuteCommandAsync();
|
||||||
|
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it=>it.id == outstock.id).ExecuteCommandAsync();
|
||||||
|
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||||
|
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||||
|
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
||||||
|
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else throw new AppFriendlyException("库存不足", 500);
|
else throw new AppFriendlyException("库存不足", 500);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using NPOI.SS.Formula;
|
using NPOI.SS.Formula;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
|
using Tnb.Common.Utils;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
@@ -93,15 +94,16 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
else if (os.pr_qty <= carryCodesPart[i].codeqty)
|
else if (os.pr_qty <= carryCodesPart[i].codeqty)
|
||||||
{
|
{
|
||||||
carryCodesPart[i].codeqty = os.pr_qty;
|
WmsCarryCode curCarryCode = DeepCopyHelper<WmsCarryCode>.DeepCopy(carryCodesPart[i]);
|
||||||
curCarryCodes.Add(carryCodesPart[i]);
|
curCarryCode.codeqty = os.pr_qty;
|
||||||
|
curCarryCodes.Add(curCarryCode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var partCarryMats = curCarryCodes.Adapt<List<WmsCarryMat>>();
|
var partCarryMats = curCarryCodes.Adapt<List<WmsCarryMat>>();
|
||||||
for (int i = 0; i < partCarryMats.Count; i++)
|
for (int i = 0; i < partCarryMats.Count; i++)
|
||||||
{
|
{
|
||||||
partCarryMats[i].need_qty = carryCodesPart[i].codeqty;
|
partCarryMats[i].need_qty = curCarryCodes[i].codeqty;
|
||||||
}
|
}
|
||||||
|
|
||||||
carryMats.AddRange(partCarryMats);
|
carryMats.AddRange(partCarryMats);
|
||||||
|
|||||||
@@ -82,9 +82,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
loc.is_use = ((int)EnumCarryStatus.空闲).ToString();
|
loc.is_use = ((int)EnumCarryStatus.空闲).ToString();
|
||||||
await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync();
|
await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
carry.location_id = null;
|
|
||||||
carry.location_code = null;
|
|
||||||
await _db.Updateable(carry).UpdateColumns(it => new { it.location_id, it.location_code }).ExecuteCommandAsync();
|
|
||||||
WmsDistaskH? disTask = null;
|
WmsDistaskH? disTask = null;
|
||||||
if (!input.disTaskId.IsNullOrEmpty())
|
if (!input.disTaskId.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
@@ -129,20 +126,22 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost, NonUnify]
|
[HttpPost]
|
||||||
public async Task<dynamic> MESCarrySign(MESCarrySignInput input)
|
public async Task<dynamic> MESCarrySign(MESCarrySignInput input)
|
||||||
{
|
{
|
||||||
|
var isSuccessFul = false;
|
||||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||||
var signInput = input.Adapt<SignForDeliveryInput>();
|
var signInput = input.Adapt<SignForDeliveryInput>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await SignForDelivery(signInput);
|
await SignForDelivery(signInput);
|
||||||
|
isSuccessFul = true;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
return ToApiResult(HttpStatusCode.InternalServerError, "签收失败");
|
isSuccessFul= false;
|
||||||
}
|
}
|
||||||
return ToApiResult();
|
return isSuccessFul;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,71 +132,85 @@ namespace Tnb.WarehouseMgr
|
|||||||
public async Task KittingOutByIsToBeShipped()
|
public async Task KittingOutByIsToBeShipped()
|
||||||
{
|
{
|
||||||
|
|
||||||
var kittingOuts = await _db.Queryable<WmsKittingoutH>()
|
try
|
||||||
.Where(a => a.status == WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID)
|
|
||||||
.OrderBy(a => a.seq)
|
|
||||||
.ToListAsync();
|
|
||||||
if (kittingOuts?.Count > 0)
|
|
||||||
{
|
{
|
||||||
var grpList = kittingOuts.GroupBy(g => g.location_id).ToList();
|
var kittingOuts = await _db.Queryable<WmsKittingoutH>()
|
||||||
foreach (var koGrp in grpList)
|
.Where(a => a.status == WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID)
|
||||||
|
.OrderBy(a => a.seq)
|
||||||
|
.ToListAsync();
|
||||||
|
if (kittingOuts?.Count > 0)
|
||||||
{
|
{
|
||||||
var locs = await _db.Queryable<BasLocation>().Where(it => it.id == koGrp.Key && it.is_use == ((int)EnumCarryStatus.空闲).ToString() && it.is_lock == 0).ToListAsync();
|
var grpList = kittingOuts.GroupBy(g => g.location_id).ToList();
|
||||||
if (locs?.Count > 0)
|
foreach (var koGrp in grpList)
|
||||||
{
|
{
|
||||||
|
var locs = await _db.Queryable<BasLocation>().Where(it => it.id == koGrp.Key && it.is_use == ((int)EnumCarryStatus.空闲).ToString() && it.is_lock == 0).ToListAsync();
|
||||||
var arr = koGrp.ToArray();
|
if (locs?.Count > 0)
|
||||||
var ko = arr[^arr.Length];
|
|
||||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
|
|
||||||
if (carry != null)
|
|
||||||
{
|
{
|
||||||
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
var arr = koGrp.ToArray();
|
||||||
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == ko.location_id);
|
var ko = arr[^arr.Length];
|
||||||
if (sPoint != null && ePoint != null)
|
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
|
||||||
|
if (carry != null)
|
||||||
{
|
{
|
||||||
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||||
if (points?.Count > 0)
|
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == ko.location_id);
|
||||||
|
if (sPoint != null && ePoint != null)
|
||||||
{
|
{
|
||||||
|
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||||
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
if (points?.Count > 0)
|
||||||
{
|
{
|
||||||
var sPoint = it.FirstOrDefault();
|
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||||
var ePoint = it.LastOrDefault();
|
{
|
||||||
|
var sPoint = it.FirstOrDefault();
|
||||||
|
var ePoint = it.LastOrDefault();
|
||||||
|
|
||||||
WmsPretaskH preTask = new();
|
WmsPretaskH preTask = new();
|
||||||
preTask.org_id = _userManager.User.OrganizeId;
|
preTask.org_id = _userManager.User.OrganizeId;
|
||||||
preTask.startlocation_id = sPoint?.location_id!;
|
preTask.startlocation_id = sPoint?.location_id!;
|
||||||
preTask.startlocation_code = sPoint?.location_code!;
|
preTask.startlocation_code = sPoint?.location_code!;
|
||||||
preTask.endlocation_id = ePoint?.location_id!;
|
preTask.endlocation_id = ePoint?.location_id!;
|
||||||
preTask.endlocation_code = ePoint?.location_code!;
|
preTask.endlocation_code = ePoint?.location_code!;
|
||||||
preTask.start_floor = sPoint?.floor.ToString();
|
preTask.start_floor = sPoint?.floor.ToString();
|
||||||
preTask.end_floor = ePoint?.floor.ToString();
|
preTask.end_floor = ePoint?.floor.ToString();
|
||||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||||
preTask.biz_type = ko.biz_type;
|
preTask.biz_type = ko.biz_type;
|
||||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
||||||
preTask.carry_id = ko!.carry_id!;
|
preTask.carry_id = ko!.carry_id!;
|
||||||
preTask.carry_code = ko!.carry_code!;
|
preTask.carry_code = ko!.carry_code!;
|
||||||
preTask.area_id = sPoint?.area_id!;
|
preTask.area_id = sPoint?.area_id!;
|
||||||
preTask.area_code = it.Key;
|
preTask.area_code = it.Key;
|
||||||
preTask.require_id = ko.id;
|
preTask.require_id = ko.id;
|
||||||
preTask.require_code = ko.bill_code;
|
preTask.require_code = ko.bill_code;
|
||||||
preTask.create_id = _userManager.UserId;
|
preTask.create_id = _userManager.UserId;
|
||||||
preTask.create_time = DateTime.Now;
|
preTask.create_time = DateTime.Now;
|
||||||
return preTask;
|
return preTask;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
await _warehouseService.GenPreTask(preTasks, null!);
|
await _warehouseService.GenPreTask(preTasks, null!);
|
||||||
var subCarrys = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == ko.carry_id).ToListAsync();
|
var subCarrys = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == ko.carry_id).ToListAsync();
|
||||||
var carryIds = subCarrys.Select(x => x.carry_id).Concat(new[] { ko.carry_id }).Distinct().ToList();
|
var carryIds = subCarrys.Select(x => x.carry_id).Concat(new[] { ko.carry_id }).Distinct().ToList();
|
||||||
GenPreTaskUpInput genPreTaskInput = new() { CarryIds = carryIds!, LocationIds = new List<string> { carry.location_id!, ko.location_id! } };
|
GenPreTaskUpInput genPreTaskInput = new() { CarryIds = carryIds!, LocationIds = new List<string> { carry.location_id!, ko.location_id! } };
|
||||||
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = ((int)EnumCarryStatus.齐套).ToString() }, it => new BasLocation { is_lock = 1 });
|
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = ((int)EnumCarryStatus.齐套).ToString() }, it => new BasLocation { is_lock = 1 });
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("无可用的载具", 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("无可用的库位", 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||||
@@ -288,9 +302,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[NonUnify]
|
|
||||||
public async Task<dynamic> MESKittingOutStk(List<MESKittingOutStkInput> input)
|
public async Task<dynamic> MESKittingOutStk(List<MESKittingOutStkInput> input)
|
||||||
{
|
{
|
||||||
|
var isSuccessFul = false;
|
||||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -320,15 +334,18 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
await _db.Insertable(kittingOuts).ExecuteCommandAsync();
|
await _db.Insertable(kittingOuts).ExecuteCommandAsync();
|
||||||
await _db.Insertable(kittingOutDs).ExecuteCommandAsync();
|
await _db.Insertable(kittingOutDs).ExecuteCommandAsync();
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
|
await KittingOutByAdd();
|
||||||
|
isSuccessFul = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
isSuccessFul = false;
|
||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
|
||||||
}
|
}
|
||||||
await KittingOutByAdd();
|
|
||||||
return ToApiResult();
|
return isSuccessFul;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
59
common/Tnb.Common/Utils/ParameterCheckHelper.cs
Normal file
59
common/Tnb.Common/Utils/ParameterCheckHelper.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Tnb.Common.Utils
|
||||||
|
{
|
||||||
|
public class PropertyNotNullChecker<T>
|
||||||
|
{
|
||||||
|
private static readonly Dictionary<Type, Func<T, bool>> Cache = new Dictionary<Type, Func<T, bool>>();
|
||||||
|
|
||||||
|
public static bool CheckAllPropertiesNotNull(T obj)
|
||||||
|
{
|
||||||
|
//Type type = typeof(T);
|
||||||
|
|
||||||
|
//// 检查缓存中是否存在类型的检查方法
|
||||||
|
//if (Cache.TryGetValue(type, out var checkFunc))
|
||||||
|
//{
|
||||||
|
// return checkFunc(obj);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//var properties = type.GetProperties();
|
||||||
|
|
||||||
|
//// 创建表达式树的参数
|
||||||
|
//var objParam = Expression.Parameter(type, "obj");
|
||||||
|
|
||||||
|
//var propertyNotNullExpressions = new List<Expression>();
|
||||||
|
|
||||||
|
//foreach (var property in properties)
|
||||||
|
//{
|
||||||
|
// // 创建访问属性的表达式
|
||||||
|
// var propertyAccess = Expression.Property(objParam, property);
|
||||||
|
|
||||||
|
// // 创建检查属性非空的表达式
|
||||||
|
// var notNullExpression = Expression.NotEqual(propertyAccess, Expression.Constant(null));
|
||||||
|
|
||||||
|
// propertyNotNullExpressions.Add(notNullExpression);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//// 创建所有属性非空的表达式
|
||||||
|
//var allPropertiesNotNullExpression = Expression.AndAlso(propertyNotNullExpressions);
|
||||||
|
|
||||||
|
//// 创建Lambda表达式
|
||||||
|
//var lambda = Expression.Lambda<Func<T, bool>>(allPropertiesNotNullExpression, objParam);
|
||||||
|
|
||||||
|
//// 编译表达式并执行
|
||||||
|
//var func = lambda.Compile();
|
||||||
|
|
||||||
|
//// 将类型和检查方法添加到缓存中
|
||||||
|
//Cache[type] = func;
|
||||||
|
|
||||||
|
//return func(obj);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -69,7 +69,7 @@ public class WechatOpenService : IDynamicApiController, ITransient
|
|||||||
[HttpPost("token")]
|
[HttpPost("token")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[IgnoreLog]
|
[IgnoreLog]
|
||||||
[NonUnify]
|
//[NonUnify]
|
||||||
public async Task<dynamic> Create([FromQuery] string signature, [FromQuery] string timestamp, [FromQuery] string nonce, [FromQuery] string openid)
|
public async Task<dynamic> Create([FromQuery] string signature, [FromQuery] string timestamp, [FromQuery] string nonce, [FromQuery] string openid)
|
||||||
{
|
{
|
||||||
var input = await GetWechatMPEvent();
|
var input = await GetWechatMPEvent();
|
||||||
|
|||||||
Reference in New Issue
Block a user