diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs
index 53f530fd..fbe3bd00 100644
--- a/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs
+++ b/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs
@@ -18,5 +18,12 @@ namespace Tnb.BasicData.Interfaces
///
///
public Task GetCanCreateSubWorkOrderMaterial(MaterialSelectQueryInput queryInput);
+
+ ///
+ /// 根据物料类型获取物料列表
+ ///
+ ///
+ ///
+ public Task GetMaterialByType(Dictionary dic);
}
}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData/BasMaterialService.cs b/BasicData/Tnb.BasicData/BasMaterialService.cs
index f5ba3c65..91a92305 100644
--- a/BasicData/Tnb.BasicData/BasMaterialService.cs
+++ b/BasicData/Tnb.BasicData/BasMaterialService.cs
@@ -160,6 +160,21 @@ namespace Tnb.BasicData
}
}
+ [HttpPost]
+ public async Task GetMaterialByType(Dictionary dic)
+ {
+ string types = dic["types"];
+ string[] typeArr = types.Split(",");
+ List list = await _repository.AsSugarClient().Queryable().Where(x => x.state=="1").ToListAsync();
+ List result = new List();
+ foreach (var type in typeArr)
+ {
+ result.AddRange(list.Where(x=>x.category_id.Contains(type)));
+ }
+
+ return result;
+ }
+
///
/// 获取物料清单下所子集物料id
///
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs
index 13e35519..a1255946 100644
--- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs
@@ -10,5 +10,12 @@ namespace Tnb.EquipMgr.Interfaces
///
///
public Task GetEntityById(Dictionary dic);
+
+ ///
+ /// 根据设备类型获取设备列表
+ ///
+ ///
+ ///
+ public Task GetListByTypeId(Dictionary dic);
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EquipmentService.cs b/EquipMgr/Tnb.EquipMgr/EquipmentService.cs
index c059dbda..f2be6958 100644
--- a/EquipMgr/Tnb.EquipMgr/EquipmentService.cs
+++ b/EquipMgr/Tnb.EquipMgr/EquipmentService.cs
@@ -69,5 +69,14 @@ namespace Tnb.EquipMgr
string id = dic["id"];
return await _repository.GetSingleAsync(x => x.id == id);
}
+
+ [HttpPost]
+ public async Task GetListByTypeId(Dictionary dic)
+ {
+ string typeIds = dic["typeIds"];
+ string[] typeIdArr = typeIds.Split(",");
+ return await _repository.AsSugarClient().Queryable().Where(x => typeIdArr.Contains(x.equip_type_id))
+ .ToListAsync();
+ }
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs
index d1250d59..ad70afc4 100644
--- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs
+++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs
@@ -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}";
+ }
+
}
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs
index 2528b66c..3fc8e29a 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs
@@ -170,6 +170,11 @@ namespace Tnb.WarehouseMgr.Entities.Consts
/// 预任务生成业务类型-配送申请
///
public const string BIZTYPE_WMSDELIVERY_ID = "26585291847957";
+ ///
+ /// 预任务生成业务类型-载具绑定
+ ///
+ public const string BIZTYPE_WMSCARRYBIND_ID = "27118595509525";
+
///
/// 条码打印状态-已完成
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/RobotCallBackInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/RobotCallBackInput.cs
index 3d0338a9..a4ae81bf 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/RobotCallBackInput.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/RobotCallBackInput.cs
@@ -35,5 +35,9 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
/// 是否最后一个
///
public bool isLast { get; set; }
+ ///
+ /// 位置
+ ///
+ public int loc { get; set; }
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarrybindH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarrybindH.cs
index 1eb7a537..b28ac64a 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarrybindH.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarrybindH.cs
@@ -42,7 +42,7 @@ public partial class WmsCarrybindH : BaseEntity
///
/// dataType
///
- public int biz_type { get; set; }
+ public int type { get; set; }
///
/// 载具分类ID
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryBindService.cs
new file mode 100644
index 00000000..8a60fe25
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryBindService.cs
@@ -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
+{
+ ///
+ /// 载具绑定服务接口
+ ///
+ public interface IWmsCarryBindService
+ {
+ Task CarryBind(VisualDevModelDataCrInput input);
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsKittingInStkService.cs
new file mode 100644
index 00000000..849a24b8
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsKittingInStkService.cs
@@ -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
+{
+ ///
+ /// 齐套入库服务接口s
+ ///
+ public interface IWmsKittingInStkService
+ {
+ Task KittingInStk(VisualDevModelDataCrInput input);
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
index c8a19f8f..50e377e4 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
@@ -31,7 +31,7 @@ namespace Tnb.WarehouseMgr
/// 载具绑定
///
[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 CarryBind(VisualDevModelDataCrInput input)
+ [NonAction]
+ public async Task 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().Where(it => it.carry_id == subCarryId).ToListAsync();
+ List 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);
}
- ///
- /// 机器人回调操作
- ///
- ///
- [HttpPost]
- public async Task RobotCallBack()
- {
- }
-
/* public override async Task ModifyAsync(WareHouseUpInput input)
{
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs
new file mode 100644
index 00000000..dfc6aa2e
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs
@@ -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
+{
+ ///
+ /// 齐套入库
+ ///
+ [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 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 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().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
+ }
+ if (endLocations?.Count > 0)
+ {
+ ePoint = await _db.Queryable().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 carryCodes = new();
+ if (input.data.ContainsKey("tablefield130"))
+ {
+ if (input.data["tablefield130"] != null && input.data["tablefield130"].IsNotEmptyOrNull())
+ {
+ carryCodes = input.data["tablefield130"].ToObject>();
+ }
+ }
+
+ List pretaskCodes = new();
+ foreach (var pt in preTasks)
+ {
+ var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList();
+ var curPreTaskCodes = partCodes.Adapt>();
+ 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().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().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().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
+ if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
+ }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
index 4936c01d..a2f903ce 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
@@ -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().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();
ptc.id = SnowflakeIdHelper.NextId();
ptc.bill_id = pt.id;
- ptc.material_id = jo.Value(nameof(WmsPretaskCode.material_id));
- ptc.material_code = jo.Value(nameof(WmsPretaskCode.material_code));
- ptc.barcode = jo.Value(nameof(WmsPretaskCode.barcode));
+ ptc.material_id = jo.Value(nameof(WmsPretaskCode.material_id))!;
+ ptc.material_code = jo.Value(nameof(WmsPretaskCode.material_code))!;
+ ptc.barcode = jo.Value(nameof(WmsPretaskCode.barcode))!;
ptc.codeqty = jo.Value(nameof(WmsPretaskCode.codeqty));
- ptc.unit_id = jo.Value(nameof(WmsPretaskCode.unit_id));
+ ptc.unit_id = jo.Value(nameof(WmsPretaskCode.unit_id))!;
ptc.code_batch = jo.Value(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();
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(nameof(WmsHandleCode.material_code))!;
handleCode.barcode = jo.Value(nameof(WmsHandleCode.barcode))!;
handleCode.code_batch = jo.Value(nameof(WmsHandleCode.code_batch));
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAKittingInStkService.cs
new file mode 100644
index 00000000..c7821ac4
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAKittingInStkService.cs
@@ -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
+{
+ ///
+ /// 齐套入库
+ ///
+ [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 repository,
+ IRunService runService,
+ IVisualDevService visualDevService,
+ IWareHouseService wareHouseService,
+ IUserManager userManager,
+ IBillRullService billRullService) : base(repository, runService, visualDevService, wareHouseService, userManager, billRullService)
+
+ {
+
+ }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs
index 44c4981a..41b169d3 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs
@@ -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()!;
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs
new file mode 100644
index 00000000..8dcc7be3
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs
@@ -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
+{
+ ///
+ /// 机器人回调服务类
+ ///
+ 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 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().SingleAsync(it => it.id == input.carry_id);
+ var subCarry = await _db.Queryable().SingleAsync(it => it.id == input.membercarry_id);
+ if (carry != null && subCarry != null)
+ {
+ VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary() };
+ 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().FirstAsync(it => it.collocation_scheme_id == carry.collocation_scheme_id && it.status == WmsWareHouseConst.BILLSTATUS_CALLED_ID);
+ if (kittingout != null)
+ {
+ visualDevModelCrInput.data = new Dictionary();
+ 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().SingleAsync(it => it.id == kittingout.location_id);
+ if (kittingout.location_id.IsNullOrWhiteSpace() || (location != null && location.is_type.ToEnum() == EnumLocationType.存储库位))
+ {
+ //入库
+ await _wmsKittingInStkService.KittingInStk(visualDevModelCrInput);
+ }
+ else
+ {
+ if (location != null && location.is_use == (int)EnumCarryStatus.空闲 && location.is_lock == 0)
+ {
+ //出库
+ var sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carry.location_id);
+ var ePoint = await _db.Queryable().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().Where(it => it.carry_id == carry.id).ToListAsync();
+ List pretaskCodes = new();
+ foreach (var pt in preTasks)
+ {
+ var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList();
+ var curPreTaskCodes = partCodes.Adapt>();
+ 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 { 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> _genPreTask(WmsPointH sPoint, WmsPointH ePoint, WmsCarryH carry, dynamic KittingOutObj)
+ {
+ List 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;
+ }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs
index 75fc0464..c5f83a4a 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs
@@ -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()!;