wms 消除warning

This commit is contained in:
alex
2023-07-04 09:22:13 +08:00
parent e78f63acfb
commit 1a01692551
41 changed files with 296 additions and 327 deletions

View File

@@ -36,25 +36,30 @@ namespace Tnb.WarehouseMgr
public class WmsPDADeliveryService : BaseWareHouseService, IPdaStroage
{
private const string BizTypeId = "26125644258853";
private readonly ISqlSugarClient _db;
private readonly IRunService _runService;
private readonly IVisualDevService _visualDevService;
private readonly IBasLocationService _basLocationService;
private readonly IWareHouseService _wareHouseService;
private readonly IBillRullService _billRullService;
private readonly IUserManager _userManager;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
private readonly ISqlSugarClient? _db;
private readonly IRunService? _runService;
private readonly IVisualDevService? _visualDevService;
private readonly IBasLocationService? _basLocationService;
private readonly IWareHouseService? _wareHouseService;
private readonly IBillRullService? _billRullService;
private readonly IUserManager? _userManager;
public WmsPDADeliveryService(
ISqlSugarRepository<WmsDelivery> repository,
IRunService runService,
IVisualDevService visualDevService,
IBasLocationService basLocationService
IBasLocationService basLocationService,
IBillRullService billRullService,
IWareHouseService wareHouseService,
IUserManager userManager
)
{
_db = repository.AsSugarClient();
_runService = runService;
_visualDevService = visualDevService;
_basLocationService = basLocationService;
_billRullService = billRullService;
_wareHouseService = wareHouseService;
_userManager = userManager;
OverideFuncs.CreateAsync = Create;
}
/// <summary>
@@ -91,30 +96,30 @@ namespace Tnb.WarehouseMgr
endLocationId = input.data[nameof(WmsDelivery.endlocation_id)]?.ToString()!;
}
var locIds = new[] { startLocationId, endLocationId };
var locs = await _basLocationService.GetLocationInfobyIds(locIds);
var locs = await _basLocationService?.GetLocationInfobyIds(locIds)!;
if (locs?.Count > 0)
{
var isStoreLoc = locs.Where(x => !x.IsNullOrEmpty()).Select(x => x.is_type.ParseToInt()).Any(x => x == (int)EnumLocationType.);
if (isStoreLoc) throw new AppFriendlyException("起始库位不能为存储库位", 500);
}
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSDELIVERYPDA_ID, true);
VisualDevEntity? templateEntity = await _visualDevService?.GetInfoById(ModuleConsts.MODULE_WMSDELIVERYPDA_ID, true)!;
await _runService.Create(templateEntity, input);
// 计算路径,插入预任务申请
WmsPointH sPoint = null;
WmsPointH ePoint = null;
WmsPointH sPoint = null!;
WmsPointH ePoint = null!;
if (input.data.ContainsKey(nameof(WmsDelivery.startlocation_id)))
{
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsTransfer.startlocation_id)].ToString());
sPoint = await _db?.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsTransfer.startlocation_id)].ToString())!;
}
if (input.data.ContainsKey(nameof(WmsTransfer.endlocation_id)))
{
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsTransfer.endlocation_id)].ToString());
ePoint = await _db!.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsTransfer.endlocation_id)].ToString());
}
if (sPoint != null && ePoint != null)
{
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
var points = await _wareHouseService!.PathAlgorithms(sPoint.id, ePoint.id);
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
if (points?.Count > 0)
{
@@ -125,20 +130,20 @@ namespace Tnb.WarehouseMgr
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.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.bill_code = _billRullService!.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID;
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID;
preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!;
preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!;
preTask.area_id = sPoint?.area_id;
preTask.area_id = sPoint?.area_id!;
preTask.area_code = it.Key;
preTask.require_id = input.data["ReturnIdentity"].ToString();
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
@@ -146,7 +151,7 @@ namespace Tnb.WarehouseMgr
preTask.create_time = DateTime.Now;
return preTask;
}).ToList();
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
var isOk = await _wareHouseService.GenPreTask(preTasks, null!);
if (isOk)
{
if (input.data.ContainsKey(nameof(WmsDelivery.startlocation_id)) && input.data.ContainsKey(nameof(WmsDelivery.endlocation_id)) && input.data[nameof(WmsDelivery.endlocation_id)] != null && input.data[nameof(WmsDelivery.endlocation_id)] != null)