From c7cd6ba42c35d99f3602544ead0cf7a58611894a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AD=A3=E6=98=93?= Date: Fri, 28 Jun 2024 15:21:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=93=E5=BA=93=E8=B4=A7=E7=89=A9=EF=BC=8C?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E8=AE=B0=E5=BD=95=E6=9F=A5=E8=AF=A2=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/mm/MmIngredientTaskController.cs | 8 +- .../Controllers/mes/ql/PainLab02Controller.cs | 16 +- .../Controllers/mes/ql/PainLab03Controller.cs | 16 +- ZR.Model/MES/mm/Dto/MmIngredientTaskDto.cs | 8 +- ZR.Model/MES/ql/DTO/PLBatchDto.cs | 9 +- ZR.Model/MES/ql/DTO/PLRawMaterialDto.cs | 9 +- ZR.Model/MES/ql/DTO/PLTestDto.cs | 9 +- ZR.Model/MES/ql/PLBatch.cs | 8 +- ZR.Model/MES/ql/PLRawMaterial.cs | 8 +- ZR.Model/MES/ql/PLTest.cs | 8 +- .../MES/wms/Dto/WmGoodsNowProductionDto.cs | 23 +- .../MES/wms/Dto/WmGoodsOutProductionDto.cs | 2 + .../mm/IService/IMmIngredientTaskService.cs | 3 - ZR.Service/mes/mm/MmIngredientTaskService.cs | 19 +- ZR.Service/mes/op/OperationService.cs | 1 - ZR.Service/mes/ql/IService/IPLBatchService.cs | 6 +- .../mes/ql/IService/IPLRawMaterialService.cs | 9 +- ZR.Service/mes/ql/IService/IPLTestService.cs | 6 +- ZR.Service/mes/ql/PLBatchService.cs | 13 +- ZR.Service/mes/ql/PLRawMaterialService.cs | 26 +- ZR.Service/mes/ql/PLTestService.cs | 11 +- .../mes/wms/WmGoodsNowProductionService.cs | 250 +++++++++++------- .../mes/wms/WmGoodsOutProductionService.cs | 184 ++++++++----- 23 files changed, 335 insertions(+), 317 deletions(-) diff --git a/ZR.Admin.WebApi/Controllers/mes/mm/MmIngredientTaskController.cs b/ZR.Admin.WebApi/Controllers/mes/mm/MmIngredientTaskController.cs index f055ce8d..418a6e48 100644 --- a/ZR.Admin.WebApi/Controllers/mes/mm/MmIngredientTaskController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/mm/MmIngredientTaskController.cs @@ -1,11 +1,9 @@ using Microsoft.AspNetCore.Mvc; -using ZR.Model.Dto; -using ZR.Service.mes.mm.IService; -using ZR.Service.mes.mm; using ZR.Admin.WebApi.Extensions; using ZR.Admin.WebApi.Filters; -using ZR.Model.MES.mm.Dto; using ZR.Model.MES.mm; +using ZR.Model.MES.mm.Dto; +using ZR.Service.mes.mm.IService; //创建时间:2024-06-05 namespace ZR.Admin.WebApi.Controllers @@ -51,7 +49,7 @@ namespace ZR.Admin.WebApi.Controllers public IActionResult GetMmIngredientTask(int Id) { var response = _MmIngredientTaskService.GetInfo(Id); - + var info = response.Adapt(); return SUCCESS(info); } diff --git a/ZR.Admin.WebApi/Controllers/mes/ql/PainLab02Controller.cs b/ZR.Admin.WebApi/Controllers/mes/ql/PainLab02Controller.cs index 832b4ad5..81f7d389 100644 --- a/ZR.Admin.WebApi/Controllers/mes/ql/PainLab02Controller.cs +++ b/ZR.Admin.WebApi/Controllers/mes/ql/PainLab02Controller.cs @@ -1,21 +1,7 @@ -using Infrastructure.Extensions; -using JinianNet.JNTemplate; -using Microsoft.AspNetCore.Mvc; -using Microsoft.IdentityModel.Tokens; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System.Text.Json; -using ZR.Admin.WebApi.Extensions; -using ZR.Model.mes.pro; -using ZR.Model.MES.qc.DTO; +using Microsoft.AspNetCore.Mvc; using ZR.Model.MES.ql; using ZR.Model.MES.ql.DTO; -using ZR.Service.mes.pro; -using ZR.Service.mes.pro.IService; -using ZR.Service.mes.ql; using ZR.Service.mes.ql.IService; -using ZR.Service.mes.qu.IService; -using static System.Runtime.InteropServices.JavaScript.JSType; namespace ZR.Admin.WebApi.Controllers.mes.ql { diff --git a/ZR.Admin.WebApi/Controllers/mes/ql/PainLab03Controller.cs b/ZR.Admin.WebApi/Controllers/mes/ql/PainLab03Controller.cs index 2baed6f6..9d15c0ed 100644 --- a/ZR.Admin.WebApi/Controllers/mes/ql/PainLab03Controller.cs +++ b/ZR.Admin.WebApi/Controllers/mes/ql/PainLab03Controller.cs @@ -1,21 +1,7 @@ -using Infrastructure.Extensions; -using JinianNet.JNTemplate; -using Microsoft.AspNetCore.Mvc; -using Microsoft.IdentityModel.Tokens; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System.Text.Json; -using ZR.Admin.WebApi.Extensions; -using ZR.Model.mes.pro; -using ZR.Model.MES.qc.DTO; +using Microsoft.AspNetCore.Mvc; using ZR.Model.MES.ql; using ZR.Model.MES.ql.DTO; -using ZR.Service.mes.pro; -using ZR.Service.mes.pro.IService; -using ZR.Service.mes.ql; using ZR.Service.mes.ql.IService; -using ZR.Service.mes.qu.IService; -using static System.Runtime.InteropServices.JavaScript.JSType; namespace ZR.Admin.WebApi.Controllers.mes.ql { diff --git a/ZR.Model/MES/mm/Dto/MmIngredientTaskDto.cs b/ZR.Model/MES/mm/Dto/MmIngredientTaskDto.cs index 21fe8751..e4696a83 100644 --- a/ZR.Model/MES/mm/Dto/MmIngredientTaskDto.cs +++ b/ZR.Model/MES/mm/Dto/MmIngredientTaskDto.cs @@ -5,12 +5,12 @@ namespace ZR.Model.MES.mm.Dto /// /// 配料任务清单查询对象 /// - public class MmIngredientTaskQueryDto : PagerInfo + public class MmIngredientTaskQueryDto : PagerInfo { - public string Workorder { get; set; } + public string Workorder { get; set; } - public DateTime Starttime { get; set; } - public DateTime Endtime { get; set; } + public DateTime Starttime { get; set; } + public DateTime Endtime { get; set; } } diff --git a/ZR.Model/MES/ql/DTO/PLBatchDto.cs b/ZR.Model/MES/ql/DTO/PLBatchDto.cs index f399880d..61ce6965 100644 --- a/ZR.Model/MES/ql/DTO/PLBatchDto.cs +++ b/ZR.Model/MES/ql/DTO/PLBatchDto.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Text; -using System.Threading.Tasks; - -namespace ZR.Model.MES.ql.DTO +namespace ZR.Model.MES.ql.DTO { /// /// 当前工单 diff --git a/ZR.Model/MES/ql/DTO/PLRawMaterialDto.cs b/ZR.Model/MES/ql/DTO/PLRawMaterialDto.cs index a0b8b6ea..39cad423 100644 --- a/ZR.Model/MES/ql/DTO/PLRawMaterialDto.cs +++ b/ZR.Model/MES/ql/DTO/PLRawMaterialDto.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Text; -using System.Threading.Tasks; - -namespace ZR.Model.MES.ql.DTO +namespace ZR.Model.MES.ql.DTO { /// /// 当前工单 diff --git a/ZR.Model/MES/ql/DTO/PLTestDto.cs b/ZR.Model/MES/ql/DTO/PLTestDto.cs index bafd3d13..2446e23b 100644 --- a/ZR.Model/MES/ql/DTO/PLTestDto.cs +++ b/ZR.Model/MES/ql/DTO/PLTestDto.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Text; -using System.Threading.Tasks; - -namespace ZR.Model.MES.ql.DTO +namespace ZR.Model.MES.ql.DTO { /// /// 当前工单 diff --git a/ZR.Model/MES/ql/PLBatch.cs b/ZR.Model/MES/ql/PLBatch.cs index e59843de..e6970541 100644 --- a/ZR.Model/MES/ql/PLBatch.cs +++ b/ZR.Model/MES/ql/PLBatch.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ZR.Model.MES.ql +namespace ZR.Model.MES.ql { /// diff --git a/ZR.Model/MES/ql/PLRawMaterial.cs b/ZR.Model/MES/ql/PLRawMaterial.cs index 776055a0..d829f8c0 100644 --- a/ZR.Model/MES/ql/PLRawMaterial.cs +++ b/ZR.Model/MES/ql/PLRawMaterial.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ZR.Model.MES.ql +namespace ZR.Model.MES.ql { /// diff --git a/ZR.Model/MES/ql/PLTest.cs b/ZR.Model/MES/ql/PLTest.cs index fb505da7..0bbc13b6 100644 --- a/ZR.Model/MES/ql/PLTest.cs +++ b/ZR.Model/MES/ql/PLTest.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ZR.Model.MES.ql +namespace ZR.Model.MES.ql { /// diff --git a/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs b/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs index 7075a4a1..a1e9d5d1 100644 --- a/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs +++ b/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs @@ -7,24 +7,25 @@ namespace ZR.Model.MES.wms.Dto { public string Id { get; set; } - public string PackageCode { get; set; } - public string PackageCodeClient { get; set; } public string PackageCodeOriginal { get; set; } - public string LocationCode { get; set; } public string Partnumber { get; set; } + public string Description { get; set; } + public int? GoodsNumLogic { get; set; } public int? GoodsNumAction { get; set; } public DateTime? EntryWarehouseTime { get; set; } + public DateTime? EntryWarehouseTimeStart { get; set; } + public DateTime? EntryWarehouseTimeEnd { get; set; } public string Remark { get; set; } @@ -42,21 +43,18 @@ namespace ZR.Model.MES.wms.Dto /// public class WmGoodsNowProductionDto { - public string Id { get; set; } - public string PackageCode { get; set; } - public string PackageCodeClient { get; set; } public string PackageCodeOriginal { get; set; } - public string LocationCode { get; set; } public string Partnumber { get; set; } + public string Description { get; set; } public int? GoodsNumLogic { get; set; } @@ -76,7 +74,6 @@ namespace ZR.Model.MES.wms.Dto public DateTime? CreatedTime { get; set; } } - /// /// 成品库当前货物表查询对象(下拉菜单) /// @@ -93,37 +90,45 @@ namespace ZR.Model.MES.wms.Dto /// 成品库货物id /// public string Id { get; set; } + /// /// 批次号(MES中) /// public string PackageCodeClient { get; set; } = string.Empty; + /// /// 库位号 /// public string LocationCode { get; set; } = string.Empty; + /// /// 零件号 /// public string Partnumber { get; set; } = string.Empty; + /// /// 详细描述 /// public string Description { get; set; } = string.Empty; + /// /// 入库时库存 /// public int? GoodsNumLogic { get; set; } = 0; + /// /// 当前实际库存! /// public int? GoodsNumAction { get; set; } = 0; + /// /// 下拉显示值 /// public string Label { get; set; } = string.Empty; + /// /// 下拉实际值 /// public object Value { get; set; } } -} \ No newline at end of file +} diff --git a/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs b/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs index dcb17d25..de475f83 100644 --- a/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs +++ b/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs @@ -32,6 +32,8 @@ namespace ZR.Model.MES.wms.Dto public DateTime? EntryWarehouseTime { get; set; } public DateTime? OutTime { get; set; } + public DateTime? OutTimeStart { get; set; } + public DateTime? OutTimeEnd { get; set; } public string Remark { get; set; } diff --git a/ZR.Service/mes/mm/IService/IMmIngredientTaskService.cs b/ZR.Service/mes/mm/IService/IMmIngredientTaskService.cs index b428bb87..9d3159d6 100644 --- a/ZR.Service/mes/mm/IService/IMmIngredientTaskService.cs +++ b/ZR.Service/mes/mm/IService/IMmIngredientTaskService.cs @@ -1,9 +1,6 @@ -using System; using ZR.Model; -using ZR.Model.Dto; using ZR.Model.MES.mm; using ZR.Model.MES.mm.Dto; -using System.Collections.Generic; namespace ZR.Service.mes.mm.IService { diff --git a/ZR.Service/mes/mm/MmIngredientTaskService.cs b/ZR.Service/mes/mm/MmIngredientTaskService.cs index 7cc05015..8c84e627 100644 --- a/ZR.Service/mes/mm/MmIngredientTaskService.cs +++ b/ZR.Service/mes/mm/MmIngredientTaskService.cs @@ -1,14 +1,11 @@ -using System; -using SqlSugar; using Infrastructure.Attribute; -using Infrastructure.Extensions; +using SqlSugar; +using System; using ZR.Model; - -using ZR.Repository; using ZR.Model.MES.mm; -using ZR.Service.mes.mm.IService; -using System.Linq; using ZR.Model.MES.mm.Dto; +using ZR.Repository; +using ZR.Service.mes.mm.IService; namespace ZR.Service.mes.mm { @@ -26,12 +23,12 @@ namespace ZR.Service.mes.mm public PagedInfo GetList(MmIngredientTaskQueryDto parm) { var predicate = Expressionable.Create() - .AndIF(parm.Starttime!=null&&parm.Starttime>new DateTime(1899,1,1),it=>it.CreatedTime>=parm.Starttime) - .AndIF(parm.Endtime!=null&&parm.Starttime>new DateTime(1899,1,1),it=>it.CreatedTime<=parm.Endtime) - .AndIF(!string.IsNullOrEmpty(parm.Workorder),it=>it.Workorder.Contains(parm.Workorder)); + .AndIF(parm.Starttime != null && parm.Starttime > new DateTime(1899, 1, 1), it => it.CreatedTime >= parm.Starttime) + .AndIF(parm.Endtime != null && parm.Starttime > new DateTime(1899, 1, 1), it => it.CreatedTime <= parm.Endtime) + .AndIF(!string.IsNullOrEmpty(parm.Workorder), it => it.Workorder.Contains(parm.Workorder)); var response = Queryable() - .OrderByDescending(it=>it.CreatedTime) + .OrderByDescending(it => it.CreatedTime) .Where(predicate.ToExpression()) .ToPage(parm); diff --git a/ZR.Service/mes/op/OperationService.cs b/ZR.Service/mes/op/OperationService.cs index afd1f277..60b83d9e 100644 --- a/ZR.Service/mes/op/OperationService.cs +++ b/ZR.Service/mes/op/OperationService.cs @@ -5,7 +5,6 @@ using ZR.Model.MES.op.DTO; using ZR.Model.MES.op.ZR.Model.mes.md; using ZR.Model.MES.pro; using ZR.Model.MES.qc; -using ZR.Model.MES.qc.DTO; using ZR.Model.MES.qu; using ZR.Service.MES.op.IService; diff --git a/ZR.Service/mes/ql/IService/IPLBatchService.cs b/ZR.Service/mes/ql/IService/IPLBatchService.cs index fe6b2a4f..e458ed8c 100644 --- a/ZR.Service/mes/ql/IService/IPLBatchService.cs +++ b/ZR.Service/mes/ql/IService/IPLBatchService.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using ZR.Model.MES.ql; @@ -11,7 +7,7 @@ namespace ZR.Service.mes.ql.IService public interface IPLBatchService { - public (List, int) GetPLBatchTable(DateTime starttime, DateTime endTime, string code,int pageNum, int pageSize); + public (List, int) GetPLBatchTable(DateTime starttime, DateTime endTime, string code, int pageNum, int pageSize); public int AddPLBatchRecords(int num, int size); diff --git a/ZR.Service/mes/ql/IService/IPLRawMaterialService.cs b/ZR.Service/mes/ql/IService/IPLRawMaterialService.cs index c895934d..3e16183c 100644 --- a/ZR.Service/mes/ql/IService/IPLRawMaterialService.cs +++ b/ZR.Service/mes/ql/IService/IPLRawMaterialService.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ZR.Model.MES.qc; using ZR.Model.MES.ql; @@ -12,9 +7,9 @@ namespace ZR.Service.mes.ql.IService public interface IPLRawMaterialService { - public (List, int) GetRawMaterialTable(DateTime starttime, DateTime endTime,string pci, string colorCode,int pageNum, int pageSize); + public (List, int) GetRawMaterialTable(DateTime starttime, DateTime endTime, string pci, string colorCode, int pageNum, int pageSize); - public int AddRawMaterialRecords(int num,int size); + public int AddRawMaterialRecords(int num, int size); public int DelRawMaterialRecords(string idGroup); diff --git a/ZR.Service/mes/ql/IService/IPLTestService.cs b/ZR.Service/mes/ql/IService/IPLTestService.cs index 3bd89982..6e32b125 100644 --- a/ZR.Service/mes/ql/IService/IPLTestService.cs +++ b/ZR.Service/mes/ql/IService/IPLTestService.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using ZR.Model.MES.ql; @@ -11,7 +7,7 @@ namespace ZR.Service.mes.ql.IService public interface IPLTestService { - public (List, int) GetPLTestTable(DateTime starttime, DateTime endTime, string code,int pageNum, int pageSize); + public (List, int) GetPLTestTable(DateTime starttime, DateTime endTime, string code, int pageNum, int pageSize); public int AddPLTestRecords(int num, int size); diff --git a/ZR.Service/mes/ql/PLBatchService.cs b/ZR.Service/mes/ql/PLBatchService.cs index 64b8a9e1..91da8ad3 100644 --- a/ZR.Service/mes/ql/PLBatchService.cs +++ b/ZR.Service/mes/ql/PLBatchService.cs @@ -1,15 +1,6 @@ using Infrastructure.Attribute; -using Mapster; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Tokens; using SqlSugar; using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Security.AccessControl; -using System.Text; -using System.Threading.Tasks; using ZR.Model.MES.ql; using ZR.Service.mes.ql.IService; @@ -75,7 +66,7 @@ namespace ZR.Service.mes.ql /// /// /// - public (List, int) GetPLBatchTable(DateTime starttime, DateTime endTime,string code, int pageNum, int pageSize) + public (List, int) GetPLBatchTable(DateTime starttime, DateTime endTime, string code, int pageNum, int pageSize) { starttime = starttime.ToLocalTime(); endTime = endTime.ToLocalTime(); @@ -89,7 +80,7 @@ namespace ZR.Service.mes.ql //int totalNum = 0; List data = Context.Queryable() .Where(predicate) - .OrderByDescending(it=>it.IdGroup) + .OrderByDescending(it => it.IdGroup) .OrderBy(it => it.Id) .ToPageList(pageNum, pageSize, ref totalNum); return (data, totalNum); diff --git a/ZR.Service/mes/ql/PLRawMaterialService.cs b/ZR.Service/mes/ql/PLRawMaterialService.cs index 908ee60f..0d2b783a 100644 --- a/ZR.Service/mes/ql/PLRawMaterialService.cs +++ b/ZR.Service/mes/ql/PLRawMaterialService.cs @@ -1,16 +1,6 @@ using Infrastructure.Attribute; -using Mapster; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Tokens; using SqlSugar; using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Security.AccessControl; -using System.Text; -using System.Threading.Tasks; -using ZR.Model.MES.qc; using ZR.Model.MES.ql; using ZR.Service.mes.ql.IService; @@ -122,10 +112,10 @@ namespace ZR.Service.mes.ql return new PLRawMaterial() { Id = 0, - IdGroup=DateTime.Now.ToString("yyyyMMddHHmmssfff"), - Code="", - Pci="", - Value01="", + IdGroup = DateTime.Now.ToString("yyyyMMddHHmmssfff"), + Code = "", + Pci = "", + Value01 = "", Value02 = "", Value03 = "", Value04 = "", @@ -136,10 +126,10 @@ namespace ZR.Service.mes.ql Value09 = "", Value10 = "", Value11 = "", - CreatedBy="user", - CreatedTime=DateTime.Now, - UpdatedBy="user", - UpdatedTime=DateTime.Now, + CreatedBy = "user", + CreatedTime = DateTime.Now, + UpdatedBy = "user", + UpdatedTime = DateTime.Now, }; } } diff --git a/ZR.Service/mes/ql/PLTestService.cs b/ZR.Service/mes/ql/PLTestService.cs index 71d50107..56979436 100644 --- a/ZR.Service/mes/ql/PLTestService.cs +++ b/ZR.Service/mes/ql/PLTestService.cs @@ -1,15 +1,6 @@ using Infrastructure.Attribute; -using Mapster; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Tokens; using SqlSugar; using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Security.AccessControl; -using System.Text; -using System.Threading.Tasks; using ZR.Model.MES.ql; using ZR.Service.mes.ql.IService; @@ -75,7 +66,7 @@ namespace ZR.Service.mes.ql /// /// /// - public (List, int) GetPLTestTable(DateTime starttime, DateTime endTime, string code,int pageNum, int pageSize) + public (List, int) GetPLTestTable(DateTime starttime, DateTime endTime, string code, int pageNum, int pageSize) { starttime = starttime.ToLocalTime(); endTime = endTime.ToLocalTime(); diff --git a/ZR.Service/mes/wms/WmGoodsNowProductionService.cs b/ZR.Service/mes/wms/WmGoodsNowProductionService.cs index 7b53ab9d..8a4df90b 100644 --- a/ZR.Service/mes/wms/WmGoodsNowProductionService.cs +++ b/ZR.Service/mes/wms/WmGoodsNowProductionService.cs @@ -1,7 +1,7 @@ -using Infrastructure.Attribute; -using SqlSugar; using System; using System.Linq; +using Infrastructure.Attribute; +using SqlSugar; using ZR.Model; using ZR.Model.MES.wms; using ZR.Model.MES.wms.Dto; @@ -13,8 +13,13 @@ namespace ZR.Service.mes.wms /// /// 成品库当前货物表Service业务层处理 /// - [AppService(ServiceType = typeof(IWmGoodsNowProductionService), ServiceLifetime = LifeTime.Transient)] - public class WmGoodsNowProductionService : BaseService, IWmGoodsNowProductionService + [AppService( + ServiceType = typeof(IWmGoodsNowProductionService), + ServiceLifetime = LifeTime.Transient + )] + public class WmGoodsNowProductionService + : BaseService, + IWmGoodsNowProductionService { /// /// 查询成品库当前货物表列表 @@ -23,33 +28,69 @@ namespace ZR.Service.mes.wms /// public PagedInfo GetList(WmGoodsNowProductionQueryDto parm) { - var predicate = Expressionable.Create() - .AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber)) - .AndIF(!string.IsNullOrEmpty(parm.PackageCodeClient), it => it.PackageCodeClient.Contains(parm.PackageCodeClient)) - .AndIF(!string.IsNullOrEmpty(parm.LocationCode), it => it.LocationCode.Contains(parm.LocationCode)) - ; - - var response = Queryable() + List partnumberByDescription = new(); + if (parm != null && !string.IsNullOrEmpty(parm.Description)) + { + partnumberByDescription = Context + .Queryable() + .Where(it => it.Description.Contains(parm.Description)) + .Select(it => it.Partnumber) + .ToList(); + } + var predicate = Expressionable + .Create() + .AndIF( + partnumberByDescription.Count > 0, + it => partnumberByDescription.Contains(it.Partnumber) + ) + .AndIF( + !string.IsNullOrEmpty(parm.Partnumber), + it => it.Partnumber.Contains(parm.Partnumber) + ) + .AndIF( + !string.IsNullOrEmpty(parm.PackageCodeClient), + it => it.PackageCodeClient.Contains(parm.PackageCodeClient) + ) + .AndIF( + parm.EntryWarehouseTimeStart != null, + it => it.EntryWarehouseTime > parm.EntryWarehouseTimeStart + ) + .AndIF( + parm.EntryWarehouseTimeEnd != null, + it => it.EntryWarehouseTime < parm.EntryWarehouseTimeEnd + ) + .AndIF( + !string.IsNullOrEmpty(parm.PackageCodeClient), + it => it.PackageCodeClient.Contains(parm.PackageCodeClient) + ) + .AndIF( + !string.IsNullOrEmpty(parm.LocationCode), + it => it.LocationCode.Contains(parm.LocationCode) + ); + var response = Context + .Queryable() .Where(predicate.ToExpression()) .OrderByDescending(x => x.EntryWarehouseTime) .ToPage(parm); foreach (WmGoodsNowProductionDto item in response.Result) { - WmMaterial material = Context.Queryable() - .Where(it => it.Partnumber == item.Partnumber) - .First(); + WmMaterial material = Context + .Queryable() + .Where(it => it.Partnumber == item.Partnumber) + .First(); if (material == null) { item.Description = "此零件号不在物料清单内!"; continue; } - item.Description = !string.IsNullOrEmpty(material.Description) ? material.Description : material.ProductName; + item.Description = !string.IsNullOrEmpty(material.Description) + ? material.Description + : material.ProductName; } return response; } - /// /// 批量查看 /// @@ -60,52 +101,63 @@ namespace ZR.Service.mes.wms { List list = null; int total = 0; - var predicate = Expressionable.Create() - .AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber)) - .AndIF(!string.IsNullOrEmpty(parm.PackageCodeClient), it => it.PackageCodeClient.Contains(parm.PackageCodeClient)); + var predicate = Expressionable + .Create() + .AndIF( + !string.IsNullOrEmpty(parm.Partnumber), + it => it.Partnumber.Contains(parm.Partnumber) + ) + .AndIF( + !string.IsNullOrEmpty(parm.PackageCodeClient), + it => it.PackageCodeClient.Contains(parm.PackageCodeClient) + ); - List rawdatas = Queryable().Where(predicate.ToExpression()).ToPageList(parm.PageNum, parm.PageSize, ref total); + List rawdatas = Queryable() + .Where(predicate.ToExpression()) + .ToPageList(parm.PageNum, parm.PageSize, ref total); if (rawdatas != null && rawdatas.Count > 0) { //todo 对字段进行拆分 - List WmGoods_nodeDto_list = rawdatas.Select(p => new WmGoods_nodeDto() - { - Id = p.Id, - PackageCode = p.PackageCode, - PackageCodeClient_short_parent = p.PackageCodeClient.Split("_")[0], - PackageCodeClient_son = p.PackageCodeClient, - PackageCodeOriginal = p.PackageCodeClient, - LocationCode = p.LocationCode, - Partnumber = p.Partnumber, - Pack_num = 1, - GoodsNumLogic = p.GoodsNumLogic, - GoodsNumAction = p.GoodsNumAction, - EntryWarehouseTime = p.EntryWarehouseTime, - Remark = p.Remark, - - }).ToList(); + List WmGoods_nodeDto_list = rawdatas + .Select(p => new WmGoods_nodeDto() + { + Id = p.Id, + PackageCode = p.PackageCode, + PackageCodeClient_short_parent = p.PackageCodeClient.Split("_")[0], + PackageCodeClient_son = p.PackageCodeClient, + PackageCodeOriginal = p.PackageCodeClient, + LocationCode = p.LocationCode, + Partnumber = p.Partnumber, + Pack_num = 1, + GoodsNumLogic = p.GoodsNumLogic, + GoodsNumAction = p.GoodsNumAction, + EntryWarehouseTime = p.EntryWarehouseTime, + Remark = p.Remark, + }) + .ToList(); //todo 分组 聚合 生成父节点 - List WmGoods_nodeDto_list_parent = WmGoods_nodeDto_list.GroupBy(p => p.PackageCodeClient_short_parent) - .Select(group => new WmGoods_nodeDto() - { - PackageCodeClient_short_parent = "", - PackageCodeClient_son = group.Key, - GoodsNumLogic = group.Sum(group => group.GoodsNumLogic), - GoodsNumAction = group.Sum(group => group.GoodsNumAction), - Partnumber = group.Max(group => group.Partnumber), - Pack_num = group.Count() - }).ToList(); + List WmGoods_nodeDto_list_parent = WmGoods_nodeDto_list + .GroupBy(p => p.PackageCodeClient_short_parent) + .Select(group => new WmGoods_nodeDto() + { + PackageCodeClient_short_parent = "", + PackageCodeClient_son = group.Key, + GoodsNumLogic = group.Sum(group => group.GoodsNumLogic), + GoodsNumAction = group.Sum(group => group.GoodsNumAction), + Partnumber = group.Max(group => group.Partnumber), + Pack_num = group.Count() + }) + .ToList(); //todo 合并 list = WmGoods_nodeDto_list.Concat(WmGoods_nodeDto_list_parent).ToList(); - - } return (list, total); } + /// /// 移动端 货物查看 根据Query零件号与批次号查看信息 /// @@ -116,16 +168,22 @@ namespace ZR.Service.mes.wms // 结果集 List resultList = new(); // 全数据处理 - var predicate = Expressionable.Create() - .OrIF(!string.IsNullOrEmpty(parm.Query), it => it.Partnumber.Contains(parm.Query)) - .OrIF(!string.IsNullOrEmpty(parm.Query), it => it.PackageCodeClient.Contains(parm.Query)); - List wmGoodsNowsList = Context.Queryable() - .Where(predicate.ToExpression()) - .OrderByDescending(it => it.PackageCodeClient) - .ToList(); + var predicate = Expressionable + .Create() + .OrIF(!string.IsNullOrEmpty(parm.Query), it => it.Partnumber.Contains(parm.Query)) + .OrIF( + !string.IsNullOrEmpty(parm.Query), + it => it.PackageCodeClient.Contains(parm.Query) + ); + List wmGoodsNowsList = Context + .Queryable() + .Where(predicate.ToExpression()) + .OrderByDescending(it => it.PackageCodeClient) + .ToList(); // 聚合数据 - resultList = wmGoodsNowsList.GroupBy(it => it.PackageCodeClient.Split('_')[0]) + resultList = wmGoodsNowsList + .GroupBy(it => it.PackageCodeClient.Split('_')[0]) .Select(group => new WmGoodShortPackageCodeDto { ShortPackageCode = group.Key, @@ -133,7 +191,8 @@ namespace ZR.Service.mes.wms EntryWarehouseTime = group.Max(item => item.EntryWarehouseTime), PackageNumber = group.Count(), PartnumberNumber = group.Sum(item => item.GoodsNumAction) - }).ToList(); + }) + .ToList(); // 结果数据处理 //每页多少条 int rows = parm.PageSize; @@ -141,7 +200,7 @@ namespace ZR.Service.mes.wms int page = parm.PageNum; //每一页开始下标 int startIndex = (page - 1) * rows; - //数据总数 + //数据总数 int sum = resultList.Count; if (startIndex + rows > sum) { @@ -153,6 +212,7 @@ namespace ZR.Service.mes.wms } return resultList; } + /// /// 移动端 短批次号详情 /// @@ -160,8 +220,12 @@ namespace ZR.Service.mes.wms /// public List Patchsearchdetail(WmGoodsNowProductionQueryDto parm) { - var predicate = Expressionable.Create() - .AndIF(!string.IsNullOrEmpty(parm.PackageCodeClient), it => it.PackageCodeClient.Contains(parm.PackageCodeClient)); + var predicate = Expressionable + .Create() + .AndIF( + !string.IsNullOrEmpty(parm.PackageCodeClient), + it => it.PackageCodeClient.Contains(parm.PackageCodeClient) + ); var response = Queryable() .Where(predicate.ToExpression()) @@ -178,21 +242,22 @@ namespace ZR.Service.mes.wms .ToList(); foreach (WmGoodsNowProductionDto item in response) { - WmMaterial material = Context.Queryable() - .Where(it => it.Partnumber == item.Partnumber) - .First(); + WmMaterial material = Context + .Queryable() + .Where(it => it.Partnumber == item.Partnumber) + .First(); if (material == null) { item.Description = "此零件号不在物料清单内!"; continue; } - item.Description = !string.IsNullOrEmpty(material.Description) ? material.Description : material.ProductName; + item.Description = !string.IsNullOrEmpty(material.Description) + ? material.Description + : material.ProductName; } return response; - } - /// /// 获取详情 /// @@ -200,9 +265,7 @@ namespace ZR.Service.mes.wms /// public WmGoodsNowProduction GetInfo(string Id) { - var response = Queryable() - .Where(x => x.Id == Id) - .First(); + var response = Queryable().Where(x => x.Id == Id).First(); return response; } @@ -216,7 +279,7 @@ namespace ZR.Service.mes.wms { if (string.IsNullOrEmpty(model.Id)) { - model.Id = SnowFlakeSingle.Instance.NextId().ToString();//也可以在程序中直接获取ID + model.Id = SnowFlakeSingle.Instance.NextId().ToString(); //也可以在程序中直接获取ID } if (string.IsNullOrEmpty(model.PackageCode)) { @@ -226,9 +289,10 @@ namespace ZR.Service.mes.wms { model.PackageCodeOriginal = model.PackageCodeClient; } - bool hasRecord = Context.Queryable() - .Where(it => it.PackageCodeClient == model.PackageCodeClient) - .Any(); + bool hasRecord = Context + .Queryable() + .Where(it => it.PackageCodeClient == model.PackageCodeClient) + .Any(); if (hasRecord) { throw new Exception("成品仓库已有相同批次号记录"); @@ -271,18 +335,21 @@ namespace ZR.Service.mes.wms /// public int ModifyInventoryQuantity(string id, int stack_num) { - return Context.Updateable() - .SetColumns(it => it.GoodsNumAction == stack_num) - .Where(it => it.Id == id).ExecuteCommand(); + return Context + .Updateable() + .SetColumns(it => it.GoodsNumAction == stack_num) + .Where(it => it.Id == id) + .ExecuteCommand(); } public PagedInfo GetDictData(WmGoodsNowProductionDictDto parm) { - var predicate = Expressionable.Create() + var predicate = Expressionable + .Create() .AndIF(!string.IsNullOrEmpty(parm.Query), it => it.Partnumber.Contains(parm.Query)) .Or(it => it.PackageCodeClient.Contains(parm.Query)) - // .Or(it => it.LocationCode.Contains(parm.Query)) - ; + // .Or(it => it.LocationCode.Contains(parm.Query)) + ; var response = Queryable() .Where(predicate.ToExpression()) @@ -301,18 +368,27 @@ namespace ZR.Service.mes.wms foreach (WmGoodsNowProductionDictDto item in response.Result) { - WmMaterial material = Context.Queryable() - .Where(it => it.Partnumber == item.Partnumber) - .First(); + WmMaterial material = Context + .Queryable() + .Where(it => it.Partnumber == item.Partnumber) + .First(); if (material == null) { item.Description = "此零件号不在物料清单内!"; } else { - item.Description = !string.IsNullOrEmpty(material.Description) ? material.Description : material.ProductName; + item.Description = !string.IsNullOrEmpty(material.Description) + ? material.Description + : material.ProductName; } - string label = "批次号:" + item.PackageCodeClient + " 零件号:" + item.Partnumber + " 描述:" + item.Description; + string label = + "批次号:" + + item.PackageCodeClient + + " 零件号:" + + item.Partnumber + + " 描述:" + + item.Description; var value = new { Id = item.Id, @@ -325,12 +401,8 @@ namespace ZR.Service.mes.wms }; item.Value = value; item.Label = label; - } return response; } } - - - -} \ No newline at end of file +} diff --git a/ZR.Service/mes/wms/WmGoodsOutProductionService.cs b/ZR.Service/mes/wms/WmGoodsOutProductionService.cs index 16d793eb..a461151b 100644 --- a/ZR.Service/mes/wms/WmGoodsOutProductionService.cs +++ b/ZR.Service/mes/wms/WmGoodsOutProductionService.cs @@ -1,6 +1,6 @@ +using System; using Infrastructure.Attribute; using SqlSugar; -using System; using ZR.Model.MES.wms; using ZR.Model.MES.wms.Dto; using ZR.Service.mes.wms.IService; @@ -10,8 +10,13 @@ namespace ZR.Service.mes.wms /// /// 出库货物记录表Service业务层处理 /// - [AppService(ServiceType = typeof(IWmGoodsOutProductionService), ServiceLifetime = LifeTime.Transient)] - public class WmGoodsOutProductionService : BaseService, IWmGoodsOutProductionService + [AppService( + ServiceType = typeof(IWmGoodsOutProductionService), + ServiceLifetime = LifeTime.Transient + )] + public class WmGoodsOutProductionService + : BaseService, + IWmGoodsOutProductionService { /// /// 查询出库货物记录表列表 @@ -21,24 +26,55 @@ namespace ZR.Service.mes.wms public (List, int) GetList(WmGoodsOutProductionQueryDto parm) { int total = 0; - var predicate = Expressionable.Create() - .AndIF(!string.IsNullOrEmpty(parm.Partnumber), wgo => wgo.Partnumber.Contains(parm.Partnumber)) - .AndIF(!string.IsNullOrEmpty(parm.PackageCodeClient), wgo => wgo.PackageCodeClient.Contains(parm.PackageCodeClient)) - .AndIF(!string.IsNullOrEmpty(parm.LocationCode), wgo => wgo.LocationCode.Contains(parm.LocationCode)) - .AndIF(!string.IsNullOrEmpty(parm.FkOutOrderId), wgo => wgo.FkOutOrderId.Contains(parm.FkOutOrderId)) - ; + List partnumberByDescription = new(); + if (parm != null && !string.IsNullOrEmpty(parm.Description)) + { + partnumberByDescription = Context + .Queryable() + .Where(it => it.Description.Contains(parm.Description)) + .Select(it => it.Partnumber) + .ToList(); + } + var predicate = Expressionable + .Create() + .AndIF( + !string.IsNullOrEmpty(parm.Partnumber), + wgo => wgo.Partnumber.Contains(parm.Partnumber) + ) + .AndIF( + partnumberByDescription.Count > 0, + wgo => partnumberByDescription.Contains(wgo.Partnumber) + ) + .AndIF( + !string.IsNullOrEmpty(parm.PackageCodeClient), + wgo => wgo.PackageCodeClient.Contains(parm.PackageCodeClient) + ) + .AndIF( + !string.IsNullOrEmpty(parm.LocationCode), + wgo => wgo.LocationCode.Contains(parm.LocationCode) + ) + .AndIF(parm.OutTimeStart != null, wgo => wgo.OutTime > parm.OutTimeStart) + .AndIF(parm.OutTimeEnd != null, wgo => wgo.OutTime < parm.OutTimeEnd) + .AndIF( + !string.IsNullOrEmpty(parm.FkOutOrderId), + wgo => wgo.FkOutOrderId.Contains(parm.FkOutOrderId) + ); + //TODO 添加了Distinct去重 var response = Queryable() .LeftJoin((wgo, wml) => wgo.Partnumber == wml.Partnumber) .Where(predicate.ToExpression()) - .Select((wgo, wml) => new WmGoodsOutProductionDto { Description = wml.Description }, true) + .Select( + (wgo, wml) => new WmGoodsOutProductionDto { Description = wml.Description }, + true + ) .MergeTable() + .Distinct() .OrderBy(wml => wml.OutTime, OrderByType.Desc) .ToPageList(parm.PageNum, parm.PageSize, ref total); return (response, total); } - /// /// 获取详情 /// @@ -46,9 +82,7 @@ namespace ZR.Service.mes.wms /// public WmGoodsOutRecord GetInfo(string Id) { - var response = Queryable() - .Where(x => x.Id == Id) - .First(); + var response = Queryable().Where(x => x.Id == Id).First(); return response; } @@ -61,8 +95,10 @@ namespace ZR.Service.mes.wms public WmGoodsOutRecord AddWmGoodsOutProduction(WmGoodsOutRecord model) { // 检查成品库数据是否存在 - bool hasRecord = Context.Queryable() - .Where(it => it.Id == model.FkNowProductionId).Any(); + bool hasRecord = Context + .Queryable() + .Where(it => it.Id == model.FkNowProductionId) + .Any(); if (!hasRecord) { throw new Exception("请检查该箱是否已完全出库,或已添加出库记录!"); @@ -73,7 +109,7 @@ namespace ZR.Service.mes.wms } if (string.IsNullOrEmpty(model.Id)) { - model.Id = SnowFlakeSingle.Instance.NextId().ToString();//也可以在程序中直接获取ID + model.Id = SnowFlakeSingle.Instance.NextId().ToString(); //也可以在程序中直接获取ID } //2. 根据成品仓库id修改记录 @@ -86,11 +122,17 @@ namespace ZR.Service.mes.wms } if (updateModel.GoodsNumAction == 0) { - Context.Deleteable().Where(it => it.Id == updateModel.Id).ExecuteCommand(); + Context + .Deleteable() + .Where(it => it.Id == updateModel.Id) + .ExecuteCommand(); } else { - Context.Updateable(updateModel).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + Context + .Updateable(updateModel) + .IgnoreColumns(ignoreAllNullColumns: true) + .ExecuteCommand(); } return Context.Insertable(model).ExecuteReturnEntity(); } @@ -132,32 +174,38 @@ namespace ZR.Service.mes.wms var list = parm.Ids; for (int i = 0; i < list.Count; i++) { - WmGoodsNowProduction nowProduction = Context.Queryable() - .Where(it => it.Id == list[i]).First(); + WmGoodsNowProduction nowProduction = Context + .Queryable() + .Where(it => it.Id == list[i]) + .First(); if (nowProduction == null) { continue; } - WmGoodsOutRecord outRecord = new() - { - Id = SnowFlakeSingle.Instance.NextId().ToString(), - FkNowProductionId = nowProduction.Id, - FkOutOrderId = parm.FkOutOrderId, - PackageCode = nowProduction.PackageCode, - PackageCodeClient = nowProduction.PackageCodeClient, - PackageCodeOriginal = nowProduction.PackageCodeOriginal, - LocationCode = nowProduction.LocationCode, - Partnumber = nowProduction.Partnumber, - GoodsNumAction = nowProduction.GoodsNumAction, - GoodsNumLogic = nowProduction.GoodsNumAction, - EntryWarehouseTime = nowProduction.EntryWarehouseTime, - OutTime = time, - Remark = "批量出库", - CreatedBy = parm.CreatedBy ?? "batch", - CreatedTime = time, - }; + WmGoodsOutRecord outRecord = + new() + { + Id = SnowFlakeSingle.Instance.NextId().ToString(), + FkNowProductionId = nowProduction.Id, + FkOutOrderId = parm.FkOutOrderId, + PackageCode = nowProduction.PackageCode, + PackageCodeClient = nowProduction.PackageCodeClient, + PackageCodeOriginal = nowProduction.PackageCodeOriginal, + LocationCode = nowProduction.LocationCode, + Partnumber = nowProduction.Partnumber, + GoodsNumAction = nowProduction.GoodsNumAction, + GoodsNumLogic = nowProduction.GoodsNumAction, + EntryWarehouseTime = nowProduction.EntryWarehouseTime, + OutTime = time, + Remark = "批量出库", + CreatedBy = parm.CreatedBy ?? "batch", + CreatedTime = time, + }; Context.Insertable(outRecord).ExecuteCommand(); - Context.Deleteable().Where(it => it.Id == nowProduction.Id).ExecuteCommand(); + Context + .Deleteable() + .Where(it => it.Id == nowProduction.Id) + .ExecuteCommand(); } } else if (type == 2) @@ -172,39 +220,47 @@ namespace ZR.Service.mes.wms { return "请输入至少8位批次号编码,以保证正确批次出库!"; } - List nowProductionList = Context.Queryable() - .Where(it => it.PackageCodeClient.Contains(shortPackageCode)).ToList(); + List nowProductionList = Context + .Queryable() + .Where(it => it.PackageCodeClient.Contains(shortPackageCode)) + .ToList(); for (int i = 0; i < nowProductionList.Count; i++) { - WmGoodsNowProduction nowProduction = Context.Queryable() - .Where(it => it.Id == nowProductionList[i].Id).First(); + WmGoodsNowProduction nowProduction = Context + .Queryable() + .Where(it => it.Id == nowProductionList[i].Id) + .First(); if (nowProduction == null) { continue; } - WmGoodsOutRecord outRecord = new() - { - Id = SnowFlakeSingle.Instance.NextId().ToString(), - FkNowProductionId = nowProduction.Id, - FkOutOrderId = parm.FkOutOrderId, - PackageCode = nowProduction.PackageCode, - PackageCodeClient = nowProduction.PackageCodeClient, - PackageCodeOriginal = nowProduction.PackageCodeOriginal, - LocationCode = nowProduction.LocationCode, - Partnumber = nowProduction.Partnumber, - GoodsNumAction = nowProduction.GoodsNumAction, - GoodsNumLogic = nowProduction.GoodsNumAction, - EntryWarehouseTime = nowProduction.EntryWarehouseTime, - OutTime = time, - Remark = "批量出库", - CreatedBy = parm.CreatedBy ?? "batch", - CreatedTime = time, - }; + WmGoodsOutRecord outRecord = + new() + { + Id = SnowFlakeSingle.Instance.NextId().ToString(), + FkNowProductionId = nowProduction.Id, + FkOutOrderId = parm.FkOutOrderId, + PackageCode = nowProduction.PackageCode, + PackageCodeClient = nowProduction.PackageCodeClient, + PackageCodeOriginal = nowProduction.PackageCodeOriginal, + LocationCode = nowProduction.LocationCode, + Partnumber = nowProduction.Partnumber, + GoodsNumAction = nowProduction.GoodsNumAction, + GoodsNumLogic = nowProduction.GoodsNumAction, + EntryWarehouseTime = nowProduction.EntryWarehouseTime, + OutTime = time, + Remark = "批量出库", + CreatedBy = parm.CreatedBy ?? "batch", + CreatedTime = time, + }; Context.Insertable(outRecord).ExecuteCommand(); - Context.Deleteable().Where(it => it.Id == nowProduction.Id).ExecuteCommand(); + Context + .Deleteable() + .Where(it => it.Id == nowProduction.Id) + .ExecuteCommand(); } } return "ok"; } } -} \ No newline at end of file +}