Prechádzať zdrojové kódy

修改根据产品属性查询逻辑

klzhangweiya 3 rokov pred
rodič
commit
8b5cb490f2

+ 118 - 28
src_0nline/ShwasherSys/ShwasherSys.Application/Common/QueryAppService.cs

@@ -7,6 +7,7 @@ using System.Linq.Dynamic.Core;
 using System.Reflection;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
+using System.Web.Http.Results;
 using System.Web.Mvc;
 using System.Web.UI.WebControls;
 using System.Xml;
@@ -733,8 +734,15 @@ namespace ShwasherSys.Common
         {
             identityResult.CheckErrors(LocalizationManager);
         }
+        protected virtual void CheckErrors(String error)
+        {
+	        var identityResult = IdentityResult.Failed(error);
+	        CheckErrors(identityResult);
 
-        public ShortMessage GetShortMsgDetailInfo(ShortMsgDetailDto input)
+			 
+			//identityResult.CheckErrors(LocalizationManager);
+		}
+		public ShortMessage GetShortMsgDetailInfo(ShortMsgDetailDto input)
         {
             var entity = ShortMessageRepository.FirstOrDefault(input.MsgID);
             var detailInfo = ShortMsgDetailRepository.FirstOrDefault(input.Id);
@@ -1261,6 +1269,32 @@ namespace ShwasherSys.Common
 
 		#region 2023
 
+		private void GetPropertiesNo(List<MultiSearchDto> searchList,ref string modelNo, ref string materialNo, ref string rigidityNo, ref string surfaceColorNo)
+		{
+			foreach (var o in searchList)
+			{
+				if (o.KeyWords.IsNullOrEmpty())
+					continue;
+				object keyWords = o.KeyWords;
+				if (o.KeyField?.ToLower() == "modelno")
+				{
+					modelNo = keyWords.ToString();
+				}
+				if (o.KeyField?.ToLower() == "materialno")
+				{
+					materialNo = keyWords.ToString();
+				}
+				if (o.KeyField?.ToLower() == "rigidityno")
+				{
+					rigidityNo = keyWords.ToString();
+				}
+				if (o.KeyField?.ToLower() == "surfacecolorno")
+				{
+					surfaceColorNo = keyWords.ToString();
+				}
+			}
+		}
+
 		public async Task<PagedResultDto<ProductionOrderDto>> QueryProductionOrderDtoByProNo(PagedRequestDto input)
 		{
 			var query = ProductionOrderRepository.GetAll();
@@ -1309,16 +1343,29 @@ namespace ShwasherSys.Common
 			var searchList = input.SearchList;
 			if (searchList != null && searchList.Count > 0)
 			{
-				List<LambdaObject> objList = new List<LambdaObject>();
-				foreach (var o in searchList)
+				//List<LambdaObject> objList = new List<LambdaObject>();
+				string modelNo = "", materialNo = "", rigidityNo = "", surfaceColorNo = "";
+				GetPropertiesNo(searchList,ref modelNo, ref materialNo, ref rigidityNo, ref surfaceColorNo);
+				if (modelNo.IsNullOrEmpty())
 				{
-					if (o.KeyWords.IsNullOrEmpty())
-						continue;
-					object keyWords = o.KeyWords;
-					if (o.KeyField?.ToLower() == "productno")
-                    {
-						result = result.Where(a => a.SemiProductNo.StartsWith(o.KeyWords));
-					}
+                    CheckErrors("规格不能为空!");
+				}
+ 
+				
+                //111,110,100,000
+				if ((materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty())||(!materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty())|| (!materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty()) || (!materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty()))
+				{
+					result = result.Where(i => i.SemiProductNo.StartsWith("s" + modelNo + materialNo + rigidityNo + surfaceColorNo));
+					
+				}//101,001,011
+				else if((!materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty()) || (materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty()) || (materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty()))
+				{
+					result = result.Where(i => i.SemiProductNo.StartsWith("s" + modelNo + materialNo) && i.SemiProductNo.Contains(rigidityNo + surfaceColorNo));
+				}//010
+				else if (materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty())
+				{
+					result = result.Where(i => i.SemiProductNo.StartsWith("s" + modelNo));
+					result = result.Where(i => i.SemiProductNo.Contains(  rigidityNo));
 				}
 			}
 			var totalCount = await AsyncQueryableExecuter.CountAsync(result);
@@ -1339,16 +1386,38 @@ namespace ShwasherSys.Common
 			var searchList = input.SearchList;
 			if (searchList != null && searchList.Count > 0)
 			{
-				List<LambdaObject> objList = new List<LambdaObject>();
-				foreach (var o in searchList)
+				//List<LambdaObject> objList = new List<LambdaObject>();
+				//foreach (var o in searchList)
+				//{
+				//	if (o.KeyWords.IsNullOrEmpty())
+				//		continue;
+				//	object keyWords = o.KeyWords;
+				//	if (o.KeyField?.ToLower() == "productno")
+				//	{
+				//		query = query.Where(a => a.ProductNo.StartsWith(o.KeyWords));
+				//	}
+				//}
+				string modelNo = "", materialNo = "", rigidityNo = "", surfaceColorNo = "";
+				GetPropertiesNo(searchList, ref modelNo, ref materialNo, ref rigidityNo, ref surfaceColorNo);
+				if (modelNo.IsNullOrEmpty())
 				{
-					if (o.KeyWords.IsNullOrEmpty())
-						continue;
-					object keyWords = o.KeyWords;
-					if (o.KeyField?.ToLower() == "productno")
-					{
-						query = query.Where(a => a.ProductNo.StartsWith(o.KeyWords));
-					}
+					CheckErrors("规格不能为空!");
+                }
+				
+                //111,110,100,000
+				if ((materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty()) || (!materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty()) || (!materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty()) || (!materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty()))
+                {
+	                query = query.Where(i => i.ProductNo.StartsWith("s" + modelNo + materialNo + rigidityNo + surfaceColorNo));
+                }//101,001,011
+				else if ((!materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty()) || (materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty()) || (materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty()))
+                {
+	                query = query.Where(i => i.ProductNo.StartsWith("s" + modelNo + materialNo) && i.ProductNo.Contains(rigidityNo + surfaceColorNo));
+	                //query = query.Where(i => i.ProductNo.EndsWith(rigidityNo + surfaceColorNo));
+                }//010
+                else if (materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty())
+                {
+	                query = query.Where(i => i.ProductNo.StartsWith("s" + modelNo));
+					query = query.Where(i => i.ProductNo.Contains(rigidityNo));
 				}
 			}
 
@@ -1369,16 +1438,37 @@ namespace ShwasherSys.Common
 			var searchList = input.SearchList;
 			if (searchList != null && searchList.Count > 0)
 			{
-				List<LambdaObject> objList = new List<LambdaObject>();
-				foreach (var o in searchList)
+				//List<LambdaObject> objList = new List<LambdaObject>();
+				//foreach (var o in searchList)
+				//{
+				//	if (o.KeyWords.IsNullOrEmpty())
+				//		continue;
+				//	object keyWords = o.KeyWords;
+				//	if (o.KeyField?.ToLower() == "productno")
+				//	{
+				//		query = query.Where(a => a.SemiProductNo.StartsWith(o.KeyWords));
+				//	}
+				//}
+				string modelNo = "", materialNo = "", rigidityNo = "", surfaceColorNo = "";
+				GetPropertiesNo(searchList, ref modelNo, ref materialNo, ref rigidityNo, ref surfaceColorNo);
+				if (modelNo.IsNullOrEmpty())
+				{
+					CheckErrors("规格不能为空!");
+				}
+				
+				//111,110,100,000
+				if ((materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty()) || (!materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty()) || (!materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty()) || (!materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty()))
+				{
+					query = query.Where(i => i.SemiProductNo.StartsWith("s" + modelNo + materialNo + rigidityNo + surfaceColorNo));
+				}//101,001,011
+				else if ((!materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty()) || (materialNo.IsNullOrEmpty() && rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty()) || (materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && !surfaceColorNo.IsNullOrEmpty()))
+				{
+					query = query.Where(i => i.SemiProductNo.StartsWith("s" + modelNo + materialNo)&& i.SemiProductNo.Contains(rigidityNo + surfaceColorNo));
+				}//010
+				else if (materialNo.IsNullOrEmpty() && !rigidityNo.IsNullOrEmpty() && surfaceColorNo.IsNullOrEmpty())
 				{
-					if (o.KeyWords.IsNullOrEmpty())
-						continue;
-					object keyWords = o.KeyWords;
-					if (o.KeyField?.ToLower() == "productno")
-					{
-						query = query.Where(a => a.SemiProductNo.StartsWith(o.KeyWords));
-					}
+					query = query.Where(i => i.SemiProductNo.StartsWith("s" + modelNo));
+					query = query.Where(i => i.SemiProductNo.Contains(rigidityNo));
 				}
 			}
 			query = query.Where(i => i.ActualQuantity > 0);

+ 1 - 0
src_0nline/ShwasherSys/ShwasherSys.Application/OrderSendInfo/Dto/OrderSendBillCreateDto.cs

@@ -12,6 +12,7 @@ namespace ShwasherSys.OrderSendInfo.Dto
         public string Id { get; set; }
         [Required]
         public string OrderSendIds { get; set; }
+
         [Required] 
         [StringLength(OrderSendBill.CustomerIdMaxLength)]
 		public string CustomerId  { get; set; }

+ 4 - 4
src_0nline/ShwasherSys/ShwasherSys.Web/Views/OrderInfo/OrderStatusMg.cshtml

@@ -1676,10 +1676,10 @@ new SearchItem("saleMan", "业务员",showField:"saleManName").SetSearchIcon("qu
             } else {
                 result += '<span class="label label-danger">' + name + '</span>';
             }
-            //result +=
-            //    `<span class="label label-success" style="text-decoration:underline;margin-left:2px;" onclick="showProductProcess(${r.id
-            //    })">当前进度</span>`;
-			result += `<span class="label label-success" style="text-decoration:underline;margin-left:2px;" onclick="showSelectProductDialog('${r.productNo}')">生产进度</span>`;
+            result +=
+                `<span class="label label-success" style="text-decoration:underline;margin-left:2px;" onclick="showProductProcess(${r.id
+                })">生产进度</span>`;
+			result += `<span class="label label-success" style="text-decoration:underline;margin-left:2px;" onclick="showSelectProductDialog('${r.productNo}')">产品查询</span>`;
             return result;
         }
         

+ 30 - 22
src_0nline/ShwasherSys/ShwasherSys.Web/Views/OrderInfo/js/OrderMg.js

@@ -24,7 +24,8 @@ function showSelectProductDialog(pNo) {
 				let rigidityNo = getNumByProductNo(productNo, 3);
 				let surfaceColor = res.surfaceColor;// $("#SurfaceColor").val();
 				let surfaceColorNo = getNumByProductNo(productNo, 4);
-				tmpSearch[0].KeyWords = 's' + modelNo;
+				//tmpSearch[0].KeyWords = 's' + modelNo;
+				tmpSearch[0].KeyWords = modelNo;
 				if (isFirstEnter) {
 					initQueryTable();
 				} else {
@@ -43,24 +44,25 @@ function showSelectProductDialog(pNo) {
 
 				$('.tool-rc-group input[name="propType"]').on('change',
 					function (e) {
-						let $checkbox = $(this);
-						let flag = $checkbox.is(':checked');
-						let $as = $('.tool-rc-group input[name="propType"]');
-						if (flag) {
-							$.each($as,
-								function (i, v) {
-									if ($(v).data('index') < $checkbox.data('index')) {
-										$(v).prop("checked", "checked");
-									}
-								});
-						} else {
-							$.each($as,
-								function (i, v) {
-									if ($(v).data('index') > $checkbox.data('index')) {
-										$(v).prop("checked", false);
-									}
-								});
-						}
+						//let $checkbox = $(this);
+						//let flag = $checkbox.is(':checked');
+						//let $as = $('.tool-rc-group input[name="propType"]');
+						//if (flag) {
+						//	$.each($as,
+						//		function (i, v) {
+						//			if ($(v).data('index') < $checkbox.data('index')) {
+						//				$(v).prop("checked", "checked");
+						//			}
+						//		});
+						//} else {
+						//	$.each($as,
+						//		function (i, v) {
+						//			if ($(v).data('index') > $checkbox.data('index')) {
+						//				$(v).prop("checked", false);
+						//			}
+						//		});
+						//}
+						
 						searchProductInfo();
 						e.stopPropagation();
 					});
@@ -124,7 +126,10 @@ function LoadTable1(option) {
 //item
 var $tableProductionOrder, $tableProductStore, $tableSemiStore;
 var tmpSearch = [
-	{ KeyWords: "0", KeyField: "ProductNo", FieldType: "1", ExpType: "0" }
+	{ KeyWords: "", KeyField: "modelNo", FieldType: "1", ExpType: "0" },
+	{ KeyWords: "", KeyField: "materialNo", FieldType: "1", ExpType: "0" },
+	{ KeyWords: "", KeyField: "rigidityNo", FieldType: "1", ExpType: "0" },
+	{ KeyWords: "", KeyField: "surfaceColorNo", FieldType: "1", ExpType: "0" }
 ];
 function searchProductInfo() {
 	isFirstEnter = false;
@@ -133,11 +138,14 @@ function searchProductInfo() {
 	$.each($as,
 		function (i, v) {
 			if ($(v).is(':checked')) {
-				proNo += $(v).val();
+				//proNo += $(v).val();
+				tmpSearch[i].KeyWords = $(v).val();
+			} else {
+				tmpSearch[i].KeyWords = "";
 			}
 		});
 	console.log('proNo', proNo);
-	tmpSearch[0].KeyWords = 's' + proNo;
+	//tmpSearch[0].KeyWords = 's' + proNo;
 	$tableProductionOrder.iwbTable('setSearchList', tmpSearch);
 	$tableProductionOrder.iwbTable('refresh');
 	$tableProductStore.iwbTable('setSearchList', tmpSearch);