Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -26,7 +26,7 @@ namespace Tnb.BasicData
|
|||||||
[OverideVisualDev(ModelId)]
|
[OverideVisualDev(ModelId)]
|
||||||
public class BasMbomService : IBasMbomService, IOverideVisualDevService, IDynamicApiController, ITransient
|
public class BasMbomService : IBasMbomService, IOverideVisualDevService, IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
public const string ModelId = "25574817510421";
|
public const string ModelId = "27204627275029";
|
||||||
private readonly ISqlSugarRepository<BasMbom> _repository;
|
private readonly ISqlSugarRepository<BasMbom> _repository;
|
||||||
private readonly DataBaseManager _dbManager;
|
private readonly DataBaseManager _dbManager;
|
||||||
private readonly IDictionaryDataService _dictionaryDataService;
|
private readonly IDictionaryDataService _dictionaryDataService;
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
namespace Tnb.ProductionMgr.Entities.Dto
|
||||||
|
{
|
||||||
|
public class MaterialReceiptNewInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 工位id
|
||||||
|
/// </summary>
|
||||||
|
public string station_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务单id
|
||||||
|
/// </summary>
|
||||||
|
public string? mo_task_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备id
|
||||||
|
/// </summary>
|
||||||
|
public string? equip_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 二维码信息
|
||||||
|
/// </summary>
|
||||||
|
public string? carry_code { get; set; }
|
||||||
|
|
||||||
|
public List<Dictionary<string,string>>? details { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -98,6 +98,11 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
|||||||
/// Nullable:True
|
/// Nullable:True
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int icmo_qty { get; set; }
|
public int icmo_qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工位
|
||||||
|
/// </summary>
|
||||||
|
public string? station { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,5 +78,39 @@ public partial class PrdReport : BaseEntity<string>
|
|||||||
/// 生产任务量
|
/// 生产任务量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? icmo_qty { get; set; }
|
public int? icmo_qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批次
|
||||||
|
/// </summary>
|
||||||
|
public string? batch { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备id
|
||||||
|
/// </summary>
|
||||||
|
public string? equip_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工位id
|
||||||
|
/// </summary>
|
||||||
|
public string? station { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产bom工序id
|
||||||
|
/// </summary>
|
||||||
|
public string? mbom_process_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态 0 未入库 1 已入库
|
||||||
|
/// </summary>
|
||||||
|
public int status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料id
|
||||||
|
/// </summary>
|
||||||
|
public string? material_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料单位
|
||||||
|
/// </summary>
|
||||||
|
public string? unit_id { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,5 +14,12 @@ namespace Tnb.ProductionMgr.Interfaces
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<dynamic> SaveData(MaterialReceiptInput input);
|
public Task<dynamic> SaveData(MaterialReceiptInput input);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<dynamic> SaveDataNew(MaterialReceiptNewInput input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ using JNPF.Common.Security;
|
|||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Systems.Entitys.Permission;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.ClearScript.Util.Web;
|
using Microsoft.ClearScript.Util.Web;
|
||||||
@@ -13,6 +14,8 @@ using Tnb.ProductionMgr.Entities;
|
|||||||
using Tnb.ProductionMgr.Entities.Dto;
|
using Tnb.ProductionMgr.Entities.Dto;
|
||||||
using Tnb.ProductionMgr.Interfaces;
|
using Tnb.ProductionMgr.Interfaces;
|
||||||
using Tnb.ProductionMgr.Entities.Consts;
|
using Tnb.ProductionMgr.Entities.Consts;
|
||||||
|
using Tnb.WarehouseMgr;
|
||||||
|
using Tnb.WarehouseMgr.Entities;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr
|
namespace Tnb.ProductionMgr
|
||||||
{
|
{
|
||||||
@@ -26,16 +29,20 @@ namespace Tnb.ProductionMgr
|
|||||||
private readonly ISqlSugarRepository<PrdFeedingH> _repository;
|
private readonly ISqlSugarRepository<PrdFeedingH> _repository;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
private readonly IBillRullService _billRullService;
|
private readonly IBillRullService _billRullService;
|
||||||
|
private readonly WmsSignForDeliveryService _wmsSignForDeliveryService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public PrdFeedingService(
|
public PrdFeedingService(
|
||||||
ISqlSugarRepository<PrdFeedingH> repository,
|
ISqlSugarRepository<PrdFeedingH> repository,
|
||||||
IBillRullService billRullService,
|
IBillRullService billRullService,
|
||||||
|
WmsSignForDeliveryService wmsSignForDeliveryService,
|
||||||
IUserManager userManager
|
IUserManager userManager
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
|
_wmsSignForDeliveryService = _wmsSignForDeliveryService;
|
||||||
_billRullService = billRullService;
|
_billRullService = billRullService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,6 +139,131 @@ namespace Tnb.ProductionMgr
|
|||||||
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (result.IsSuccess)
|
||||||
|
{
|
||||||
|
//签收后调用载具签收接口
|
||||||
|
await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput()
|
||||||
|
{
|
||||||
|
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
carry_code = input.carry_code ?? "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||||
|
return result.IsSuccess ? "签收成功" : result.ErrorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> SaveDataNew(MaterialReceiptNewInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
var moTask = await db.Queryable<PrdMoTask>().FirstAsync(x => x.id == input.mo_task_id);
|
||||||
|
var parentMoTask = await db.Queryable<PrdMoTask>().FirstAsync(x => x.id == moTask.parent_id);
|
||||||
|
var carry = await db.Queryable<WmsCarryH>().SingleAsync(x => x.carry_code == input.carry_code);
|
||||||
|
var workline = await db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == parentMoTask.workline_id);
|
||||||
|
var workshop = await db.Queryable<OrganizeEntity>().SingleAsync(x=>x.Id==workline.ParentId);
|
||||||
|
var inputMaterials = await db.Queryable<BasMbomInput>()
|
||||||
|
.Where(x => x.mbom_id == moTask.bom_id && x.mbom_process_id == moTask.mbom_process_id)
|
||||||
|
.Select(x=>x.material_id)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE);
|
||||||
|
PrdFeedingH prdFeedingH = new PrdFeedingH()
|
||||||
|
{
|
||||||
|
code = code,
|
||||||
|
station_id = input.station_id,
|
||||||
|
mo_task_id = input.mo_task_id,
|
||||||
|
process_id = moTask.process_id,
|
||||||
|
equip_id = input.equip_id,
|
||||||
|
workshop_id = workshop?.Id,
|
||||||
|
carry_id = carry.id,
|
||||||
|
workline_id = moTask.workline_id,
|
||||||
|
carry_code = input.carry_code,
|
||||||
|
// remark = input.remark,
|
||||||
|
mbom_process_id = moTask.mbom_process_id,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now,
|
||||||
|
org_id = _userManager.GetUserInfo().Result.organizeId
|
||||||
|
};
|
||||||
|
|
||||||
|
List<PrdFeedingD> list = new List<PrdFeedingD>();
|
||||||
|
if (input.details != null && input.details.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in input.details)
|
||||||
|
{
|
||||||
|
if(!inputMaterials.Contains(item["material_id"]))
|
||||||
|
throw new Exception("该物料不是生产bom投入物料,不能签收");
|
||||||
|
|
||||||
|
var detail = await db.Queryable<PrdMaterialReceiptD>()
|
||||||
|
.Where(x => x.carry_id == carry.id && x.is_all_feeding == 0).FirstAsync();
|
||||||
|
decimal num = Convert.ToDecimal(item["num"]);
|
||||||
|
list.Add(new PrdFeedingD
|
||||||
|
{
|
||||||
|
feeding_id = prdFeedingH.id,
|
||||||
|
material_receipt_detail_id = detail?.id,
|
||||||
|
material_id = item["material_id"],
|
||||||
|
num = num,
|
||||||
|
batch = item["batch"],
|
||||||
|
unit_id = item["unit_id"],
|
||||||
|
carry_id = carry.id,
|
||||||
|
status = "0",
|
||||||
|
use_num = 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (detail != null)
|
||||||
|
{
|
||||||
|
if(detail.feeding_num + num > detail.num)
|
||||||
|
{
|
||||||
|
throw new Exception("投料数量不能大于签收数量");
|
||||||
|
}else if (detail.feeding_num + num == detail.num)
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMaterialReceiptD>()
|
||||||
|
.SetColumns(x => x.feeding_num == x.feeding_num + num)
|
||||||
|
.SetColumns(x => x.is_all_feeding == 1)
|
||||||
|
.Where(x => x.id == detail.id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMaterialReceiptD>()
|
||||||
|
.SetColumns(x => x.feeding_num == x.feeding_num + num)
|
||||||
|
.Where(x => x.id == detail.id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("没有签收单,无法投料");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("没有签收物料");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
||||||
|
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result.IsSuccess)
|
||||||
|
{
|
||||||
|
//签收后调用载具签收接口
|
||||||
|
await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput()
|
||||||
|
{
|
||||||
|
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
carry_code = input.carry_code ?? "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||||
return result.IsSuccess ? "签收成功" : result.ErrorMessage;
|
return result.IsSuccess ? "签收成功" : result.ErrorMessage;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using Tnb.ProductionMgr.Interfaces;
|
|||||||
namespace Tnb.ProductionMgr
|
namespace Tnb.ProductionMgr
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// mes入库申请
|
/// mes生产入库申请
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||||
[Route("api/[area]/[controller]/[action]")]
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
eqp_id = b.id,
|
eqp_id = b.id,
|
||||||
eqp_code = b.code,
|
eqp_code = b.code,
|
||||||
eqp_type_code = SqlFunc.Subqueryable<EqpEquipType>().Where(iit => iit.id == b.equip_type_id).Select(iit => iit.code),
|
eqp_type_code = SqlFunc.Subqueryable<EqpEquipType>().Where(iit => iit.id == b.equip_type_id).Select(iit => iit.name),
|
||||||
eqp_machine_num = b.eqp_machine_num,
|
eqp_machine_num = b.eqp_machine_num,
|
||||||
tonnage = b.tonnage,
|
tonnage = b.tonnage,
|
||||||
task_list_qty = SqlFunc.Subqueryable<PrdTask>().Where(x => x.eqp_id == b.id).Count(),
|
task_list_qty = SqlFunc.Subqueryable<PrdTask>().Where(x => x.eqp_id == b.id).Count(),
|
||||||
@@ -1254,16 +1254,24 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
var row = -1;
|
var row = -1;
|
||||||
var report = await db.Queryable<PrdReport>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
var report = await db.Queryable<PrdReport>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
||||||
|
var prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||||
|
|
||||||
report = input.Adapt<PrdReport>();
|
report = input.Adapt<PrdReport>();
|
||||||
report.id = SnowflakeIdHelper.NextId();
|
report.id = SnowflakeIdHelper.NextId();
|
||||||
report.reported_qty = input.reported_qty;
|
report.reported_qty = input.reported_qty;
|
||||||
report.create_id = _userManager.UserId;
|
report.create_id = _userManager.UserId;
|
||||||
report.create_time = DateTime.Now;
|
report.create_time = DateTime.Now;
|
||||||
|
report.batch = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
|
||||||
|
report.equip_id = prdMoTask.eqp_id;
|
||||||
|
report.mbom_process_id = prdMoTask.mbom_process_id;
|
||||||
|
report.station = input.station;
|
||||||
|
report.status = 0;
|
||||||
|
report.material_id = prdMoTask.material_id;
|
||||||
|
report.unit_id = prdMoTask.unit_id;
|
||||||
|
|
||||||
row = await db.Insertable(report).ExecuteCommandAsync();
|
row = await db.Insertable(report).ExecuteCommandAsync();
|
||||||
|
|
||||||
var prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
|
||||||
if (prdMoTask.reported_work_qty == null)
|
if (prdMoTask.reported_work_qty == null)
|
||||||
{
|
{
|
||||||
await db.Updateable<PrdMoTask>()
|
await db.Updateable<PrdMoTask>()
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
||||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Entities\Tnb.WarehouseMgr.Entities.csproj" />
|
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Entities\Tnb.WarehouseMgr.Entities.csproj" />
|
||||||
|
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr\Tnb.WarehouseMgr.csproj" />
|
||||||
<ProjectReference Include="..\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj" />
|
<ProjectReference Include="..\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -34,10 +34,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IWHStorageService).IsAssignableFrom(u)).ToList();
|
var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IWHStorageService).IsAssignableFrom(u)).ToList();
|
||||||
foreach (var serviceType in serviceTypes)
|
foreach (var serviceType in serviceTypes)
|
||||||
{
|
{
|
||||||
var callerName = serviceType.GetCustomAttribute<CallerAttribute>()?.Name;
|
var callerName = serviceType.GetCustomAttribute<CallerAttribute>()?.Name ?? string.Empty;
|
||||||
if (!callerName.IsNullOrEmpty())
|
if (callerName.IsNullOrEmpty() && !serviceType.IsNull())
|
||||||
{
|
{
|
||||||
_stroageMap[callerName!] = (IWHStorageService)Activator.CreateInstance(serviceType)!;
|
var obj = Activator.CreateInstance(serviceType) as IWHStorageService;
|
||||||
|
if (obj == null) continue;
|
||||||
|
_stroageMap[callerName] = obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,14 +251,13 @@ 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 => SnowflakeIdHelper.NextId());
|
|
||||||
items.ForEach(x =>
|
items.ForEach(x =>
|
||||||
{
|
{
|
||||||
|
x.id = SnowflakeIdHelper.NextId();
|
||||||
x.status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID;
|
x.status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID;
|
||||||
x.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE).GetAwaiter().GetResult();
|
x.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE).GetAwaiter().GetResult();
|
||||||
});
|
});
|
||||||
var areaPreTasks = itGroup.ToList();
|
|
||||||
if (moveNum == 1)
|
if (moveNum == 1)
|
||||||
{
|
{
|
||||||
items.ForEach(x =>
|
items.ForEach(x =>
|
||||||
@@ -269,6 +268,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
else if (moveNum > 1)
|
else if (moveNum > 1)
|
||||||
{
|
{
|
||||||
|
var areaPreTasks = itGroup.ToList();
|
||||||
//搬运数量==预任务数,可以生成任务执行,为任务链
|
//搬运数量==预任务数,可以生成任务执行,为任务链
|
||||||
if (moveNum == areaPreTasks.Count)
|
if (moveNum == areaPreTasks.Count)
|
||||||
{
|
{
|
||||||
@@ -296,7 +296,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
var curPreTaskCodes = preTaskCodes.FindAll(x => x.bill_id == disTask.pretask_id);
|
var curPreTaskCodes = preTaskCodes.FindAll(x => x.bill_id == disTask.pretask_id);
|
||||||
var curDisTaskCodes = curPreTaskCodes.Adapt<List<WmsDistaskCode>>();
|
var curDisTaskCodes = curPreTaskCodes.Adapt<List<WmsDistaskCode>>();
|
||||||
curPreTaskCodes.ForEach(x =>
|
curDisTaskCodes.ForEach(x =>
|
||||||
{
|
{
|
||||||
x.id = SnowflakeIdHelper.NextId();
|
x.id = SnowflakeIdHelper.NextId();
|
||||||
x.bill_id = disTask.id;
|
x.bill_id = disTask.id;
|
||||||
@@ -387,15 +387,16 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
await _db.Updateable<WmsDistaskH>().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_RUNING_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync();
|
await _db.Updateable<WmsDistaskH>().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_RUNING_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync();
|
||||||
//清空载具库位数据
|
//清空载具库位数据
|
||||||
var carryIds = await _db.Queryable<WmsDistaskH>().Where(it => input.disTaskIds.Contains(it.id)).Select(it => it.carry_id).ToListAsync();
|
var carryAndLocIds = await _db.Queryable<WmsDistaskH>().Where(it => input.disTaskIds.Contains(it.id)).Select(it => new { it.carry_id, it.startlocation_id }).ToListAsync();
|
||||||
if (carryIds?.Count > 0)
|
if (carryAndLocIds?.Count > 0)
|
||||||
{
|
{
|
||||||
|
var carryIds = carryAndLocIds.Select(x => x.carry_id).ToList();
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { location_id = null, location_code = null }).Where(it => carryIds.Contains(it.id)).ExecuteCommandAsync();
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { location_id = null, location_code = null }).Where(it => carryIds.Contains(it.id)).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
var startLocationIds = await _db.Queryable<WmsDistaskH>().Where(it => input.disTaskIds.Contains(it.id)).Select(it => it.startlocation_id).ToListAsync();
|
|
||||||
//更新起始库位,状态改为空闲、锁定状态,未锁定
|
//更新起始库位,状态改为空闲、锁定状态,未锁定
|
||||||
if (startLocationIds?.Count > 0)
|
if (carryAndLocIds?.Count > 0)
|
||||||
{
|
{
|
||||||
|
var startLocationIds = carryAndLocIds.Select(x => x.startlocation_id).ToList();
|
||||||
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.空闲).ToString(), is_lock = 0 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync();
|
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.空闲).ToString(), is_lock = 0 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,13 +441,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == multiList[i].endlocation_id);
|
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == multiList[i].endlocation_id);
|
||||||
await _db.Updateable<WmsCarryCode>().SetColumns(it => new WmsCarryCode { warehouse_id = loc.wh_id, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
|
await _db.Updateable<WmsCarryCode>().SetColumns(it => new WmsCarryCode { warehouse_id = loc.wh_id, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//更新库位信息,使用状态为 使用,锁定状态为未锁定
|
//更新库位信息,使用状态为 使用,锁定状态为未锁定
|
||||||
if (disTasks?.Count > 0)
|
if (disTasks?.Count > 0)
|
||||||
{
|
{
|
||||||
var destLocIds = disTasks.Select(it => it.endlocation_id).ToList();
|
|
||||||
var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList();
|
var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList();
|
||||||
for (int i = 0; i < multis.Count; i++)
|
for (int i = 0; i < multis.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch })
|
carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch })
|
||||||
.Select(x =>
|
.Select(x =>
|
||||||
{
|
{
|
||||||
WmsCarryMat? carryMat = x.FirstOrDefault()!;
|
WmsCarryMat? carryMat = x.FirstOrDefault();
|
||||||
carryMat.need_qty = x.Sum(d => d.need_qty);
|
carryMat.need_qty = x.Sum(d => d.need_qty);
|
||||||
return carryMat;
|
return carryMat;
|
||||||
})
|
})
|
||||||
@@ -505,7 +505,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
outstockDs.ForEach(x => x.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID);
|
outstockDs.ForEach(x => x.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID);
|
||||||
await _db.Updateable(outstockDs).UpdateColumns(it => it.line_status).ExecuteCommandAsync();
|
await _db.Updateable(outstockDs).UpdateColumns(it => it.line_status).ExecuteCommandAsync();
|
||||||
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it=>it.id == outstock.id).ExecuteCommandAsync();
|
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == outstock.id).ExecuteCommandAsync();
|
||||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
||||||
|
|||||||
@@ -99,34 +99,37 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
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);
|
|
||||||
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||||
{
|
{
|
||||||
var sPoint = it.FirstOrDefault();
|
var sPoint = it.FirstOrDefault();
|
||||||
var ePoint = it.LastOrDefault();
|
var ePoint = it.LastOrDefault();
|
||||||
|
|
||||||
WmsPretaskH preTask = new();
|
WmsPretaskH preTask = new()
|
||||||
preTask.org_id = _userManager.User.OrganizeId;
|
{
|
||||||
preTask.startlocation_id = sPoint?.location_id!;
|
org_id = _userManager.User.OrganizeId,
|
||||||
preTask.startlocation_code = sPoint?.location_code!;
|
startlocation_id = sPoint?.location_id ?? "",
|
||||||
preTask.endlocation_id = ePoint?.location_id!;
|
startlocation_code = sPoint?.location_code ?? "",
|
||||||
preTask.endlocation_code = ePoint?.location_code!;
|
endlocation_id = ePoint?.location_id ?? "",
|
||||||
preTask.start_floor = sPoint?.floor.ToString();
|
endlocation_code = ePoint?.location_code ?? "",
|
||||||
preTask.end_floor = ePoint?.floor.ToString();
|
start_floor = sPoint?.floor.ToString(),
|
||||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
end_floor = ePoint?.floor.ToString(),
|
||||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(),
|
||||||
preTask.biz_type = input.data[nameof(WmsPretaskH.biz_type)]?.ToString()!;
|
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
|
||||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
biz_type = input.data[nameof(WmsPretaskH.biz_type)]?.ToString() ?? "",
|
||||||
preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!;
|
task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID,
|
||||||
preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!;
|
carry_id = input.data[nameof(preTask.carry_id)]?.ToString() ?? "",
|
||||||
preTask.area_id = sPoint?.area_id!;
|
carry_code = input.data[nameof(preTask.carry_code)]?.ToString() ?? "",
|
||||||
preTask.area_code = it.Key;
|
area_id = sPoint?.area_id ?? "",
|
||||||
preTask.require_id = input.data[nameof(WmsHandleH.require_id)].ToString();
|
area_code = it.Key,
|
||||||
preTask.require_code = input.data[nameof(WmsHandleH.require_code)]?.ToString()!;
|
require_id = input.data[nameof(WmsHandleH.require_id)].ToString(),
|
||||||
preTask.create_id = _userManager.UserId;
|
require_code = input.data[nameof(WmsHandleH.require_code)]?.ToString(),
|
||||||
preTask.create_time = DateTime.Now;
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now,
|
||||||
|
};
|
||||||
|
|
||||||
return preTask;
|
return preTask;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
//生成预任务条码信息
|
//生成预任务条码信息
|
||||||
@@ -221,7 +224,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
foreach (var jo in jArr.Children())
|
foreach (var jo in jArr.Children())
|
||||||
{
|
{
|
||||||
var materialId = jo.Value<string>(nameof(WmsInstockCode.material_id));
|
|
||||||
var materialCode = jo.Value<string>(nameof(WmsInstockCode.material_code));
|
var materialCode = jo.Value<string>(nameof(WmsInstockCode.material_code));
|
||||||
var codeBatch = jo.Value<string>(nameof(WmsInstockCode.code_batch));
|
var codeBatch = jo.Value<string>(nameof(WmsInstockCode.code_batch));
|
||||||
var b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch);
|
var b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch);
|
||||||
@@ -229,7 +231,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
var c = DeepCopyHelper<WmsInstockCode>.DeepCopy(b);
|
var c = DeepCopyHelper<WmsInstockCode>.DeepCopy(b);
|
||||||
c.id = SnowflakeIdHelper.NextId();
|
c.id = SnowflakeIdHelper.NextId();
|
||||||
c.bill_d_id = instockDetails.Find(x => x.material_code == materialCode && x.code_batch == codeBatch)?.id!;
|
c.bill_d_id = b.id;
|
||||||
c.barcode = jo.Value<string>(nameof(WmsInstockCode.barcode))!;
|
c.barcode = jo.Value<string>(nameof(WmsInstockCode.barcode))!;
|
||||||
c.codeqty = jo.Value<int>(nameof(WmsInstockCode.codeqty));
|
c.codeqty = jo.Value<int>(nameof(WmsInstockCode.codeqty));
|
||||||
instockCOdes.Add(c);
|
instockCOdes.Add(c);
|
||||||
@@ -297,7 +299,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await _db.Updateable(instockDetails).ExecuteCommandAsync();
|
await _db.Updateable(instockDetails).ExecuteCommandAsync();
|
||||||
var allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it=>it.bill_id ==input.requireId).ToListAsync();
|
var allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||||
if (allInstockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
if (allInstockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||||
{
|
{
|
||||||
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using Tnb.WarehouseMgr.Entities.Consts;
|
|||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
using Tnb.WarehouseMgr.Entities.Enums;
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
using UAParser;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
@@ -69,11 +70,19 @@ namespace Tnb.WarehouseMgr
|
|||||||
List<WmsCarryMat> carryMats = new();
|
List<WmsCarryMat> carryMats = new();
|
||||||
List<WmsCarryCode> carryCodes = new();
|
List<WmsCarryCode> carryCodes = new();
|
||||||
List<string> carryIds = new();
|
List<string> carryIds = new();
|
||||||
|
|
||||||
|
var whereExpr = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
|
||||||
|
.And((a, b, c) => a.is_lock == 0)
|
||||||
|
.And((a, b, c) => !string.IsNullOrEmpty(a.location_id))
|
||||||
|
.And((a, b, c) => a.status == (int)EnumCarryStatus.占用);
|
||||||
foreach (var os in setSortingDList)
|
foreach (var os in setSortingDList)
|
||||||
{
|
{
|
||||||
|
whereExpr.And((a, b, c) => b.material_id == os.material_id)
|
||||||
|
.And((a, b, c) => c.wh_id == os.warehouse_id)
|
||||||
|
.AndIF(!string.IsNullOrEmpty(os.code_batch), (a, b, c) => b.code_batch == os.code_batch);
|
||||||
|
|
||||||
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||||
.Where((a, b, c) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.占用 && c.wh_id == os.warehouse_id)
|
.Where(whereExpr.ToExpression())
|
||||||
.WhereIF(!string.IsNullOrEmpty(os.code_batch), (a, b) => b.code_batch == os.code_batch)
|
|
||||||
.Select<WmsCarryCode>()
|
.Select<WmsCarryCode>()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (carryCodesPart?.Count > 0)
|
if (carryCodesPart?.Count > 0)
|
||||||
@@ -158,7 +167,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
pretaskCodes.AddRange(curPreTaskCodes);
|
pretaskCodes.AddRange(curPreTaskCodes);
|
||||||
}
|
}
|
||||||
await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
||||||
await _db.Updateable<WmsSetsortingH>().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).ExecuteCommandAsync();
|
await _db.Updateable<WmsSetsortingH>().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it=> it.id == singleSorting.id).ExecuteCommandAsync();
|
||||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
||||||
|
|||||||
Reference in New Issue
Block a user