ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/inbound/inboundOrder.vue
@@ -335,14 +335,13 @@ align: "left", bind: { key: "orderDetailStatusEnum", data: [] }, }, // { // field: "returnToMESStatus", // title: "åä¼ ç¶æ", // type: "string", // width: 90, // align: "left", // bind: { key: "returnStatus", data: [{ key: 0, value: "æªåä¼ " }, { key: 1, value: "å·²åä¼ æå" }, { key: 2, value: "åä¼ å¤±è´¥" }] } // }, { field: "palletCode", title: "å·²ç»æçå·", type: "string", width: 100, align: "left", }, { field: "creater", title: "å建人", ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs
@@ -453,19 +453,138 @@ Type t = typeof(TEntity); if (pageData.Value == null) return new PageGridData<object>(total: 0, null); string keyName = t.GetKeyName(); ////çææ¥è¯¢æ¡ä»¶ //Expression<Func<TEntity, bool>> whereExpression = keyName.CreateExpression<TEntity>(pageData.Value, LinqExpressionType.Equal); int totalCount = 0; PropertyInfo propertyInfo = t.GetProperties().FirstOrDefault(x => x.GetCustomAttribute<Navigate>() != null); List<ExpandoObject> detailList = new List<ExpandoObject>(); if (propertyInfo != null) { Type detailType = propertyInfo.PropertyType.GetGenericArguments()[0]; Navigate navigate = propertyInfo.GetCustomAttribute<Navigate>(); List<ExpandoObject> list = BaseDal.Db.Queryable(detailType.Name, "detail").Where(navigate.GetName(), "=", pageData.Value).ToPageList(pageData.Page, pageData.Rows, ref totalCount); return new PageGridData<ExpandoObject>(totalCount, list); detailList = BaseDal.Db.Queryable(detailType.Name, "detail") .Where(navigate.GetName(), "=", pageData.Value) .ToPageList(pageData.Page, pageData.Rows, ref totalCount); if (detailList.Any()) { // 1. æåæç»ææbarcode List<string> allBarcodes = new List<string>(); foreach (var expando in detailList) { var detailDict = (IDictionary<string, object>)expando; if (detailDict.ContainsKey("barcode") && detailDict["barcode"] != null) { string barcodeValue = (detailDict["barcode"] as string)?.Trim() ?? string.Empty; if (!string.IsNullOrWhiteSpace(barcodeValue)) { allBarcodes.Add(barcodeValue); } } } if (allBarcodes.Count == 0) { foreach (var expando in detailList) { var detailDict = (IDictionary<string, object>)expando; detailDict["palletCode"] = ""; } return new PageGridData<ExpandoObject>(totalCount, detailList); } // 2. æ¥åºåæç»è¡¨ï¼è·åbarcode â StockIdæ å° Dictionary<string, object> barcodeToStockIdDict = new Dictionary<string, object>(); var distinctBarcodes = allBarcodes.Distinct().ToList(); var barcodeStockIdList = BaseDal.Db.Queryable("Dt_StockInfoDetail", "sd") .In("sd.barcode", distinctBarcodes) .Select("sd.barcode, sd.StockId") .ToList(); foreach (var item in barcodeStockIdList) { if (item == null) continue; var itemDict = (IDictionary<string, object>)item; if (itemDict.ContainsKey("barcode") && itemDict["barcode"] != null) { string barcode = (itemDict["barcode"] as string)?.Trim() ?? string.Empty; object stockId = itemDict.ContainsKey("StockId") ? itemDict["StockId"] : null; if (!string.IsNullOrWhiteSpace(barcode) && !barcodeToStockIdDict.ContainsKey(barcode)) { barcodeToStockIdDict.Add(barcode, stockId); } } } if (barcodeToStockIdDict.Count == 0) { foreach (var expando in detailList) { var detailDict = (IDictionary<string, object>)expando; detailDict["palletCode"] = ""; } return new PageGridData<ExpandoObject>(totalCount, detailList); } Dictionary<object, string> stockIdToPalletDict = new Dictionary<object, string>(); var allStockIds = barcodeToStockIdDict.Values.Distinct().ToList(); var stockIdPalletList = BaseDal.Db.Queryable("Dt_StockInfo", "s") .In("s.Id", allStockIds) .Select("s.Id, s.PalletCode") .ToList(); // æå PalletCode foreach (var item in stockIdPalletList) { if (item == null) continue; var itemDict = (IDictionary<string, object>)item; if (itemDict.ContainsKey("Id") && itemDict["Id"] != null) { object stockId = itemDict["Id"]; string palletCode = itemDict.ContainsKey("PalletCode") && itemDict["PalletCode"] != null ? (itemDict["PalletCode"] as string)?.Trim() ?? string.Empty : string.Empty; if (!stockIdToPalletDict.ContainsKey(stockId)) { stockIdToPalletDict.Add(stockId, palletCode); } } } // 5. ç»æç»çpalletCodeåæ®µèµå¼ä¸»è¡¨çPalletCodeå¼ foreach (var expando in detailList) { var detailDict = (IDictionary<string, object>)expando; string palletValue = string.Empty; if (detailDict.ContainsKey("barcode") && detailDict["barcode"] != null) { string barcode = (detailDict["barcode"] as string)?.Trim() ?? string.Empty; // éè¿barcodeè·åStockId if (!string.IsNullOrWhiteSpace(barcode) && barcodeToStockIdDict.TryGetValue(barcode, out var stockId)) { // éè¿StockIdè·å主表çPalletCode stockIdToPalletDict.TryGetValue(stockId, out palletValue); } } // å¨ææ´æ°/æ·»å palletCodeåæ®µ if (detailDict.ContainsKey("palletCode")) { detailDict["palletCode"] = palletValue; } else { detailDict.Add("palletCode", palletValue); } } } } return new PageGridData<object>(total: 0, null); return new PageGridData<ExpandoObject>(totalCount, detailList); } /// <summary> ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs
@@ -12,6 +12,7 @@ using System.Data; using System.Linq; using System.Net; using System.Reflection.Metadata; using System.Text; using System.Threading.Tasks; using WIDESEA_Common.AllocateEnum; @@ -95,10 +96,12 @@ var details = _inboundOrderDetailRepository.QueryData(x => (x.OutBoxbarcodes == palletDto.Barcode|| x.Barcode == palletDto.Barcode) && x.OrderDetailStatus == (int)InOrderStatusEnum.æªå¼å§); if (details.Count() <= 0) { var inbounddetail =_inboundOrderDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode); if(inbounddetail == null) var inbounddetail = _inboundOrderDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode); if (inbounddetail == null) { return content.Error($"æ¡ç {palletDto.Barcode}ä¸åå¨"); } @@ -108,26 +111,26 @@ return content.Error("åæ®ä¸è½ä¸ºç©º"); } var detail = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().LeftJoin<Dt_InboundOrder>((d,o)=>d.OrderId==o.Id).Where((d, o) => d.OrderId == inbound.Id var detail = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().LeftJoin<Dt_InboundOrder>((d, o) => d.OrderId == o.Id).Where((d, o) => d.OrderId == inbound.Id && d.ReceiptQuantity != 0 && d.OverInQuantity == 0).Select((d, o) => new { orderNo=o.InboundOrderNo, d.Barcode, d.MaterielCode, d.BatchNo, d.ReceiptQuantity, d.Unit, d.SupplyCode, d.WarehouseCode }).ToList(); var palletId = _stockInfoDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode); { orderNo = o.InboundOrderNo, d.Barcode, d.MaterielCode, d.BatchNo, d.ReceiptQuantity, d.Unit, d.SupplyCode, d.WarehouseCode }).ToList(); var palletId = _stockInfoDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode); if (palletId == null) { return content.Error($"æ¡ç æ¡ç {palletDto.Barcode}ä¸åå¨"); return content.Error($"æ¡ç {palletDto.Barcode}å·²ç»ç"); } var pallet =_stockInfoRepository.QueryFirst(x => x.Id == palletId.StockId); return content.Error($"æ¡ç {palletDto.Barcode}å·²ç»ç»å°{pallet.PalletCode}",detail); var pallet = _stockInfoRepository.QueryFirst(x => x.Id == palletId.StockId); return content.Error($"æ¡ç {palletDto.Barcode}å·²ç»ç»å°{pallet.PalletCode}", detail); } inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Includes(x=>x.Details).Where(x => x.Id == details.First().OrderId).First(); @@ -285,7 +288,16 @@ { return content.Error("已䏿¶çæçä¸è½å次ç»ç"); } var nullpallet = _stockInfoRepository.QueryFirst(x => x.PalletType == -1 && x.PalletCode == palletDto.PalletCode); if (nullpallet != null) { return content.Error($"该æç{palletDto.PalletCode}å·²ç»è¿è¡ç©ºæç»ç,ä¸è½å¨è¿è¡ç»ç"); } var outbundPallet = _stockInfoRepository.QueryFirst(x => x.StockStatus == (int)StockStatusEmun.åºåºå®æ && x.PalletCode == palletDto.PalletCode); if (outbundPallet != null) { return content.Error($"该æç{palletDto.PalletCode}æªè¿è¡å空箱,ä¸è½è¿è¡ç»ç"); } if (_stockService.StockInfoDetailService.ExistBarcodes(palletDto.Barcode)) { return content.Error($"{palletDto.Barcode} æ¡ç å¨åºåä¸å·²åå¨"); @@ -927,5 +939,8 @@ return content.Error(ex.Message); } } } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_AllocateOrderDetail.cs
@@ -131,5 +131,11 @@ [SugarColumn(IsNullable = true, ColumnDescription = "è¿ææ¥æ")] public DateTime ValidDate { get; set; } /// <summary> /// æçç¼å· /// </summary> [SugarColumn(IsIgnore = true, IsNullable = true)] public string Pallet { get; set; } } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_InboundOrderDetail.cs
@@ -151,5 +151,11 @@ /// </summary> [SugarColumn(IsNullable = true, ColumnDescription = "è¿ææ¥æ")] public DateTime ValidDate { get; set; } /// <summary> /// æçç¼å· /// </summary> [SugarColumn(IsIgnore = true, IsNullable = true)] public string Pallet { get; set; } } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs
@@ -399,6 +399,40 @@ string returnToMESStatus = returnToMESStatusParam.Value.ToString().Trim(); sugarQueryable1 = sugarQueryable1.Where(x => x.ReturnToMESStatus.Equals(returnToMESStatus)); } var createDateParams = searchParametersList .Where(x => x.Name.Equals("createDate", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(x.Value?.ToString())) .ToList(); DateTime? minCreateDate = null; DateTime? maxCreateDate = null; foreach (var dateParam in createDateParams) { if (DateTime.TryParse(dateParam.Value.ToString(), out DateTime dateValue)) { LinqExpressionType expressionType = dateParam.DisplayType.GetLinqCondition(); switch (expressionType) { case LinqExpressionType.ThanOrEqual: minCreateDate = dateValue; break; case LinqExpressionType.LessThanOrEqual: maxCreateDate = dateValue; break; } } } if (minCreateDate.HasValue) { sugarQueryable1 = sugarQueryable1.Where(x => x.CreateDate >= minCreateDate.Value); } if (maxCreateDate.HasValue) { sugarQueryable1 = sugarQueryable1.Where(x => x.CreateDate <= maxCreateDate.Value); } } } catch { }