diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index 1d8edacb..1719855f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -257,7 +257,8 @@ namespace Tnb.WarehouseMgr var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); if (isOk) { - await _db.Updateable(outStockDList).SetColumns(it => it.line_status == WmsWareHouseConst.BILLSTATUS_ON_ID).ExecuteCommandAsync(); + outStockDList.ForEach(x => x.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID); + await _db.Updateable(outStockDList).UpdateColumns(it => it.line_status).ExecuteCommandAsync(); await _db.Updateable().SetColumns(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).Where(it => it.id == input.data["ReturnIdentity"].ToString()).ExecuteCommandAsync(); GenPreTaskUpInput genPreTaskAfterUpInput = new(); @@ -455,10 +456,10 @@ namespace Tnb.WarehouseMgr 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!, + startlocation_id = sPoint?.location_id ?? string.Empty, + startlocation_code = sPoint?.location_code ?? string.Empty, + endlocation_id = ePoint?.location_id ?? string.Empty, + endlocation_code = ePoint?.location_code ?? string.Empty, start_floor = sPoint?.floor.ToString(), end_floor = ePoint?.floor.ToString(), bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), @@ -467,13 +468,14 @@ namespace Tnb.WarehouseMgr task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID, carry_id = carry.id, carry_code = carry.carry_code, - area_id = sPoint?.area_id!, + area_id = sPoint?.area_id ?? string.Empty, area_code = it.Key, - require_id = outstock.id.ToString() + require_id = outstock.id.ToString(), + require_code = outstock.bill_code?.ToString(), + create_id = _userManager.UserId, + create_time = DateTime.Now }; - preTask.require_code = outstock.bill_code?.ToString()!; - preTask.create_id = _userManager.UserId; - preTask.create_time = DateTime.Now; + return preTask; }).ToList(); if (location.is_sign == 0) @@ -501,7 +503,8 @@ namespace Tnb.WarehouseMgr var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); if (isOk) { - await _db.Updateable(outstockDs).SetColumns(it => new WmsOutstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).ExecuteCommandAsync(); + outstockDs.ForEach(x => x.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID); + await _db.Updateable(outstockDs).UpdateColumns(it => it.line_status).ExecuteCommandAsync(); await _db.Updateable(outstock).SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).ExecuteCommandAsync(); GenPreTaskUpInput genPreTaskAfterUpInput = new(); genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();