diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs index a30a0206..69ae0583 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs @@ -65,8 +65,8 @@ namespace Tnb.WarehouseMgr if (input == null) throw new ArgumentNullException(nameof(input)); var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; var subCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : ""; - var carry = await _db.Queryable().FirstAsync(it => it.id == carryId); - var subCarry = await _db.Queryable().FirstAsync(it => it.id == subCarryId); + var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); + var subCarry = await _db.Queryable().SingleAsync(it => it.id == subCarryId); WmsCarrybindH wmsCarrybindH = carry.Adapt(); if (carry != null && subCarry != null) { @@ -83,9 +83,28 @@ namespace Tnb.WarehouseMgr row = await _db.Updateable(carry).ExecuteCommandAsync(); subCarry.carry_status = "1"; row = await _db.Updateable(subCarry).ExecuteCommandAsync(); + var items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); + for (int i = 0; i < items.Count; i++) + { + WmsCarrybindCode wmsCarrybindCode = new(); + wmsCarrybindCode.id = SnowflakeIdHelper.NextId(); + wmsCarrybindCode.org_id = subCarry.id; + wmsCarrybindCode.carrybind_id = wmsCarrybindH.id; + wmsCarrybindCode.material_id = items[i].material_id; + wmsCarrybindCode.material_code = items[i].material_code; + wmsCarrybindCode.barcode = items[i].barcode; + wmsCarrybindCode.code_batch = items[i].code_batch; + wmsCarrybindCode.codeqty = items[i].codeqty; + wmsCarrybindCode.membercarry_id = subCarry.id; + wmsCarrybindCode.membercarry_code = subCarry.carry_code; + wmsCarrybindCode.unit_id = items[i].unit_id; + wmsCarrybindCode.unit_code = items[i].unit_code; + wmsCarrybindCode.create_id = _userManager.UserId; + wmsCarrybindCode.create_time = DateTime.Now; + row = await _db.Insertable(wmsCarrybindCode).ExecuteCommandAsync(); + } isOk = (row > 0); if (!isOk) throw Oops.Oh(ErrorCode.COM1001); - } else { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs index e8fd09c8..00192980 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs @@ -87,7 +87,7 @@ namespace Tnb.WarehouseMgr ePoint = await _db.Queryable().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString()); } int i = 0; - var isOk = false; + //根据每个载具的起始库位做路径运算 for (i = 0; i < setQty.qty; i++) @@ -95,7 +95,7 @@ namespace Tnb.WarehouseMgr if (carrys?.Count > 0) sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carrys[i].location_id); - + var isOk = false; if (sPoint != null && ePoint != null) { var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);