diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs index c80e2eba..9db06d08 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs @@ -27,7 +27,7 @@ public partial class WmsInstockCode : BaseEntity /// /// 行号 /// - public int bill_line { get; set; } + public int? bill_line { get; set; } /// /// 入库单明细ID @@ -37,7 +37,7 @@ public partial class WmsInstockCode : BaseEntity /// /// 入库单明细行号 /// - public int bill_d_line { get; set; } + public int? bill_d_line { get; set; } /// /// 明细状态 @@ -72,7 +72,7 @@ public partial class WmsInstockCode : BaseEntity /// /// 是否锁定 /// - public int is_lock { get; set; } + public int? is_lock { get; set; } /// /// 是否结束 @@ -87,7 +87,7 @@ public partial class WmsInstockCode : BaseEntity /// /// 单位代码 /// - public string unit_code { get; set; } = string.Empty; + public string? unit_code { get; set; } /// /// 来源单据ID @@ -132,12 +132,12 @@ public partial class WmsInstockCode : BaseEntity /// /// 创建用户 /// - public string create_id { get; set; } = string.Empty; + public string? create_id { get; set; } /// /// 创建时间 /// - public DateTime create_time { get; set; } = DateTime.Now; + public DateTime? create_time { get; set; } /// /// 修改用户 @@ -149,4 +149,19 @@ public partial class WmsInstockCode : BaseEntity /// public DateTime? modify_time { get; set; } + /// + /// 生产工单号 + /// + public string? mo_code { get; set; } + + /// + /// 生产工单行号 + /// + public int? mo_line { get; set; } + + /// + /// 生产工单BOM明细Id + /// + public string? mo_bom_detail_id { get; set; } + } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 50d91966..bc391286 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -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 repository, IDictionaryDataService dictionaryDataService, IBillRullService billRullService) + private readonly IUserManager _userManager; + public WareHouseService(ISqlSugarRepository repository, IDictionaryDataService dictionaryDataService, IBillRullService billRullService, IUserManager userManager) { _db = repository.AsSugarClient(); _dictionaryDataService = dictionaryDataService; _billRullService = billRullService; + _userManager = userManager; } /// /// 根据载具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) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs index 7d486bf9..d3a395a2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs @@ -35,23 +35,17 @@ namespace Tnb.WarehouseMgr private readonly ISqlSugarClient _db; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; - private readonly IWareHouseService _wareHouseService; - private readonly IBillRullService _billRullService; private readonly IUserManager _userManager; public WmsCarryBindService( ISqlSugarRepository repository, IRunService runService, IVisualDevService visualDevService, - IWareHouseService wareHouseService, - IUserManager userManager, - IBillRullService billRullService) + IUserManager userManager) { _db = repository.AsSugarClient(); _runService = runService; _visualDevService = visualDevService; - _wareHouseService = wareHouseService; _userManager = userManager; - _billRullService = billRullService; OverideFuncs.CreateAsync = CarryBind; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs index dbb7daf3..cfa60d8b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs @@ -35,23 +35,18 @@ namespace Tnb.WarehouseMgr private readonly ISqlSugarClient _db; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; - private readonly IWareHouseService _wareHouseService; - private readonly IBillRullService _billRullService; private readonly IUserManager _userManager; public WmsCarryUnbindService( ISqlSugarRepository repository, IRunService runService, IVisualDevService visualDevService, - IWareHouseService wareHouseService, - IUserManager userManager, - IBillRullService billRullService) + + IUserManager userManager) { _db = repository.AsSugarClient(); _runService = runService; _visualDevService = visualDevService; - _wareHouseService = wareHouseService; _userManager = userManager; - _billRullService = billRullService; OverideFuncs.CreateAsync = CarryUnbind; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs index 18b333d0..9a748c50 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs @@ -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; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs index ab432e88..e8e0d87e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs @@ -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; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs index 1cbe6da2..3e6da716 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs @@ -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().FirstAsync(it => it.id == input.data["bill_id"].ToString()); + var instockH = await _db.Queryable().FirstAsync(it => it.id == input.data[requireIdField].ToString()); if (instockH != null) { var handleH = instockH.Adapt(); @@ -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(nameof(WmsHandleCode.material_code)); - handleCode.barcode = jo.Value(nameof(WmsHandleCode.barcode)); + handleCode.material_code = jo.Value(nameof(WmsHandleCode.material_code))!; + handleCode.barcode = jo.Value(nameof(WmsHandleCode.barcode))!; handleCode.code_batch = jo.Value(nameof(WmsHandleCode.code_batch)); handleCode.codeqty = jo.Value(nameof(WmsHandleCode.codeqty)); handleCode.unit_id = _db.Queryable().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() + .Where(b => b.bill_id == input.data[requireIdField].ToString()) + .ToListAsync(); + var items = instockDetails.Adapt>(); + List instockCOdes = new(); + jArr = JArray.Parse(input.data["tablefield115"].ToString()!); + if (jArr?.Children().Count() > 0) + { + foreach (var jo in jArr.Children()) + { + var materialId = jo.Value(nameof(WmsInstockCode.material_id)); + var materialCode = jo.Value(nameof(WmsInstockCode.material_code)); + var codeBatch = jo.Value(nameof(WmsInstockCode.code_batch)); + var b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch); + if (b != null) + { + b.barcode = jo.Value(nameof(WmsInstockCode.barcode)); + b.barcode_qty = jo.Value(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().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().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().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) + { + + } } } diff --git a/system/Tnb.OAuth/OAuthService.cs b/system/Tnb.OAuth/OAuthService.cs index f494dee3..5780322a 100644 --- a/system/Tnb.OAuth/OAuthService.cs +++ b/system/Tnb.OAuth/OAuthService.cs @@ -279,6 +279,8 @@ public class OAuthService : IDynamicApiController, ITransient public async Task 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) }; diff --git a/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.cs b/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.cs index 26b6aecc..dbae17a6 100644 --- a/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.cs +++ b/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.cs @@ -8,7 +8,7 @@ namespace JNPF.Systems.Entitys.Permission; /// 用户信息基类. /// [SugarTable("BASE_USER")] -public class UserEntity : CLDEntityBase +public partial class UserEntity : CLDEntityBase { /// /// 账户. diff --git a/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.part.cs b/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.part.cs new file mode 100644 index 00000000..e6e41ea0 --- /dev/null +++ b/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.part.cs @@ -0,0 +1,16 @@ +using JNPF.Common.Const; +using JNPF.Common.Contracts; +using SqlSugar; + +namespace JNPF.Systems.Entitys.Permission; + +/// +/// 用户信息基类. +/// +public partial class UserEntity +{ + /// + /// 登录类型 + /// + public string LoginType { get; set; } +} \ No newline at end of file