Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2023-06-26 17:02:11 +08:00
52 changed files with 961 additions and 40 deletions

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.BasicData.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50313;http://localhost:50314"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.BasicData.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50305;http://localhost:50306"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.BasicData": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50307;http://localhost:50308"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.EquipMgr.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50299;http://localhost:50300"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.EquipMgr.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50303;http://localhost:50304"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.EquipMgr": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50301;http://localhost:50302"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.PerMgr.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50319;http://localhost:50320"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.PerMgr.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50321;http://localhost:50322"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.PerMgr": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50317;http://localhost:50318"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.ProductionMgr.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50311;http://localhost:50312"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.ProductionMgr.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50315;http://localhost:50316"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.ProductionMgr": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50309;http://localhost:50310"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.QcMgr.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50295;http://localhost:50296"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.QcMgr.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50297;http://localhost:50298"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.QcMgr": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50291;http://localhost:50292"
}
}
}

View File

@@ -94,6 +94,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "12-ProductionMgr", "12-ProductionMgr", "{ABE58B5E-610B-4159-BFF0-8B04BF700B3C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "13-WarehouseMgr", "13-WarehouseMgr", "{D90E2789-189A-4F05-B081-27F2FABB2E7E}"
ProjectSection(SolutionItems) = preProject
WmsSignForDeliveryService.txt = WmsSignForDeliveryService.txt
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "14-QcMgr", "14-QcMgr", "{D65B00D5-F40C-4FF2-8F8D-870772FAAA56}"
EndProject
@@ -131,11 +134,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.ProductionMgr.Entities"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "16-PerMgr", "16-PerMgr", "{74AB6486-1090-4CC9-9D1A-F1245E3ECFC3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tnb.PerMgr", "PerMgr\Tnb.PerMgr\Tnb.PerMgr.csproj", "{D41946CF-09C6-4CA4-A1F4-42E7E1538BF7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.PerMgr", "PerMgr\Tnb.PerMgr\Tnb.PerMgr.csproj", "{D41946CF-09C6-4CA4-A1F4-42E7E1538BF7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tnb.PerMgr.Entities", "PerMgr\Tnb.PerMgr.Entities\Tnb.PerMgr.Entities.csproj", "{42AD083D-D199-4B09-ADD8-89251011C959}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.PerMgr.Entities", "PerMgr\Tnb.PerMgr.Entities\Tnb.PerMgr.Entities.csproj", "{42AD083D-D199-4B09-ADD8-89251011C959}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tnb.PerMgr.Interfaces", "PerMgr\Tnb.PerMgr.Interfaces\Tnb.PerMgr.Interfaces.csproj", "{F3656494-27D3-4BD7-B831-8D909DFBD7B9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.PerMgr.Interfaces", "PerMgr\Tnb.PerMgr.Interfaces\Tnb.PerMgr.Interfaces.csproj", "{F3656494-27D3-4BD7-B831-8D909DFBD7B9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@@ -0,0 +1,142 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tnb.WarehouseMgr.Entities.Dto.Outputs
{
/// <summary>
/// 载具信息输出类
/// </summary>
public class CarryInfoOutput
{
/// <summary>
/// 租户ID
/// </summary>
public string? tenant_id { get; set; }
/// <summary>
/// 所属组织ID
/// </summary>
public string? org_id { get; set; }
/// <summary>
/// 载具编号
/// </summary>
public string carry_code { get; set; } = string.Empty;
/// <summary>
/// 载具名称
/// </summary>
public string carry_name { get; set; } = string.Empty;
/// <summary>
/// 状态
/// </summary>
public int status { get; set; }
/// <summary>
/// 载具状态
/// </summary>
public string carry_status { get; set; }
/// <summary>
/// 载具分类ID
/// </summary>
public string carrystd_id { get; set; } = string.Empty;
/// <summary>
/// 载具库位ID
/// </summary>
public string? location_id { get; set; }
/// <summary>
/// 载具库位编号
/// </summary>
public string? location_code { get; set; }
/// <summary>
/// 是否锁定
/// </summary>
public int is_lock { get; set; }
/// <summary>
/// 出库类型
/// </summary>
public string out_status { get; set; }
/// <summary>
/// 是否检验
/// </summary>
public int is_check { get; set; }
/// <summary>
/// 来源单据ID
/// </summary>
public string? source_id { get; set; }
/// <summary>
/// 来源单据代码
/// </summary>
public string? source_code { get; set; }
/// <summary>
/// 创建用户
/// </summary>
public string create_id { get; set; } = string.Empty;
/// <summary>
/// 创建时间
/// </summary>
public DateTime create_time { get; set; } = DateTime.Now;
/// <summary>
/// 最后修改人员ID
/// </summary>
public string? modify_id { get; set; }
/// <summary>
/// 最后修改时间
/// </summary>
public DateTime? modify_time { get; set; }
/// <summary>
/// 扩展字段
/// </summary>
public string? extras { get; set; }
/// <summary>
/// 时间戳(用于并发控制)
/// </summary>
public DateTime? timestamp { get; set; }
/// <summary>
/// 打包号
/// </summary>
public string? bale_num { get; set; }
/// <summary>
/// 齐套搭配方案ID
/// </summary>
public string? collocation_scheme_id { get; set; }
/// <summary>
/// 齐套搭配方案编号
/// </summary>
public string? collocation_scheme_code { get; set; }
/// <summary>
/// 载具明细列表
/// </summary>
public List<WmsCarryD> carryDetails { get; set; }=new List<WmsCarryD>();
/// <summary>
/// 载具条码列表
/// </summary>
public List<WmsCarryCode> carryCodes { get; set; } = new List<WmsCarryCode>();
/// <summary>
/// 载具无聊分拣明细
/// </summary>
public List<WmsCarryMat> carryMats { get; set; } = new List<WmsCarryMat>();
}
}

View File

@@ -122,7 +122,7 @@ public partial class WmsSetsortingH : BaseEntity<string>
/// <summary>
/// 顺序号
/// </summary>
public int order { get; set; }
public int seq { get; set; }
/// <summary>
/// 备注
@@ -152,11 +152,21 @@ public partial class WmsSetsortingH : BaseEntity<string>
/// <summary>
/// 修改用户
/// </summary>
public string modify_id { get; set; } = string.Empty;
public string? modify_id { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime modify_time { get; set; } = DateTime.Now;
public DateTime? modify_time { get; set; }
/// <summary>
/// 流程任务Id
/// </summary>
public string? f_flowtaskid { get; set; }
/// <summary>
/// 流程引擎Id
/// </summary>
public string? f_flowid { get; set; }
}

View File

@@ -0,0 +1,20 @@
using JNPF.Common.Contracts;
using JNPF.Common.Security;
using SqlSugar;
namespace Tnb.WarehouseMgr.Entities;
/// <summary>
/// 齐套分拣主表
/// </summary>
public partial class WmsSetsortingH
{
/// <summary>
/// 载具ID
/// </summary>
[SugarColumn(IsIgnore = true)]
public string? carry_id { get; set; }
[SugarColumn(IsIgnore = true)]
public string? carry_code { get; set; }
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.WarehouseMgr.Entities": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50287;http://localhost:50288"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.WarehouseMgr.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50293;http://localhost:50294"
}
}
}

View File

@@ -18,6 +18,7 @@ using Tnb.Common.Utils;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces;
@@ -35,11 +36,11 @@ namespace Tnb.WarehouseMgr
private readonly IRunService _runService;
private readonly IVisualDevService _visualDevService;
public WmsCarryService(
ISqlSugarRepository<WmsCarryH> repository,
IUserManager userManager,
IBillRullService billRullService,
ISqlSugarRepository<WmsCarryH> repository,
IUserManager userManager,
IBillRullService billRullService,
IRunService runService,
IVisualDevService visualDevService )
IVisualDevService visualDevService)
{
_db = repository.AsSugarClient();
_userManager = userManager;
@@ -49,6 +50,23 @@ namespace Tnb.WarehouseMgr
OverideFuncs.CreateAsync = ExchangeCarry;
}
/// <summary>
/// 根据载具ID获取载具信息
/// </summary>
/// <param name="carryId"></param>
/// <returns></returns>
[HttpGet]
public async Task<dynamic> GetCarryInfoById([FromRoute] string carryId)
{
var carryOutPut = await _db.Queryable<WmsCarryH>().Where(it => it.id == carryId).Select<CarryInfoOutput>().FirstAsync();
if (carryOutPut == null) throw new AppFriendlyException("找不到载具", 500);
carryOutPut.carryDetails = await _db.Queryable<WmsCarryD>().Where(it=>it.carry_id == carryId).ToListAsync();
carryOutPut.carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carryId).ToListAsync();
carryOutPut.carryMats = await _db.Queryable<WmsCarryMat>().Where(it => it.carry_id == carryId).ToListAsync();
return carryOutPut;
}
/// <summary>
/// 更换载具
/// </summary>
@@ -63,7 +81,7 @@ namespace Tnb.WarehouseMgr
/// <exception cref="ArgumentNullException"></exception>
private async Task<dynamic> ExchangeCarry(VisualDevModelDataCrInput input)
{
var isOk = false;
try

View File

@@ -82,7 +82,8 @@ namespace Tnb.WarehouseMgr
foreach (var os in outStockDList)
{
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
.Where((a, b) => b.material_id == os.material_id && b.code_batch == os.code_batch && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.)
.Where((a, b) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.)
.WhereIF(!string.IsNullOrEmpty(os.code_batch), (a, b) => b.code_batch == os.code_batch)
.Select<WmsCarryCode>()
.ToListAsync();
if (carryCodesPart?.Count > 0)
@@ -94,11 +95,10 @@ namespace Tnb.WarehouseMgr
throw new AppFriendlyException($"需要出库[{os.pr_qty}],实际库存{codeQty},数量不足", 500);
}
var partCarryMats = carryCodesPart.Adapt<List<WmsCarryMat>>();
partCarryMats.ForEach(x =>
for (int i = 0; i < partCarryMats.Count; i++)
{
x.need_qty = (int)os.pr_qty;
x.real_qty = codeQty;
});
partCarryMats[i].need_qty = carryCodesPart[i].codeqty;
}
carryMats.AddRange(partCarryMats);
}
}
@@ -109,12 +109,12 @@ namespace Tnb.WarehouseMgr
.Select(x =>
{
WmsCarryMat? carryMat = x.FirstOrDefault()!;
carryMat.real_qty = x.Sum(d => d.real_qty);
carryMat.need_qty = x.Sum(d => d.need_qty);
return carryMat;
})
.ToList();
await _db.Insertable(carryMats).ExecuteCommandAsync();
var dic = carryMats.DistinctBy(x => x.carry_id).ToDictionary(x => x.carry_id, x => x.real_qty);
var dic = carryMats.DistinctBy(x => x.carry_id).ToDictionary(x => x.carry_id, x => x.need_qty);
var allOutIds = new List<string>();
var sortingOutIds = new List<string>();
foreach (var pair in dic)

View File

@@ -87,26 +87,29 @@ namespace Tnb.WarehouseMgr
feedBox.qty = carryMaterial.qty;
feedBox.batch = carryMaterial?.code_batch!;
feedBox.status = carry.status;
feedBox.create_id = _userManager.UserId;
feedBox.create_time = DateTime.Now;
feedBox.modify_id = _userManager.UserId;
feedBox.modify_time = DateTime.Now;
var row = await _db.Updateable(feedBox).ExecuteCommandAsync();
//更新投料记录条码表
foreach (var carryCode in carryCodes)
if (carryCodes != null)
{
WmsFeedingrecordCode wmsFeedingrecordCode = new();
wmsFeedingrecordCode.id = SnowflakeIdHelper.NextId();
wmsFeedingrecordCode.org_id = _userManager.User.OrganizeId;
wmsFeedingrecordCode.record_id = input.data["ReturnIdentity"]?.ToString()!;
wmsFeedingrecordCode.material_id = carryCode.material_id;
wmsFeedingrecordCode.material_code = carryCode.material_code;
wmsFeedingrecordCode.barcode = carryCode.barcode;
wmsFeedingrecordCode.code_batch = carryCode.code_batch;
wmsFeedingrecordCode.codeqty = carryCode.codeqty;
wmsFeedingrecordCode.unit_id = carryCode.unit_id;
wmsFeedingrecordCode.unit_code = carryCode.unit_code;
wmsFeedingrecordCode.create_id = _userManager.UserId;
wmsFeedingrecordCode.create_time = DateTime.Now;
row = await _db.Insertable(wmsFeedingrecordCode).ExecuteCommandAsync();
foreach (var carryCode in carryCodes)
{
WmsFeedingrecordCode wmsFeedingrecordCode = new();
wmsFeedingrecordCode.id = SnowflakeIdHelper.NextId();
wmsFeedingrecordCode.org_id = _userManager.User.OrganizeId;
wmsFeedingrecordCode.record_id = input.data["ReturnIdentity"]?.ToString()!;
wmsFeedingrecordCode.material_id = carryCode.material_id;
wmsFeedingrecordCode.material_code = carryCode.material_code;
wmsFeedingrecordCode.barcode = carryCode.barcode;
wmsFeedingrecordCode.code_batch = carryCode.code_batch;
wmsFeedingrecordCode.codeqty = carryCode.codeqty;
wmsFeedingrecordCode.unit_id = carryCode.unit_id;
wmsFeedingrecordCode.unit_code = carryCode.unit_code;
wmsFeedingrecordCode.create_id = _userManager.UserId;
wmsFeedingrecordCode.create_time = DateTime.Now;
row = await _db.Insertable(wmsFeedingrecordCode).ExecuteCommandAsync();
}
}
//更新载具
row = await UpdateNullCarry(carry);
@@ -117,11 +120,11 @@ namespace Tnb.WarehouseMgr
{
if (carry == null)
{
throw new AppFriendlyException("没有可用的载具", 500);
throw new AppFriendlyException("没有可用的载具", 500);
}
if (feedBox == null)
{
throw new AppFriendlyException("没有可用的新载具", 500);
throw new AppFriendlyException("没有可用的投料箱", 500);
}
}

View File

@@ -0,0 +1,189 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JNPF.Common.Core.Manager;
using JNPF.Common.Extension;
using JNPF.Common.Security;
using JNPF.FriendlyException;
using JNPF.Systems.Interfaces.System;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using NPOI.SS.Formula;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.WarehouseMgr
{
/// <summary>
/// 齐套分拣服务类
/// </summary>
public class WmsSetSortingService : BaseWareHouseService
{
private readonly ISqlSugarClient _db;
private readonly IWareHouseService _wareHouseService;
private readonly IBillRullService _billRullService;
private readonly IUserManager _userManager;
public WmsSetSortingService(ISqlSugarRepository<WmsSetsortingH> repository, IWareHouseService wareHouseService, IUserManager userManager, IBillRullService billRullService)
{
_db = repository.AsSugarClient();
_wareHouseService = wareHouseService;
_billRullService = billRullService;
_userManager = userManager;
}
/// <summary>
/// 齐套分拣(新增状态)
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task PackSortingByAdd()
{
var setSortings = await _db.Queryable<WmsSetsortingH>()
.Where(a => a.status == WmsWareHouseConst.BILLSTATUS_ADD_ID).OrderBy(a => a.seq)
.ToListAsync();
var items = await _db.Queryable<WmsSetsortingH>().Where(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).ToListAsync();
var onFlag = items?.Count > 0;
if (setSortings?.Count > 0 && !onFlag)
{
var singleSorting = setSortings[^setSortings.Count];
var setSortingDList = await _db.Queryable<WmsSetsortingD>().Where(it => it.bill_id == singleSorting.id).ToListAsync();
if (setSortingDList?.Count > 0)
{
List<WmsCarryMat> carryMats = new();
List<WmsCarryCode> carryCodes = new();
List<string> carryIds = new();
foreach (var os in setSortingDList)
{
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
.Where((a, b) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.)
.WhereIF(!string.IsNullOrEmpty(os.code_batch), (a, b) => b.code_batch == os.code_batch)
.Select<WmsCarryCode>()
.ToListAsync();
if (carryCodesPart?.Count > 0)
{
carryCodes.AddRange(carryCodesPart);
var codeQty = carryCodes.Sum(x => x.codeqty);
if (codeQty < os.pr_qty)
{
throw new AppFriendlyException($"需要出库[{os.pr_qty}],实际库存{codeQty},数量不足", 500);
}
var partCarryMats = carryCodesPart.Adapt<List<WmsCarryMat>>();
for (int i = 0; i < partCarryMats.Count; i++)
{
partCarryMats[i].need_qty = carryCodesPart[i].codeqty;
}
carryMats.AddRange(partCarryMats);
}
}
if (carryMats.Count > 0)
{
carryMats.ForEach(x => x.id = SnowflakeIdHelper.NextId());
carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch })
.Select(x =>
{
WmsCarryMat? carryMat = x.FirstOrDefault()!;
carryMat.need_qty = x.Sum(d => d.need_qty);
return carryMat;
})
.ToList();
await _db.Insertable(carryMats).ExecuteCommandAsync();
var dic = carryMats.DistinctBy(x => x.carry_id).ToDictionary(x => x.carry_id, x => x.need_qty);
carryIds = carryMats.Select(x => x.carry_id).Distinct().ToList();
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.).ToString() }).Where(it => carryIds.Contains(it.id)).ExecuteCommandAsync();
//天益项目不需要
//await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.分拣出).ToString() }).Where(it => sortingOutIds.Contains(it.id)).ExecuteCommandAsync();
}
var carrys = await _db.Queryable<WmsCarryH>().Where(it => carryIds.Contains(it.id)).ToArrayAsync();
if (carrys?.Length > 0)
{
List<WmsPretaskH> preTasks = new();
List<string> locIds = new();
string firstLocationId = "27010980724501", secondLocationId = "27010987857941";
if (carrys.Length > 6)
{
var leftCarrys = carrys[..6];
var rightCarrys = carrys[6..];
await _genPreTask(leftCarrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
await _genPreTask(rightCarrys, locIds, secondLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
}
else
{
await _genPreTask(carrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
}
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
GenPreTaskUpInput genPreTaskAfterUpInput = new();
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
}
}
}
}
private async Task _genPreTask(WmsCarryH[] carrys, List<string> locIds, string eLocationId, string requireId, string requireCode, List<WmsPretaskH> preTasks)
{
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == eLocationId);
foreach (var carry in carrys)
{
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == eLocationId);
if (sPoint != null && ePoint != null)
{
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
locIds.AddRange(points.Select(x => x.location_id).ToList()!);
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
if (points?.Count > 0)
{
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
var curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
{
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_WMSOUTSTOCK_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 = requireId;
preTask.require_code = requireCode;
preTask.create_id = _userManager.UserId;
preTask.create_time = DateTime.Now;
return preTask;
}).ToList();
if (loc.is_sign == 0)
{
curPreTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
}
preTasks.AddRange(curPreTasks);
}
}
}
}
}
}

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JNPF.Common.Enums;
using JNPF.FriendlyException;
using Microsoft.AspNetCore.Mvc;
using Microsoft.CodeAnalysis.Operations;
using SqlSugar;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Consts;
namespace Tnb.WarehouseMgr
{
/// <summary>
/// 出库签收
/// </summary>
public class WmsSignForDeliveryService : BaseWareHouseService
{
private readonly ISqlSugarClient _db;
public WmsSignForDeliveryService(ISqlSugarRepository<WmsDistaskH> repository)
{
_db = repository.AsSugarClient();
}
/// <summary>
/// 根据载具ID获取对应的执行任务记录
/// </summary>
/// <param name="carryId"></param>
/// <returns></returns>
[HttpGet]
public async Task<dynamic> GetDisTasksByCarryId([FromRoute] string carryId)
{
var item = await _db.Queryable<WmsDistaskH>().FirstAsync(it => it.carry_id == carryId && it.status == WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID && it.is_sign == 0);
return item;
}
[HttpPost]
public async Task SaveData()
{
}
}
}

View File

@@ -79,7 +79,7 @@ namespace Tnb.WarehouseMgr
var setSortingH = ko.Adapt<WmsSetsortingH>();
setSortingH.id = SnowflakeIdHelper.NextId();
setSortingH.kittingout_id = ko.id;
setSortingH.order = ko.seq;
setSortingH.seq = ko.seq;
setSortingH.org_id = _userManager.User.OrganizeId;
setSortingH.create_id = _userManager.UserId;
setSortingH.create_time = DateTime.Now;
@@ -131,9 +131,9 @@ namespace Tnb.WarehouseMgr
var locs = await _db.Queryable<BasLocation>().Where(it => it.id == koGrp.Key && it.is_use == "0" && it.is_lock == 0).ToListAsync();
if (locs?.Count > 0)
{
var arr = koGrp.ToArray();
Index start = ^arr.Length;
var ko = arr[start];
var ko = arr[^arr.Length];
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
if (carry != null)
{

View File

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Apps.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50247;http://localhost:50263"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Apps": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50240;http://localhost:50264"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.CollectiveOAuth": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50269;http://localhost:50270"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Common.Core": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50271;http://localhost:50273"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Common": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50246;http://localhost:50267"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.SqlSugar": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50289;http://localhost:50290"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Thirdparty": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50276;http://localhost:50277"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.WebSockets": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50272;http://localhost:50274"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Extend.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50285;http://localhost:50286"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Extend.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50283;http://localhost:50284"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Message.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50244;http://localhost:50268"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Message.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50239;http://localhost:50259"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Message": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50241;http://localhost:50262"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.OAuth": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50278;http://localhost:50279"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.Systems.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50280;http://localhost:50281"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.TaskScheduler.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50245;http://localhost:50257"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.TaskScheduler.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50251;http://localhost:50258"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.TaskScheduler": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50250;http://localhost:50255"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.VisualDev.Engine": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50248;http://localhost:50254"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.VisualDev.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50243;http://localhost:50260"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.VisualDev.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50252;http://localhost:50256"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.VisualDev": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50242;http://localhost:50266"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.WorkFlow.Entitys": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50253;http://localhost:50261"
}
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Tnb.WorkFlow.Interfaces": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50249;http://localhost:50265"
}
}
}