From f5eb41629045613692873e4738a9503fdf1d7818 Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期一, 22 十二月 2025 18:45:15 +0800
Subject: [PATCH] 1
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs | 51 ++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 44 insertions(+), 7 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 b66eda7..b295a20 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"
@@ -1,12 +1,18 @@
锘縰sing LogLibrary.Log;
using MailKit;
using MailKit.Search;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using Org.BouncyCastle.Asn1.X509;
+using SixLabors.ImageSharp;
using SqlSugar;
using System;
+using System.Collections;
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using WIDESEA_Common.AllocateEnum;
using WIDESEA_Common.CommonEnum;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.StockEnum;
@@ -41,7 +47,8 @@
private IStockService _stockService;
private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfo;
private readonly HttpClientHelper _httpClientHelper;
- public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper)
+ private readonly IRepository<Dt_MesReturnRecord> _mesReturnRecord;
+ public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord)
{
_unitOfWorkManage = unitOfWorkManage;
InboundOrderDetailService = inboundOrderDetailService;
@@ -55,6 +62,7 @@
_taskRepository = taskRepository;
_allocateMaterialInfo = allocateMaterialInfo;
_httpClientHelper = httpClientHelper;
+ _mesReturnRecord = mesReturnRecord;
}
public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto)
@@ -105,6 +113,8 @@
foreach (var item in details)
{
+ var datevaliDate = _inboundOrderRepository.Db.Queryable<Dt_MaterialExpirationDate>().Where(x=>x.MaterialCode.Contains(item.MaterielCode.Substring(0,6))).First();
+
stockInfo.Details.Add(new Dt_StockInfoDetail
{
StockId = stockInfo == null ? 0 : stockInfo.Id,
@@ -122,7 +132,8 @@
Status = 0,
OrderNo = inboundOrder.InboundOrderNo,
BusinessType = inboundOrder.BusinessType,
-
+ ValidDate = inboundOrder.BusinessType == BusinessTypeEnum.澶栭儴浠撳簱璋冩櫤浠�.ToString() ? item.ValidDate : datevaliDate.ValidityDays == null ? null : Convert.ToDateTime(DateTime.Now).AddDays(Convert.ToDouble(datevaliDate.ValidityDays)),
+ //ValidDate = datevaliDate == null ? null : DateTime.Now.AddDays(datevaliDate.ValidityDays),
});
item.ReceiptQuantity = item.BarcodeQty;
@@ -326,21 +337,41 @@
}
}
- public WebResponseContent BatchInOrderFeedbackToMes(string OrderNo)
+ public WebResponseContent BatchInOrderFeedbackToMes(int id)
{
WebResponseContent content = new WebResponseContent();
try
{
var inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>()
- .Where(x => x.InboundOrderNo == OrderNo)
+ .Where(x => x.Id == id)
.First();
+
+ List<Dt_MesReturnRecord> returnRecords = _mesReturnRecord.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo && x.OrderId == inboundOrder.Id && x.ReturnStatus == 2);
+ foreach (var item in returnRecords)
+ {
+ HttpResponseResult<MesResponseDTO> httpResponse = _httpClientHelper.Post<MesResponseDTO>(item.ApiUrl, item.RequestData);
+ item.ReturnCount += 1;
+ bool success = httpResponse.IsSuccess && httpResponse.Data.Code == "200";
+ item.ReturnStatus = success ? 1 : 2;
+ item.HttpStatusCode = httpResponse.StatusCode.ObjToInt();
+ item.LastReturnTime = DateTime.Now;
+ item.ResponseData = httpResponse.Content;
+ item.SuccessTime = httpResponse.IsSuccess ? DateTime.Now : null;
+
+ //List<Dt_InboundOrderDetail> details=new List<Dt_InboundOrderDetail>();
+ //foreach (var y in item.DetailsId.Split(','))
+ //{
+ // details.Add( _inboundOrderDetailRepository.QueryFirst(x => x.Id == Convert.ToInt32(y)));
+ //}
+ }
+ _mesReturnRecord.UpdateData(returnRecords);
var inboundOrderDetail = _inboundOrderRepository.Db.Queryable<Dt_InboundOrderDetail>()
.Where(x => x.OrderId == inboundOrder.Id && x.OrderDetailStatus==(int)OrderDetailStatusEnum.Over && x.ReturnToMESStatus == 0)
.ToList();
var stocks = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.StockStatus == 6)
- .Where(it => SqlFunc.Subqueryable<Dt_StockInfoDetail>().Where(s => s.StockId == it.Id && s.OrderNo == OrderNo).Any())
+ .Where(it => SqlFunc.Subqueryable<Dt_StockInfoDetail>().Where(s => s.StockId == it.Id && s.OrderNo == inboundOrder.InboundOrderNo).Any())
.ToList();
var stockIds = stocks.Select(s => s.Id).ToList();
@@ -387,12 +418,18 @@
throw new Exception("鏈壘鍒伴渶瑕佸洖浼犵殑鏁版嵁");
}
- var response = responseModel(inboundOrder, 3,null, allocatefeedmodel);
+ var response = responseModel(inboundOrder, 3, null, allocatefeedmodel);
if (response != null && response.IsSuccess)
{
_inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
- .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
+ .Where(it => it.OrderId == inboundOrder.Id && inbounddetailID.Contains(it.Id)).ExecuteCommand();
+ }
+ else
+ {
+ _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 })
+ .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand();
+ return content.Error("鍥炰紶MES澶辫触");
}
}
else
--
Gitblit v1.9.3