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