From 51f7eb771322a65ee552ca9b60280632f72760e6 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期三, 15 十月 2025 16:55:08 +0800
Subject: [PATCH] 修改物料管理列表

---
 Wms/Model/ModelVm/SysVm/MaterialsVm.cs      |   16 ++
 HTML/views/BaseSetting/Materials.html       |  204 ++++++++++++---------------------
 Wms/WMS.BLL/SysServer/CustomerServer.cs     |    2 
 Wms/WMS.BLL/SysServer/MaterialsServer.cs    |   71 ++++++++---
 Wms/Model/InterFaceModel/HttpModel.cs       |    4 
 Wms/Wms/Controllers/BasisController.cs      |   12 +
 Wms/WMS.IBLL/ISysServer/IMaterialsServer.cs |    4 
 7 files changed, 159 insertions(+), 154 deletions(-)

diff --git a/HTML/views/BaseSetting/Materials.html b/HTML/views/BaseSetting/Materials.html
index 0d65c55..b329135 100644
--- a/HTML/views/BaseSetting/Materials.html
+++ b/HTML/views/BaseSetting/Materials.html
@@ -222,6 +222,7 @@
 				laypage = layui.laypage,
 				layer = layui.layer;
 
+			var $ = layui.$;
 			var h1 = GetTableHeight();
 			refreshTable("", "", "", "", "", "", "", "");
 			var tableIns;
@@ -251,132 +252,22 @@
 					CategoryNo: CategoryNo
 				};
 
-				var url = "/Basis/GetMateList?SkuNo=" + SkuNo + "&&SkuName=" + SkuName + "&&AuditStatusNo=" + AuditStatusNo + "&&Type=" + Type + "&&IsControlled=" + IsControlled + "&&IsInspect=" + IsInspect + "&&Environment=" + Environment + "&CategoryNo=" + CategoryNo;
-				sendData(IP + url, {}, 'get', function (res) {
-					if (res.code == 0) //鎴愬姛
-					{
-						var list = res.data;
-						$.extend(infoOptions, {
-							data: list
-						});
-						infoOptions.page = {
-							curr: 1
-						}
-						tableIns = table.render(infoOptions);
-					}
-					else //涓嶆垚鍔�
-					{
-						layer.msg('鑾峰彇鐗╂枡鍒楄〃淇℃伅澶辫触锛�', {
-							icon: 2,
-							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-						}, function () { });
-					}
-				});
-				sendData(IP + "/basis/GetRoleRightList", {}, "get", function (res) {
-					$(function () {
-						$(".approvalBtn").hide();
-					});
-					$(function () {
-						$(".approvalBtndel").hide();
-					});
-					$(function () {
-						$(".approvalBtnupt").hide();
-					});
-					if (res.code == 0) //鎴愬姛
-					{
-						for (var k = 0; k < res.data.length; k++) {
-							if (res.data[k].MenuName == "娣诲姞鐗╂枡") {
-								$(function () {
-									$(".approvalBtn").show();
-								});
-							}
-							if (res.data[k].MenuName == "鍒犻櫎鐗╂枡") {
-								$(function () {
-									$(".approvalBtndel").show();
-								});
-							}
-							if (res.data[k].MenuName == "缂栬緫鐗╂枡") {
-								$(function () {
-									$(".approvalBtnupt").show();
-								});
-							}
-						}
-					}
-					else //涓嶆垚鍔�
-					{
-						layer.msg(
-							"鑾峰彇淇℃伅澶辫触",
-							{
-								icon: 2,
-								time: 2000, //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-							},
-							function () {
-								//鍥炶皟
-							}
-						);
-					}
-				});
-			}
-
-
-
-			sendData(IP + "/basis/GetRoleRightList", {}, "get", function (res) {
-				$(function () {
-					$(".approvalBtn").hide();
-				});
-				$(function () {
-					$(".approvalBtndel").hide();
-				});
-				$(function () {
-					$(".approvalBtnupt").hide();
-				});
-				if (res.code == 0) //鎴愬姛
-				{
-					for (var k = 0; k < res.data.length; k++) {
-						if (res.data[k].MenuName == "娣诲姞鐗╂枡") {
-							$(function () {
-								$(".approvalBtn").show();
-							});
-						}
-						if (res.data[k].MenuName == "鍒犻櫎鐗╂枡") {
-							$(function () {
-								$(".approvalBtndel").show();
-							});
-						}
-						if (res.data[k].MenuName == "缂栬緫鐗╂枡") {
-							$(function () {
-								$(".approvalBtnupt").show();
-							});
-						}
-					}
-				}
-				else //涓嶆垚鍔�
-				{
-					layer.msg(
-						"鑾峰彇淇℃伅澶辫触",
-						{
-							icon: 2,
-							time: 2000, //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-						},
-						function () {
-							//鍥炶皟
-						}
-					);
-				}
-			});
-
-
-			var infoOptions = {
-				elem: "#LAY-app-content-list",
-				height: h1,
-				id: "LAY-app-content-list",
-				page: true,
-				limit: pageCnt,
-				limits: pageLimits,
-				even: true,
-				cellMinWidth: 80, //鍏ㄥ眬瀹氫箟甯歌鍗曞厓鏍肩殑鏈�灏忓搴︼紝layui 2.2.1 鏂板
-				cols:
-					[[
+				table.render({
+					elem: '#LAY-app-content-list',
+					url: IP +"/Basis/GetMateList",
+					method: 'POST',
+					height: h1,//'full-'+hei1
+					id: 'LAY-app-content-list',
+					where: param,
+					contentType: 'application/json',
+					headers: { ToKen: $.cookie('token') },
+					page: true,
+					even: true,
+					limit: pageCnt,
+					limits: pageLimits,
+					cellMinWidth: 60, //鍏ㄥ眬瀹氫箟甯歌鍗曞厓鏍肩殑鏈�灏忓搴︼紝layui 2.2.1 鏂板
+					even: true,
+					cols: [[
 						{
 							title: '搴忓彿', type: 'numbers', fixed: 'left', width: 65
 						},
@@ -448,8 +339,65 @@
 						{
 							title: '鎿嶄綔', fixed: 'right', align: 'center', toolbar: '#table-content-list', width: 170
 						}
-					]],
-			};
+					]],parseData: function(res) { // 鏁版嵁瑙f瀽鍥炶皟
+    console.log('鍘熷杩斿洖鏁版嵁:', res);
+    return {
+      "code": res.code, // 瑙f瀽鎺ュ彛鐘舵��
+      "msg": res.msg, // 瑙f瀽鎻愮ず鏂囨湰
+      "count": res.count, // 瑙f瀽鏁版嵁闀垮害
+      "data": res.data // 瑙f瀽鏁版嵁鍒楄〃
+    };
+  },
+				});
+				
+			}
+
+
+
+			sendData(IP + "/basis/GetRoleRightList", {}, "get", function (res) {
+				$(function () {
+					$(".approvalBtn").hide();
+				});
+				$(function () {
+					$(".approvalBtndel").hide();
+				});
+				$(function () {
+					$(".approvalBtnupt").hide();
+				});
+				if (res.code == 0) //鎴愬姛
+				{
+					for (var k = 0; k < res.data.length; k++) {
+						if (res.data[k].MenuName == "娣诲姞鐗╂枡") {
+							$(function () {
+								$(".approvalBtn").show();
+							});
+						}
+						if (res.data[k].MenuName == "鍒犻櫎鐗╂枡") {
+							$(function () {
+								$(".approvalBtndel").show();
+							});
+						}
+						if (res.data[k].MenuName == "缂栬緫鐗╂枡") {
+							$(function () {
+								$(".approvalBtnupt").show();
+							});
+						}
+					}
+				}
+				else //涓嶆垚鍔�
+				{
+					layer.msg(
+						"鑾峰彇淇℃伅澶辫触",
+						{
+							icon: 2,
+							time: 2000, //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						},
+						function () {
+							//鍥炶皟
+						}
+					);
+				}
+			});
 
 			//鐩戝惉鎼滅储
 			form.on('submit(LAY-app-contlist-search)', function (data) {
diff --git a/Wms/Model/InterFaceModel/HttpModel.cs b/Wms/Model/InterFaceModel/HttpModel.cs
index ebe1a0a..2f931b9 100644
--- a/Wms/Model/InterFaceModel/HttpModel.cs
+++ b/Wms/Model/InterFaceModel/HttpModel.cs
@@ -685,7 +685,7 @@
             /// <summary>
             /// 缂栧彿
             /// </summary>
-            public long customerNo { get; set; }
+            public string customerNo { get; set; }
             /// <summary>
             /// 鍚嶇О
             /// </summary>
@@ -697,7 +697,7 @@
             /// <summary>
             /// 鍦板潃
             /// </summary>
-            public string streetAddress { get; set; }
+            public string Address { get; set; }
             /// <summary>
             /// 鑱旂郴浜�
             /// </summary>
diff --git a/Wms/Model/ModelVm/SysVm/MaterialsVm.cs b/Wms/Model/ModelVm/SysVm/MaterialsVm.cs
index d34d40c..66337d3 100644
--- a/Wms/Model/ModelVm/SysVm/MaterialsVm.cs
+++ b/Wms/Model/ModelVm/SysVm/MaterialsVm.cs
@@ -22,5 +22,21 @@
         /// 鏄惁鍙楁帶
         /// </summary>
         public string IsControlled { get; set; }
+        /// <summary>
+        /// 瀹℃牳鐘舵��
+        /// </summary>
+        public string AuditStatusNo { get; set; }
+        /// <summary>
+        /// 鏄惁鍏嶆
+        /// </summary>
+        public string IsInspect { get; set; }
+        /// <summary>
+        /// 瀛樺偍鐜
+        /// </summary>
+        public string Environment { get; set; }
+        /// <summary>
+        /// 绫诲埆缂栫爜
+        /// </summary>
+        public string CategoryNo { get; set; }
     }
 }
diff --git a/Wms/WMS.BLL/SysServer/CustomerServer.cs b/Wms/WMS.BLL/SysServer/CustomerServer.cs
index 3ffd2fb..bd79575 100644
--- a/Wms/WMS.BLL/SysServer/CustomerServer.cs
+++ b/Wms/WMS.BLL/SysServer/CustomerServer.cs
@@ -197,7 +197,7 @@
                     CustomerNo = model.customerNo.ToString(),
                     CustomerName = model.customerName,
                     Type = int.Parse(model.CustomerType),
-                    Address = model.streetAddress,
+                    Address = model.Address,
                     LinkMan = model.contact,
                     Phone = model.contactMobile,
 
diff --git a/Wms/WMS.BLL/SysServer/MaterialsServer.cs b/Wms/WMS.BLL/SysServer/MaterialsServer.cs
index d23f17a..aaa6ff4 100644
--- a/Wms/WMS.BLL/SysServer/MaterialsServer.cs
+++ b/Wms/WMS.BLL/SysServer/MaterialsServer.cs
@@ -8,10 +8,13 @@
 using System.Threading.Tasks;
 using AutoMapper;
 using Model.InterFaceModel;
+using Model.ModelDto.BllSoDto;
 using Model.ModelDto.SysDto;
+using Model.ModelVm.SysVm;
 using SqlSugar;
 using Utility;
 using WMS.DAL;
+using WMS.Entity.BllSoEntity;
 using WMS.Entity.Context;
 using WMS.Entity.SysEntity;
 using WMS.IBLL.ISysServer;
@@ -19,7 +22,7 @@
 
 namespace WMS.BLL.SysServer
 {
-    public class MaterialsServer : DbHelper<SysMaterialCategory>, IMaterialsServer
+    public class MaterialsServer : DbHelper<SysMaterials>, IMaterialsServer
     {
         /// <summary>
         /// 渚濊禆娉ㄥ叆
@@ -54,25 +57,55 @@
         /// <param name="environment">瀛樺偍鐜</param>
         /// <param name="categoryNo">绫诲埆缂栫爜</param>
         /// <returns></returns>
-        public Task<List<MaterialsDto>> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo)
+        public async Task<List<MaterialsDto>> GetMateList(GetMaterialsVm model, RefAsync<int> count)
         {
-            var DA =  Db.Queryable<SysMaterials>()
-                     .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id)
-                     .LeftJoin<SysPackag>((a, b,c) => a.PackagNo == c.PackagNo)
-                     //.LeftJoin<SysUnit> ((a,b,c,d)=>a.UnitNo == d.UnitNo)
-                     .LeftJoin<SysMaterialCategory>((a,b,c,d)=>a.CategoryNo == d.CategoryNo)
-                     .Where((a,b,c,d) => a.IsDel == "0" && d.IsDel == "0" )
-                     .WhereIF(!string.IsNullOrEmpty(skuNo), a => a.SkuNo.Contains(skuNo))
-                     .WhereIF(!string.IsNullOrEmpty(skuName), a => a.SkuName.Contains(skuName))
-                     .WhereIF(!string.IsNullOrEmpty(auditStatusNo), a => a.AuditStatusNo == auditStatusNo)
-                     .WhereIF(!string.IsNullOrEmpty(type), a => a.Type == type)
-                     .WhereIF(!string.IsNullOrEmpty(isControlled), a => a.IsControlled == isControlled)
-                     .WhereIF(!string.IsNullOrEmpty(isInspect), a => a.IsInspect == isInspect)
-                     .WhereIF(!string.IsNullOrEmpty(environment), a => a.Environment == environment)
-                     .WhereIF(!string.IsNullOrEmpty(categoryNo), a => a.CategoryNo == categoryNo)
-                     .Select<MaterialsDto>((a, b, c,d) => new MaterialsDto() { CreateUserName = b.RealName,PackagName = c.PackagName }, true)
-                     .ToListAsync();
-            return DA;
+            Expression<Func<SysMaterials, bool>> item = Expressionable.Create<SysMaterials>()
+             .AndIF(!string.IsNullOrWhiteSpace(model.SkuNo), it => it.SkuNo.Contains(model.SkuNo.Trim()))
+             .AndIF(!string.IsNullOrWhiteSpace(model.SkuName), it => it.SkuNo.Contains(model.SkuName.Trim()))
+             .AndIF(!string.IsNullOrWhiteSpace(model.AuditStatusNo), it => it.AuditStatusNo == model.AuditStatusNo)
+             .AndIF(!string.IsNullOrWhiteSpace(model.Type), it => it.Type == model.Type)
+             .AndIF(!string.IsNullOrWhiteSpace(model.IsControlled), it => it.IsControlled == model.IsControlled)
+             .AndIF(!string.IsNullOrWhiteSpace(model.IsInspect), it => it.IsInspect == model.IsInspect)
+             .AndIF(!string.IsNullOrWhiteSpace(model.Environment), it => it.Environment == model.Environment)
+             .AndIF(!string.IsNullOrWhiteSpace(model.CategoryNo), it => it.CategoryNo == model.CategoryNo)
+             .And(it => it.IsDel == "0")
+             .ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
+            //Db.Aop.OnLogExecuting = (sql, data) =>
+            //{
+            //    var nl = sql;
+            //};
+            var data = await GetAllWhereAsync(item)
+               .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id && b.IsDel == "0")
+               .LeftJoin<SysPackag>((a, b, c) => a.PackagNo == c.PackagNo && c.IsDel == "0")
+               .LeftJoin<SysMaterialCategory>((a, b, c, d) => a.CategoryNo == d.CategoryNo && d.IsDel == "0")
+               .Select((a, b, c, d) => new MaterialsDto()
+               {
+                   SkuNo = a.SkuNo,
+                   SkuName = a.SkuName,
+                   Standard = a.Standard,
+                   Type = a.Type,
+                   IsControlled = a.IsControlled,
+                   IsInspect = a.IsInspect,
+                   IsPasteCode = a.IsPasteCode,
+                   Origin = a.Origin,
+                   UnitNo = a.UnitNo,
+                   PackagName = c.PackagName,
+                   Environment = a.Environment,
+                   CategoryNo = d.CategoryNo,
+                   Weight = a.Weight,
+                   Warranty = a.Warranty,
+                   UnpackWarranty = a.UnpackWarranty,
+                   AdventTime = a.AdventTime,
+                   LowInventory = a.LowInventory,
+                   Demo = a.Demo,
+                   CreateUserName = b.UserName,
+                   CreateTime = a.CreateTime
+               })
+               .Distinct()
+               .OrderByDescending(a => a.CreateTime)
+               .ToPageListAsync(model.Page, model.Limit, count);
+
+            return data;
         }
 
         /// <summary>
diff --git a/Wms/WMS.IBLL/ISysServer/IMaterialsServer.cs b/Wms/WMS.IBLL/ISysServer/IMaterialsServer.cs
index ee56bcb..8fb7165 100644
--- a/Wms/WMS.IBLL/ISysServer/IMaterialsServer.cs
+++ b/Wms/WMS.IBLL/ISysServer/IMaterialsServer.cs
@@ -4,6 +4,8 @@
 using System.Threading.Tasks;
 using Model.InterFaceModel;
 using Model.ModelDto.SysDto;
+using Model.ModelVm.SysVm;
+using SqlSugar;
 using WMS.Entity.SysEntity;
 
 namespace WMS.IBLL.ISysServer
@@ -24,7 +26,7 @@
         /// <param name="environment">瀛樺偍鐜</param>
         /// <param name="categoryNo">绫诲埆缂栫爜</param>
         /// <returns></returns>
-        Task<List<MaterialsDto>> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment,string categoryNo);
+        Task<List<MaterialsDto>> GetMateList(GetMaterialsVm model, RefAsync<int> count);
 
         /// <summary>
         /// 鏍规嵁id鏌ヨ鐗╂枡淇℃伅
diff --git a/Wms/Wms/Controllers/BasisController.cs b/Wms/Wms/Controllers/BasisController.cs
index c93cd90..efd7527 100644
--- a/Wms/Wms/Controllers/BasisController.cs
+++ b/Wms/Wms/Controllers/BasisController.cs
@@ -23,6 +23,7 @@
 using Utility;
 using Model.ModelVm.LogVm;
 using System.Diagnostics;
+using Model.ModelVm.BllSoVm;
 
 namespace Wms.Controllers
 {
@@ -617,10 +618,15 @@
         /// <param name="environment">瀛樺偍鐜</param>
         /// <param name="categoryNo">绫诲埆缂栫爜</param>
         /// <returns></returns>
-        [HttpGet]
-        public async Task<List<MaterialsDto>> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo)
+        [HttpPost]
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<IActionResult> GetMateList(GetMaterialsVm model)
         {
-            return await _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo);
+            RefAsync<int> count = new RefAsync<int>();
+            var bolls = await _mate.GetMateList(model, count);
+
+            //return new SqlSugarPagedList() { Items = bolls, Total = count };
+            return Ok(new { code = 0, count=count.Value, msg = "鐗╂枡淇℃伅", data = bolls });
         }
 
         /// <summary>

--
Gitblit v1.8.0