Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -18,5 +18,12 @@ namespace Tnb.BasicData.Interfaces
|
||||
/// <param name="queryInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetCanCreateSubWorkOrderMaterial(MaterialSelectQueryInput queryInput);
|
||||
|
||||
/// <summary>
|
||||
/// 根据物料类型获取物料列表
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetMaterialByType(Dictionary<string, string> dic);
|
||||
}
|
||||
}
|
||||
@@ -160,6 +160,21 @@ namespace Tnb.BasicData
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetMaterialByType(Dictionary<string, string> dic)
|
||||
{
|
||||
string types = dic["types"];
|
||||
string[] typeArr = types.Split(",");
|
||||
List<BasMaterial> list = await _repository.AsSugarClient().Queryable<BasMaterial>().Where(x => x.state=="1").ToListAsync();
|
||||
List<BasMaterial> result = new List<BasMaterial>();
|
||||
foreach (var type in typeArr)
|
||||
{
|
||||
result.AddRange(list.Where(x=>x.category_id.Contains(type)));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料清单下所子集物料id
|
||||
/// </summary>
|
||||
|
||||
@@ -10,5 +10,12 @@ namespace Tnb.EquipMgr.Interfaces
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
public Task<EqpEquipment> GetEntityById(Dictionary<string, string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 根据设备类型获取设备列表
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetListByTypeId(Dictionary<string, string> dic);
|
||||
}
|
||||
}
|
||||
@@ -69,5 +69,14 @@ namespace Tnb.EquipMgr
|
||||
string id = dic["id"];
|
||||
return await _repository.GetSingleAsync(x => x.id == id);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetListByTypeId(Dictionary<string, string> dic)
|
||||
{
|
||||
string typeIds = dic["typeIds"];
|
||||
string[] typeIdArr = typeIds.Split(",");
|
||||
return await _repository.AsSugarClient().Queryable<EqpEquipment>().Where(x => typeIdArr.Contains(x.equip_type_id))
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,8 +69,11 @@ namespace Tnb.EquipMgr
|
||||
var pair = row[nameof(ToolMoldMaintainTask.mold_id)];
|
||||
if (pair.IsNotEmptyOrNull())
|
||||
{
|
||||
var multi = _dicMold[pair.ToString()!];
|
||||
row[nameof(ToolMoldMaintainTask.mold_id)] = $"{multi.code}/{multi.name}";
|
||||
if(_dicMold.TryGetValue(pair.ToString(),out var multi))
|
||||
{
|
||||
row[nameof(ToolMoldMaintainTask.mold_id)] = $"{multi.code}/{multi.name}";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +170,11 @@ namespace Tnb.WarehouseMgr.Entities.Consts
|
||||
/// 预任务生成业务类型-配送申请
|
||||
/// </summary>
|
||||
public const string BIZTYPE_WMSDELIVERY_ID = "26585291847957";
|
||||
/// <summary>
|
||||
/// 预任务生成业务类型-载具绑定
|
||||
/// </summary>
|
||||
public const string BIZTYPE_WMSCARRYBIND_ID = "27118595509525";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 条码打印状态-已完成
|
||||
|
||||
@@ -35,5 +35,9 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// 是否最后一个
|
||||
/// </summary>
|
||||
public bool isLast { get; set; }
|
||||
/// <summary>
|
||||
/// 位置
|
||||
/// </summary>
|
||||
public int loc { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public partial class WmsCarrybindH : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// dataType
|
||||
/// </summary>
|
||||
public int biz_type { get; set; }
|
||||
public int type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具分类ID
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具绑定服务接口
|
||||
/// </summary>
|
||||
public interface IWmsCarryBindService
|
||||
{
|
||||
Task<dynamic> CarryBind(VisualDevModelDataCrInput input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// 齐套入库服务接口s
|
||||
/// </summary>
|
||||
public interface IWmsKittingInStkService
|
||||
{
|
||||
Task<dynamic> KittingInStk(VisualDevModelDataCrInput input);
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// 载具绑定
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYBIND_ID)]
|
||||
public class WmsCarryBindService : BaseWareHouseService
|
||||
public class WmsCarryBindService : BaseWareHouseService, IWmsCarryBindService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
@@ -52,8 +52,8 @@ namespace Tnb.WarehouseMgr
|
||||
_billRullService = billRullService;
|
||||
OverideFuncs.CreateAsync = CarryBind;
|
||||
}
|
||||
|
||||
private async Task<dynamic> CarryBind(VisualDevModelDataCrInput input)
|
||||
[NonAction]
|
||||
public async Task<dynamic> CarryBind(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
@@ -88,6 +88,7 @@ namespace Tnb.WarehouseMgr
|
||||
};
|
||||
row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync();
|
||||
var items = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == subCarryId).ToListAsync();
|
||||
List<WmsCarrybindCode> wmsCarrybindCodes = new();
|
||||
//更新载具绑定条码表
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
@@ -106,8 +107,9 @@ namespace Tnb.WarehouseMgr
|
||||
wmsCarrybindCode.unit_code = items[i].unit_code;
|
||||
wmsCarrybindCode.create_id = _userManager.UserId;
|
||||
wmsCarrybindCode.create_time = DateTime.Now;
|
||||
row = await _db.Insertable(wmsCarrybindCode).ExecuteCommandAsync();
|
||||
wmsCarrybindCodes.Add(wmsCarrybindCode);
|
||||
}
|
||||
row = await _db.Insertable(wmsCarrybindCodes).ExecuteCommandAsync();
|
||||
isOk = (row > 0);
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
@@ -128,17 +130,8 @@ namespace Tnb.WarehouseMgr
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 机器人回调操作
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task RobotCallBack()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
|
||||
213
WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs
Normal file
213
WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs
Normal file
@@ -0,0 +1,213 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 齐套入库
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSKITTINGINSTK_ID)]
|
||||
[ServiceModule(BizTypeId)]
|
||||
public class WmsKittingInStkService : BaseWareHouseService
|
||||
{
|
||||
private const string BizTypeId = "26165655816741";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
|
||||
public WmsKittingInStkService(
|
||||
ISqlSugarRepository<WmsCarryH> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService,
|
||||
IWareHouseService wareHouseService,
|
||||
IUserManager userManager,
|
||||
IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
OverideFuncs.CreateAsync = KittingInStk;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public async Task<dynamic> KittingInStk(VisualDevModelDataCrInput input)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSKITTINGINSTK_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
//入库取终点 //出库起点
|
||||
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString(), Size = 1 };
|
||||
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
WmsPointH sPoint = null;
|
||||
WmsPointH ePoint = null;
|
||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
||||
{
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||
}
|
||||
if (endLocations?.Count > 0)
|
||||
{
|
||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == endLocations[0].id);
|
||||
}
|
||||
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
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 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_WMSKITTINGINSTK_ID;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
||||
preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!;
|
||||
preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!;
|
||||
preTask.area_id = sPoint?.area_id;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = input.data["ReturnIdentity"].ToString();
|
||||
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
List<WmsCarryCode> carryCodes = new();
|
||||
if (input.data.ContainsKey("tablefield130"))
|
||||
{
|
||||
if (input.data["tablefield130"] != null && input.data["tablefield130"].IsNotEmptyOrNull())
|
||||
{
|
||||
carryCodes = input.data["tablefield130"].ToObject<List<WmsCarryCode>>();
|
||||
}
|
||||
}
|
||||
|
||||
List<WmsPretaskCode> pretaskCodes = new();
|
||||
foreach (var pt in preTasks)
|
||||
{
|
||||
var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList();
|
||||
var curPreTaskCodes = partCodes.Adapt<List<WmsPretaskCode>>();
|
||||
curPreTaskCodes.ForEach(x =>
|
||||
{
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.bill_id = pt.id;
|
||||
x.create_time = DateTime.Now;
|
||||
});
|
||||
pretaskCodes.AddRange(curPreTaskCodes);
|
||||
}
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
||||
if (isOk)
|
||||
{
|
||||
var preTaskUpInput = new GenPreTaskUpInput();
|
||||
preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString();
|
||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
||||
|
||||
WmsHandleH handleH = new();
|
||||
handleH.org_id = _userManager.User.OrganizeId;
|
||||
handleH.startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString();
|
||||
handleH.endlocation_id = endLocations[0].id;
|
||||
handleH.bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString();
|
||||
handleH.biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString();
|
||||
handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString();
|
||||
handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString();
|
||||
handleH.require_id = input.data["ReturnIdentity"].ToString();
|
||||
handleH.require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!;
|
||||
handleH.create_id = _userManager.UserId;
|
||||
handleH.create_time = DateTime.Now;
|
||||
preTaskUpInput.PreTaskRecord = handleH;
|
||||
//根据齐套入库Id,回更单据状态
|
||||
await _db.Updateable<WmsKittingInstock>().SetColumns(it => new WmsKittingInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||
var status = ((int)EnumCarryStatus.齐套).ToString();
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.data[nameof(WmsHandleH.carry_id)].ToString());
|
||||
if (carry?.out_status != status) {
|
||||
if (carryCodes?.Count>0) {
|
||||
carryCodes.ForEach(x =>
|
||||
{
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.carry_id = input.data[nameof(WmsHandleH.carry_id)].ToString();
|
||||
x.create_id = _userManager.UserId;
|
||||
x.create_time = DateTime.Now;
|
||||
});
|
||||
await _db.Insertable(carryCodes).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||
it => new WmsCarryH
|
||||
{
|
||||
is_lock = 1,
|
||||
location_id = preTaskUpInput.CarryStartLocationId,
|
||||
location_code = preTaskUpInput.CarryStartLocationCode,
|
||||
carry_status = ((int)EnumCarryStatus.齐套).ToString(),
|
||||
collocation_scheme_id = input.data[nameof(WmsKittingInstock.collocation_scheme_id)].ToString(),
|
||||
collocation_scheme_code = input.data[nameof(WmsKittingInstock.collocation_scheme_code)].ToString()
|
||||
},
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var row = await _db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,13 +79,13 @@ namespace Tnb.WarehouseMgr
|
||||
JArray jArr = null;
|
||||
if (input.data.ContainsKey("tablefield115"))
|
||||
{
|
||||
jArr = JArray.Parse(input.data["tablefield115"].ToString());
|
||||
jArr = JArray.Parse(input.data["tablefield115"].ToString()!);
|
||||
}
|
||||
//入库取终点 //出库起点
|
||||
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString(), Size = 1 };
|
||||
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 };
|
||||
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
WmsPointH sPoint = null;
|
||||
WmsPointH ePoint = null;
|
||||
WmsPointH sPoint = null!;
|
||||
WmsPointH ePoint = null!;
|
||||
if (input.data.ContainsKey(nameof(WmsHandleH.startlocation_id)))
|
||||
{
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsHandleH.startlocation_id)].ToString());
|
||||
@@ -109,19 +109,19 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
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.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 = input.data[nameof(WmsPretaskH.biz_type)]?.ToString();
|
||||
preTask.biz_type = input.data[nameof(WmsPretaskH.biz_type)]?.ToString()!;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
||||
preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!;
|
||||
preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!;
|
||||
preTask.area_id = sPoint?.area_id;
|
||||
preTask.area_id = sPoint?.area_id!;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = input.data[nameof(WmsHandleH.require_id)].ToString();
|
||||
preTask.require_code = input.data[nameof(WmsHandleH.require_code)]?.ToString()!;
|
||||
@@ -140,11 +140,11 @@ namespace Tnb.WarehouseMgr
|
||||
var ptc = pt.Adapt<WmsPretaskCode>();
|
||||
ptc.id = SnowflakeIdHelper.NextId();
|
||||
ptc.bill_id = pt.id;
|
||||
ptc.material_id = jo.Value<string>(nameof(WmsPretaskCode.material_id));
|
||||
ptc.material_code = jo.Value<string>(nameof(WmsPretaskCode.material_code));
|
||||
ptc.barcode = jo.Value<string>(nameof(WmsPretaskCode.barcode));
|
||||
ptc.material_id = jo.Value<string>(nameof(WmsPretaskCode.material_id))!;
|
||||
ptc.material_code = jo.Value<string>(nameof(WmsPretaskCode.material_code))!;
|
||||
ptc.barcode = jo.Value<string>(nameof(WmsPretaskCode.barcode))!;
|
||||
ptc.codeqty = jo.Value<int>(nameof(WmsPretaskCode.codeqty));
|
||||
ptc.unit_id = jo.Value<string>(nameof(WmsPretaskCode.unit_id));
|
||||
ptc.unit_id = jo.Value<string>(nameof(WmsPretaskCode.unit_id))!;
|
||||
ptc.code_batch = jo.Value<string>(nameof(WmsPretaskCode.code_batch));
|
||||
pretaskCodes.Add(ptc);
|
||||
}
|
||||
@@ -158,11 +158,11 @@ namespace Tnb.WarehouseMgr
|
||||
var requireIdField = "require_id";
|
||||
|
||||
var preTaskUpInput = new GenPreTaskUpInput();
|
||||
preTaskUpInput.RquireId = input.data[nameof(WmsHandleH.require_id)].ToString();
|
||||
preTaskUpInput.RquireId = input.data[nameof(WmsHandleH.require_id)].ToString()!;
|
||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!;
|
||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!;
|
||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!;
|
||||
if (input.data.ContainsKey(requireIdField) && input.data[requireIdField].IsNotEmptyOrNull())
|
||||
{
|
||||
//创建预任务操作记录
|
||||
@@ -172,9 +172,9 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
var handleH = instockH.Adapt<WmsHandleH>();
|
||||
operBillId = handleH.id = SnowflakeIdHelper.NextId();
|
||||
handleH.startlocation_id = input.data[nameof(WmsHandleH.startlocation_id)]?.ToString();
|
||||
handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString();
|
||||
handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString();
|
||||
handleH.startlocation_id = input.data[nameof(WmsHandleH.startlocation_id)]?.ToString()!;
|
||||
handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!;
|
||||
handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!;
|
||||
preTaskUpInput.PreTaskRecord = handleH;
|
||||
}
|
||||
//创建预任务条码操作记录
|
||||
@@ -187,7 +187,7 @@ namespace Tnb.WarehouseMgr
|
||||
WmsHandleCode handleCode = new();
|
||||
handleCode.org_id = _userManager.User.OrganizeId;
|
||||
handleCode.bill_id = operBillId;
|
||||
handleCode.material_id = materialId;
|
||||
handleCode.material_id = materialId!;
|
||||
handleCode.material_code = jo.Value<string>(nameof(WmsHandleCode.material_code))!;
|
||||
handleCode.barcode = jo.Value<string>(nameof(WmsHandleCode.barcode))!;
|
||||
handleCode.code_batch = jo.Value<string>(nameof(WmsHandleCode.code_batch));
|
||||
|
||||
55
WarehouseMgr/Tnb.WarehouseMgr/WmsPDAKittingInStkService.cs
Normal file
55
WarehouseMgr/Tnb.WarehouseMgr/WmsPDAKittingInStkService.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 齐套入库
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSKITTINGINSTKPDA_ID)]
|
||||
public class WmsPDAKittingInStkService : WmsKittingInStkService, IPdaStroage
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
|
||||
public WmsPDAKittingInStkService(
|
||||
ISqlSugarRepository<WmsCarryH> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService,
|
||||
IWareHouseService wareHouseService,
|
||||
IUserManager userManager,
|
||||
IBillRullService billRullService) : base(repository, runService, visualDevService, wareHouseService, userManager, billRullService)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ namespace Tnb.WarehouseMgr
|
||||
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_WMSDELIVERY_ID;
|
||||
preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID;
|
||||
preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!;
|
||||
preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!;
|
||||
|
||||
186
WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs
Normal file
186
WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs
Normal file
@@ -0,0 +1,186 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.OpenXmlFormats;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 机器人回调服务类
|
||||
/// </summary>
|
||||
public class WmsRobotCallbackService : BaseWareHouseService
|
||||
{
|
||||
private readonly IWmsCarryBindService _wmsCarryBindService;
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IWareHouseService _warehouseService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly IWmsKittingInStkService _wmsKittingInStkService;
|
||||
public WmsRobotCallbackService(
|
||||
IWmsCarryBindService wmsCarryBindService,
|
||||
ISqlSugarRepository<WmsCarrybindH> repository,
|
||||
IUserManager userManager,
|
||||
IWareHouseService warehouseService,
|
||||
IBillRullService billRullService,
|
||||
IWmsKittingInStkService wmsKittingInStkService)
|
||||
{
|
||||
_wmsCarryBindService = wmsCarryBindService;
|
||||
_db = repository.AsSugarClient();
|
||||
_userManager = userManager;
|
||||
_warehouseService = warehouseService;
|
||||
_billRullService = billRullService;
|
||||
_wmsKittingInStkService = wmsKittingInStkService;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task RobotCallback(RobotCallBackInput input)
|
||||
{
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
|
||||
var subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.membercarry_id);
|
||||
if (carry != null && subCarry != null)
|
||||
{
|
||||
VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary<string, object>() };
|
||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_id)] = input.carry_id;
|
||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_code)] = input.carry_code;
|
||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_id)] = input.membercarry_id;
|
||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_code)] = input.membercarry_code;
|
||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.type)] = 0;
|
||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.carrystd_id)] = carry.carrystd_id;
|
||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_id)] = _userManager.UserId;
|
||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_time)] = DateTime.Now;
|
||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.loc)] = input.loc;
|
||||
await _wmsCarryBindService.CarryBind(visualDevModelCrInput);
|
||||
|
||||
carry.collocation_scheme_id = subCarry.collocation_scheme_id;
|
||||
carry.collocation_scheme_code = subCarry.collocation_scheme_code;
|
||||
carry.carry_status = ((int)EnumCarryStatus.齐套).ToString();
|
||||
await _db.Updateable(carry).UpdateColumns(it => new { it.collocation_scheme_id, it.collocation_scheme_code, it.carry_status }).ExecuteCommandAsync();
|
||||
|
||||
if (input.isLast)
|
||||
{
|
||||
var kittingout = await _db.Queryable<WmsKittingoutH>().FirstAsync(it => it.collocation_scheme_id == carry.collocation_scheme_id && it.status == WmsWareHouseConst.BILLSTATUS_CALLED_ID);
|
||||
if (kittingout != null)
|
||||
{
|
||||
visualDevModelCrInput.data = new Dictionary<string, object>();
|
||||
visualDevModelCrInput.data[nameof(InStockStrategyQuery.warehouse_id)] = kittingout.warehouse_id;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.carry_id)] = input.carry_id;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.carry_code)] = input.carry_code;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.collocation_scheme_id)] = carry.collocation_scheme_id;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.collocation_scheme_code)] = carry.collocation_scheme_code;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.seq)] = kittingout.seq;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSKITTINGINSTK_ID;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.create_id)] = _userManager.UserId;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.create_time)] = DateTime.Now;
|
||||
|
||||
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == kittingout.location_id);
|
||||
if (kittingout.location_id.IsNullOrWhiteSpace() || (location != null && location.is_type.ToEnum<EnumLocationType>() == EnumLocationType.存储库位))
|
||||
{
|
||||
//入库
|
||||
await _wmsKittingInStkService.KittingInStk(visualDevModelCrInput);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (location != null && location.is_use == (int)EnumCarryStatus.空闲 && location.is_lock == 0)
|
||||
{
|
||||
//出库
|
||||
var sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||
var ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == kittingout.location_id);
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
var kittingOutObj = new { requireId = kittingout.id, requireCode = kittingout.bill_code };
|
||||
var preTasks = await _genPreTask(sPoint, ePoint, carry, kittingOutObj);
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carry.id).ToListAsync();
|
||||
List<WmsPretaskCode> pretaskCodes = new();
|
||||
foreach (var pt in preTasks)
|
||||
{
|
||||
var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList();
|
||||
var curPreTaskCodes = partCodes.Adapt<List<WmsPretaskCode>>();
|
||||
curPreTaskCodes.ForEach(x =>
|
||||
{
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.bill_id = pt.id;
|
||||
x.create_time = DateTime.Now;
|
||||
});
|
||||
pretaskCodes.AddRange(curPreTaskCodes);
|
||||
}
|
||||
await _warehouseService.GenPreTask(preTasks, pretaskCodes);
|
||||
await _db.Updateable(kittingout).UpdateColumns(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).ExecuteCommandAsync();
|
||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||
genPreTaskAfterUpInput.LocationIds = new List<string> { carry.location_id! };
|
||||
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//入库
|
||||
await _wmsKittingInStkService.KittingInStk(visualDevModelCrInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<List<WmsPretaskH>> _genPreTask(WmsPointH sPoint, WmsPointH ePoint, WmsCarryH carry, dynamic KittingOutObj)
|
||||
{
|
||||
List<WmsPretaskH> preTasks = new();
|
||||
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count > 0)
|
||||
{
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
{
|
||||
var sPoint = it.FirstOrDefault();
|
||||
var ePoint = it.LastOrDefault();
|
||||
|
||||
WmsPretaskH preTask = new();
|
||||
preTask.org_id = _userManager.User.OrganizeId;
|
||||
preTask.startlocation_id = sPoint?.location_id!;
|
||||
preTask.startlocation_code = sPoint?.location_code!;
|
||||
preTask.endlocation_id = ePoint?.location_id!;
|
||||
preTask.endlocation_code = ePoint?.location_code!;
|
||||
preTask.start_floor = sPoint?.floor.ToString();
|
||||
preTask.end_floor = ePoint?.floor.ToString();
|
||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||
preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
preTask.carry_id = carry.id!;
|
||||
preTask.carry_code = carry.carry_code!;
|
||||
preTask.area_id = sPoint?.area_id!;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = KittingOutObj.requireId;
|
||||
preTask.require_code = KittingOutObj.requireCode;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
}
|
||||
return preTasks;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ namespace Tnb.WarehouseMgr
|
||||
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_WMSDELIVERY_ID;
|
||||
preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID;
|
||||
preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!;
|
||||
preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!;
|
||||
|
||||
Reference in New Issue
Block a user