From c3de7bb2097aa347a1f92c2f640d18753aff633a Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期六, 28 二月 2026 13:41:26 +0800
Subject: [PATCH] 添加HTTP客户端助手、枚举、DTO;更新URL
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs | 40 ++++++++++++++++++++++++++++++----------
1 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
index bbe42f9..c8cf69a 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
@@ -1,4 +1,8 @@
-锘縰sing WIDESEA_Common.StockEnum;
+锘縰sing Autofac.Core;
+using System.Net;
+using System.Threading.Channels;
+using WIDESEA_Common.StockEnum;
+using WIDESEA_Core;
using WIDESEA_DTO.Stock;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
@@ -15,6 +19,8 @@
public IStockInfoDetail_HtyService StockInfoDetail_HtyService { get; }
public IStockInfo_HtyService StockInfo_HtyService { get; }
+
+
public StockSerivce(
IStockInfoDetailService stockInfoDetailService,
IStockInfoService stockInfoService,
@@ -30,7 +36,7 @@
/// <summary>
/// 缁勭洏
/// </summary>
- public async Task<bool> GroupPallet(StockDTO stock)
+ public async Task<bool> GroupPalletAsync(StockDTO stock)
{
var now = DateTime.Now;
var details = stock.Details.Select(item => new Dt_StockInfoDetail
@@ -70,7 +76,7 @@
/// <summary>
/// 鎹㈢洏
/// </summary>
- public async Task<bool> ChangePallet(StockDTO stock)
+ public async Task<bool> ChangePalletAsync(StockDTO stock)
{
if (stock == null ||
string.IsNullOrWhiteSpace(stock.TargetPalletNo) ||
@@ -121,7 +127,7 @@
/// <summary>
/// 鎷嗙洏
/// </summary>
- public async Task<bool> SplitPallet(StockDTO stock)
+ public async Task<bool> SplitPalletAsync(StockDTO stock)
{
if (stock == null || string.IsNullOrWhiteSpace(stock.SourcePalletNo))
return false;
@@ -130,7 +136,13 @@
if (sourceStock == null) return false;
var serialNumbers = stock.Details.Select(d => d.CellBarcode).Distinct().ToList();
- if (!serialNumbers.Any()) return false;
+ if (!serialNumbers.Any())
+ {
+ serialNumbers = sourceStock.Details
+ .Where(x => stock.Details.Any(d => d.Channel == x.InboundOrderRowNo))
+ .Select(x => x.SerialNumber)
+ .ToList();
+ }
var detailEntities = StockInfoDetailService.Repository.QueryData(
d => d.StockId == sourceStock.Id && serialNumbers.Contains(d.SerialNumber));
@@ -145,19 +157,26 @@
return await StockInfoDetailService.Repository.DeleteDataAsync(detailEntities);
}
- public async Task<bool> UpdateStockInfo(StockInfoDTO stock)
+ /// <summary>
+ /// 鍫嗗灈鏈烘崲鐩樺悗鏇存柊搴撳瓨淇℃伅锛堟竻绌哄簱浣嶄俊鎭級
+ /// </summary>
+ /// <param name="stock"></param>
+ /// <returns></returns>
+ public async Task<WebResponseContent> UpdateStockInfoAsync(StockInfoDTO stock)
{
- if (stock == null) return false;
+ WebResponseContent content = new WebResponseContent();
+ if (string.IsNullOrWhiteSpace(stock.PalletCode)) return content.Error("鎵樼洏鍙蜂笉鑳戒负绌�");
var existingStock = StockInfoService.Repository.QueryFirst(s => s.PalletCode == stock.PalletCode);
- if (existingStock == null) return false;
+ if (existingStock == null) return content.Error("鎵樼洏淇℃伅涓嶅瓨鍦�");
existingStock.LocationCode = "";
existingStock.LocationId = 0;
- return await StockInfoService.Repository.UpdateDataAsync(existingStock);
+ var result = await StockInfoService.Repository.UpdateDataAsync(existingStock);
+ if (!result) return content.Error("鏇存柊搴撳瓨淇℃伅澶辫触");
+ return content.OK("鏇存柊搴撳瓨淇℃伅鎴愬姛");
}
-
private static List<Dt_StockInfoDetail_Hty> CreateDetailHistory(IEnumerable<Dt_StockInfoDetail> details, string operateType)
{
@@ -208,5 +227,6 @@
ModifyDate = s.ModifyDate
}).ToList();
}
+
}
}
\ No newline at end of file
--
Gitblit v1.9.3