From 64840e4e6d97d177b8a765ba8c53888abcf86d16 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期二, 13 一月 2026 18:48:20 +0800
Subject: [PATCH] Merge branch 'htq20251215' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu into htq20251215
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 115 insertions(+), 0 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
index 4a3c19c..b7b4f4a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
@@ -31,6 +31,7 @@
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Basic;
+using WIDESEA_Model.Models.Check;
namespace WIDESEA_InboundService
{
@@ -443,6 +444,19 @@
if (allocatefeedmodel.Details.Count <= 0)
{
+ if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1))
+ {
+ inboundOrder.ReturnToMESStatus = 1;
+ }
+ else if (returnRecords.Count(x => x.ReturnStatus == 2) > 0)
+ {
+ inboundOrder.ReturnToMESStatus = 4;
+ }
+ else if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 2))
+ {
+ inboundOrder.ReturnToMESStatus = 2;
+ }
+ _inboundOrderRepository.UpdateData(inboundOrder);
return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
}
@@ -477,6 +491,19 @@
if (feedmodel.details.Count<=0)
{
+ if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1))
+ {
+ inboundOrder.ReturnToMESStatus = 1;
+ }
+ else if (returnRecords.Count(x => x.ReturnStatus == 2) > 0)
+ {
+ inboundOrder.ReturnToMESStatus = 4;
+ }
+ else if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 2))
+ {
+ inboundOrder.ReturnToMESStatus = 2;
+ }
+ _inboundOrderRepository.UpdateData(inboundOrder);
return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
}
var response = responseModel(inboundOrder, 3, feedmodel);
@@ -716,5 +743,93 @@
return content.Error(ex.Message);
}
}
+
+ public async Task<WebResponseContent> ReCheckGroupPallet(GroupPalletDto palletDto)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ (bool, string, object?) result2 = ModelValidate.ValidateModelData(palletDto);
+ if (!result2.Item1) return content.Error(result2.Item2);
+
+ var code = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Code == palletDto.WarehouseType).Select(x => x.Code).First();
+ if (string.IsNullOrEmpty(code))
+ {
+ return content.Error($"浠撳簱涓病鏈夎{palletDto.WarehouseType}缂栧彿銆�");
+ }
+
+ Dt_StockInfo? stockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync();
+
+ if (_taskRepository.QueryFirst(x => x.PalletCode == palletDto.PalletCode) != null)
+ {
+ return content.Error($"璇ユ墭鐩樺凡鐢熸垚浠诲姟");
+ }
+ if (stockInfo != null && !string.IsNullOrEmpty(stockInfo.LocationCode) && stockInfo.StockStatus != (int)StockStatusEmun.缁勭洏鏆傚瓨)
+ {
+ return content.Error("宸蹭笂鏋剁殑鎵樼洏涓嶈兘鍐嶆缁勭洏");
+ }
+
+ if (stockInfo == null)
+ {
+ stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None, LocationType = Convert.ToInt32(palletDto.locationType) };
+ stockInfo.Details = new List<Dt_StockInfoDetail>();
+ }
+
+ if (stockInfo != null && stockInfo.Details.Count > 0 && stockInfo.Details.FirstOrDefault()?.WarehouseCode != palletDto.WarehouseType)
+ {
+ return content.Error($"璇ユ墭鐩樼粍鐩樹粨搴撲负{stockInfo.Details.FirstOrDefault()?.WarehouseCode}涓庡綋鍓嶄粨搴搟palletDto.WarehouseType}涓嶄竴鑷达紝涓嶅厑璁哥粍鐩�");
+ }
+ Dt_StockInfoDetail stockInfoDetail = _stockInfoRepository.Db.Queryable<Dt_StockInfoDetail>().Where(x => x.Barcode == palletDto.Barcode && x.Status == StockStatusEmun.鎵嬪姩鍐荤粨.ObjToInt()).First();
+ if(stockInfoDetail == null)
+ {
+ return content.Error("鏈壘鍒板簱瀛樹腑閲嶆鍐荤粨鐨勬潯鐮�");
+ }
+ Dt_ReCheckOrder reCheckOrder = _stockInfoRepository.Db.Queryable<Dt_ReCheckOrder>().Where(x => x.MaterielCode == stockInfoDetail.MaterielCode && x.BatchNo == stockInfoDetail.BatchNo && x.Result == 0).First();
+ if(reCheckOrder != null)
+ {
+ return content.Error($"璇ラ噸妫�鏉$爜鐨勬壒娆″湪閲嶆鍗曚腑鏈嬁鍒伴噸妫�缁撴灉锛岃妫�娴嬮噸妫�鍗晎reCheckOrder.OrderNo}鐘舵��");
+ }
+ stockInfo.Details.Add(new Dt_StockInfoDetail
+ {
+ StockId = stockInfo == null ? 0 : stockInfo.Id,
+ Barcode = stockInfoDetail.Barcode,
+ MaterielCode = stockInfoDetail.MaterielCode,
+ MaterielName = stockInfoDetail.MaterielName,
+ BatchNo = stockInfoDetail.BatchNo,
+ Unit = stockInfoDetail.Unit,
+ SupplyCode = stockInfoDetail.SupplyCode,
+ WarehouseCode = stockInfoDetail.WarehouseCode,
+ StockQuantity = stockInfoDetail.StockQuantity,
+ BarcodeQty = stockInfoDetail.BarcodeQty,
+ BarcodeUnit = stockInfoDetail.BarcodeUnit,
+ FactoryArea = stockInfoDetail.FactoryArea,
+ Status = stockInfoDetail.Status,
+ OrderNo = stockInfoDetail.OrderNo,
+ BusinessType = "30",
+ ValidDate = stockInfoDetail.ValidDate
+ });
+ _stockInfoRepository.Db.Deleteable<Dt_StockInfoDetail>().Where(x => x.Barcode == stockInfoDetail.Barcode).ExecuteCommand();
+ if (stockInfo.Id == 0)
+ {
+ stockInfo.PalletCode = palletDto.PalletCode;
+ stockInfo.StockStatus = (int)StockStatusEmun.閫佹搴撳瓨瀹屾垚;
+ }
+ stockInfo.PalletType = (int)PalletTypeEnum.None;
+ _unitOfWorkManage.BeginTran();
+ _stockService.StockInfoService.AddMaterielGroup(stockInfo);
+ _unitOfWorkManage.CommitTran();
+
+ Dt_StockInfo? NewstockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync();
+
+ return WebResponseContent.Instance.OK(data: NewstockInfo.Details.OrderByDescending(x => x.Id));
+
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ LogFactory.GetLog($"缁勭洏淇℃伅").Info(true, $"銆愬紓甯搞�戯細銆恵ex.Message}銆憑Environment.NewLine}銆恵ex.StackTrace}銆憑Environment.NewLine}{Environment.NewLine}");
+ return content.Error(ex.Message);
+ }
+ }
}
}
--
Gitblit v1.9.3