diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs index 39844def..78e5b2ec 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs @@ -1,6 +1,7 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; +using SqlSugar.DbConvert; namespace Tnb.BasicData.Entities; @@ -42,7 +43,8 @@ public partial class BasLocation : BaseEntity /// /// 是否使用 /// - public string is_use { get; set; } = string.Empty; + [SugarColumn(ColumnDataType = "varchar(1)", SqlParameterDbType = typeof(CommonPropertyConvert))] + public int is_use { get; set; } /// /// 是否最小 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index c8390c52..34a673f8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -210,7 +210,7 @@ namespace Tnb.WarehouseMgr [HttpGet] public async Task> InStockStrategy([FromQuery] InStockStrategyQuery input) { - var items = await _db.Queryable().Where(it => it.wh_id == input.warehouse_id && it.is_lock == 0 && it.is_use == "0" && it.is_type == "0").OrderBy(it => new { it.layers, it.loc_line, it.loc_column }, OrderByType.Asc).ToListAsync(); + var items = await _db.Queryable().Where(it => it.wh_id == input.warehouse_id && it.is_lock == 0 && it.is_use == (int)EnumCarryStatus.空闲 && it.is_type == "0").OrderBy(it => new { it.layers, it.loc_line, it.loc_column }, OrderByType.Asc).ToListAsync(); return items.Take(input.Size).ToList(); } /// @@ -399,7 +399,7 @@ namespace Tnb.WarehouseMgr //更新起始库位,状态改为空闲、锁定状态,未锁定 if (startLocationIds?.Count > 0) { - await _db.Updateable().SetColumns(it => new BasLocation { is_use = "0", is_lock = 0 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(it => new BasLocation { is_use = (int)EnumCarryStatus.空闲, is_lock = 0 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); @@ -450,7 +450,7 @@ namespace Tnb.WarehouseMgr { carryStatus = (int)EnumCarryStatus.空闲; } - await _db.Updateable().SetColumns(it => new BasLocation { is_use = carryStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(it => new BasLocation { is_use = carryStatus, is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); } //更新业务主表的单据状态 if (disTasks?.Count > 0) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs index f091e3fe..3d9003e6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs @@ -240,7 +240,7 @@ namespace Tnb.WarehouseMgr await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, carry_status = (int)EnumCarryStatus.占用, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, - it => new BasLocation { is_lock = 1, is_use = "1" }); + it => new BasLocation { is_lock = 1, is_use = (int)EnumCarryStatus.占用 }); 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(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index 7bc941a4..6047e83c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using JNPF.Common.Core.Manager; +using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.FriendlyException; @@ -14,6 +15,7 @@ using NPOI.SS.Formula; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; +using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Enums; @@ -24,12 +26,14 @@ namespace Tnb.WarehouseMgr /// /// 齐套分拣服务类 /// + [ServiceModule(BizTypeId)] public class WmsSetSortingService : BaseWareHouseService { private readonly ISqlSugarClient _db; private readonly IWareHouseService _wareHouseService; private readonly IBillRullService _billRullService; private readonly IUserManager _userManager; + private const string BizTypeId = "26172520979237"; public WmsSetSortingService(ISqlSugarRepository repository, IWareHouseService wareHouseService, IUserManager userManager, IBillRullService billRullService) { @@ -186,10 +190,25 @@ namespace Tnb.WarehouseMgr } - public override Task ModifyAsync(WareHouseUpInput input) + public override async Task ModifyAsync(WareHouseUpInput input) { - return Task.CompletedTask; + if (input == null) throw new ArgumentNullException(nameof(input)); + //根据载具更新明细表状态 + try + { + await _db.Ado.BeginTranAsync(); + await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = (int)EnumCarryStatus.齐套 }).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(it => new BasLocation { is_use = (int)EnumCarryStatus.空闲 }).ExecuteCommandAsync(); + + await _db.Ado.CommitTranAsync(); + } + catch (Exception) + { + await _db.Ado.RollbackTranAsync(); + throw; + + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs index bedfb86b..adc56ba8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs @@ -17,6 +17,7 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -81,7 +82,7 @@ namespace Tnb.WarehouseMgr } } var loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id); - loc.is_use = "0"; + loc.is_use = (int)EnumCarryStatus.空闲; await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); WareHouseUpInput upInput = new() { bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List { input.carryId } }; await DoUpdate(upInput); //回更业务 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index 3c2e978e..99436256 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -128,7 +128,7 @@ namespace Tnb.WarehouseMgr var grpList = kittingOuts.GroupBy(g => g.location_id).ToList(); foreach (var koGrp in grpList) { - var locs = await _db.Queryable().Where(it => it.id == koGrp.Key && it.is_use == "0" && it.is_lock == 0).ToListAsync(); + var locs = await _db.Queryable().Where(it => it.id == koGrp.Key && it.is_use == (int)EnumCarryStatus.空闲 && it.is_lock == 0).ToListAsync(); if (locs?.Count > 0) {