wms扫码入库逻辑代码提交
This commit is contained in:
@@ -27,7 +27,7 @@ public partial class WmsInstockCode : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 行号
|
||||
/// </summary>
|
||||
public int bill_line { get; set; }
|
||||
public int? bill_line { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库单明细ID
|
||||
@@ -37,7 +37,7 @@ public partial class WmsInstockCode : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 入库单明细行号
|
||||
/// </summary>
|
||||
public int bill_d_line { get; set; }
|
||||
public int? bill_d_line { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 明细状态
|
||||
@@ -72,7 +72,7 @@ public partial class WmsInstockCode : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 是否锁定
|
||||
/// </summary>
|
||||
public int is_lock { get; set; }
|
||||
public int? is_lock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否结束
|
||||
@@ -87,7 +87,7 @@ public partial class WmsInstockCode : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 单位代码
|
||||
/// </summary>
|
||||
public string unit_code { get; set; } = string.Empty;
|
||||
public string? unit_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源单据ID
|
||||
@@ -132,12 +132,12 @@ public partial class WmsInstockCode : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string create_id { get; set; } = string.Empty;
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime create_time { get; set; } = DateTime.Now;
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
@@ -149,4 +149,19 @@ public partial class WmsInstockCode : BaseEntity<string>
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生产工单号
|
||||
/// </summary>
|
||||
public string? mo_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生产工单行号
|
||||
/// </summary>
|
||||
public int? mo_line { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生产工单BOM明细Id
|
||||
/// </summary>
|
||||
public string? mo_bom_detail_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using Aop.Api.Domain;
|
||||
using Aspose.Cells.Drawing;
|
||||
using Dm;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
@@ -49,11 +50,13 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService, IBillRullService billRullService)
|
||||
private readonly IUserManager _userManager;
|
||||
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService, IBillRullService billRullService, IUserManager userManager)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_dictionaryDataService = dictionaryDataService;
|
||||
_billRullService = billRullService;
|
||||
_userManager = userManager;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据载具Id带出库位、仓库信息
|
||||
@@ -438,9 +441,9 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
foreach (var dt in disTasks)
|
||||
{
|
||||
if (!input.prefix.IsNullOrWhiteSpace())
|
||||
if (_userManager.User.LoginType == "App")
|
||||
{
|
||||
dt.biz_type = $"{input.prefix}{dt.biz_type}";
|
||||
dt.biz_type = $"pda{dt.biz_type}";
|
||||
}
|
||||
var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id };
|
||||
if (dt.is_chain == 0)
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
public class WmsPDAEmptyInstockService : BaseWareHouseService
|
||||
{
|
||||
private const string BizTypeId = "26121986416677";
|
||||
private const string BizTypeId = "pda26121986416677";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
public class WmsPDAEmptyOutstockService : BaseWareHouseService
|
||||
{
|
||||
private const string BizTypeId = "26121986416677";
|
||||
private const string BizTypeId = "pda26121986416677";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
|
||||
@@ -17,6 +17,7 @@ using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NPOI.OpenXmlFormats.Vml;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
@@ -35,7 +36,7 @@ namespace Tnb.WarehouseMgr
|
||||
[ServiceModule(BizTypeId)]
|
||||
public class WmsPDAInStockService : BaseWareHouseService
|
||||
{
|
||||
private const string BizTypeId = "pda26121988909861";
|
||||
private const string BizTypeId = "pda26191496816421";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
@@ -72,7 +73,6 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
jArr = JArray.Parse(input.data["tablefield115"].ToString());
|
||||
}
|
||||
|
||||
//入库取终点 //出库起点
|
||||
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString(), Size = 1 };
|
||||
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
@@ -98,7 +98,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
var sPoint = it.FirstOrDefault();
|
||||
var ePoint = it.LastOrDefault();
|
||||
|
||||
|
||||
WmsPretaskH preTask = new();
|
||||
preTask.org_id = _userManager.User.OrganizeId;
|
||||
preTask.startlocation_id = sPoint?.location_id;
|
||||
@@ -145,17 +145,20 @@ namespace Tnb.WarehouseMgr
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
||||
if (isOk)
|
||||
{
|
||||
var requireIdField = "require_id";
|
||||
var requireCodeField = "require_code";
|
||||
|
||||
var preTaskUpInput = new GenPreTaskUpInput();
|
||||
preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString();
|
||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
||||
if (input.data.ContainsKey("bill_id") && input.data["bill_id"].IsNotEmptyOrNull())
|
||||
if (input.data.ContainsKey(requireIdField) && input.data[requireIdField].IsNotEmptyOrNull())
|
||||
{
|
||||
//创建预任务操作记录
|
||||
var operBillId = string.Empty;
|
||||
var instockH = await _db.Queryable<WmsInstockH>().FirstAsync(it => it.id == input.data["bill_id"].ToString());
|
||||
var instockH = await _db.Queryable<WmsInstockH>().FirstAsync(it => it.id == input.data[requireIdField].ToString());
|
||||
if (instockH != null)
|
||||
{
|
||||
var handleH = instockH.Adapt<WmsHandleH>();
|
||||
@@ -166,7 +169,7 @@ namespace Tnb.WarehouseMgr
|
||||
preTaskUpInput.PreTaskRecord = handleH;
|
||||
}
|
||||
//创建预任务条码操作记录
|
||||
jArr = JArray.Parse(input.data["tablefield115"].ToString());
|
||||
jArr = JArray.Parse(input.data["tablefield115"].ToString()!);
|
||||
if (jArr?.Children().Count() > 0)
|
||||
{
|
||||
foreach (var jo in jArr.Children())
|
||||
@@ -176,8 +179,8 @@ namespace Tnb.WarehouseMgr
|
||||
handleCode.org_id = _userManager.User.OrganizeId;
|
||||
handleCode.bill_id = operBillId;
|
||||
handleCode.material_id = materialId;
|
||||
handleCode.material_code = jo.Value<string>(nameof(WmsHandleCode.material_code));
|
||||
handleCode.barcode = jo.Value<string>(nameof(WmsHandleCode.barcode));
|
||||
handleCode.material_code = jo.Value<string>(nameof(WmsHandleCode.material_code))!;
|
||||
handleCode.barcode = jo.Value<string>(nameof(WmsHandleCode.barcode))!;
|
||||
handleCode.code_batch = jo.Value<string>(nameof(WmsHandleCode.code_batch));
|
||||
handleCode.codeqty = jo.Value<int>(nameof(WmsHandleCode.codeqty));
|
||||
handleCode.unit_id = _db.Queryable<BasMaterial>().Single(it => it.id == materialId).unit_id;
|
||||
@@ -194,12 +197,38 @@ namespace Tnb.WarehouseMgr
|
||||
x.is_out = 0;
|
||||
});
|
||||
//生成入库申请条码
|
||||
|
||||
await _db.Insertable(preTaskUpInput.PreTaskRecord).ExecuteCommandAsync();
|
||||
var instockDetails = await _db.Queryable<WmsInstockD>()
|
||||
.Where(b => b.bill_id == input.data[requireIdField].ToString())
|
||||
.ToListAsync();
|
||||
var items = instockDetails.Adapt<List<WmsInstockCode>>();
|
||||
List<WmsInstockCode> instockCOdes = new();
|
||||
jArr = JArray.Parse(input.data["tablefield115"].ToString()!);
|
||||
if (jArr?.Children().Count() > 0)
|
||||
{
|
||||
foreach (var jo in jArr.Children())
|
||||
{
|
||||
var materialId = jo.Value<string>(nameof(WmsInstockCode.material_id));
|
||||
var materialCode = jo.Value<string>(nameof(WmsInstockCode.material_code));
|
||||
var codeBatch = jo.Value<string>(nameof(WmsInstockCode.code_batch));
|
||||
var b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch);
|
||||
if (b != null)
|
||||
{
|
||||
b.barcode = jo.Value<string>(nameof(WmsInstockCode.barcode));
|
||||
b.barcode_qty = jo.Value<int>(nameof(WmsInstockCode.barcode_qty));
|
||||
instockCOdes.Add(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Insertable(carryCodes).ExecuteCommandAsync();
|
||||
await _db.Insertable(instockCOdes).ExecuteCommandAsync();
|
||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||
it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, status = (int)EnumCarryStatus.占用, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||
it => new BasLocation { is_lock = 1, is_use = "1" });
|
||||
if (instockCOdes?.Count > 0)
|
||||
{
|
||||
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<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString(), is_lock = (int)EnumCarryStatus.占用, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }).Where(it => it.id == preTaskUpInput.CarryId).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,11 +243,9 @@ namespace Tnb.WarehouseMgr
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
//public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
//{
|
||||
// if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
// var isOk = await _db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
// if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
//}
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,6 +279,8 @@ public class OAuthService : IDynamicApiController, ITransient
|
||||
public async Task<dynamic> GetCurrentUser(string type)
|
||||
{
|
||||
if (type.IsNullOrEmpty()) type = "Web"; // 默认为Web端菜单目录
|
||||
//modify by ly on 20230616 用于区分pc与 pda
|
||||
_userManager.User.LoginType = type;
|
||||
|
||||
var userId = _userManager.UserId;
|
||||
|
||||
@@ -669,7 +671,8 @@ public class OAuthService : IDynamicApiController, ITransient
|
||||
}
|
||||
}
|
||||
|
||||
return new {
|
||||
return new
|
||||
{
|
||||
theme = user.Theme == null ? "classic" : user.Theme,
|
||||
token = string.Format("Bearer {0}", accessToken)
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace JNPF.Systems.Entitys.Permission;
|
||||
/// 用户信息基类.
|
||||
/// </summary>
|
||||
[SugarTable("BASE_USER")]
|
||||
public class UserEntity : CLDEntityBase
|
||||
public partial class UserEntity : CLDEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 账户.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Contracts;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.Systems.Entitys.Permission;
|
||||
|
||||
/// <summary>
|
||||
/// 用户信息基类.
|
||||
/// </summary>
|
||||
public partial class UserEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录类型
|
||||
/// </summary>
|
||||
public string LoginType { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user