From 5b8bf171b9afda52fa366a72e54eedbd9e6d4d17 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期六, 01 十一月 2025 19:54:25 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhiHuiQiCe/FangCangZhiNeng
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 154 insertions(+), 0 deletions(-)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs"
new file mode 100644
index 0000000..dfdc13f
--- /dev/null
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs"
@@ -0,0 +1,154 @@
+锘縰sing HslCommunication;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core;
+using WIDESEA_Core.Helper;
+using WIDESEA_ISquareCabinServices;
+using WIDESEA_Model.Models;
+using static WIDESEA_DTO.SquareCabin.OrderDto;
+
+namespace WIDESEA_SquareCabinServices
+{
+ public partial class Business
+ {
+ #region 鑾峰彇ERP鍏ュ簱鍗�
+ static string SearchInOrderDate = "2025-11-01 00:00:00";
+ public WebResponseContent GetInOrder()
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var url = "http://121.37.118.63:80/GYZ2/95fck/inOrder";
+ if (string.IsNullOrEmpty(SearchInOrderDate)) SearchInOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ var requestData = new { searchDate = SearchInOrderDate };
+ SearchInOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ var result = HttpHelper.Post(url, requestData.ToJsonString());
+ var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstreamOrderInfo>>(result);
+ if (response == null || response.resultCode != "0") return content;
+ if (response.data.Count < 1) return content;
+ var ordernos = response.data.Select(x => x.order_no).ToList();
+ var existingOrderNos = _cabinOrderServices.Repository.QueryData(x => ordernos.Contains(x.Order_no)).Select(x => x.Order_no).Distinct().ToList();
+ var newOrders = response.data.Where(order => !existingOrderNos.Contains(order.order_no)).ToList();
+ if (newOrders.Count < 1) return content;
+ foreach (var order in newOrders)
+ {
+ try
+ {
+ if (order.order_type == "1")
+ {
+ _cabinOrderServices.CreateInboundOrder(order);
+ }
+ else if (order.order_type == "3")//鍏ュ簱閫�鏂�
+ {
+ #region 杞崲涓哄嚭搴撳崟
+ UpstramOutOrderInfo upstramOutOrderInfo = new UpstramOutOrderInfo()
+ {
+ order_no = order.order_no,
+ order_type = order.order_type,
+ warehouse_no = order.warehouse_no,
+ details = new List<UpstreamOutOrderDetail>()
+ };
+ foreach (var item in order.details)
+ {
+ UpstreamOutOrderDetail detail = new UpstreamOutOrderDetail()
+ {
+ batch_num = item.batch_num,
+ goods_no = item.goods_no,
+ order_qty = item.order_qty,
+ exp_date = item.exp_date,
+ };
+ upstramOutOrderInfo.details.Add(detail);
+ }
+ _deliveryOrderServices.CreateOutboundOrder(upstramOutOrderInfo);
+ #endregion
+ }
+ else if (order.order_type == "5")//鎶ユ孩鍏ュ簱
+ {
+ _cabinOrderServices.CreateCheckInOrder(order);
+ }
+ }
+ catch (Exception ex)
+ {
+ continue;
+ }
+ }
+ return content.OK();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("鑾峰彇ERP鍏ュ簱鍗曚俊鎭紓甯革細" + ex.Message);
+ return content.Error(ex.Message);
+ }
+ }
+ #endregion
+
+ #region 鑾峰彇ERP鍑哄簱鍗�
+ static string SearchOutOrderDate = "2025-11-01 00:00:00";
+ public WebResponseContent GetOutOrder()
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var url = "http://121.37.118.63:80/GYZ2/95fck/outOrder";
+ if (string.IsNullOrEmpty(SearchOutOrderDate)) SearchOutOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ var requestData = new { searchDate = SearchOutOrderDate };
+ SearchOutOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ var result = HttpHelper.Post(url, requestData.ToJsonString());
+ var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstramOutOrderInfo>>(result);
+
+ if (response == null || response.resultCode != "0") return content;
+ if (response.data.Count < 1) return content;
+ var ordernos = response.data.Select(x => x.order_no).ToList();
+ var existingOutOrderNos = _deliveryOrderServices.Repository.QueryData(x => ordernos.Contains(x.Out_no)).Select(x => x.Out_no).Distinct().ToList();
+ var newOutOrders = response.data.Where(outorder => !existingOutOrderNos.Contains(outorder.order_no)).ToList();
+ if (newOutOrders.Count < 1) return content;
+
+ foreach (var outorder in newOutOrders)
+ {
+ if (outorder.order_type == "1")// 姝e父鍑哄簱鍗�
+ {
+ _deliveryOrderServices.CreateOutboundOrder(outorder);
+ }
+ else if (outorder.order_type == "2")//鍑哄簱閫�璐�
+ {
+ #region 杞崲鎴愬叆搴撳崟
+ UpstreamOrderInfo order = new UpstreamOrderInfo()
+ {
+ order_no = outorder.order_no,
+ order_type = outorder.order_type,
+ warehouse_no = outorder.warehouse_no,
+ details = new List<UpstreamOrderDetail>()
+ };
+ foreach (var item in outorder.details)
+ {
+ UpstreamOrderDetail detail = new UpstreamOrderDetail()
+ {
+ batch_num = item.batch_num,
+ goods_no = item.goods_no,
+ order_qty = item.order_qty,
+ exp_date = item.exp_date,
+ };
+ order.details.Add(detail);
+ }
+ #endregion
+ _cabinOrderServices.CreateInboundOrder(order);
+ }
+ else if (outorder.order_type == "6")//鎶ユ崯鍑哄簱
+ {
+ _deliveryOrderServices.CreateCheckOutOrder(outorder);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ #endregion
+ }
+}
--
Gitblit v1.9.3