Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -12,6 +12,9 @@ namespace Tnb.BasicData
|
|||||||
|
|
||||||
//生产出库接口
|
//生产出库接口
|
||||||
public const string MES_CREATE_OUTSTOCK = "/api/wms/wms-out-stock/mes-create-outstock";
|
public const string MES_CREATE_OUTSTOCK = "/api/wms/wms-out-stock/mes-create-outstock";
|
||||||
|
|
||||||
|
//齐套出库接口
|
||||||
|
public const string MES_KITTING_OUT_STK = "/api/wms/wmskitting-out/mes-kitting-out-stk";
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// mes齐套出库子表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("prd_kitting_out_d")]
|
||||||
|
public partial class PrdKittingOutD : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public PrdKittingOutD()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 物料ID
|
||||||
|
/// </summary>
|
||||||
|
public string material_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料编号
|
||||||
|
/// </summary>
|
||||||
|
public string? material_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位ID
|
||||||
|
/// </summary>
|
||||||
|
public string? unit_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位代码
|
||||||
|
/// </summary>
|
||||||
|
public string? unit_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批次
|
||||||
|
/// </summary>
|
||||||
|
public string? code_batch { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数量(件数)
|
||||||
|
/// </summary>
|
||||||
|
public decimal pr_qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 箱数
|
||||||
|
/// </summary>
|
||||||
|
public int box { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// q齐套出库id
|
||||||
|
/// </summary>
|
||||||
|
public string kitting_out_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// mes齐套出库主表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("prd_kitting_out_h")]
|
||||||
|
public partial class PrdKittingOutH : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public PrdKittingOutH()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 出库仓库ID
|
||||||
|
/// </summary>
|
||||||
|
public string warehouse_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 目标库位编号
|
||||||
|
/// </summary>
|
||||||
|
public string location_code { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品ID
|
||||||
|
/// </summary>
|
||||||
|
public string material_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品编号
|
||||||
|
/// </summary>
|
||||||
|
public string? material_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 齐套搭配方案ID
|
||||||
|
/// </summary>
|
||||||
|
public string collocation_scheme_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 齐套搭配方案编号
|
||||||
|
/// </summary>
|
||||||
|
public string? collocation_scheme_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 顺序号
|
||||||
|
/// </summary>
|
||||||
|
public string? seq { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户
|
||||||
|
/// </summary>
|
||||||
|
public string? create_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? create_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属组织
|
||||||
|
/// </summary>
|
||||||
|
public string? org_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程任务Id
|
||||||
|
/// </summary>
|
||||||
|
public string? f_flowtaskid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程引擎Id
|
||||||
|
/// </summary>
|
||||||
|
public string? f_flowid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单据号
|
||||||
|
/// </summary>
|
||||||
|
public string code { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属工位
|
||||||
|
/// </summary>
|
||||||
|
public string? workstation_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属产线
|
||||||
|
/// </summary>
|
||||||
|
public string? worklinei_d { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务单
|
||||||
|
/// </summary>
|
||||||
|
public string? mo_task_id { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Tnb.ProductionMgr.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// MES齐套出库接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IPrdKittingOutService
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
108
ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs
Normal file
108
ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
using JNPF;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.Extras.CollectiveOAuth.Models;
|
||||||
|
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Logging;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys;
|
||||||
|
using JNPF.VisualDev.Interfaces;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
using Tnb.BasicData.Entities;
|
||||||
|
using Tnb.ProductionMgr.Entities;
|
||||||
|
using Tnb.ProductionMgr.Interfaces;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生产领料
|
||||||
|
/// </summary>
|
||||||
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||||
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
|
[OverideVisualDev(ModuleId)]
|
||||||
|
public class PrdKittingOutService : IOverideVisualDevService, IPrdKittingOutService, IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private const string ModuleId = "27565198830357";
|
||||||
|
private readonly ISqlSugarRepository<PrdKittingOutH> _repository;
|
||||||
|
private readonly ISqlSugarClient _db;
|
||||||
|
private readonly IRunService _runService;
|
||||||
|
private readonly IVisualDevService _visualDevService;
|
||||||
|
private readonly IDictionaryDataService _dictionaryDataService;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
|
|
||||||
|
public PrdKittingOutService(ISqlSugarRepository<PrdKittingOutH> repository, IRunService runService, IUserManager userManager,IVisualDevService visualDevService, IDictionaryDataService dictionaryDataService)
|
||||||
|
{
|
||||||
|
_db = repository.AsSugarClient();
|
||||||
|
_runService = runService;
|
||||||
|
_visualDevService = visualDevService;
|
||||||
|
_dictionaryDataService = dictionaryDataService;
|
||||||
|
_repository = repository;
|
||||||
|
_userManager = userManager;
|
||||||
|
OverideFuncs.CreateAsync = Create;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<dynamic> Create(VisualDevModelDataCrInput visualDevModelDataCrInput)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
|
||||||
|
List<MESKittingOutStkInput> input = new List<MESKittingOutStkInput>();
|
||||||
|
visualDevModelDataCrInput.data["code"] = "111";
|
||||||
|
input.Add(new MESKittingOutStkInput()
|
||||||
|
{
|
||||||
|
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||||
|
bill_date = DateTime.Now,
|
||||||
|
warehouse_id = visualDevModelDataCrInput.data.ContainsKey("warehouse_id") ? visualDevModelDataCrInput.data["warehouse_id"].ToString() : "",
|
||||||
|
location_code = visualDevModelDataCrInput.data.ContainsKey("location_code") ? visualDevModelDataCrInput.data["location_code"].ToString() : "",
|
||||||
|
material_id = visualDevModelDataCrInput.data.ContainsKey("material_id") ? visualDevModelDataCrInput.data["material_id"].ToString() : "",
|
||||||
|
material_code = visualDevModelDataCrInput.data.ContainsKey("material_code") ? visualDevModelDataCrInput.data["material_code"].ToString() : "",
|
||||||
|
collocation_scheme_id = visualDevModelDataCrInput.data.ContainsKey("collocation_scheme_id") ? visualDevModelDataCrInput.data["collocation_scheme_id"].ToString() : "",
|
||||||
|
collocation_scheme_code = visualDevModelDataCrInput.data.ContainsKey("collocation_scheme_code") ? visualDevModelDataCrInput.data["collocation_scheme_code"].ToString() : "",
|
||||||
|
source_id = visualDevModelDataCrInput.data.ContainsKey("code") ? visualDevModelDataCrInput.data["code"].ToString() : "",
|
||||||
|
// source_id = "123",
|
||||||
|
seq = visualDevModelDataCrInput.data.ContainsKey("seq") ? (int)visualDevModelDataCrInput.data["seq"] : 0,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
|
||||||
|
});
|
||||||
|
|
||||||
|
input[0].wmsKittingoutDs = JsonConvert.DeserializeObject<List<MESKittingOutStkDInput>>(JsonConvert.SerializeObject(visualDevModelDataCrInput.data["tableField115"]));
|
||||||
|
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||||
|
Dictionary<string, object> header = new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||||
|
};
|
||||||
|
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_KITTING_OUT_STK,JsonConvert.SerializeObject(input),header);
|
||||||
|
Log.Information(sendResult);
|
||||||
|
|
||||||
|
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||||
|
if (authResponse.code != 200)
|
||||||
|
{
|
||||||
|
throw Oops.Bah(authResponse.msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||||
|
await _runService.Create(templateEntity, visualDevModelDataCrInput);
|
||||||
|
}
|
||||||
|
return await Task.FromResult(true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
|
Log.Error(e.Message);
|
||||||
|
throw Oops.Bah(e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,10 +3,11 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||||
{
|
{
|
||||||
public class MESCollocationSchemeQueryInput
|
public class MESCollocationSchemeQueryInput : PageInputBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 齐套出库主表
|
/// 齐套出库主表
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Org.BouncyCastle.Asn1.Mozilla;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr.Entities.Dto.Outputs
|
namespace Tnb.WarehouseMgr.Entities.Dto.Outputs
|
||||||
@@ -64,7 +65,12 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 齐套明细输出
|
/// 齐套明细输出
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
public List<CollocationSchemeDOutput>? CollocationSchemeDs { get; set; }
|
public List<CollocationSchemeDOutput>? CollocationSchemeDs { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 齐套明细Json
|
||||||
|
/// </summary>
|
||||||
|
public string CollocationSchemeDsJson { get; set; }=string.Empty;
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public List<WmsCollocationSchemeD>? list { get; set; }
|
public List<WmsCollocationSchemeD>? list { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ namespace Tnb.WarehouseMgr.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<dynamic> MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input);
|
Task<dynamic?> MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ using Mapster;
|
|||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.CodeAnalysis;
|
using Microsoft.CodeAnalysis;
|
||||||
|
using NPOI.HPSF;
|
||||||
using NPOI.OpenXmlFormats.Wordprocessing;
|
using NPOI.OpenXmlFormats.Wordprocessing;
|
||||||
using Polly.Timeout;
|
using Polly.Timeout;
|
||||||
using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen;
|
using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen;
|
||||||
@@ -187,6 +188,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
//任务链属性处理内部函数
|
//任务链属性处理内部函数
|
||||||
async Task _taskChainAttrHandle(List<WmsDistaskH> items, List<WmsPretaskH> areaPreTasks, int moveNum)
|
async Task _taskChainAttrHandle(List<WmsDistaskH> items, List<WmsPretaskH> areaPreTasks, int moveNum)
|
||||||
{
|
{
|
||||||
|
var groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE);
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
if (moveNum == 1 || (moveNum > areaPreTasks.Count && areaPreTasks.Count == 1))
|
if (moveNum == 1 || (moveNum > areaPreTasks.Count && areaPreTasks.Count == 1))
|
||||||
@@ -194,19 +196,34 @@ namespace Tnb.WarehouseMgr
|
|||||||
items.ForEach(x =>
|
items.ForEach(x =>
|
||||||
{
|
{
|
||||||
x.is_chain = 0;
|
x.is_chain = 0;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
items[^items.Count].groups = $"{groupCode}-1";
|
||||||
}
|
}
|
||||||
else if ((moveNum > areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count)
|
else if ((moveNum > areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count)
|
||||||
{
|
{
|
||||||
items.ForEach(x => x.is_chain = 1);
|
items.ForEach(x => x.is_chain = 1);
|
||||||
//items[0].chain_type = "1";
|
var mod = items.Count % moveNum > 0 ? items.Count / moveNum + 1 : items.Count / moveNum;
|
||||||
//for (int i = 0; i < items.Count; i++)
|
int start = 0, end = moveNum;
|
||||||
//{
|
var arrary = items.ToArray();
|
||||||
// if (i == 0 || i == items.Count - 1) continue;
|
var itemsCount = items.Count;
|
||||||
// items[i].chain_type = "2";
|
for (int i = 1; i <= mod; i++)
|
||||||
//}
|
{
|
||||||
//items[^1].chain_type = "3";
|
if (start >= itemsCount) break;
|
||||||
|
var subArray = arrary[start..end];
|
||||||
|
for (int j = 0, arrLen = subArray.Length; j < arrLen; j++)
|
||||||
|
{
|
||||||
|
subArray[j].groups = $"{groupCode}-{i}";
|
||||||
|
}
|
||||||
|
start = end;
|
||||||
|
if ((end + moveNum) >= arrary.Length)
|
||||||
|
{
|
||||||
|
end = arrary.Length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
end = end + moveNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -234,12 +251,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
var moveNum = itGroup.First().move_num;
|
var moveNum = itGroup.First().move_num;
|
||||||
var items = itGroup.Adapt<List<WmsDistaskH>>();
|
var items = itGroup.Adapt<List<WmsDistaskH>>();
|
||||||
items.ForEach(x =>
|
for (int i = 0, cnt = items.Count; i < cnt; i++)
|
||||||
{
|
{
|
||||||
x.id = SnowflakeIdHelper.NextId();
|
items[i].id = SnowflakeIdHelper.NextId();
|
||||||
x.status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID;
|
items[i].status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID;
|
||||||
x.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE).GetAwaiter().GetResult();
|
items[i].bill_code = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE);
|
||||||
});
|
}
|
||||||
|
|
||||||
if (moveNum == 1)
|
if (moveNum == 1)
|
||||||
{
|
{
|
||||||
@@ -508,7 +525,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
if (arr.Length > 1)
|
if (arr.Length > 1)
|
||||||
{
|
{
|
||||||
var subArr = arr[..^1];
|
var subArr = arr[..^1];
|
||||||
Array.ForEach(subArr, a => a.chain_type = "1");
|
System.Array.ForEach(subArr, a => a.chain_type = "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
[NonAction]
|
[NonAction]
|
||||||
public async Task<int> UpdateNullCarry(WmsCarryH carryObj)
|
public async Task<int> UpdateNullCarry(WmsCarryH carryObj)
|
||||||
{
|
{
|
||||||
var row = -1;
|
var row = 1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
carryObj.status = 0;
|
carryObj.status = 0;
|
||||||
@@ -172,7 +172,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
carryObj.collocation_scheme_code = null;
|
carryObj.collocation_scheme_code = null;
|
||||||
carryObj.source_id = null;
|
carryObj.source_id = null;
|
||||||
carryObj.source_code = null;
|
carryObj.source_code = null;
|
||||||
row = await _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync();
|
Task<int>.Run(() => _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync());
|
||||||
|
//row = await _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync();
|
||||||
//删除对应明细表
|
//删除对应明细表
|
||||||
//删除载具明细
|
//删除载具明细
|
||||||
await _db.CopyNew().Deleteable<WmsCarryD>().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync();
|
await _db.CopyNew().Deleteable<WmsCarryD>().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync();
|
||||||
@@ -183,12 +184,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error("更新空载具出错",ex);
|
row = 0;
|
||||||
|
Log.Error("更新空载具出错", ex);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task<bool> _updateSubCarry<T>(ExChangeCarryInput input) where T : BaseEntity<string>, IWmsCarryEntity, new()
|
private async Task<bool> _updateSubCarry<T>(ExChangeCarryInput input) where T : BaseEntity<string>, IWmsCarryEntity, new()
|
||||||
{
|
{
|
||||||
var row = -1;
|
var row = -1;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Aop.Api.Domain;
|
|||||||
using Aspose.Cells.Drawing;
|
using Aspose.Cells.Drawing;
|
||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
@@ -15,6 +16,7 @@ using JNPF.VisualDev.Entitys;
|
|||||||
using JNPF.VisualDev.Interfaces;
|
using JNPF.VisualDev.Interfaces;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
@@ -89,25 +91,25 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
//[NonUnify]
|
//[NonUnify]
|
||||||
public async Task<dynamic> MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input)
|
public async Task<dynamic?> MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input)
|
||||||
{
|
{
|
||||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||||
var data = new List<CollocationSchemeOutput>();
|
SqlSugarPagedList<CollocationSchemeOutput> pageData = new();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
data = await _db.Queryable<WmsCollocationSchemeH>()
|
pageData = await _db.Queryable<WmsCollocationSchemeH>()
|
||||||
.Where(a => a.material_id == input.material_id)
|
.Where(a => a.material_id == input.material_id)
|
||||||
.Select(a => new CollocationSchemeOutput
|
.Select(a => new CollocationSchemeOutput
|
||||||
{
|
{
|
||||||
list = SqlFunc.Subqueryable<WmsCollocationSchemeD>().Where(b => b.bill_id == a.id).ToList(),
|
list = SqlFunc.Subqueryable<WmsCollocationSchemeD>().Where(b => b.bill_id == a.id).ToList(),
|
||||||
}, true)
|
}, true)
|
||||||
.Mapper(it => it.CollocationSchemeDs = it.list?.Adapt<List<CollocationSchemeDOutput>>())
|
.Mapper(it => it.CollocationSchemeDsJson = JsonConvert.SerializeObject(it.list))
|
||||||
.ToListAsync();
|
.ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
return data;
|
return pageData == null ? Enumerable.Empty<dynamic>() : PageResult<CollocationSchemeOutput>.SqlSugarPageResult(pageData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -314,7 +314,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Updateable(curSortingDetails).ExecuteCommandAsync();
|
await _db.Updateable(curSortingDetails).ExecuteCommandAsync();
|
||||||
if (curSortingDetails.All(it => it.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
if (curSortingDetails.All(it => it.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||||
{
|
{
|
||||||
|
|
||||||
await _db.Updateable<WmsSetsortingH>().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
await _db.Updateable<WmsSetsortingH>().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Transactions;
|
||||||
using Aop.Api.Domain;
|
using Aop.Api.Domain;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
@@ -304,7 +305,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
carrys.Add(carry);
|
carrys.Add(carry);
|
||||||
if (carrys?.Count > 0)
|
if (carrys?.Count > 0)
|
||||||
{
|
{
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
var tasks = new List<Task<int>>();
|
var tasks = new List<Task<int>>();
|
||||||
foreach (var carryIt in carrys)
|
foreach (var carryIt in carrys)
|
||||||
{
|
{
|
||||||
@@ -313,7 +314,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
var all = await Task.WhenAll(tasks);
|
var all = await Task.WhenAll(tasks);
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
if (all.All(x => x > 0))
|
if (all.All(x => x > 0))
|
||||||
|
{
|
||||||
isOk = all?.Length > 0;
|
isOk = all?.Length > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||||
@@ -338,11 +341,21 @@ namespace Tnb.WarehouseMgr
|
|||||||
if (input.IsNull()) throw new ArgumentNullException(nameof(input));
|
if (input.IsNull()) throw new ArgumentNullException(nameof(input));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var kittingOut = input[^1];
|
//var kittingOut = input[^1];
|
||||||
var curCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == kittingOut.carry_id);
|
//if ((!kittingOut.carry_id.IsNullOrEmpty() || !kittingOut.carry_code.IsNullOrEmpty()) && !kittingOut.location_code.IsNullOrEmpty())
|
||||||
var endLocation = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == kittingOut.location_id);
|
//{
|
||||||
var isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, endLocation);
|
// WmsCarryH? curCarry = null;
|
||||||
if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500);
|
// if (!kittingOut.carry_id.IsNullOrEmpty())
|
||||||
|
// curCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == kittingOut.carry_id);
|
||||||
|
// else
|
||||||
|
// curCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.carry_code == kittingOut.carry_code);
|
||||||
|
|
||||||
|
// var endLocation = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == kittingOut.location_code);
|
||||||
|
// var isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, endLocation);
|
||||||
|
// if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500);
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
List<WmsKittingoutD> kittingOutDs = new();
|
List<WmsKittingoutD> kittingOutDs = new();
|
||||||
|
|||||||
Reference in New Issue
Block a user