From 5bbb8e206ae8328a5e1233eb43ed4ecb2a02a98e Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期二, 25 十一月 2025 11:06:46 +0800
Subject: [PATCH] 1
---
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_OrderServices/Dt_InboundOrderService.cs | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 151 insertions(+), 10 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OrderServices/Dt_InboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OrderServices/Dt_InboundOrderService.cs"
index 73a7a9b..303c1de 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OrderServices/Dt_InboundOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OrderServices/Dt_InboundOrderService.cs"
@@ -1,11 +1,14 @@
-锘縰sing MailKit.Search;
+锘縰sing AngleSharp.Dom;
+using MailKit.Search;
using Masuit.Tools;
+using Newtonsoft.Json;
using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Const;
using WIDESEA_Core.Helper;
+using WIDESEA_IBusinessesRepository;
using WIDESEA_IOrderRepository;
using WIDESEA_IOrderServices;
using WIDESEA_IServices;
@@ -21,16 +24,38 @@
{
private readonly IUnitOfWorkManage _unitOfWorkManage;
private readonly ISys_ConfigService _configService;
+ private readonly IDt_WareAreaInfoRepository _wareAreaInfoRepository;
public Dt_InboundOrderService(IDt_InboundOrderRepository BaseDal,
IUnitOfWorkManage unitOfWorkManage,
- ISys_ConfigService configService) : base(BaseDal)
+ ISys_ConfigService configService,
+ IDt_WareAreaInfoRepository wareAreaInfoRepository) : base(BaseDal)
{
_unitOfWorkManage = unitOfWorkManage;
_configService = configService;
-
+ _wareAreaInfoRepository = wareAreaInfoRepository;
}
+ public override WebResponseContent UpdateData(SaveModel saveModel)
+ {
+ var quantity = saveModel.MainData["quantity"].ToString();
+ var wareHouseId = saveModel.MainData["wareHouseId"].ToString();
+
+ Dt_WareAreaInfo? wareinfo = _wareAreaInfoRepository.QueryFirst(x => x.WareAreaCode == wareHouseId);
+
+ if (wareinfo == null)
+ {
+ return WebResponseContent.Instance.Error("鏈壘鍒颁粨搴撲俊鎭�!");
+ }
+ saveModel.MainData.Add("warehouseName", wareinfo.WareAreaName.ToString());
+ return base.UpdateData(saveModel);
+ }
+
+ /// <summary>
+ /// 鏌ヨ鍏ュ簱鍗曟嵁淇℃伅
+ /// </summary>
+ /// <param name="OrderNo"></param>
+ /// <returns></returns>
public WebResponseContent GetInboundOrderInfo(string OrderNo)
{
WebResponseContent content=new WebResponseContent();
@@ -48,6 +73,12 @@
return content.Error(ex.Message);
}
}
+
+ /// <summary>
+ /// 鎵撳嵃
+ /// </summary>
+ /// <param name="keys"></param>
+ /// <returns></returns>
public WebResponseContent PrintOrder(int[] keys)
{
WebResponseContent content = new WebResponseContent();
@@ -62,15 +93,103 @@
inboundOrders.Add(InboundOrder);
}
}
- PrintInbound(inboundOrders);
- return content.OK("鎴愬姛");
+ content = PrintInbound(inboundOrders);
+ return content;
}
catch (Exception ex)
{
- return content.Error(ex.Message);
+ return content.Error("鏈煡閿欒锛岃鑱旂郴绠$悊鍛�");
}
}
+ /// <summary>
+ /// 澶氭鎵撳嵃
+ /// </summary>
+ /// <param name="keys"></param>
+ /// <param name="num"></param>
+ /// <returns></returns>
+ public WebResponseContent MultiplePrintOrder(int keys,int num)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ List<Dt_InboundOrder> inboundOrders = new List<Dt_InboundOrder>();
+ var InboundOrder = BaseDal.QueryFirst(x => x.Id == keys);
+ for (int i = 0; i < num; i++)
+ {
+ if (InboundOrder != null)
+ {
+ inboundOrders.Add(InboundOrder);
+ }
+ }
+
+ content = PrintInbound(inboundOrders);
+ return content;
+ }
+ catch (Exception ex)
+ {
+ return content.Error("鏈煡閿欒锛岃鑱旂郴绠$悊鍛�");
+ }
+ }
+
+ /// <summary>
+ /// 鎷嗗垎
+ /// </summary>
+ /// <param name="id"></param>
+ /// <param name="num"></param>
+ /// <returns></returns>
+ public WebResponseContent SplitOrder(int id,int num)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var originalOrder = BaseDal.QueryFirst(x => x.Id == id);
+ if (originalOrder == null)
+ {
+ return content.Error("鏈壘鍒拌鍏ュ簱鍗曚俊鎭�");
+ }
+ if(originalOrder.Quantity < num || num <= 0 || originalOrder.Quantity - num == 0)
+ {
+ return content.Error("鎷嗗垎鏁伴噺涓嶅悎娉�");
+ }
+ Dt_InboundOrder orderNew = new Dt_InboundOrder()
+ {
+ OrderNo = GetOrderPintCode("OrderNoIn"),
+ UpperOrderNo = originalOrder.UpperOrderNo,
+ DemandClassification = originalOrder.DemandClassification,
+ OrderType = originalOrder.OrderType,
+ WarehouseName = originalOrder.WarehouseName,
+ Datetime = originalOrder.Datetime,
+ LineNumber = originalOrder.LineNumber,
+ ProductDrawingNumber = originalOrder.ProductDrawingNumber,
+ MaterialNo = originalOrder.MaterialNo,
+ MaterialName = originalOrder.MaterialName,
+ Weight = originalOrder.Weight,
+ WareHouseId = originalOrder.WareHouseId,
+ Specs = originalOrder.Specs,
+ Unit = originalOrder.Unit,
+ Texture = originalOrder.Texture,
+ Quantity = num,
+ OrderStatus = originalOrder.OrderStatus,
+ };
+ originalOrder.Quantity = originalOrder.Quantity - num;
+
+ BaseDal.AddData(orderNew);
+ BaseDal.UpdateData(originalOrder);
+ return content.OK();
+ }
+ catch (Exception ex)
+ {
+ return content.Error("鏈煡閿欒锛岃鑱旂郴绠$悊鍛�");
+ }
+ }
+
+
+ /// <summary>
+ /// 鎵撳嵃鎵樼洏鐮�
+ /// </summary>
+ /// <param name="num"></param>
+ /// <returns></returns>
public WebResponseContent PrintPalletCode(int num)
{
WebResponseContent content = new WebResponseContent();
@@ -81,14 +200,20 @@
{
PalletCodes.Add(GetOrderPintCode("PalletCodes"));
}
- PrintPallet(PalletCodes);
+ content= PrintPallet(PalletCodes);
return content.OK();
}
catch (Exception ex)
{
- return content.Error(ex.Message);
+ return content.Error("鏈煡閿欒锛岃鑱旂郴绠$悊鍛�");
}
}
+
+ /// <summary>
+ /// 鑾峰彇璁㈠崟缂栧彿
+ /// </summary>
+ /// <param name="printCode"></param>
+ /// <returns></returns>
public string GetOrderPintCode(string printCode)
{
string PrintCode = "";
@@ -108,7 +233,14 @@
SqlSugarHelper.DbWMS.Updateable(PrintSetting).ExecuteCommand();
return PrintCode;
}
- public void PrintPallet(List<string> palletCodes)
+
+ /// <summary>
+ /// 璋冪敤鎵撳嵃鎵樼洏鐮佹帴鍙�
+ /// </summary>
+ /// <param name="palletCodes"></param>
+ /// <returns></returns>
+ /// <exception cref="InvalidOperationException"></exception>
+ public WebResponseContent PrintPallet(List<string> palletCodes)
{
var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
var Base = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.PrintIPAddress)?.ConfigValue;
@@ -119,9 +251,16 @@
}
var IpAddress = Base + ipAddress;
var result = HttpsClient.PostAsync(IpAddress, palletCodes.ToJsonString()).Result;
+ return JsonConvert.DeserializeObject<WebResponseContent>(result);
}
- public void PrintInbound(List<Dt_InboundOrder> orders)
+ /// <summary>
+ /// 璋冪敤鎵撳嵃鍗曟嵁鎺ュ彛
+ /// </summary>
+ /// <param name="orders"></param>
+ /// <returns></returns>
+ /// <exception cref="InvalidOperationException"></exception>
+ public WebResponseContent PrintInbound(List<Dt_InboundOrder> orders)
{
var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
var Base = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.PrintIPAddress)?.ConfigValue;
@@ -132,6 +271,8 @@
}
var IpAddress = Base + ipAddress;
var result = HttpsClient.PostAsync(IpAddress, orders.ToJsonString()).Result;
+ return JsonConvert.DeserializeObject<WebResponseContent>(result);
}
+
}
}
--
Gitblit v1.9.3