消除warning
This commit is contained in:
@@ -156,36 +156,36 @@ namespace Tnb.WarehouseMgr
|
||||
List<WmsPretaskH> preTasks = new();
|
||||
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
if (points?.Count > 0)
|
||||
{
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
{
|
||||
var sPoint = it.FirstOrDefault();
|
||||
var ePoint = it.LastOrDefault();
|
||||
{
|
||||
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 = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
preTask.carry_id = carry.id!;
|
||||
preTask.carry_code = carry.carry_code!;
|
||||
preTask.area_id = sPoint?.area_id!;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = KittingOutObj.requireId;
|
||||
preTask.require_code = KittingOutObj.requireCode;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
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 = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
preTask.carry_id = carry.id!;
|
||||
preTask.carry_code = carry.carry_code!;
|
||||
preTask.area_id = sPoint?.area_id!;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = KittingOutObj.requireId;
|
||||
preTask.require_code = KittingOutObj.requireCode;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
}
|
||||
return preTasks;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -10,6 +11,7 @@ using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -53,7 +55,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task KittingOutByAdd()
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
@@ -129,7 +131,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task KittingOutByIsToBeShipped()
|
||||
public async Task KittingOutByIsToBeShipped(IDbTransaction? tran = null)
|
||||
{
|
||||
|
||||
try
|
||||
@@ -308,13 +310,20 @@ namespace Tnb.WarehouseMgr
|
||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||
try
|
||||
{
|
||||
using (var conn = _db.Ado.Connection)
|
||||
{
|
||||
using (var tran = conn.BeginTransaction())
|
||||
{
|
||||
_db.Ado.Transaction = tran;
|
||||
}
|
||||
}
|
||||
await _db.Ado.BeginTranAsync();
|
||||
List<WmsKittingoutD> kittingOutDs = new();
|
||||
var kittingOuts = input.Adapt<List<WmsKittingoutH>>();
|
||||
|
||||
|
||||
for (int i = 0; i < kittingOuts.Count; i++)
|
||||
{
|
||||
var x= kittingOuts[i];
|
||||
var x = kittingOuts[i];
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_KITTINGOUTSTK_ENCODE).GetAwaiter().GetResult();
|
||||
x.bill_date = DateTime.Now;
|
||||
@@ -322,7 +331,7 @@ namespace Tnb.WarehouseMgr
|
||||
x.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
x.biz_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
||||
var d = input[i]?.wmsKittingoutDs?.Adapt<List<WmsKittingoutD>>();
|
||||
d?.ForEach(it =>
|
||||
d?.ForEach(it =>
|
||||
{
|
||||
it.id = SnowflakeIdHelper.NextId();
|
||||
it.bill_id = x.id;
|
||||
@@ -330,21 +339,26 @@ namespace Tnb.WarehouseMgr
|
||||
it.real_box = 0;
|
||||
it.warehouse_id = x.warehouse_id;
|
||||
});
|
||||
kittingOutDs.AddRange(d!);
|
||||
if (d != null)
|
||||
{
|
||||
kittingOutDs.AddRange(d);
|
||||
}
|
||||
}
|
||||
await _db.Insertable(kittingOuts).ExecuteCommandAsync();
|
||||
await _db.Insertable(kittingOutDs).ExecuteCommandAsync();
|
||||
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
|
||||
await KittingOutByAdd();
|
||||
isSuccessFul = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("MES齐套出库接口出错", ex);
|
||||
isSuccessFul = false;
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
}
|
||||
|
||||
|
||||
return isSuccessFul;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user