diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsBatchSearchController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsBatchSearchController.cs
new file mode 100644
index 00000000..26073983
--- /dev/null
+++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsBatchSearchController.cs
@@ -0,0 +1,59 @@
+using Microsoft.AspNetCore.Mvc;
+using ZR.Model.Dto;
+using ZR.Service.Business.IBusinessService;
+using ZR.Admin.WebApi.Extensions;
+using ZR.Admin.WebApi.Filters;
+using ZR.Model.MES.wms.Dto;
+using ZR.Service.mes.wms.IService;
+using ZR.Model.MES.wms;
+
+//创建时间:2024-04-26
+namespace ZR.Admin.WebApi.Controllers
+{
+ ///
+ /// 仓库批量查询综合接口
+ ///
+ // [Verify]
+ [Route("/mes/wm/WmGoodsBatchSearch")]
+ public class WmGoodsBatchSearchController : BaseController
+ {
+ ///
+ /// 仓库操作
+ ///
+ private readonly IWmGoodsBatchSearchService _wmGoodsBatchSearchService;
+
+ public WmGoodsBatchSearchController(IWmGoodsBatchSearchService wmGoodsBatchSearchService)
+ {
+ _wmGoodsBatchSearchService = wmGoodsBatchSearchService;
+ }
+
+ ///
+ /// 根据查询条件聚合批量查询出库数据,并生成树列表数据
+ ///
+ ///
+ [HttpPost("getBatchOutRecordTreeTableData")]
+ [Log(Title = "根据查询条件聚合批量查询出库数据,并生成树列表数据", BusinessType = BusinessType.QUERY)]
+ public IActionResult GetBatchOutRecordTreeTableData([FromBody] WmGoodsBatchSearchDto parm)
+ {
+ if (parm is null)
+ {
+ throw new ArgumentNullException(nameof(parm));
+ }
+ List result = null;
+ // 父组件
+ if (parm.Model == 1 && parm.Type == 1)
+ {
+ result = _wmGoodsBatchSearchService.GetBatchOutRecordByPackageCodeShort(parm);
+ }
+ else if (parm.Model == 1 && parm.Type == 2)
+ {
+ result = _wmGoodsBatchSearchService.GetBatchOutRecordTreeLazyByPackageCodeShort(parm);
+ }
+ if (result is null)
+ {
+ return ToResponse(new ApiResult(500, "数据获取异常", result));
+ }
+ return ToResponse(new ApiResult(200, "ok", result));
+ }
+ }
+}
\ No newline at end of file
diff --git a/ZR.Model/MES/wms/Dto/WmGoodsBatchSearchDto.cs b/ZR.Model/MES/wms/Dto/WmGoodsBatchSearchDto.cs
new file mode 100644
index 00000000..76fb605b
--- /dev/null
+++ b/ZR.Model/MES/wms/Dto/WmGoodsBatchSearchDto.cs
@@ -0,0 +1,83 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace ZR.Model.MES.wms.Dto
+{
+ ///
+ /// 批量查询
+ ///
+ public class WmGoodsBatchSearchDto : PagerInfo
+ {
+ ///
+ /// 查询类别:1-树父节点 2-树子节点
+ ///
+ public int Type { get; set; } = 1;
+ ///
+ /// 聚合模型类别:1-根据批次号 2-根据零件号
+ ///
+ public int Model { get; set; } = 1;
+ ///
+ /// 零件号
+ ///
+ public string Partnumber { get; set; } = string.Empty;
+ ///
+ /// 批次号
+ ///
+ public string PackageCode { get; set; } = string.Empty;
+
+ }
+
+ ///
+ /// 列表字段
+ ///
+ public class WmGoodsBatchTableDto : PagerInfo
+ {
+ ///
+ /// ID
+ ///
+ public int Id { get; set; } = -1;
+ ///
+ /// 树子节点主键(需要第二层为空)
+ ///
+ public string PackageCodeClient_son { get; set; } = null;
+ ///
+ /// 树父节点主键(需要第一层为空)
+ ///
+ public string PackageCodeClient_short_parent { get; set; } = null;
+ ///
+ /// 零件号
+ ///
+ public string Partnumber { get; set; } = string.Empty;
+ ///
+ /// 描述
+ ///
+ public string Description { get; set; } = string.Empty;
+ ///
+ /// 显示批次号
+ ///
+ public string PackageCode { get; set; } = string.Empty;
+ ///
+ /// 库位号
+ ///
+ public string LocationCode { get; set; } = string.Empty;
+ ///
+ /// 箱数
+ ///
+ public string PackageNum { get; set; } = string.Empty;
+ ///
+ /// 理论库存
+ ///
+ public int GoodsNumLogic { get; set; } = 0;
+ ///
+ /// 实际库存
+ ///
+ public int GoodsNumAction { get; set; } = 0;
+ ///
+ /// 入库时间
+ ///
+ public DateTime? EntryWarehouseTime { get; set; } = null;
+ ///
+ /// 是否拥有树子节点
+ ///
+ public bool HasChild { get; set; } = false;
+ }
+}
\ No newline at end of file
diff --git a/ZR.Service/mes/wms/IService/IWmGoodsBatchSearchService.cs b/ZR.Service/mes/wms/IService/IWmGoodsBatchSearchService.cs
new file mode 100644
index 00000000..cd33037a
--- /dev/null
+++ b/ZR.Service/mes/wms/IService/IWmGoodsBatchSearchService.cs
@@ -0,0 +1,29 @@
+using System;
+using ZR.Model;
+using ZR.Model.Dto;
+using ZR.Model.MES.wms;
+using System.Collections.Generic;
+using ZR.Model.MES.wms.Dto;
+
+namespace ZR.Service.mes.wms.IService
+{
+ ///
+ /// 仓库批量查询service接口
+ ///
+ public interface IWmGoodsBatchSearchService : IBaseService
+ {
+ ///
+ /// 树表最外层查询
+ ///
+ ///
+ ///
+ List GetBatchOutRecordByPackageCodeShort(WmGoodsBatchSearchDto parm);
+ ///
+ /// 树表子节点懒加载查询
+ ///
+ ///
+ ///
+ List GetBatchOutRecordTreeLazyByPackageCodeShort(WmGoodsBatchSearchDto parm);
+
+ }
+}
diff --git a/ZR.Service/mes/wms/WmGoodsActionService.cs b/ZR.Service/mes/wms/WmGoodsActionService.cs
index 0cfb5e98..ca58fbab 100644
--- a/ZR.Service/mes/wms/WmGoodsActionService.cs
+++ b/ZR.Service/mes/wms/WmGoodsActionService.cs
@@ -14,6 +14,7 @@ using System.Text.Json;
using MimeKit.Utils;
using System.Collections.Generic;
using Org.BouncyCastle.Crypto;
+using static System.Runtime.InteropServices.JavaScript.JSType;
namespace ZR.Service.Business
{
@@ -136,8 +137,17 @@ namespace ZR.Service.Business
var jsonObject = new
{
packageList = list,
+ // 拼箱批次号
newPatchCode = newPatchCode,
+ // 拼箱流水号
+ serialNumber = newPatchCode.Split("_")[1],
+ // 拼箱数量
newQuantityCount = quantityCount,
+ // 拼箱班组
+ Team = "C",
+ // 拼箱零件号
+ newPartnumber = mainPackage.PartNumner,
+ // 拼箱时间
time = DateUtils.FormatDate(nowTime)
};
// 日志记录
@@ -169,9 +179,9 @@ namespace ZR.Service.Business
nowProduction.GoodsNumAction = quantityCount;
nowProduction.Remark = "拼箱整箱";
//TODO 20240422开会讨论结果:拼箱完需要重新扫码入库,原数据删除
- //Context.Deleteable().Where(it => it.Id == nowProduction.Id).ExecuteCommand();
- //Context.Deleteable().Where(it => it.Id == secondId).ExecuteCommand();
- //return log;
+ Context.Deleteable().Where(it => it.Id == nowProduction.Id).ExecuteCommand();
+ Context.Deleteable().Where(it => it.Id == secondId).ExecuteCommand();
+ return log;
// 修改主箱
Context.Updateable(nowProduction).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
// 次箱操作
@@ -283,11 +293,25 @@ namespace ZR.Service.Business
DateTime nowTime = DateTime.Now.ToLocalTime();
var jsonObject = new
{
+ // 主箱信息
mainPackage = mainPackage,
+ // 新标签1
newPatchCode1 = newPatchCode1,
+ // 新流水号1
+ serialNumber1 = newPatchCode1.Split("_")[1],
+ // 新标签2
newPatchCode2 = newPatchCode2,
+ // 新流水号2
+ serialNumber2 = newPatchCode2.Split("_")[1],
+ // 拆箱1数量
firstNum = firstNum,
+ // 拆箱2数量
secondNum = secondNum,
+ // 班组
+ Team = "C",
+ // 全部箱子零件号
+ newPartnumber = mainPackage.PartNumner,
+ // 拆箱时间
time = DateUtils.FormatDate(nowTime)
};
// 日志记录
@@ -301,8 +325,8 @@ namespace ZR.Service.Business
};
Context.Insertable(log).ExecuteReturnEntity();
//TODO 20240422开会讨论结果:拆箱完需要重新扫码入库,原主箱数据删除
- //Context.Deleteable().Where(it => it.Id == mainNowProduction.Id).ExecuteCommand();
- //return log;
+ Context.Deleteable().Where(it => it.Id == mainNowProduction.Id).ExecuteCommand();
+ return log;
// 执行修改
// 1.主箱修改为1号分箱参数
WmGoodsNowProduction newPackage1 = mainNowProduction;
diff --git a/ZR.Service/mes/wms/WmGoodsBatchSearchService.cs b/ZR.Service/mes/wms/WmGoodsBatchSearchService.cs
new file mode 100644
index 00000000..0360e4ba
--- /dev/null
+++ b/ZR.Service/mes/wms/WmGoodsBatchSearchService.cs
@@ -0,0 +1,60 @@
+using System;
+using SqlSugar;
+using Infrastructure.Attribute;
+using Infrastructure.Extensions;
+using ZR.Model;
+using ZR.Model.Dto;
+using ZR.Model.MES.wms;
+using ZR.Repository;
+using ZR.Service.Business.IBusinessService;
+using System.Linq;
+using ZR.Service.mes.wms.IService;
+using ZR.Model.MES.wms.Dto;
+using System.Text.Json;
+using MimeKit.Utils;
+using System.Collections.Generic;
+using Org.BouncyCastle.Crypto;
+using static System.Runtime.InteropServices.JavaScript.JSType;
+
+namespace ZR.Service.Business
+{
+ ///
+ /// 仓库操作日志Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IWmGoodsBatchSearchService), ServiceLifetime = LifeTime.Transient)]
+ public class WmGoodsBatchSearchService : BaseService, IWmGoodsBatchSearchService
+ {
+ public List GetBatchOutRecordByPackageCodeShort(WmGoodsBatchSearchDto parm)
+ {
+ try
+ {
+ // 查询条件
+ var exp = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.PackageCodeClient.Contains(parm.Partnumber))
+ .AndIF(!string.IsNullOrEmpty(parm.PackageCode), it => it.PackageCodeClient.Contains(parm.PackageCode))
+ .ToExpression();
+ // 出库记录
+ List outPackageList = Context.Queryable()
+ .Where(exp)
+ .GroupBy(x => x.PackageCode)
+
+ .ToList();
+
+
+
+ List result = new List();
+ return result;
+ }
+ catch
+ {
+ return null;
+ }
+
+ }
+
+ public List GetBatchOutRecordTreeLazyByPackageCodeShort(WmGoodsBatchSearchDto parm)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file