diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs index 75ddcae5..f41c5f38 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs @@ -18,10 +18,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 载具ID /// - public string carryId { get; set; } - /// - /// 服务模块 - /// - public string serviceModule { get; set; } + public string carryId { get; set; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs index 94df7398..5dd02dac 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs @@ -1,6 +1,7 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; +using SqlSugar.DbConvert; namespace Tnb.WarehouseMgr.Entities; @@ -42,7 +43,7 @@ public partial class WmsCarryH : BaseEntity /// /// 载具状态 /// - public string carry_status { get; set; } + public int carry_status { get; set; } /// /// 载具分类ID diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs index cf9870e0..9bbbc560 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs @@ -13,5 +13,5 @@ public partial class WmsDistaskH /// 载具状态 /// [SugarColumn(IsIgnore = true)] - public string carry_status { get; set; } + public int carry_status { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 9eeb99b1..c8390c52 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -446,11 +446,11 @@ namespace Tnb.WarehouseMgr for (int i = 0; i < multis.Count; i++) { var carryStatus = multis[i].carry_status; - if (multis[i].carry_status == "0") + if (multis[i].carry_status == (int)EnumCarryStatus.空闲) { - carryStatus = "1"; + carryStatus = (int)EnumCarryStatus.空闲; } - await _db.Updateable().SetColumns(it => new BasLocation { is_use = carryStatus, is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(it => new BasLocation { is_use = carryStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); } //更新业务主表的单据状态 if (disTasks?.Count > 0) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs index 377f2f6d..006c31e9 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs @@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -69,9 +70,9 @@ namespace Tnb.WarehouseMgr var subCarry = await _db.Queryable().SingleAsync(it => it.id == subCarryId); if (carry != null && subCarry != null) { - carry.carry_status = "1"; + carry.carry_status = (int)EnumCarryStatus.占用; var row = await _db.Updateable(carry).ExecuteCommandAsync(); - subCarry.carry_status = "1"; + subCarry.carry_status = (int)EnumCarryStatus.占用; row = await _db.Updateable(subCarry).ExecuteCommandAsync(); //更新载具明细表 WmsCarryD wmsCarryD = new() diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs index 2596f2f4..8945d77a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs @@ -160,7 +160,7 @@ namespace Tnb.WarehouseMgr try { carryObj.status = 0; - carryObj.carry_status = "0"; + carryObj.carry_status = (int)EnumCarryStatus.空闲; carryObj.location_id = null; carryObj.location_code = null; carryObj.out_status = "0"; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs index 739d972f..1bdd4499 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs @@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -91,9 +92,9 @@ namespace Tnb.WarehouseMgr wmsCarryUnbindCode.create_time = DateTime.Now; row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync(); } - carry.carry_status = "0"; + carry.carry_status = (int)EnumCarryStatus.空闲; row = await _db.Updateable(carry).ExecuteCommandAsync(); - subCarry.carry_status = "0"; + subCarry.carry_status = (int)EnumCarryStatus.空闲; row = await _db.Updateable(subCarry).ExecuteCommandAsync(); isOk = (row > 0); if (!isOk) throw Oops.Oh(ErrorCode.COM1001); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs index 94c43365..5066db04 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs @@ -158,7 +158,7 @@ namespace Tnb.WarehouseMgr var location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString()); { //载具加锁,增加库位信息 - await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(), + await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = (int)EnumCarryStatus.占用, is_lock = 1, location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(), location_code = location.location_code}).Where(it => it.id == input.data[nameof(WmsDelivery.carry_id)].ToString()).ExecuteCommandAsync(); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs index d6beff87..fe5418ca 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs @@ -78,7 +78,7 @@ namespace Tnb.WarehouseMgr var setQty = await _db.Queryable().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString()); var carrys = await _db.Queryable().LeftJoin((a, b) => a.location_id == b.id) .Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString() - && a.carry_status == "0" && a.is_lock == 0 && b.is_lock == 0) + && a.carry_status == (int)EnumCarryStatus.空闲 && a.is_lock == 0 && b.is_lock == 0) .ToListAsync(); WmsPointH sPoint = null; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs index eecedd09..657c232a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs @@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -83,9 +84,9 @@ namespace Tnb.WarehouseMgr create_time = DateTime.Now }; var row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync(); - carry.carry_status = "1"; + carry.carry_status = (int)EnumCarryStatus.占用; row = await _db.Updateable(carry).ExecuteCommandAsync(); - subCarry.carry_status = "1"; + subCarry.carry_status = (int)EnumCarryStatus.占用; row = await _db.Updateable(subCarry).ExecuteCommandAsync(); var items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); //更新载具绑定条码表 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs index 37b39ebf..6652b476 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs @@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -90,9 +91,9 @@ namespace Tnb.WarehouseMgr wmsCarryUnbindCode.create_time = DateTime.Now; row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync(); } - carry.carry_status = "0"; + carry.carry_status = (int)EnumCarryStatus.空闲; row = await _db.Updateable(carry).ExecuteCommandAsync(); - subCarry.carry_status = "0"; + subCarry.carry_status = (int)EnumCarryStatus.空闲; row = await _db.Updateable(subCarry).ExecuteCommandAsync(); isOk = (row > 0); if (!isOk) throw Oops.Oh(ErrorCode.COM1001); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs index 2ecb1828..3b44dd0b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs @@ -157,7 +157,7 @@ namespace Tnb.WarehouseMgr //载具加锁,增加库位信息 await _db.Updateable().SetColumns(it => new WmsCarryH { - carry_status = ((int)EnumCarryStatus.占用).ToString(), + carry_status = (int)EnumCarryStatus.占用, is_lock = 1, location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(), location_code = location.location_code diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs index 0f4dbfda..ba1ace87 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs @@ -75,7 +75,7 @@ namespace Tnb.WarehouseMgr var setQty = await _db.Queryable().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString()); var carrys = await _db.Queryable().LeftJoin((a, b) => a.location_id == b.id) .Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString() - && a.carry_status == "0" && a.is_lock == 0 && b.is_lock == 0) + && a.carry_status ==(int)EnumCarryStatus.空闲 && a.is_lock == 0 && b.is_lock == 0) .ToListAsync(); WmsPointH sPoint = null; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs index b8c1b403..7398487d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs @@ -132,7 +132,7 @@ namespace Tnb.WarehouseMgr try { carryObj.status = 0; - carryObj.carry_status = "0"; + carryObj.carry_status = (int)EnumCarryStatus.空闲; carryObj.location_id = null; carryObj.location_code = null; carryObj.out_status = "0"; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs index fa06b6d5..f091e3fe 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs @@ -239,7 +239,7 @@ namespace Tnb.WarehouseMgr await _db.Insertable(carryCodes).ExecuteCommandAsync(); 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.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, + 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" }); if (instockCOdes?.Count > 0) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs index 54c69b7b..89027139 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs @@ -145,7 +145,7 @@ namespace Tnb.WarehouseMgr var baleNum = input.data[nameof(WmsCarryH.bale_num)]?.ToString(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, - it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode, carry_status = ((int)EnumCarryStatus.寄存).ToString(), bale_num = baleNum }, + it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode, carry_status = (int)EnumCarryStatus.寄存, bale_num = baleNum }, it => new BasLocation { is_lock = 1 }); //((int)EnumCarryStatus.寄存).ToString() } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs index 44c4981a..259fa4e2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs @@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr //载具加锁,增加库位信息 await _db.Updateable().SetColumns(it => new WmsCarryH { - carry_status = ((int)EnumCarryStatus.占用).ToString(), + carry_status = (int)EnumCarryStatus.占用, is_lock = 1, location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(), location_code = location.location_code diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index bd13a658..39f43c1b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -124,7 +124,7 @@ namespace Tnb.WarehouseMgr GenPreTaskUpInput genPreTaskAfterUpInput = new(); genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList(); genPreTaskAfterUpInput.LocationIds = new HashSet(locIds).ToList(); - await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 }); + await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1, carry_status = (int)EnumCarryStatus.齐套分拣 }, it => new BasLocation { is_use = ((int)EnumCarryStatus.齐套分拣).ToString() }); } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs index 9242aa8d..8a82ceb9 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs @@ -57,28 +57,40 @@ namespace Tnb.WarehouseMgr { _dicBizType = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_BIZTYPE_ID); } - var carry = await _db.Queryable().SingleAsync(it => it.id == input.carryId); - if (carry != null) + try { - var disTask = await _db.Queryable().SingleAsync(it => it.id == input.disTaskId); - if (disTask != null) + await _db.Ado.BeginTranAsync(); + + var carry = await _db.Queryable().SingleAsync(it => it.id == input.carryId); + if (carry != null) { - if (_dicBizType.ContainsKey(disTask.biz_type)) + var disTask = await _db.Queryable().SingleAsync(it => it.id == input.disTaskId); + if (disTask != null) { - switch (_dicBizType[disTask.biz_type]) + if (_dicBizType.ContainsKey(disTask.biz_type)) { - case "空载具出库": - case "寄存出库": - case "齐套出库": - case "一般出库": - await _wareCarryService.UpdateNullCarry(carry); - break; + switch (_dicBizType[disTask.biz_type]) + { + case "空载具出库": + case "寄存出库": + case "齐套出库": + case "一般出库": + await _wareCarryService.UpdateNullCarry(carry); + break; + } } } + var loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id); + loc.is_use = "0"; + await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); } - var loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id); - loc.is_use = "0"; - await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); + + await _db.Ado.CommitTranAsync(); + } + catch (Exception) + { + await _db.Ado.RollbackTranAsync(); + throw; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs index 2ce0a3c7..20f2935c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs @@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr //载具加锁,增加库位信息 await _db.Updateable().SetColumns(it => new WmsCarryH { - carry_status = ((int)EnumCarryStatus.占用).ToString(), + carry_status = (int)EnumCarryStatus.占用, is_lock = 1, location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(), location_code = location.location_code diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index 439a7bad..3c2e978e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -176,7 +176,7 @@ namespace Tnb.WarehouseMgr var subCarrys = await _db.Queryable().Where(it => it.carry_id == ko.carry_id).ToListAsync(); var carryIds = subCarrys.Select(x => x.carry_id).Concat(new[] { ko.carry_id }).Distinct().ToList(); GenPreTaskUpInput genPreTaskInput = new() { CarryIds = carryIds, LocationIds = new List { carry.location_id, ko.location_id } }; - await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = ((int)EnumCarryStatus.齐套).ToString() }, it => new BasLocation { is_lock = 1 }); + await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = (int)EnumCarryStatus.齐套 }, it => new BasLocation { is_lock = 1 }); } }