路段管理,起重点验证失效bug处理

This commit is contained in:
alex
2023-07-03 11:58:10 +08:00
parent a8c894aac8
commit c901340266
4 changed files with 40 additions and 14 deletions

View File

@@ -9,6 +9,7 @@ using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Extension;
using JNPF.Common.Security;
using JNPF.FriendlyException;
using JNPF.Logging;
using JNPF.Systems.Interfaces.System;
using Mapster;
using Microsoft.AspNetCore.Mvc;
@@ -210,7 +211,8 @@ namespace Tnb.WarehouseMgr
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
//如果是自动单据,需要回更上层系统
}
else {
else
{
//任务没有结束,更新状态为工作中
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
}
@@ -230,8 +232,8 @@ namespace Tnb.WarehouseMgr
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
//[HttpPost]
private async Task<dynamic> MESCreateInstock(VisualDevModelDataCrInput input)
[HttpPost]
public async Task<dynamic> MESCreateInstock(VisualDevModelDataCrInput input)
{
try
{
@@ -240,8 +242,9 @@ namespace Tnb.WarehouseMgr
List<WmsInstockD> instockds = new();
List<WmsInstockCode> instockcodes = new();
//入库申请主表
if (input.data.ContainsKey("wmsInStock")) {
instock = input.data.ContainsKey("wmsInStock").ToObject<WmsInstockH>();
if (input.data.ContainsKey("wmsInStock"))
{
instock = input.data.ContainsKey("wmsInStock").ToObject<WmsInstockH>();
}
//入库申请物料明细表
if (input.data.ContainsKey("instockds"))
@@ -252,13 +255,16 @@ namespace Tnb.WarehouseMgr
}
}
//入库申请条码明细表
if (input.data.ContainsKey("instockcodes")) {
if (input.data["instockcodes"] != null && input.data["instockcodes"].IsNotEmptyOrNull()) {
if (input.data.ContainsKey("instockcodes"))
{
if (input.data["instockcodes"] != null && input.data["instockcodes"].IsNotEmptyOrNull())
{
instockcodes = input.data["instockcodes"].ToObject<List<WmsInstockCode>>();
}
}
//如果数据不全,
if (instock.IsNotEmptyOrNull() || instock.carry_id.IsEmpty()|| instock.location_id.IsEmpty() || instockds.Count<1 || instockcodes.Count<1) {
if (instock.IsNull() || instock.carry_id.IsEmpty() || instock.location_id.IsEmpty() || instockds.Count < 1 || instockcodes.Count < 1)
{
//报错, 提示数据不全。
throw new AppFriendlyException("数据不全!", 500);
}
@@ -279,6 +285,7 @@ namespace Tnb.WarehouseMgr
//条码表
foreach (var instockcode in instockcodes)
{
instockcode.id = SnowflakeIdHelper.NextId();
var materialId = instockcode.material_id;
var materialCode = instockcode.material_code;
var codeBatch = instockcode.code_batch;
@@ -293,10 +300,10 @@ namespace Tnb.WarehouseMgr
instockCOdes.Add(c);
}
}
var orgId = _userManager.User.OrganizeId;
var orgId = _userManager.User.OrganizeId;
await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync();
//生成预任务申请
//入库取终点 //出库起点
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = instock.warehouse_id, Size = 1 };
@@ -434,6 +441,7 @@ namespace Tnb.WarehouseMgr
}
catch (Exception ex)
{
JNPF.Logging.Log.Error(ex.Message);
await _db.Ado.RollbackTranAsync();
throw;
}

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aop.Api.Domain;
using JNPF.Common.Contracts;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Extension;
@@ -231,7 +232,7 @@ namespace Tnb.WarehouseMgr
var curPreTaskCodes = partCodes.Adapt<List<WmsPretaskCode>>();
curPreTaskCodes.ForEach(x =>
{
x.id=SnowflakeIdHelper.NextId();
x.id = SnowflakeIdHelper.NextId();
x.bill_id = pt.id;
x.create_time = DateTime.Now;
});
@@ -480,4 +481,12 @@ namespace Tnb.WarehouseMgr
}
}
}
public class TestTT
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int id { get; set; }
[SugarColumn()]
public int status { get; set; }
}
}

View File

@@ -25,13 +25,12 @@ namespace Tnb.WarehouseMgr
/// </summary>
[OverideVisualDev(ModuleId)]
public class WmsRouteMgrService : BaseWareHouseService, IWmsRouteMgrService,IPdaStroage
public class WmsRouteMgrService : BaseWareHouseService, IWmsRouteMgrService
{
private const string ModuleId = "26100621140773";
private const string ModuleId = "26100621140773";//26100621140773
private readonly ISqlSugarClient _db;
private readonly IRunService _runService;
private readonly IVisualDevService _visualDevService;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public WmsRouteMgrService(ISqlSugarRepository<WmsRoad> repository, IRunService runService, IVisualDevService visualDevService)
{

View File

@@ -691,6 +691,16 @@ public static partial class Extensions
{
return ObjToString(thisValue) != string.Empty && ObjToString(thisValue) != "undefined" && ObjToString(thisValue) != "null";
}
/// <summary>
/// 是否为空
/// added by ly on 20230703
/// </summary>
/// <param name="thisValue"></param>
/// <returns></returns>
public static bool IsNull(this object thisValue)
{
return thisValue == null;
}
#endregion