diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index fe61e471..5b2ab182 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -151,7 +151,7 @@ namespace Tnb.WarehouseMgr { CodeDetails = SqlFunc.Subqueryable().Where(it => it.bill_d_id == a.id).ToList(), }, true) - .Mapper(it => it.line_status = dic.ContainsKey(key: it.line_status) ? dic[it.line_status]?.ToString() : "") + .Mapper(it => it.line_status = dic.ContainsKey(key: it.line_status) ? dic[it.line_status]?.ToString() : "") .ToListAsync(); return data; } @@ -555,20 +555,13 @@ namespace Tnb.WarehouseMgr //根据载具ID,更新是否锁定和赋值起始库位 if (setCarryColumnsExp != null) { - if (input.CarryIds?.Count > 0) - { - await _db.Updateable().SetColumns(setCarryColumnsExp).Where(it => input.CarryIds.Contains(it.id)).ExecuteCommandAsync(); - } - else - { - await _db.Updateable().SetColumns(setCarryColumnsExp).Where(it => it.id == input.CarryId).ExecuteCommandAsync(); - } + Expression> whereExp = input.CarryIds?.Count > 0 ? it => input.CarryIds.Contains(it.id) : it => it.id == input.CarryId; + await _db.Updateable().SetColumns(setCarryColumnsExp).Where(whereExp).ExecuteCommandAsync(); } - //根据所有库位更新库位的锁定状态为“锁定” - if (setLocaionColumbExp != null) + if (setLocaionColumbExp != null && input.LocationIds?.Count > 0) { - await _db.Updateable().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds!.Contains(it.id)).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index f4c41568..357de608 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -443,10 +443,8 @@ namespace Tnb.WarehouseMgr List locIds = new(); foreach (var carry in carrys) { - WmsPointH sPoint = null!; - WmsPointH ePoint = null!; - sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carry.location_id); - ePoint = await _db.Queryable().FirstAsync(it => it.location_id == outstock.location_id.ToString()); + WmsPointH sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carry.location_id); + WmsPointH ePoint = await _db.Queryable().FirstAsync(it => it.location_id == outstock.location_id.ToString()); if (sPoint != null && ePoint != null) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index 38aefcb1..95aefa47 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -76,11 +76,11 @@ namespace Tnb.WarehouseMgr if (carrys?.Count > 0) { var firstCarry = carrys.FirstOrDefault(); - GenPreTaskUpInput genPreTaskInput = new() { CarryId = firstCarry!.id! }; + GenPreTaskUpInput genPreTaskInput = new() { CarryId = firstCarry?.id }; await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1 }, null!); ko.status = WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID; - ko.carry_id = firstCarry.id; - ko.carry_code = firstCarry.carry_code; + ko.carry_id = firstCarry?.id; + ko.carry_code = firstCarry?.carry_code; await _db.Updateable(ko).UpdateColumns(it => new { it.status, it.carry_id, it.carry_code }).ExecuteCommandAsync(); } else @@ -165,26 +165,28 @@ 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!; - preTask.startlocation_code = sPoint?.location_code!; - preTask.endlocation_id = ePoint?.location_id!; - preTask.endlocation_code = ePoint?.location_code!; - preTask.start_floor = sPoint?.floor.ToString(); - preTask.end_floor = ePoint?.floor.ToString(); - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = ko.biz_type; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; - preTask.carry_id = ko!.carry_id!; - preTask.carry_code = ko!.carry_code!; - preTask.area_id = sPoint?.area_id!; - preTask.area_code = it.Key; - preTask.require_id = ko.id; - preTask.require_code = ko.bill_code; - preTask.create_id = _userManager.UserId; - preTask.create_time = DateTime.Now; + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = ko.biz_type, + task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID, + carry_id = ko!.carry_id!, + carry_code = ko!.carry_code!, + area_id = sPoint?.area_id!, + area_code = it.Key, + require_id = ko.id, + require_code = ko.bill_code, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; return preTask; }).ToList(); await _warehouseService.GenPreTask(preTasks, null!);