From e1fc440b82cdbb9b63c6a1e47c204fbe830da0d5 Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期一, 27 四月 2026 10:31:06 +0800
Subject: [PATCH] 1
---
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs | 72 ++++++++++++++++++++++++++++++-----
1 files changed, 61 insertions(+), 11 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
index 02accf4..85139cd 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
@@ -3,17 +3,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Net.WebSockets;
using System.Reflection;
using System.Reflection.Metadata;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using WIDESEA_Common;
+using WIDESEA_Common.Log;
using WIDESEA_Common.OrderEnum;
-using WIDESEA_Common.TaskEnum;
using WIDESEA_Core;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
-using WIDESEA_Core.Log;
using WIDESEA_Core.LogHelper;
using WIDESEA_Core.TaskEnum;
using WIDESEA_DTO.Task;
@@ -54,6 +55,10 @@
if (stockInfo.StockStatus == StockStatusEmun.鍚堟墭鍑哄簱瀹屾垚.ObjToInt())
{
+ }
+ if (stockInfo.StockStatus == StockStatusEmun.鐩樼偣鍑哄簱瀹屾垚.ObjToInt())
+ {
+ return WebResponseContent.Instance.Error($"璇ユ墭鐩榹palletCode}鏈洏鐐�");
}
///鍒ゆ柇鏄惁瀛樺湪鍥炲簱鍗�,杩涜鍥炲師搴撲綅閫昏緫
string returnOrderNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.OrderNo;
@@ -164,20 +169,43 @@
// newTask.TaskType = TaskTypeEnum.MesPalletSmallReturn.ObjToInt();
// }
//}
- //else
- //{
+ //{
stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
//}
- _unitOfWorkManage.BeginTran();
- int taskId = BaseDal.AddData(newTask);
+ _unitOfWorkManage.BeginTran();
+ int taskId = BaseDal.AddData(newTask);
newTask.TaskId = taskId;
+
+ List<Dt_StockInfoDetail> stockInfoDetails = stockInfo.Details;
+ foreach (var stockInfoDetail in stockInfoDetails)
+ {
+ WriteLog.Write_Log("API", "鍏ュ簱鈥旇姹侺ED", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = 1 });
+ var postData = new
+ {
+ DeviceCode = "1005", // 灞忓箷缂栧彿
+ MaterialCode = stockInfoDetail.MaterielCode,//鐗╂枡绫诲瀷
+ SendNum = stockInfoDetail.OutboundQuantity,//鍙戞枡鏁�
+ BackNum = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity//鍥炲簱鏁�
+ };
+ WriteLog.Write_Log("API", "鍏ュ簱鈥旇姹侺ED", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃2 = postData });
+ string json = Newtonsoft.Json.JsonConvert.SerializeObject(postData);
+ WriteLog.Write_Log("API", "鍏ュ簱鈥旇姹侺ED", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃3 = json });
+ using (var client = new HttpClient())
+ {
+ var content = new StringContent(json, Encoding.UTF8, "application/json");
+ var response = client.PostAsync(LEDAPI, content).Result;
+ string result = response.Content.ReadAsStringAsync().Result;
+ WriteLog.Write_Log("API", "鍏ュ簱鈥旇姹侺ED", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = response, 鎺ユ敹鎶ユ枃 = result });
+ }
+ WriteLog.Write_Log("API", "鍏ュ簱鈥旇姹侺ED", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = 4 });
+ }
if (returnOrder != null)
{
- returnOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱涓�.ObjToInt();
+ returnOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱涓�.ObjToInt();
_returnOrderRepository.UpdateData(returnOrder);
- }
+ }
_stockRepository.StockInfoRepository.UpdateData(stockInfo);
_locationInfoService.UpdateData(locationInfo);
@@ -351,6 +379,30 @@
_unitOfWorkManage.BeginTran();
int taskId = BaseDal.AddData(newTask);
newTask.TaskId = taskId;
+ List<Dt_StockInfoDetail> stockInfoDetails = stockInfo.Details;
+ foreach (var stockInfoDetail in stockInfoDetails)
+ {
+ WriteLog.Write_Log("API", "鍏ュ簱鈥旇姹侺ED", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = 1 });
+ var postData = new
+ {
+ DeviceCode = newTask.CurrentAddress, // 灞忓箷缂栧彿
+ MaterialCode = stockInfoDetail.MaterielCode,//鐗╂枡绫诲瀷
+ SendNum = stockInfoDetail.OutboundQuantity,//鍙戞枡鏁�
+ BackNum = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity//鍥炲簱鏁�
+ };
+ WriteLog.Write_Log("API", "鍏ュ簱鈥旇姹侺ED", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃2 = postData });
+ string json = Newtonsoft.Json.JsonConvert.SerializeObject(postData);
+ WriteLog.Write_Log("API", "鍏ュ簱鈥旇姹侺ED", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃3 = json });
+ using (var client = new HttpClient())
+ {
+ var content = new StringContent(json, Encoding.UTF8, "application/json");
+ var response = client.PostAsync(LEDAPI, content).Result;
+ string result = response.Content.ReadAsStringAsync().Result;
+ WriteLog.Write_Log("API", "鍏ュ簱鈥旇姹侺ED", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = response, 鎺ユ敹鎶ユ枃 = result });
+ }
+ WriteLog.Write_Log("API", "鍏ュ簱鈥旇姹侺ED", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = 4 });
+ }
+
if (returnOrder != null)
{
returnOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱涓�.ObjToInt();
@@ -656,7 +708,7 @@
}
return palletTypeInfo.PalletType;
}
- else
+ else
{
Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2));
if (palletTypeInfo == null)
@@ -795,8 +847,6 @@
houseInboundPassBack.Context.Add("Ticket", Ticket);
houseInboundPassBack.Context.Add("InvOrgId", InvOrgId);
var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSInventoryIn, houseInboundPassBack, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
- WriteLog.Write_Log("API", "鐩樼偣宸紓鏁伴噺鍥炰紶", "璇锋眰", new { 璇锋眰鎶ユ枃 = houseInboundPassBack, 鎺ユ敹鎶ユ枃 = responses });
-
}
content = WebResponseContent.Instance.OK();
}
--
Gitblit v1.9.3