Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2023-07-03 17:36:57 +08:00
5 changed files with 88 additions and 19 deletions

View File

@@ -192,6 +192,40 @@ namespace Tnb.WarehouseMgr.Entities.Consts
/// 载具规格-料架 /// 载具规格-料架
/// </summary> /// </summary>
public const string CARRY_LJSTD_ID = "26037267399717"; public const string CARRY_LJSTD_ID = "26037267399717";
/// <summary>
/// 打印状态-未打印
/// </summary>
public const string PRINT_STATUS_NOTPRINTED = "26191366982437";
/// <summary>
/// 打印状态-打印中
/// </summary>
public const string PRINT_STATUS_PRINTING = "26191369755173";
/// <summary>
/// 打印状态-打印完成
/// </summary>
public const string PRINT_STATUS_PRINTCOMPLETE= "26191372853541";
/// <summary>
/// 同步状态-无需同步
/// </summary>
public const string SYNC_STATUS_NONEEDSYNC = "26191359047461";
/// <summary>
/// 同步状态-未同步
/// </summary>
public const string SYNC_STATUS__NOTSYNC = "26191345740069";
/// <summary>
/// 同步状态-同步中
/// </summary>
public const string SYNC_STATUS__SYNCING = "26191348846117";
/// <summary>
/// 同步状态-同步完成
/// </summary>
public const string SYNC_STATUS__SYNCCOMPLETE = "26191351559205";
/// <summary>
/// 同步状态-同步失败
/// </summary>
public const string SYNC_STATUS__SYNCFAILED = "26191354152229";
} }
} }

View File

@@ -9,6 +9,7 @@ using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Extension; using JNPF.Common.Extension;
using JNPF.Common.Security; using JNPF.Common.Security;
using JNPF.FriendlyException; using JNPF.FriendlyException;
using JNPF.Logging;
using JNPF.Systems.Interfaces.System; using JNPF.Systems.Interfaces.System;
using Mapster; using Mapster;
using Microsoft.AspNetCore.Mvc; 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(); 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(); 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> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
//[HttpPost] [HttpPost]
private async Task<dynamic> MESCreateInstock(VisualDevModelDataCrInput input) public async Task<dynamic> MESCreateInstock(VisualDevModelDataCrInput input)
{ {
try try
{ {
@@ -240,25 +242,26 @@ namespace Tnb.WarehouseMgr
List<WmsInstockD> instockds = new(); List<WmsInstockD> instockds = new();
List<WmsInstockCode> instockcodes = new(); List<WmsInstockCode> instockcodes = new();
//入库申请主表 //入库申请主表
if (input.data.ContainsKey("wmsInStock")) { if (input.data.ContainsKey("wmsInStockH")) {
instock = input.data.ContainsKey("wmsInStock").ToObject<WmsInstockH>(); instock = input.data.ContainsKey("wmsInStockH").ToObject<WmsInstockH>();
} }
//入库申请物料明细表 //入库申请物料明细表
if (input.data.ContainsKey("instockds")) if (input.data.ContainsKey("wmsInStockds"))
{ {
if (input.data["instockds"] != null && input.data["instockds"].IsNotEmptyOrNull()) if (input.data["wmsInStockds"] != null && input.data["wmsInStockds"].IsNotEmptyOrNull())
{ {
instockds = input.data["instockds"].ToObject<List<WmsInstockD>>(); instockds = input.data["wmsInStockds"].ToObject<List<WmsInstockD>>();
} }
} }
//入库申请条码明细表 //入库申请条码明细表
if (input.data.ContainsKey("instockcodes")) { if (input.data.ContainsKey("wmsInStockCodes")) {
if (input.data["instockcodes"] != null && input.data["instockcodes"].IsNotEmptyOrNull()) { if (input.data["wmsInStockCodes"] != null && input.data["wmsInStockCodes"].IsNotEmptyOrNull()) {
instockcodes = input.data["instockcodes"].ToObject<List<WmsInstockCode>>(); instockcodes = input.data["wmsInStockCodes"].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); throw new AppFriendlyException("数据不全!", 500);
} }
@@ -266,12 +269,21 @@ namespace Tnb.WarehouseMgr
instock.id = SnowflakeIdHelper.NextId(); instock.id = SnowflakeIdHelper.NextId();
instock.biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID; instock.biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID;
instock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_INSTOCK_ENCODE).GetAwaiter().GetResult(); instock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_INSTOCK_ENCODE).GetAwaiter().GetResult();
instock.generate_type = "1";// 自动
instock.sync_status =WmsWareHouseConst.SYNC_STATUS__NOTSYNC;//未同步
instock.print_status = WmsWareHouseConst.PRINT_STATUS_PRINTCOMPLETE;//已打印
instock.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;// 新增
instock.create_time = DateTime.Now;
await _db.Insertable(instock).ExecuteCommandAsync(); await _db.Insertable(instock).ExecuteCommandAsync();
//明细表 //明细表
foreach (var instockd in instockds) foreach (var instockd in instockds)
{ {
instockd.id = SnowflakeIdHelper.NextId(); instockd.id = SnowflakeIdHelper.NextId();
instockd.bill_id = instock.id; instockd.bill_id = instock.id;
instockd.line_status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
instockd.qty = 0;
instock.create_time = instock.create_time;
instock.create_id = instock.create_id;
} }
await _db.Insertable(instockds).ExecuteCommandAsync(); await _db.Insertable(instockds).ExecuteCommandAsync();
var items = instockds.Adapt<List<WmsInstockCode>>(); var items = instockds.Adapt<List<WmsInstockCode>>();
@@ -279,6 +291,7 @@ namespace Tnb.WarehouseMgr
//条码表 //条码表
foreach (var instockcode in instockcodes) foreach (var instockcode in instockcodes)
{ {
instockcode.id = SnowflakeIdHelper.NextId();
var materialId = instockcode.material_id; var materialId = instockcode.material_id;
var materialCode = instockcode.material_code; var materialCode = instockcode.material_code;
var codeBatch = instockcode.code_batch; var codeBatch = instockcode.code_batch;
@@ -290,13 +303,16 @@ namespace Tnb.WarehouseMgr
c.bill_d_id = instockcodes.Find(x => x.material_code == materialCode && x.code_batch == codeBatch)?.id!; c.bill_d_id = instockcodes.Find(x => x.material_code == materialCode && x.code_batch == codeBatch)?.id!;
c.barcode = instockcode.barcode; c.barcode = instockcode.barcode;
c.codeqty = instockcode.codeqty; c.codeqty = instockcode.codeqty;
c.is_end = 0;// 未结束
c.create_time = instock.create_time;
c.create_id = instock.create_id;
instockCOdes.Add(c); instockCOdes.Add(c);
} }
} }
var orgId = _userManager.User.OrganizeId; var orgId = _userManager.User.OrganizeId;
await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync(); await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync();
//生成预任务申请 //生成预任务申请
//入库取终点 //出库起点 //入库取终点 //出库起点
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = instock.warehouse_id, Size = 1 }; var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = instock.warehouse_id, Size = 1 };
@@ -380,7 +396,7 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!;
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!;
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!;
if (input.data.ContainsKey("wmsInStock")) if (input.data.ContainsKey("wmsInStockH"))
{ {
//创建预任务操作记录 //创建预任务操作记录
var operBillId = string.Empty; var operBillId = string.Empty;
@@ -434,6 +450,7 @@ namespace Tnb.WarehouseMgr
} }
catch (Exception ex) catch (Exception ex)
{ {
JNPF.Logging.Log.Error(ex.Message);
await _db.Ado.RollbackTranAsync(); await _db.Ado.RollbackTranAsync();
throw; throw;
} }

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Aop.Api.Domain; using Aop.Api.Domain;
using JNPF.Common.Contracts;
using JNPF.Common.Core.Manager; using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Extension; using JNPF.Common.Extension;
@@ -231,7 +232,7 @@ namespace Tnb.WarehouseMgr
var curPreTaskCodes = partCodes.Adapt<List<WmsPretaskCode>>(); var curPreTaskCodes = partCodes.Adapt<List<WmsPretaskCode>>();
curPreTaskCodes.ForEach(x => curPreTaskCodes.ForEach(x =>
{ {
x.id=SnowflakeIdHelper.NextId(); x.id = SnowflakeIdHelper.NextId();
x.bill_id = pt.id; x.bill_id = pt.id;
x.create_time = DateTime.Now; 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> /// </summary>
[OverideVisualDev(ModuleId)] [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 ISqlSugarClient _db;
private readonly IRunService _runService; private readonly IRunService _runService;
private readonly IVisualDevService _visualDevService; private readonly IVisualDevService _visualDevService;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public WmsRouteMgrService(ISqlSugarRepository<WmsRoad> repository, IRunService runService, IVisualDevService visualDevService) 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"; 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 #endregion