From d5051e5293179c99df2e3489ad5f2f73f4061667 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 25 十月 2025 11:53:38 +0800
Subject: [PATCH] 优化WCS与ERP交互逻辑
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs | 24
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs | 583 ++++---------------
新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IBusiness.cs | 45 +
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/DeliveryOrderController.cs | 7
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs | 3
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs | 651 ++++++++++++++++++++++
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs | 331 -----------
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/CabinOrderController.cs | 7
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs | 12
新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs | 27
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs | 14
11 files changed, 858 insertions(+), 846 deletions(-)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IBusiness.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IBusiness.cs"
new file mode 100644
index 0000000..05b83f0
--- /dev/null
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IBusiness.cs"
@@ -0,0 +1,45 @@
+锘縰sing WIDESEA_Core;
+
+namespace WIDESEA_ISquareCabinServices
+{
+ public interface IBusiness : IDependency
+ {
+ /// <summary>
+ /// 鑾峰彇涓婃父鍏ュ簱璁㈠崟
+ /// </summary>
+ /// <returns></returns>
+ WebResponseContent GetUpstreamOrder();
+ /// <summary>
+ /// 鑾峰彇涓婃父鍑哄簱鍗曟暟鎹�
+ /// </summary>
+ /// <param name="searchDate"></param>
+ /// <returns></returns>
+ WebResponseContent GetUpstreamOutOrder();
+
+ /// <summary>
+ /// 缁欎笅娓竪cs鍏ュ簱鍗�
+ /// </summary>
+ /// <returns></returns>
+ WebResponseContent EdiIn();
+
+ /// <summary>
+ /// 缁欎笅娓竪cs鍑哄簱鍗�
+ /// </summary>
+ /// <returns></returns>
+ WebResponseContent EdiOut();
+
+ /// <summary>
+ /// 鍏ュ簱鎶ュ畬鎴愭帴鍙�
+ /// </summary>
+ /// <param name="order_no">鍏ュ簱鍗曞彿</param>
+ /// <returns></returns>
+ //WebResponseContent CompleteOrder(string order_no);
+ WebResponseContent CompleteAllOrders();
+
+ /// <summary>
+ /// 鍑哄簱鎶ュ畬鎴愭帴鍙�
+ /// </summary>
+ /// <returns></returns>
+ WebResponseContent CompleteAllOutOrders();
+ }
+}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
index 026df50..f5b68a3 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
@@ -14,30 +14,6 @@
public interface ICabinOrderServices: IService<Dt_CabinOrder>
{
IRepository<Dt_CabinOrder> Repository { get; }
- /// <summary>
- /// 鑾峰彇涓婃父鍏ュ簱璁㈠崟
- /// </summary>
- /// <returns></returns>
- WebResponseContent GetUpstreamOrder();
-
-
- /// <summary>
- /// 鍏ュ簱鎶ュ畬鎴愭帴鍙�
- /// </summary>
- /// <param name="order_no">鍏ュ簱鍗曞彿</param>
- /// <returns></returns>
- //WebResponseContent CompleteOrder(string order_no);
- WebResponseContent CompleteAllOrders();
-
-
- /// <summary>
- /// 缁檞cs
- /// </summary>
- /// <returns></returns>
- WebResponseContent EdiIn();
-
-
-
WebResponseContent GetCabinOrders(SaveModel saveModel);
WebResponseContent GetCabinOrderDetail(int pageNo, string orderNo);
WebResponseContent FeedbackIn(SaveModel saveModel);
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs"
index db2daf6..c1ce444 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs"
@@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_DTO.SquareCabin;
using WIDESEA_Model.Models;
@@ -12,36 +13,12 @@
{
public interface IDeliveryOrderServices : IService<Dt_DeliveryOrder>
{
- /// <summary>
- /// 鑾峰彇涓婃父鍑哄簱鍗曟暟鎹�
- /// </summary>
- /// <param name="searchDate"></param>
- /// <returns></returns>
- WebResponseContent GetUpstreamOutOrder();
- /// <summary>
- /// 缁欎笅娓竪cs鍑哄簱鍗�
- /// </summary>
- /// <returns></returns>
- WebResponseContent EdiOut();
-
+ IRepository<Dt_DeliveryOrder> Repository { get; }
/// <summary>
/// 鐩樼偣鍑哄簱鎺ュ彛
/// </summary>
/// <returns></returns>
public WebResponseContent InventoryGood(string batchNo, string goodsNo);
-
- ///// <summary>
- ///// 鍑哄簱鎶ュ畬鎴愭帴鍙�
- ///// </summary>
- ///// <param name="out_no">鍑哄簱鍗曞彿</param>
- ///// <returns></returns>
- //WebResponseContent CompleteOutOrder(string out_no);
-
- /// <summary>
- /// 鍑哄簱鎶ュ畬鎴愭帴鍙�
- /// </summary>
- /// <returns></returns>
- WebResponseContent CompleteAllOutOrders();
WebResponseContent GetDeliveryOrders(SaveModel saveModel);
WebResponseContent GetDeliveryOrderDetail(int pageNo, string orderNo, bool isPick);
/// <summary>
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs"
new file mode 100644
index 0000000..355747b
--- /dev/null
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs"
@@ -0,0 +1,651 @@
+锘縰sing HslCommunication;
+using Newtonsoft.Json;
+using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
+using WIDESEA_Core.Enums;
+using WIDESEA_Core.Helper;
+using WIDESEA_IBasicService;
+using WIDESEA_ISquareCabinServices;
+using WIDESEA_IWMsInfoServices;
+using static WIDESEA_DTO.SquareCabin.OrderDto;
+using WIDESEA_Model.Models;
+using WIDESEA_SquareCabinServices;
+using static WIDESEA_DTO.SquareCabin.TowcsDto;
+using WIDESEA_Common.WareHouseEnum;
+using WIDESEA_DTO.SquareCabin;
+
+namespace WIDESEA_WMSServer
+{
+ public class Business : IBusiness
+ {
+ private readonly ICabinOrderServices _cabinOrderServices;
+ private readonly ICabinOrderDetailServices _cabinDetailServices;
+ private readonly IDeliveryOrderServices _deliveryOrderServices;
+ private readonly IDeliveryOrderDetailServices _deliveryOrderDetailServices;
+ private readonly IBasicService _basicService;
+ private readonly IUnitOfWorkManage _unitOfWorkManage;
+ private readonly IInventory_BatchServices _inventory_BatchServices;
+ private readonly IInventoryInfoService _inventoryInfoService;
+ private readonly ISupplyTaskService _supplyTaskService;
+ private readonly ITacticsService _tacticsService;
+ public Business(IDeliveryOrderServices deliveryOrderServices, IBasicService basicService, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService, ICabinOrderServices cabinOrderServices, ITacticsService tacticsService, ICabinOrderDetailServices cabinDetailServices)
+ {
+ _deliveryOrderServices = deliveryOrderServices;
+ _basicService = basicService;
+ _unitOfWorkManage = unitOfWorkManage;
+ _inventory_BatchServices = inventory_BatchServices;
+ _inventoryInfoService = inventoryInfoService;
+ _deliveryOrderDetailServices = deliveryOrderDetailServices;
+ _supplyTaskService = supplyTaskService;
+ _cabinOrderServices = cabinOrderServices;
+ _tacticsService = tacticsService;
+ _cabinDetailServices = cabinDetailServices;
+ }
+ #region 鑾峰彇ERP鍏ュ簱鍗�
+ static string SearchInDate = "2025-09-10 00:00:00";
+ /// <summary>
+ /// 鑾峰彇涓婃父绯荤粺鐨勫叆搴撳崟
+ /// </summary>
+ /// <param name="SearchInDate"></param>
+ /// <returns></returns>
+ public WebResponseContent GetUpstreamOrder()
+ {
+ var responseContent = new WebResponseContent();
+ try
+ {
+ // 璇锋眰鍦板潃
+ var url = "http://121.37.118.63:80/GYZ2/95fck/inOrder";
+ //var url = "http://127.0.0.1:4523/m2/5660322-5340849-default/363009261";
+
+ if (string.IsNullOrEmpty(SearchInDate)) SearchInDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ //// 璇锋眰鍙傛暟
+ var requestData = new
+ {
+ searchDate = SearchInDate
+ //searchDate = "2022-10-10 20:45:16" // 姝g‘鐨勬牸寮�
+ };
+ SearchInDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss");
+ // 鍙戣捣璇锋眰
+ var result = HttpHelper.Post(url, requestData.ToJsonString());
+
+ // 鍙嶅簭鍒楀寲
+ var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstreamOrderInfo>>(result);
+
+ if (response.resultCode != "0")
+ {
+ // 璋冪敤寮傚父鎺ュ彛
+ SendErrorToUpstream(1, "", response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触", "");
+ return responseContent.Error(response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触");
+ }
+
+ if (response.data == null || !response.data.Any())
+ {
+ return responseContent.OK("鏃犳柊鍏ュ簱鍗曟暟鎹�");
+ }
+ // 鑾峰彇鎵�鏈夊凡瀛樺湪鐨勫叆搴撳崟鍙�
+ var existingOrderNos = _cabinOrderServices.Db.Queryable<Dt_CabinOrder>()
+ .Select(x => x.Order_no)
+ .Distinct().ToList();
+
+ // 杩囨护鎺夊凡瀛樺湪鐨勫叆搴撳崟
+ var newOrders = response.data
+ .Where(order => !existingOrderNos.Contains(order.order_no))
+ .ToList();
+
+ if (!newOrders.Any())
+ {
+ return responseContent.OK("鎵�鏈夊叆搴撳崟宸插瓨鍦紝鏃犻渶鏂板");
+ }
+
+ _unitOfWorkManage.BeginTran();
+ try
+ {
+ List<Dt_CabinOrder> _CabinOrders = new List<Dt_CabinOrder>();
+ //瀛樺偍鍏ュ簱鍗曞彿
+ List<string> orderNos = new List<string>();
+
+ foreach (var order in newOrders)
+ {
+ if (order.order_type == "1") //姝e父鍏ュ簱
+ {
+ responseContent = _cabinOrderServices.CreateInboundOrder(order);
+ List<Dt_CabinOrder>? dt_CabinOrders = responseContent.Data as List<Dt_CabinOrder>;
+ if (dt_CabinOrders != null) _CabinOrders.AddRange(dt_CabinOrders);
+ }
+ 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.Db.InsertNav(_CabinOrders).Include(x => x.Details).ExecuteCommand();
+
+ //鍦ㄤ笅鍙戠粰wcs
+ //EdiIn(); //鍙戠粰涓嬫父
+ //濡傛灉杩欎釜鏂规硶鎴愬姛浜嗭紝閭d箞灏辫皟鐢–ompleteOrder鎺ュ彛锛岀劧鍚庢敼鍙�
+ _unitOfWorkManage.CommitTran();
+ return responseContent.OK("鍚屾鍏ュ簱鍗曟垚鍔�");
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ SendErrorToUpstream(1, "", ex.Message, "");
+ return responseContent.Error("鍚屾澶辫触: " + ex.Message);
+ }
+ }
+ catch (Exception ex)
+ {
+ // 鍏ㄥ眬寮傚父鏃讹紝涔熸帹閫佸紓甯哥粰涓婃父
+ SendErrorToUpstream(1, "", ex.Message, "");
+ return responseContent.Error("鍚屾澶辫触: " + ex.Message);
+ }
+ }
+ #endregion
+
+ #region 鑾峰彇ERP鍑哄簱鍗�
+ static string SearchOutDate = "2025-09-10 00:00:00";
+ public WebResponseContent GetUpstreamOutOrder()
+ {
+ var responseContent = new WebResponseContent();
+ try
+ {
+ var url = "http://121.37.118.63:80/GYZ2/95fck/outOrder";
+ //var url = "http://127.0.0.1:4523/m1/5660322-5340849-default/GYZ2/95fck/outOrder";
+ if (string.IsNullOrEmpty(SearchOutDate)) SearchOutDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ //// 璇锋眰鍙傛暟
+ var requestData = new
+ {
+ searchDate = SearchOutDate
+ //searchDate = "2022-10-10 20:45:16" // 姝g‘鐨勬牸寮�
+ };
+ SearchOutDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss");
+
+ var result = HttpHelper.Post(url, requestData.ToJsonString());
+ var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstramOutOrderInfo>>(result);
+
+ if (response.resultCode != "0")
+ {
+ SendErrorToUpstream(3, "", response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触", "");
+ return responseContent.Error(response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触");
+ }
+
+ if (response.data == null || !response.data.Any())
+ {
+ return responseContent.OK("鏃犳柊鍑哄簱鍗曟暟鎹�");
+ }
+
+ // 宸插瓨鍦ㄥ嚭搴撳崟鍙�
+ var existingOutOrderNos = _deliveryOrderServices.Db.Queryable<Dt_DeliveryOrder>()
+ .Select(x => x.Out_no)
+ .Distinct().ToList();
+
+ // 鏂板嚭搴撳崟
+ var newOutOrders = response.data
+ .Where(outorder => !existingOutOrderNos.Contains(outorder.order_no))
+ .ToList();
+
+ List<string> order_no = newOutOrders.Select(x => x.order_no).ToList();
+
+ if (!newOutOrders.Any())
+ {
+ return responseContent.OK("鎵�鏈夊嚭搴撳崟宸插瓨鍦紝鏃犻渶鏂板");
+ }
+
+ _unitOfWorkManage.BeginTran();
+ try
+ {
+ List<Dt_DeliveryOrder> _DeliveryOrders = new List<Dt_DeliveryOrder>();
+ List<string> orderNos = new List<string>();
+
+ foreach (var outorder in newOutOrders)
+ {
+ if (outorder.order_type == "1") // 姝e父鍑哄簱鍗�
+ {
+ _deliveryOrderServices.CreateOutboundOrder(outorder);//鍒涘缓鍑哄簱鍗曘�佸鐞嗗簱瀛樸�佹坊鍔犲嚭搴撲换鍔�
+ }
+ else if (outorder.order_type == "2")//鍑哄簱閫�璐�
+ {
+ // 鍒涘缓鍑哄簱閫�璐у崟 - 杩欓噷闇�瑕佹牴鎹笟鍔¢�昏緫瀹炵幇
+ // 鏆傛椂璺宠繃鎴栧疄鐜伴��璐ч�昏緫
+ //continue;
+ #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);
+ }
+ responseContent = _cabinOrderServices.CreateInboundOrder(order);
+ List<Dt_CabinOrder>? dt_CabinOrders = responseContent.Data as List<Dt_CabinOrder>;
+ if (dt_CabinOrders != null && dt_CabinOrders.Count > 0)
+ _cabinOrderServices.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
+ #endregion
+ }
+ else if (outorder.order_type == "6")//鎶ユ崯鍑哄簱
+ {
+
+ }
+ }
+
+ // 鎵归噺鎻掑叆鍑哄簱鍗曞拰鏄庣粏
+ //if (_DeliveryOrders.Any())
+ //{
+ // BaseDal.Db.InsertNav(_DeliveryOrders).Include(x => x.Details).ExecuteCommand();
+ //}
+ //涓嬪彂鍑哄簱鍗曚换鍔$粰wcs
+
+
+ _unitOfWorkManage.CommitTran();
+ //var tex = CreateSupplyTask(order_no);
+ //if (!tex)
+ //{
+ // return responseContent.Error("鍒涘缓渚涘簲浠诲姟澶辫触");
+ //}
+ return responseContent.OK($"鍚屾鍑哄簱鍗曟垚鍔燂紝鍏眥_DeliveryOrders.Count}鏉�");
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ SendErrorToUpstream(3, "", ex.Message, "");
+ return responseContent.Error("鍚屾澶辫触: " + ex.Message);
+ }
+ }
+ catch (Exception ex)
+ {
+ SendErrorToUpstream(3, "", ex.Message, "");
+ return responseContent.Error("鍚屾澶辫触: " + ex.Message);
+ }
+ }
+ #endregion
+
+ #region 涓嬪彂绔嬪簱鍏ュ簱鍗�
+ public WebResponseContent EdiIn()
+ {
+ try
+ {
+ //2.鏌ヨ绗﹀悎鏉′欢鐨勮鍗曪紙琛ㄥご = 鏂板缓 && 鍖呭惈鏈夋晥鏄庣粏锛�
+ //var orders = BaseDal.Db.Queryable<Dt_CabinOrder>()
+ // .Where(o => o.OdrderStatus == "鏂板缓")
+ // .Includes(o => o.Details, d => d.MedicineGoods)
+ // .ToList();
+ //鏌ュ嚭鍖呭惈鍏ㄩ儴鐨勫叆搴撳崟锛屽寘鍚叏閮ㄦ槑缁�+涓�涓槑缁嗗搴斾竴涓晢鍝�
+ var reslut = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
+ var orders = _cabinOrderServices.Db.CopyNew()
+ .Queryable<Dt_CabinOrder>()
+ .Where(o => o.OdrderStatus == "鏂板缓" && o.Warehouse_no == reslut)
+ .Includes(o => o.Details, d => d.MedicineGoods)
+ .ToList();
+ // 3. 鍐嶈繃婊ゆ帀涓嶇鍚堟潯浠剁殑鏄庣粏锛堝彧淇濈暀 Status=0锛�
+ foreach (var order in orders)
+ {
+ Console.WriteLine($"璁㈠崟 {order.Order_no} 鍘熸槑缁嗘暟锛歿order.Details.Count}");
+ order.Details = order.Details.Where(d => d.Status == 0).ToList();
+ Console.WriteLine($"璁㈠崟 {order.Order_no} 杩囨护鍚庢槑缁嗘暟锛歿order.Details.Count}");
+ }
+
+
+ if (orders == null || !orders.Any())
+ {
+ Console.WriteLine("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
+ return WebResponseContent.Instance.Error("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
+ }
+
+ // 4. 閬嶅巻璁㈠崟锛岀粍瑁� DTO 骞舵帹閫�
+ foreach (var order in orders)
+ {
+ // 浠庣涓�涓湁 MedicineGoods 鐨勬槑缁嗕腑鍙栧嚭 MaterielErpType
+ string materialCode = order.Details
+ .Select(d => d.MedicineGoods?.MaterielErpType)
+ .FirstOrDefault(x => !string.IsNullOrEmpty(x)) ?? "YY"; // 榛樿鍊糦Y
+
+ var ediDto = new ToediInInfo
+ {
+
+ //瀹㈡埛浠g爜
+ customerCode = "905",
+ //鐗╂枡绫诲瀷
+ materialCode = materialCode,
+ //鍏ュ簱鍗曞彿
+ externalOrderNo = order.Order_no,
+ //鍏ュ簱鍗曠被鍨�
+ inOrderType = order.Order_type == "1" ? "10" : "20",
+ //浼樺厛绾�
+ priority = 0,
+ //鏄惁鍙栨秷
+ Is_cancel = 0,
+ details = order.Details.Select(d => new ToediInDetail
+ {
+ //鎵瑰彿
+ batchNo = d.Batch_num,
+ //浜у搧
+ productCode = d.Goods_no,
+ //sku鍚嶇О
+ productName = d.MedicineGoods?.MaterielName,
+ //sku瑙勬牸
+ productSpecifications = d.MedicineGoods?.MaterielSpec,
+ //鏁伴噺
+ quantity = (int)d.Order_qty,
+ //鏁堟湡
+ validityPeriod = d.Exp_date,
+ //鐢熶骇鍘傚
+ manufacturer = d.MedicineGoods?.Factory,
+ //鎴垮彿
+ libraryNo = order.Warehouse_no,
+ }).ToList()
+ };
+
+ var url = "http://172.16.1.2:9357/file-admin/api/in/ediIn";
+ //var url = "http://127.0.0.1:4523/m2/5660322-5340849-default/363019549";
+ var result = HttpHelper.Post(url, ediDto.ToJsonString());
+ var resp = JsonConvert.DeserializeObject<TowcsResponse<object>>(result);
+
+ if (resp != null && resp.code == "0")
+ {
+ // 鏇存柊琛ㄥご鐘舵��
+ _cabinOrderServices.Db.Updateable<Dt_CabinOrder>()
+ .SetColumns(o => new Dt_CabinOrder { OdrderStatus = "寮�濮�" })
+ .Where(o => o.Id == order.Id)
+ .ExecuteCommand();
+
+ // 鏇存柊鏄庣粏鐘舵�佷负宸插悓姝� //杩欓噷瑕佹槸灏嗘柊寤�--銆嬪紑濮嬬姸鎬�,鍦ㄥ悗绔帴鍙h繑鍥炴垜浠殑鏃跺�欏湪杩斿洖宸插畬鎴�
+ _cabinDetailServices.Db.Updateable<Dt_CabinOrderDetail>()
+ .SetColumns(d => new Dt_CabinOrderDetail { Status = 1, OrderDetailStatus = "寮�濮�" })
+ .Where(d => d.OrderId == order.Id && d.Status == 0)
+ .ExecuteCommand();
+
+ Console.WriteLine($"璁㈠崟 {order.Order_no} 鎺ㄩ�佹垚鍔�");
+ }
+ else
+ {
+ SendErrorToUpstream(3, order.Order_no, resp?.msg ?? "WCS 鎺ㄩ�佸け璐�", "");
+ Console.WriteLine($"璁㈠崟 {order.Order_no} 鎺ㄩ�佸け璐ワ細{resp?.msg}");
+ return new WebResponseContent { Status = false, Message = "璁㈠崟鎺ㄩ�佸け璐�" };
+ }
+ }
+ return new WebResponseContent { Status = true, Message = "鎺ㄩ�佹垚鍔�" };
+ }
+ catch (Exception ex)
+ {
+
+ Console.WriteLine("EdiIn 寮傚父锛�" + ex.Message);
+ return new WebResponseContent { Status = false, Message = ex.Message };
+ }
+ }
+ #endregion
+
+ #region 涓嬪彂绔嬪簱鍑哄簱鍗�
+ public WebResponseContent EdiOut()
+ {
+ var responseContent = new WebResponseContent();
+ try
+ {
+ // 1. 鏌ヨ绗﹀悎鏉′欢鐨勮鍗曪紙琛ㄥご=鏂板缓 && 鍖呭惈鏈夋晥鏄庣粏锛�
+ var outOrders = _deliveryOrderServices.Db.CopyNew().Queryable<Dt_DeliveryOrder>()
+ .Where(o => o.OutStatus == "鏂板缓" && o.Warehouse_no == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
+ .Includes(o => o.Details, d => d.MedicineGoods)
+ .ToList();
+
+ // 2. 鍐嶈繃婊ゆ帀涓嶇鍚堟潯浠剁殑鏄庣粏锛堝彧淇濈暀 Status=0 锛�
+ foreach (var order in outOrders)
+ {
+ order.Details = order.Details.Where(d => d.Status == 0).ToList();
+ }
+
+ if (outOrders == null || !outOrders.Any())
+ {
+ Console.WriteLine("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
+ return responseContent.Error("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
+ }
+
+ foreach (var order in outOrders)
+ {
+ try
+ {
+ string materialCode = "YY";//榛樿鍊�
+ //鑾峰彇褰撳墠璁㈠崟鐨勭涓�涓槑缁嗛」
+ var firstDetail = order.Details.FirstOrDefault();
+ if (firstDetail?.MedicineGoods != null && !string.IsNullOrEmpty(firstDetail.MedicineGoods.MaterielErpType))
+ {
+ //濡傛灉鏉′欢婊¤冻锛屽皢鐗╂枡浠g爜璁剧疆涓虹涓�涓槑缁嗛」瀵瑰簲鐨勮嵂鍝佺墿鏂欎唬鐮�
+ materialCode = firstDetail.MedicineGoods.MaterielErpType;
+ }
+ // 3. 缁勮 DTO
+ var ediDto = new TowcsDto.ToediOutInfo
+ {
+ customerCode = "905",
+ materialCode = materialCode,
+ externalOrderNo = order.Out_no,
+ outOrderType = order.Out_type == "1" ? "10" : order.Out_type == "3" ? "20" : "30",//鍑哄簱鍗曠被鍨嬫槸1灏辨槸姝e父鐨勶紝3灏辨槸鐩樼偣
+ priority = 1,
+ Is_cancel = 0,
+ details = order.Details.Select(d => new TowcsDto.ToeOutdiInDetail
+ {
+ batchNo = d.Batch_num,
+ productCode = d.Goods_no,
+ productName = d.MedicineGoods?.MaterielName,
+ productSpecifications = d.MedicineGoods?.MaterielModel,
+ quantity = (int)d.Order_qty,
+ //stocktakingDetails = order.Out_type == "3"
+ // ? new List<ToOutediInStock>
+ // {
+ // new ToOutediInStock { palletCode = "FC00001", quantity = d.Order_qty.ToString() }
+ // }
+ // : null
+ }).ToList()
+ };
+
+ // 4. 璋冪敤鎺ュ彛
+ var url = "http://172.16.1.2:9357/file-admin/api/out/ediOut";
+ //var url = "http://127.0.0.1:4523/m2/5660322-5340849-default/363076920";
+
+ var result = HttpHelper.Post(url, ediDto.ToJsonString());
+ var resp = JsonConvert.DeserializeObject<TowcsDto.TowcsResponse<object>>(result);
+
+ if (resp != null && resp.code == "0")
+ {
+ // 鏇存柊琛ㄥご鐘舵��
+ _cabinDetailServices.Db.Updateable<Dt_DeliveryOrder>()
+ .SetColumns(o => new Dt_DeliveryOrder { OutStatus = "寮�濮�" })
+ .Where(o => o.Id == order.Id)
+ .ExecuteCommand();
+
+ // 鏇存柊鏄庣粏鐘舵��
+ _deliveryOrderDetailServices.Db.Updateable<Dt_DeliveryOrderDetail>()
+ .SetColumns(d => new Dt_DeliveryOrderDetail { Status = 1, OotDetailStatus = "寮�濮�" })
+ .Where(d => d.DeliveryOrderId == order.Id && d.Status == 0)
+ .ExecuteCommand();
+ Console.WriteLine($"璁㈠崟 {order.Out_no} 鎺ㄩ�佹垚鍔�");
+ }
+ else
+ {
+ SendErrorToUpstream(3, order.Out_no, resp?.msg ?? "WCS 鎺ㄩ�佸け璐�", "");
+ Console.WriteLine($"璁㈠崟 {order.Out_no} 鎺ㄩ�佸け璐ワ細{resp?.msg}");
+ }
+ //鍒犻櫎鍏ㄩ儴鐘朵负宸插畬鎴愮殑鏄庣粏鍜岃〃澶达紝绉诲叆鍘嗗彶琛�
+ }
+ catch (Exception ex)
+ {
+ SendErrorToUpstream(3, order.Out_no, ex.Message, "");
+ Console.WriteLine($"璁㈠崟 {order.Out_no} 鎺ㄩ�佸紓甯革細{ex.Message}");
+ }
+ }
+
+ return responseContent.OK("鍑哄簱璁㈠崟鎺ㄩ�佸畬鎴�");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("EdiOut 寮傚父锛�" + ex.Message);
+ return responseContent.Error("鍑哄簱璁㈠崟鎺ㄩ�佸け璐ワ細" + ex.Message);
+ }
+ }
+ #endregion
+
+ #region 鍏ュ簱瀹屾垚涓婃姤ERP
+ /// <summary>
+ /// 鍏ュ簱鎶ュ畬鎴愭帴鍙�
+ /// </summary>
+ /// <param name="order_no">鍏ュ簱鍗曞彿</param> //鍏堟鏌ユ槸鍚︽墍鏈夋槑缁嗛兘宸插畬鎴愶紝濡傛灉鏄紝閭d箞鏇存柊琛ㄥご鐘舵�佷负宸插畬鎴�
+ /// <returns></returns>
+ public WebResponseContent CompleteAllOrders()
+ {
+ var responseContent = new WebResponseContent();
+ try
+ {
+ #region 鏌ユ壘鎵�鏈夊凡瀹屾垚鍏ュ簱鍗�
+ var inorders = _cabinOrderServices.Repository.QueryData(x => x.OdrderStatus == "宸插畬鎴�").Select(x => x.Order_no).Distinct().ToList();
+ foreach (var inorder in inorders)
+ {
+ //var Orders = BaseDal.QueryData(x => x.Order_no == inorder);
+ var Orders = _cabinOrderServices.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == inorder).Includes(x => x.Details).ToList();
+ if (!Orders.Where(x => x.OdrderStatus != "宸插畬鎴�").Any())
+ {
+ _unitOfWorkManage.BeginTran();
+ _cabinOrderServices.Repository.DeleteAndMoveIntoHty(Orders, OperateTypeEnum.鑷姩瀹屾垚);
+ foreach (var item in Orders)
+ {
+ _cabinDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.鑷姩瀹屾垚);
+ }
+ // 璋冪敤涓婃父鎺ュ彛
+ var url = "http://121.37.118.63:80/GYZ2/95fck/inOrderOk";
+ var result = HttpHelper.Post(url, new { order_no = inorder }.ToJsonString());
+ var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
+ if (response.resultCode == "0")
+ {
+ // 鎻愪氦浜嬪姟
+ _unitOfWorkManage.CommitTran();
+ }
+ else
+ {
+ _unitOfWorkManage.RollbackTran();
+ SendErrorToUpstream(2, "", $"涓婃父鎺ュ彛杩斿洖澶辫触: {response.resultMsg}", inorder);
+ }
+ }
+ }
+ #endregion
+ return responseContent.OK();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return responseContent.Error("鎵归噺澶勭悊澶辫触锛�" + ex.Message);
+ }
+ }
+ #endregion
+
+ #region 鍑哄簱瀹屾垚涓婃姤ERP
+ /// <summary>
+ /// 鍑哄簱鎶ュ畬鎴愭帴鍙�
+ /// </summary>
+ /// <param name="out_no">鍑哄簱鍗曞彿</param>
+ /// <returns></returns>
+ public WebResponseContent CompleteAllOutOrders()
+ {
+ var responseContent = new WebResponseContent();
+ try
+ {
+ #region 鏌ユ壘鎵�鏈夊凡瀹屾垚鍑哄簱鍗�
+ var outorders = _deliveryOrderServices.Repository.QueryData(x => x.OutStatus == "宸插畬鎴�").Select(x => x.Out_no).Distinct().ToList();
+ foreach (var outorder in outorders)
+ {
+ var Orders = _deliveryOrderServices.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == outorder).Includes(x => x.Details).ToList();
+ if (!Orders.Where(x => x.OutStatus != "宸插畬鎴�").Any())
+ {
+ _unitOfWorkManage.BeginTran();
+ _deliveryOrderServices.Repository.DeleteAndMoveIntoHty(Orders, OperateTypeEnum.鑷姩瀹屾垚);
+ foreach (var item in Orders)
+ {
+ _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.鑷姩瀹屾垚);
+ }
+ var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
+ var requestDate = new
+ {
+ order_no = outorder
+ };
+ var result = HttpHelper.Post(url, requestDate.ToJsonString());
+ var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
+ if (response.resultCode == "0") _unitOfWorkManage.CommitTran();
+ else
+ {
+ _unitOfWorkManage.RollbackTran();
+ SendErrorToUpstream(4, "", $"涓婃父鎺ュ彛杩斿洖澶辫触: {response.resultMsg}", outorder);
+ }
+ }
+ }
+ #endregion
+
+ return responseContent.OK();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return responseContent.Error("鎵归噺澶勭悊澶辫触锛�" + ex.Message);
+ }
+ }
+ #endregion
+
+ #region 鎺ㄩ�佸紓甯镐笂鎶RP
+ /// <summary>
+ /// 鎺ㄩ�佸紓甯镐俊鎭粰涓婃父绯荤粺1.鍏ュ簱鍗曟帴鍙o紱2.鍏ュ簱鍗曟姤瀹屾垚鎺ュ彛锛�3.鍑哄簱鍗曟帴鍙o紱4.鍑哄簱鎶ュ畬鎴愭帴鍙o紱5.鑽搧鍩虹淇℃伅鍚屾鎺ュ彛锛�6.渚涘簲鍟嗕俊鎭帴鍙o紱7.瀹㈡埛淇℃伅鎺ュ彛锛�8.搴撳瓨
+ /// </summary>
+ public void SendErrorToUpstream(int type, string code, string message, string remark)
+ {
+ try
+ {
+ var url = "http://121.37.118.63:80/GYZ2/95fck/lexceptionLogog";
+
+ var requestData = new
+ {
+ type = type.ToString(),
+ code = code,
+ message = message,
+ remark = remark
+ };
+
+ var result = HttpHelper.Post(url, requestData.ToJsonString());
+ // 鍙互鍙嶅簭鍒楀寲妫�鏌� resultCode 鏄惁涓�0
+ }
+ catch (Exception e)
+ {
+ // 杩欓噷涓嶈鍐嶆姏寮傚父浜嗭紝閬垮厤姝诲惊鐜�
+ Console.WriteLine("寮傚父鎺ュ彛鎺ㄩ�佸け璐ワ細" + e.Message);
+ }
+ }
+ #endregion
+ }
+}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
index 39e9366..f35bfb2 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
@@ -41,12 +41,11 @@
private readonly IInventory_BatchServices _inventory_BatchServices;
private readonly IInventoryInfoService _inventoryInfoService;
private readonly ICabinOrderDetailServices _cabinOrderDetailServices;
- private readonly IDeliveryOrderServices _eliveryOrderServices;
private readonly ISupplyTaskService _supplyTaskService;
private readonly ISupplyTaskHtyService _supplyTaskHtyService;
public IRepository<Dt_CabinOrder> Repository => BaseDal;
- public CabinOrderServices(IRepository<Dt_CabinOrder> BaseDal, IBasicService basicService, IMedicineGoodsServices medicineGoodsServices, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, ICabinOrderDetailServices cabinOrderDetailServices, ICabinOrderHtyServices cabinOrderHtyServices, ICabinOrderDetailHtyServices cabinOrderDetailHtyServices, ISupplyTaskService supplyTaskService, ISupplyTaskHtyService supplyTaskHtyService, IDeliveryOrderServices eliveryOrderServices) : base(BaseDal)
+ public CabinOrderServices(IRepository<Dt_CabinOrder> BaseDal, IBasicService basicService, IMedicineGoodsServices medicineGoodsServices, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, ICabinOrderDetailServices cabinOrderDetailServices, ICabinOrderHtyServices cabinOrderHtyServices, ICabinOrderDetailHtyServices cabinOrderDetailHtyServices, ISupplyTaskService supplyTaskService, ISupplyTaskHtyService supplyTaskHtyService) : base(BaseDal)
{
_basicService = basicService;
_medicineGoodsServices = medicineGoodsServices;
@@ -56,7 +55,6 @@
_cabinOrderDetailServices = cabinOrderDetailServices;
_supplyTaskService = supplyTaskService;
_supplyTaskHtyService = supplyTaskHtyService;
- _eliveryOrderServices = eliveryOrderServices;
}
@@ -289,129 +287,6 @@
}
return content;
}
- static string SearchDate = "2025-09-10 00:00:00";
- /// <summary>
- /// 鑾峰彇涓婃父绯荤粺鐨勫叆搴撳崟
- /// </summary>
- /// <param name="searchDate"></param>
- /// <returns></returns>
- public WebResponseContent GetUpstreamOrder()
- {
- var responseContent = new WebResponseContent();
- try
- {
- // 璇锋眰鍦板潃
- var url = "http://121.37.118.63:80/GYZ2/95fck/inOrder";
- //var url = "http://127.0.0.1:4523/m2/5660322-5340849-default/363009261";
-
- if (string.IsNullOrEmpty(SearchDate)) SearchDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //// 璇锋眰鍙傛暟
- var requestData = new
- {
- searchDate = SearchDate
- //searchDate = "2022-10-10 20:45:16" // 姝g‘鐨勬牸寮�
- };
- SearchDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss");
- // 鍙戣捣璇锋眰
- var result = HttpHelper.Post(url, requestData.ToJsonString());
-
- // 鍙嶅簭鍒楀寲
- var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstreamOrderInfo>>(result);
-
- if (response.resultCode != "0")
- {
- // 璋冪敤寮傚父鎺ュ彛
- SendErrorToUpstream(1, "", response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触", "");
- return responseContent.Error(response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触");
- }
-
- if (response.data == null || !response.data.Any())
- {
- return responseContent.OK("鏃犳柊鍏ュ簱鍗曟暟鎹�");
- }
- // 鑾峰彇鎵�鏈夊凡瀛樺湪鐨勫叆搴撳崟鍙�
- var existingOrderNos = BaseDal.Db.Queryable<Dt_CabinOrder>()
- .Select(x => x.Order_no)
- .ToList();
-
- // 杩囨护鎺夊凡瀛樺湪鐨勫叆搴撳崟
- var newOrders = response.data
- .Where(order => !existingOrderNos.Contains(order.order_no))
- .ToList();
-
- if (!newOrders.Any())
- {
- return responseContent.OK("鎵�鏈夊叆搴撳崟宸插瓨鍦紝鏃犻渶鏂板");
- }
-
- Db.Ado.BeginTran();
- try
- {
- List<Dt_CabinOrder> _CabinOrders = new List<Dt_CabinOrder>();
- //瀛樺偍鍏ュ簱鍗曞彿
- List<string> orderNos = new List<string>();
-
- foreach (var order in newOrders)
- {
- if (order.order_type == "1") //姝e父鍏ュ簱
- {
- responseContent = CreateInboundOrder(order);
- List<Dt_CabinOrder>? dt_CabinOrders = responseContent.Data as List<Dt_CabinOrder>;
- if (dt_CabinOrders != null) _CabinOrders.AddRange(dt_CabinOrders);
- }
- 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);
- }
- _eliveryOrderServices.CreateOutboundOrder(upstramOutOrderInfo);
- #endregion
- }
- else if (order.order_type == "5")//鎶ユ孩鍏ュ簱
- {
-
- }
- };
- BaseDal.Db.InsertNav(_CabinOrders).Include(x => x.Details).ExecuteCommand();
-
- //鍦ㄤ笅鍙戠粰wcs
- //EdiIn(); //鍙戠粰涓嬫父
- //濡傛灉杩欎釜鏂规硶鎴愬姛浜嗭紝閭d箞灏辫皟鐢–ompleteOrder鎺ュ彛锛岀劧鍚庢敼鍙�
- Db.Ado.CommitTran();
- return responseContent.OK("鍚屾鍏ュ簱鍗曟垚鍔�");
- }
- catch (Exception ex)
- {
- Db.Ado.RollbackTran();
- SendErrorToUpstream(1, "", ex.Message, "");
- return responseContent.Error("鍚屾澶辫触: " + ex.Message);
- }
- }
- catch (Exception ex)
- {
- // 鍏ㄥ眬寮傚父鏃讹紝涔熸帹閫佸紓甯哥粰涓婃父
- SendErrorToUpstream(1, "", ex.Message, "");
- return responseContent.Error("鍚屾澶辫触: " + ex.Message);
- }
- }
-
#region 鍒涘缓鍏ュ簱鍗�
/// <summary>
@@ -582,209 +457,5 @@
return webResponseContent;
}
#endregion
-
- /// <summary>
- /// 浼犵粰wcs
- /// </summary>
- public WebResponseContent EdiIn()
- {
- try
- {
- //2.鏌ヨ绗﹀悎鏉′欢鐨勮鍗曪紙琛ㄥご = 鏂板缓 && 鍖呭惈鏈夋晥鏄庣粏锛�
- //var orders = BaseDal.Db.Queryable<Dt_CabinOrder>()
- // .Where(o => o.OdrderStatus == "鏂板缓")
- // .Includes(o => o.Details, d => d.MedicineGoods)
- // .ToList();
- //鏌ュ嚭鍖呭惈鍏ㄩ儴鐨勫叆搴撳崟锛屽寘鍚叏閮ㄦ槑缁�+涓�涓槑缁嗗搴斾竴涓晢鍝�
- var reslut = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
- var orders = BaseDal.Db.CopyNew()
- .Queryable<Dt_CabinOrder>()
- .Where(o => o.OdrderStatus == "鏂板缓" && o.Warehouse_no == reslut)
- .Includes(o => o.Details, d => d.MedicineGoods)
- .ToList();
- // 3. 鍐嶈繃婊ゆ帀涓嶇鍚堟潯浠剁殑鏄庣粏锛堝彧淇濈暀 Status=0锛�
- foreach (var order in orders)
- {
- Console.WriteLine($"璁㈠崟 {order.Order_no} 鍘熸槑缁嗘暟锛歿order.Details.Count}");
- order.Details = order.Details.Where(d => d.Status == 0).ToList();
- Console.WriteLine($"璁㈠崟 {order.Order_no} 杩囨护鍚庢槑缁嗘暟锛歿order.Details.Count}");
- }
-
-
- if (orders == null || !orders.Any())
- {
- Console.WriteLine("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
- return WebResponseContent.Instance.Error("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
- }
-
- // 4. 閬嶅巻璁㈠崟锛岀粍瑁� DTO 骞舵帹閫�
- foreach (var order in orders)
- {
- // 浠庣涓�涓湁 MedicineGoods 鐨勬槑缁嗕腑鍙栧嚭 MaterielErpType
- string materialCode = order.Details
- .Select(d => d.MedicineGoods?.MaterielErpType)
- .FirstOrDefault(x => !string.IsNullOrEmpty(x)) ?? "YY"; // 榛樿鍊糦Y
-
- var ediDto = new ToediInInfo
- {
-
- //瀹㈡埛浠g爜
- customerCode = "905",
- //鐗╂枡绫诲瀷
- materialCode = materialCode,
- //鍏ュ簱鍗曞彿
- externalOrderNo = order.Order_no,
- //鍏ュ簱鍗曠被鍨�
- inOrderType = order.Order_type == "1" ? "10" : "20",
- //浼樺厛绾�
- priority = 0,
- //鏄惁鍙栨秷
- Is_cancel = 0,
- details = order.Details.Select(d => new ToediInDetail
- {
- //鎵瑰彿
- batchNo = d.Batch_num,
- //浜у搧
- productCode = d.Goods_no,
- //sku鍚嶇О
- productName = d.MedicineGoods?.MaterielName,
- //sku瑙勬牸
- productSpecifications = d.MedicineGoods?.MaterielSpec,
- //鏁伴噺
- quantity = (int)d.Order_qty,
- //鏁堟湡
- validityPeriod = d.Exp_date,
- //鐢熶骇鍘傚
- manufacturer = d.MedicineGoods?.Factory,
- //鎴垮彿
- libraryNo = order.Warehouse_no,
- }).ToList()
- };
-
- var url = "http://172.16.1.2:9357/file-admin/api/in/ediIn";
- //var url = "http://127.0.0.1:4523/m2/5660322-5340849-default/363019549";
- var result = HttpHelper.Post(url, ediDto.ToJsonString());
- var resp = JsonConvert.DeserializeObject<TowcsResponse<object>>(result);
-
- if (resp != null && resp.code == "0")
- {
- // 鏇存柊琛ㄥご鐘舵��
- BaseDal.Db.Updateable<Dt_CabinOrder>()
- .SetColumns(o => new Dt_CabinOrder { OdrderStatus = "寮�濮�" })
- .Where(o => o.Id == order.Id)
- .ExecuteCommand();
-
- // 鏇存柊鏄庣粏鐘舵�佷负宸插悓姝� //杩欓噷瑕佹槸灏嗘柊寤�--銆嬪紑濮嬬姸鎬�,鍦ㄥ悗绔帴鍙h繑鍥炴垜浠殑鏃跺�欏湪杩斿洖宸插畬鎴�
- BaseDal.Db.Updateable<Dt_CabinOrderDetail>()
- .SetColumns(d => new Dt_CabinOrderDetail { Status = 1, OrderDetailStatus = "寮�濮�" })
- .Where(d => d.OrderId == order.Id && d.Status == 0)
- .ExecuteCommand();
-
- Console.WriteLine($"璁㈠崟 {order.Order_no} 鎺ㄩ�佹垚鍔�");
- }
- else
- {
- SendErrorToUpstream(3, order.Order_no, resp?.msg ?? "WCS 鎺ㄩ�佸け璐�", "");
- Console.WriteLine($"璁㈠崟 {order.Order_no} 鎺ㄩ�佸け璐ワ細{resp?.msg}");
- return new WebResponseContent { Status = false, Message = "璁㈠崟鎺ㄩ�佸け璐�" };
- }
- }
- return new WebResponseContent { Status = true, Message = "鎺ㄩ�佹垚鍔�" };
- }
- catch (Exception ex)
- {
-
- Console.WriteLine("EdiIn 寮傚父锛�" + ex.Message);
- return new WebResponseContent { Status = false, Message = ex.Message };
- }
- }
-
-
- /// <summary>
- /// 鍏ュ簱鎶ュ畬鎴愭帴鍙�
- /// </summary>
- /// <param name="order_no">鍏ュ簱鍗曞彿</param> //鍏堟鏌ユ槸鍚︽墍鏈夋槑缁嗛兘宸插畬鎴愶紝濡傛灉鏄紝閭d箞鏇存柊琛ㄥご鐘舵�佷负宸插畬鎴�
- /// <returns></returns>
- public WebResponseContent CompleteAllOrders()
- {
- var responseContent = new WebResponseContent();
- try
- {
- #region 鏌ユ壘鎵�鏈夊凡瀹屾垚鍏ュ簱鍗�
- var inorders = BaseDal.QueryData(x => x.OdrderStatus == "宸插畬鎴�").Select(x => x.Order_no).Distinct().ToList();
- foreach (var inorder in inorders)
- {
- //var Orders = BaseDal.QueryData(x => x.Order_no == inorder);
- var Orders = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == inorder).Includes(x => x.Details).ToList();
- if (!Orders.Where(x => x.OdrderStatus != "宸插畬鎴�").Any())
- {
- BaseDal.Db.Ado.BeginTran();
- BaseDal.DeleteAndMoveIntoHty(Orders, OperateTypeEnum.鑷姩瀹屾垚);
- foreach (var item in Orders)
- {
- _cabinOrderDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.鑷姩瀹屾垚);
- }
- // 璋冪敤涓婃父鎺ュ彛
- var url = "http://121.37.118.63:80/GYZ2/95fck/inOrderOk";
- var result = HttpHelper.Post(url, new { order_no = inorder }.ToJsonString());
- var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
- if (response.resultCode == "0")
- {
- // 鎻愪氦浜嬪姟
- BaseDal.Db.Ado.CommitTran();
- }
- else
- {
- BaseDal.Db.Ado.RollbackTran();
- SendErrorToUpstream(2, "", $"涓婃父鎺ュ彛杩斿洖澶辫触: {response.resultMsg}", inorder);
- }
- }
- }
- #endregion
- return responseContent.OK();
- }
- catch (Exception ex)
- {
- BaseDal.Db.Ado.RollbackTran();
- return responseContent.Error("鎵归噺澶勭悊澶辫触锛�" + ex.Message);
- }
- }
-
-
-
-
-
- /// <summary>
- /// 鎺ㄩ�佸紓甯镐俊鎭粰涓婃父绯荤粺1.鍏ュ簱鍗曟帴鍙o紱2.鍏ュ簱鍗曟姤瀹屾垚鎺ュ彛锛�3.鍑哄簱鍗曟帴鍙o紱4.鍑哄簱鎶ュ畬鎴愭帴鍙o紱5.鑽搧鍩虹淇℃伅鍚屾鎺ュ彛锛�6.渚涘簲鍟嗕俊鎭帴鍙o紱7.瀹㈡埛淇℃伅鎺ュ彛锛�8.搴撳瓨
- /// </summary>
- public void SendErrorToUpstream(int type, string code, string message, string remark)
- {
- try
- {
- var url = "http://121.37.118.63:80/GYZ2/95fck/lexceptionLogog";
-
- var requestData = new
- {
- type = type.ToString(),
- code = code,
- message = message,
- remark = remark
- };
-
- var result = HttpHelper.Post(url, requestData.ToJsonString());
- // 鍙互鍙嶅簭鍒楀寲妫�鏌� resultCode 鏄惁涓�0
- }
- catch (Exception e)
- {
- // 杩欓噷涓嶈鍐嶆姏寮傚父浜嗭紝閬垮厤姝诲惊鐜�
- Console.WriteLine("寮傚父鎺ュ彛鎺ㄩ�佸け璐ワ細" + e.Message);
- }
- }
-
-
-
-
-
-
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
index 37919a3..5e86027 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
@@ -34,14 +34,13 @@
{
public partial class DeliveryOrderServices : ServiceBase<Dt_DeliveryOrder, IRepository<Dt_DeliveryOrder>>, IDeliveryOrderServices
{
-
+ private readonly ICabinOrderServices _cabinOrderServices;
private readonly IBasicService _basicService;
private readonly IUnitOfWorkManage _unitOfWorkManage;
private readonly IInventory_BatchServices _inventory_BatchServices;
private readonly IInventoryInfoService _inventoryInfoService;
private readonly IDeliveryOrderDetailServices _deliveryOrderDetailServices;
private readonly ISupplyTaskService _supplyTaskService;
- private readonly ICabinOrderServices _cabinOrderServices;
private readonly ITacticsService _tacticsService;
public IRepository<Dt_DeliveryOrder> Repository => BaseDal;
public DeliveryOrderServices(IRepository<Dt_DeliveryOrder> BaseDal, IBasicService basicService, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService, ICabinOrderServices cabinOrderServices, ITacticsService tacticsService) : base(BaseDal)
@@ -55,133 +54,6 @@
_cabinOrderServices = cabinOrderServices;
_tacticsService = tacticsService;
}
-
-
- static string SearchDate = "2025-09-10 00:00:00";
- public WebResponseContent GetUpstreamOutOrder()
- {
- var responseContent = new WebResponseContent();
- try
- {
- var url = "http://121.37.118.63:80/GYZ2/95fck/outOrder";
- //var url = "http://127.0.0.1:4523/m1/5660322-5340849-default/GYZ2/95fck/outOrder";
- if (string.IsNullOrEmpty(SearchDate)) SearchDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //// 璇锋眰鍙傛暟
- var requestData = new
- {
- searchDate = SearchDate
- //searchDate = "2022-10-10 20:45:16" // 姝g‘鐨勬牸寮�
- };
- SearchDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss");
-
- var result = HttpHelper.Post(url, requestData.ToJsonString());
- var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstramOutOrderInfo>>(result);
-
- if (response.resultCode != "0")
- {
- SendErrorToUpstream(3, "", response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触", "");
- return responseContent.Error(response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触");
- }
-
- if (response.data == null || !response.data.Any())
- {
- return responseContent.OK("鏃犳柊鍑哄簱鍗曟暟鎹�");
- }
-
- // 宸插瓨鍦ㄥ嚭搴撳崟鍙�
- var existingOutOrderNos = BaseDal.Db.Queryable<Dt_DeliveryOrder>()
- .Select(x => x.Out_no)
- .ToList();
-
- // 鏂板嚭搴撳崟
- var newOutOrders = response.data
- .Where(outorder => !existingOutOrderNos.Contains(outorder.order_no))
- .ToList();
-
- List<string> order_no = newOutOrders.Select(x => x.order_no).ToList();
-
- if (!newOutOrders.Any())
- {
- return responseContent.OK("鎵�鏈夊嚭搴撳崟宸插瓨鍦紝鏃犻渶鏂板");
- }
-
- Db.Ado.BeginTran();
- try
- {
- List<Dt_DeliveryOrder> _DeliveryOrders = new List<Dt_DeliveryOrder>();
- List<string> orderNos = new List<string>();
-
- foreach (var outorder in newOutOrders)
- {
- if (outorder.order_type == "1") // 姝e父鍑哄簱鍗�
- {
- CreateOutboundOrder(outorder);//鍒涘缓鍑哄簱鍗曘�佸鐞嗗簱瀛樸�佹坊鍔犲嚭搴撲换鍔�
- }
- else if (outorder.order_type == "2")//鍑哄簱閫�璐�
- {
- // 鍒涘缓鍑哄簱閫�璐у崟 - 杩欓噷闇�瑕佹牴鎹笟鍔¢�昏緫瀹炵幇
- // 鏆傛椂璺宠繃鎴栧疄鐜伴��璐ч�昏緫
- //continue;
- #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);
- }
- responseContent = _cabinOrderServices.CreateInboundOrder(order);
- List<Dt_CabinOrder>? dt_CabinOrders = responseContent.Data as List<Dt_CabinOrder>;
- if (dt_CabinOrders != null && dt_CabinOrders.Count > 0)
- BaseDal.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
- #endregion
- }
- else if (outorder.order_type == "3")//鎶ユ崯鍑哄簱
- {
-
- }
- }
-
- // 鎵归噺鎻掑叆鍑哄簱鍗曞拰鏄庣粏
- //if (_DeliveryOrders.Any())
- //{
- // BaseDal.Db.InsertNav(_DeliveryOrders).Include(x => x.Details).ExecuteCommand();
- //}
- //涓嬪彂鍑哄簱鍗曚换鍔$粰wcs
-
-
- Db.Ado.CommitTran();
- //var tex = CreateSupplyTask(order_no);
- //if (!tex)
- //{
- // return responseContent.Error("鍒涘缓渚涘簲浠诲姟澶辫触");
- //}
- return responseContent.OK($"鍚屾鍑哄簱鍗曟垚鍔燂紝鍏眥_DeliveryOrders.Count}鏉�");
- }
- catch (Exception ex)
- {
- Db.Ado.RollbackTran();
- SendErrorToUpstream(3, "", ex.Message, "");
- return responseContent.Error("鍚屾澶辫触: " + ex.Message);
- }
- }
- catch (Exception ex)
- {
- SendErrorToUpstream(3, "", ex.Message, "");
- return responseContent.Error("鍚屾澶辫触: " + ex.Message);
- }
- }
/// <summary>
/// 鍒涘缓鍑哄簱鍗�
/// </summary>
@@ -193,7 +65,10 @@
try
{
Dt_Tactics tactics = _tacticsService.Repository.QueryFirst(x => x.TacticeName == "鍑哄簱绛栫暐");
- if (outorder.warehouse_no == WarehouseEnum.楹荤簿搴�.ObjToInt().ToString("000") || outorder.warehouse_no == WarehouseEnum.鍐峰喕搴�.ObjToInt().ToString("000"))
+ #region 鐗规畩搴撴埧鍑哄簱
+ string WareCodeMJ = WarehouseEnum.楹荤簿搴�.ObjToInt().ToString("000");
+ string WareCodeLD = WarehouseEnum.鍐峰喕搴�.ObjToInt().ToString("000");
+ if (outorder.warehouse_no == WareCodeMJ || outorder.warehouse_no == WareCodeLD)
{
#region 娣诲姞鍑哄簱鍗�
var entityOrder = new Dt_DeliveryOrder
@@ -219,6 +94,7 @@
BaseDal.Db.InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
#endregion
#region 澶勭悊搴撳瓨銆佸簱瀛樻壒娆°�佹坊鍔犲嚭搴撲换鍔�
+ List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
foreach (var item in entityOrder.Details)
{
Dt_Inventory_Batch inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.MaterielCode == item.Goods_no && x.BatchNo == item.Batch_num);
@@ -226,7 +102,7 @@
if (inventory_Batch.AvailableQuantity < item.Order_qty) throw new Exception($"鍑哄簱鍗曞彿銆恵entityOrder.Out_no}銆戜腑鐗╂枡缂栧彿銆恵item.Goods_no}銆戠墿鏂欐壒娆°�恵item.Batch_num}銆戠殑搴撳瓨鎵规淇℃伅鍙敤鏁伴噺涓嶈冻");
inventory_Batch.AvailableQuantity -= item.Order_qty;
inventory_Batch.OutboundQuantity += item.Order_qty;
- List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == item.Goods_no && x.BatchNo == item.Batch_num && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.StockQuantity > x.OutboundQuantity && x.WarehouseCode == item.Reservoirarea);
+ List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == item.Goods_no && x.BatchNo == item.Batch_num && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.AvailableQuantity > 0 && x.WarehouseCode == item.Reservoirarea);
#region 鎸夊嚭搴撶瓥鐣ユ煡鎵惧簱瀛�
if (tactics.SelectTactice == TacticsEnum.ComeOutonFirstTime.ObjToInt())
dt_InventoryInfos = dt_InventoryInfos.OrderBy(x => x.ValidityPeriod).ToList();
@@ -237,52 +113,66 @@
foreach (var InventoryInfo in dt_InventoryInfos)
{
if (Order_qty <= 0) break;
- if (InventoryInfo.AvailableQuantity < Order_qty)
+ if (InventoryInfo.AvailableQuantity <= Order_qty)
{
- InventoryInfo.AvailableQuantity = 0;
Order_qty -= InventoryInfo.AvailableQuantity;
InventoryInfo.OutboundQuantity += InventoryInfo.AvailableQuantity;
- InventoryInfo.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+ Dt_SupplyTask supplyTask = new Dt_SupplyTask()
+ {
+ WarehouseCode = InventoryInfo.WarehouseCode,
+ BatchNo = InventoryInfo.BatchNo,
+ MaterielName = InventoryInfo.MaterielName,
+ MaterielCode = InventoryInfo.MaterielCode,
+ MaterielSpec = InventoryInfo.MaterielSpec,
+ TaskStatus = SupplyStatusEnum.NewOut.ObjToInt(),
+ TaskType = TaskTypeEnum.OutPick.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName ?? "System",
+ LocationCode = InventoryInfo.LocationCode,
+ OrderNo = entityOrder.Out_no,
+ StockQuantity = InventoryInfo.AvailableQuantity,
+ SupplyQuantity = 0,
+ Remark = "鍑哄簱"
+ };
+ supplyTasks.Add(supplyTask);
+ InventoryInfo.AvailableQuantity = 0;
}
else
{
InventoryInfo.AvailableQuantity -= Order_qty;
- Order_qty = 0;
InventoryInfo.OutboundQuantity += Order_qty;
- InventoryInfo.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+ Dt_SupplyTask supplyTask = new Dt_SupplyTask()
+ {
+ WarehouseCode = InventoryInfo.WarehouseCode,
+ BatchNo = InventoryInfo.BatchNo,
+ MaterielName = InventoryInfo.MaterielName,
+ MaterielCode = InventoryInfo.MaterielCode,
+ MaterielSpec = InventoryInfo.MaterielSpec,
+ TaskStatus = SupplyStatusEnum.NewOut.ObjToInt(),
+ TaskType = TaskTypeEnum.OutPick.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName ?? "System",
+ LocationCode = InventoryInfo.LocationCode,
+ OrderNo = entityOrder.Out_no,
+ StockQuantity = Order_qty,
+ SupplyQuantity = 0,
+ Remark = "鍑哄簱"
+ };
+ supplyTasks.Add(supplyTask);
+ Order_qty = 0;
}
- }
- dt_InventoryInfos = dt_InventoryInfos.Where(X => X.StockStatus == StockStatusEmun.鍑哄簱閿佸畾.ObjToInt()).ToList();
- List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
- foreach (var inventoryInfo in dt_InventoryInfos)
- {
- Dt_SupplyTask supplyTask = new Dt_SupplyTask()
- {
- WarehouseCode = inventoryInfo.WarehouseCode,
- BatchNo = inventoryInfo.BatchNo,
- MaterielName = inventoryInfo.MaterielName,
- MaterielCode = inventoryInfo.MaterielCode,
- MaterielSpec = inventoryInfo.MaterielSpec,
- TaskStatus = SupplyStatusEnum.NewOut.ObjToInt(),
- TaskType = TaskTypeEnum.OutPick.ObjToInt(),
- CreateDate = DateTime.Now,
- Creater = App.User.UserName ?? "System",
- LocationCode = inventoryInfo.LocationCode,
- OrderNo = entityOrder.Out_no,
- StockQuantity = inventoryInfo.OutboundQuantity,
- SupplyQuantity = 0,
- Remark = "鍑哄簱"
- };
- supplyTasks.Add(supplyTask);
}
_inventory_BatchServices.Repository.UpdateData(inventory_Batch);
_inventoryInfoService.Repository.UpdateData(dt_InventoryInfos);
- _supplyTaskService.AddData(supplyTasks);
}
+ _supplyTaskService.AddData(supplyTasks);
#endregion
}
+ #endregion
else
{
+ string WareCodeDJ = WarehouseEnum.澶т欢搴�.ObjToInt().ToString("000");
+ string WareCodeLK = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
#region 鍒涘缓澶т欢搴撱�佺珛搴撳嚭搴撳ご琛�
var entityOrder = new Dt_DeliveryOrder
{
@@ -292,7 +182,7 @@
Client_name = outorder.client_name,
Account_time = outorder.account_time,
Client_no = outorder.client_no,
- Warehouse_no = WarehouseEnum.澶т欢搴�.ObjToInt().ToString("000"),
+ Warehouse_no = WareCodeDJ,
Details = new List<Dt_DeliveryOrderDetail>()
};
var entityOrderLK = new Dt_DeliveryOrder
@@ -303,7 +193,7 @@
Client_name = outorder.client_name,
Account_time = outorder.account_time,
Client_no = outorder.client_no,
- Warehouse_no = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"),
+ Warehouse_no = WareCodeLK,
Details = new List<Dt_DeliveryOrderDetail>()
};
#endregion
@@ -316,7 +206,7 @@
if (inventory_Batch.AvailableQuantity < detail.order_qty) throw new Exception($"鍑哄簱鍗曞彿銆恵outorder.order_no}銆戜腑鐗╂枡缂栧彿銆恵detail.goods_no}銆戠墿鏂欐壒娆°�恵detail.batch_num}銆戠殑搴撳瓨鎵规淇℃伅鍙敤鏁伴噺涓嶈冻");
inventory_Batch.AvailableQuantity -= detail.order_qty;
inventory_Batch.OutboundQuantity += detail.order_qty;
- List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.StockQuantity > x.OutboundQuantity && (x.WarehouseCode == WarehouseEnum.澶т欢搴�.ObjToInt().ToString("000") || x.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000")));
+ List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo && x.AvailableQuantity > 0 && (x.WarehouseCode == WareCodeDJ || x.WarehouseCode == WareCodeLK));
#endregion
#region 鎸夊嚭搴撶瓥鐣ユ煡鎵惧簱瀛�
if (tactics.SelectTactice == TacticsEnum.ComeOutonFirstTime.ObjToInt())
@@ -350,50 +240,59 @@
entityOrder.Details.Add(orderDetail);
#endregion
- #region 璁$畻搴撳瓨
+ List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
+ #region 璁$畻搴撳瓨銆佹坊鍔犲嚭搴撲换鍔�
foreach (var InventoryInfo in dt_InventoryInfos)
{
if (Order_qty <= 0) break;
if (InventoryInfo.AvailableQuantity < Order_qty)
{
- InventoryInfo.AvailableQuantity = 0;
Order_qty -= InventoryInfo.AvailableQuantity;
InventoryInfo.OutboundQuantity += InventoryInfo.AvailableQuantity;
- InventoryInfo.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+ Dt_SupplyTask supplyTask = new Dt_SupplyTask()
+ {
+ WarehouseCode = InventoryInfo.WarehouseCode,
+ BatchNo = InventoryInfo.BatchNo,
+ MaterielName = InventoryInfo.MaterielName,
+ MaterielCode = InventoryInfo.MaterielCode,
+ MaterielSpec = InventoryInfo.MaterielSpec,
+ TaskStatus = SupplyStatusEnum.NewOut.ObjToInt(),
+ TaskType = TaskTypeEnum.OutPick.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName ?? "System",
+ LocationCode = InventoryInfo.LocationCode,
+ OrderNo = entityOrder.Out_no,
+ StockQuantity = InventoryInfo.AvailableQuantity,
+ SupplyQuantity = 0,
+ Remark = "鍑哄簱"
+ };
+ supplyTasks.Add(supplyTask);
+ InventoryInfo.AvailableQuantity = 0;
}
else
{
InventoryInfo.AvailableQuantity -= Order_qty;
- Order_qty = 0;
InventoryInfo.OutboundQuantity += Order_qty;
- InventoryInfo.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+ Dt_SupplyTask supplyTask = new Dt_SupplyTask()
+ {
+ WarehouseCode = InventoryInfo.WarehouseCode,
+ BatchNo = InventoryInfo.BatchNo,
+ MaterielName = InventoryInfo.MaterielName,
+ MaterielCode = InventoryInfo.MaterielCode,
+ MaterielSpec = InventoryInfo.MaterielSpec,
+ TaskStatus = SupplyStatusEnum.NewOut.ObjToInt(),
+ TaskType = TaskTypeEnum.OutPick.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName ?? "System",
+ LocationCode = InventoryInfo.LocationCode,
+ OrderNo = entityOrder.Out_no,
+ StockQuantity = Order_qty,
+ SupplyQuantity = 0,
+ Remark = "鍑哄簱"
+ };
+ supplyTasks.Add(supplyTask);
+ Order_qty = 0;
}
- }
- #endregion
-
- #region 鐢熸垚鍑哄簱浠诲姟
- dt_InventoryInfos = dt_InventoryInfos.Where(X => X.StockStatus == StockStatusEmun.鍑哄簱閿佸畾.ObjToInt()).ToList();
- List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
- foreach (var inventoryInfo in dt_InventoryInfos)
- {
- Dt_SupplyTask supplyTask = new Dt_SupplyTask()
- {
- WarehouseCode = inventoryInfo.WarehouseCode,
- BatchNo = inventoryInfo.BatchNo,
- MaterielName = inventoryInfo.MaterielName,
- MaterielCode = inventoryInfo.MaterielCode,
- MaterielSpec = inventoryInfo.MaterielSpec,
- TaskStatus = SupplyStatusEnum.NewOut.ObjToInt(),
- TaskType = TaskTypeEnum.OutPick.ObjToInt(),
- CreateDate = DateTime.Now,
- Creater = App.User.UserName ?? "System",
- LocationCode = inventoryInfo.LocationCode,
- OrderNo = entityOrder.Out_no,
- StockQuantity = inventoryInfo.OutboundQuantity,
- SupplyQuantity = 0,
- Remark = "鍑哄簱"
- };
- supplyTasks.Add(supplyTask);
}
#endregion
_inventory_BatchServices.Repository.UpdateData(inventory_Batch);
@@ -403,6 +302,7 @@
#endregion
else
{
+ List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
Dt_DeliveryOrderDetail orderDetail = null;
Dt_DeliveryOrderDetail orderDetailLK = null;
var ys = Order_qty % materielInfo.BoxQty; //涓嶈兘鏁撮櫎绠辫鐨勬暎浠舵暟
@@ -424,11 +324,11 @@
}
#endregion
- #region 鏁翠欢浼樺厛鍒嗛厤澶т欢搴�
- foreach (var item in dt_InventoryInfos.Where(x => x.WarehouseCode == WarehouseEnum.澶т欢搴�.ObjToInt().ToString("000")))
+ #region 鏁翠欢浼樺厛鍒嗛厤澶т欢搴�,璁″垝搴撳瓨,娣诲姞鍑哄簱浠诲姟
+ foreach (var item in dt_InventoryInfos.Where(x => x.WarehouseCode == WareCodeDJ))
{
if (xs <= 0) break;
- item.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+ decimal outqty = 0;
while (item.AvailableQuantity > 0 && xs > 0)
{
xs--;
@@ -443,50 +343,73 @@
Exp_date = detail.exp_date,
OotDetailStatus = "鏂板缓",
Order_Outqty = 0,
- Status = 0
+ Status = 2
};
item.AvailableQuantity -= materielInfo.BoxQty;
item.OutboundQuantity += materielInfo.BoxQty;
+ outqty += materielInfo.BoxQty;
}
else
{
orderDetail.Order_qty += materielInfo.BoxQty;
item.AvailableQuantity -= materielInfo.BoxQty;
item.OutboundQuantity += materielInfo.BoxQty;
+ outqty += materielInfo.BoxQty;
}
}
+ Dt_SupplyTask supplyTask = new Dt_SupplyTask()
+ {
+ WarehouseCode = item.WarehouseCode,
+ BatchNo = item.BatchNo,
+ MaterielName = item.MaterielName,
+ MaterielCode = item.MaterielCode,
+ MaterielSpec = item.MaterielSpec,
+ TaskStatus = SupplyStatusEnum.NewOut.ObjToInt(),
+ TaskType = TaskTypeEnum.OutPick.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName ?? "System",
+ LocationCode = item.LocationCode,
+ OrderNo = entityOrder.Out_no,
+ StockQuantity = outqty,
+ SupplyQuantity = 0,
+ Remark = "鍑哄簱"
+ };
+ supplyTasks.Add(supplyTask);
+ _inventoryInfoService.Repository.UpdateData(item);
}
#endregion
#region 鍒嗛厤瀹屽ぇ浠跺簱濡傛灉杩樻湁绠辨暟锛屽啀閫夋嫨鍒嗛厤绔嬪簱
- if (orderDetailLK == null)
+ if (xs > 0)
{
- orderDetailLK = new Dt_DeliveryOrderDetail()
+ if (orderDetailLK == null)
{
- Reservoirarea = entityOrderLK.Warehouse_no,
- Goods_no = detail.goods_no,
- Order_qty = xs * materielInfo.BoxQty,
- Batch_num = detail.batch_num,
- Exp_date = detail.exp_date,
- OotDetailStatus = "鏂板缓",
- Order_Outqty = 0,
- Status = 0
- };
- }
- else
- {
- orderDetailLK.Order_qty += xs * materielInfo.BoxQty;
+ orderDetailLK = new Dt_DeliveryOrderDetail()
+ {
+ Reservoirarea = entityOrderLK.Warehouse_no,
+ Goods_no = detail.goods_no,
+ Order_qty = xs * materielInfo.BoxQty,
+ Batch_num = detail.batch_num,
+ Exp_date = detail.exp_date,
+ OotDetailStatus = "鏂板缓",
+ Order_Outqty = 0,
+ Status = 0
+ };
+ }
+ else
+ {
+ orderDetailLK.Order_qty += xs * materielInfo.BoxQty;
+ }
}
#endregion
- List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
+
+ #region 绔嬪簱鍑哄簱鍗曪紝淇敼绔嬪簱搴撳瓨锛屾坊鍔犵珛搴撳嚭搴撲换鍔�
if (orderDetailLK != null)
{
#region 娣诲姞鍑哄簱浠诲姟銆佷慨鏀瑰簱瀛樹俊鎭�
- Dt_InventoryInfo inventoryInfo = dt_InventoryInfos.Where(x => x.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000")).First();
+ Dt_InventoryInfo inventoryInfo = dt_InventoryInfos.Where(x => x.WarehouseCode == WareCodeLK).First();
inventoryInfo.AvailableQuantity -= orderDetailLK.Order_qty;
inventoryInfo.OutboundQuantity += orderDetailLK.Order_qty;
- inventoryInfo.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
- _inventoryInfoService.Repository.UpdateData(inventoryInfo);
Dt_SupplyTask supplyTask = new Dt_SupplyTask()
{
WarehouseCode = inventoryInfo.WarehouseCode,
@@ -500,44 +423,18 @@
Creater = App.User.UserName ?? "System",
LocationCode = inventoryInfo.LocationCode,
OrderNo = entityOrder.Out_no,
- StockQuantity = inventoryInfo.OutboundQuantity,
+ StockQuantity = orderDetailLK.Order_qty,
SupplyQuantity = 0,
Remark = "鍑哄簱"
};
supplyTasks.Add(supplyTask);
#endregion
+ _inventoryInfoService.Repository.UpdateData(inventoryInfo);
entityOrderLK.Details.Add(orderDetailLK);
}
- if (orderDetail != null)
- {
- #region 娣诲姞鍑哄簱浠诲姟銆佷慨鏀瑰簱瀛樹俊鎭�
- dt_InventoryInfos = dt_InventoryInfos.Where(X => X.StockStatus == StockStatusEmun.鍑哄簱閿佸畾.ObjToInt()).ToList();
- foreach (var inventoryInfo in dt_InventoryInfos)
- {
- Dt_SupplyTask supplyTask = new Dt_SupplyTask()
- {
- WarehouseCode = inventoryInfo.WarehouseCode,
- BatchNo = inventoryInfo.BatchNo,
- MaterielName = inventoryInfo.MaterielName,
- MaterielCode = inventoryInfo.MaterielCode,
- MaterielSpec = inventoryInfo.MaterielSpec,
- TaskStatus = SupplyStatusEnum.NewOut.ObjToInt(),
- TaskType = TaskTypeEnum.OutPick.ObjToInt(),
- CreateDate = DateTime.Now,
- Creater = App.User.UserName ?? "System",
- LocationCode = inventoryInfo.LocationCode,
- OrderNo = entityOrder.Out_no,
- StockQuantity = inventoryInfo.OutboundQuantity,
- SupplyQuantity = 0,
- Remark = "鍑哄簱"
- };
- supplyTasks.Add(supplyTask);
- }
- #endregion
- entityOrder.Details.Add(orderDetail);
- }
+ #endregion
+ if (orderDetail != null) entityOrder.Details.Add(orderDetail);
_inventory_BatchServices.Repository.UpdateData(inventory_Batch);
- _inventoryInfoService.Repository.UpdateData(dt_InventoryInfos);
_supplyTaskService.AddData(supplyTasks);
}
}
@@ -661,116 +558,6 @@
}
- /// <summary>
- /// 鍑哄簱鍗曟帹閫佺粰 WCS
- /// </summary>
- /// <returns></returns>
- public WebResponseContent EdiOut()
- {
- var responseContent = new WebResponseContent();
- try
- {
- // 1. 鏌ヨ绗﹀悎鏉′欢鐨勮鍗曪紙琛ㄥご=鏂板缓 && 鍖呭惈鏈夋晥鏄庣粏锛�
- var outOrders = BaseDal.Db.CopyNew().Queryable<Dt_DeliveryOrder>()
- .Where(o => o.OutStatus == "鏂板缓" && o.Warehouse_no == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
- .Includes(o => o.Details, d => d.MedicineGoods)
- .ToList();
-
- // 2. 鍐嶈繃婊ゆ帀涓嶇鍚堟潯浠剁殑鏄庣粏锛堝彧淇濈暀 Status=0 锛�
- foreach (var order in outOrders)
- {
- order.Details = order.Details.Where(d => d.Status == 0).ToList();
- }
-
- if (outOrders == null || !outOrders.Any())
- {
- Console.WriteLine("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
- return responseContent.Error("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
- }
-
- foreach (var order in outOrders)
- {
- try
- {
- string materialCode = "YY";//榛樿鍊�
- //鑾峰彇褰撳墠璁㈠崟鐨勭涓�涓槑缁嗛」
- var firstDetail = order.Details.FirstOrDefault();
- if (firstDetail?.MedicineGoods != null && !string.IsNullOrEmpty(firstDetail.MedicineGoods.MaterielErpType))
- {
- //濡傛灉鏉′欢婊¤冻锛屽皢鐗╂枡浠g爜璁剧疆涓虹涓�涓槑缁嗛」瀵瑰簲鐨勮嵂鍝佺墿鏂欎唬鐮�
- materialCode = firstDetail.MedicineGoods.MaterielErpType;
- }
- // 3. 缁勮 DTO
- var ediDto = new TowcsDto.ToediOutInfo
- {
- customerCode = "905",
- materialCode = materialCode,
- externalOrderNo = order.Out_no,
- outOrderType = order.Out_type == "1" ? "10" : order.Out_type == "3" ? "20" : "30",//鍑哄簱鍗曠被鍨嬫槸1灏辨槸姝e父鐨勶紝3灏辨槸鐩樼偣
- priority = 1,
- Is_cancel = 0,
- details = order.Details.Select(d => new TowcsDto.ToeOutdiInDetail
- {
- batchNo = d.Batch_num,
- productCode = d.Goods_no,
- productName = d.MedicineGoods?.MaterielName,
- productSpecifications = d.MedicineGoods?.MaterielModel,
- quantity = (int)d.Order_qty,
- //stocktakingDetails = order.Out_type == "3"
- // ? new List<ToOutediInStock>
- // {
- // new ToOutediInStock { palletCode = "FC00001", quantity = d.Order_qty.ToString() }
- // }
- // : null
- }).ToList()
- };
-
- // 4. 璋冪敤鎺ュ彛
- var url = "http://172.16.1.2:9357/file-admin/api/out/ediOut";
- //var url = "http://127.0.0.1:4523/m2/5660322-5340849-default/363076920";
-
- var result = HttpHelper.Post(url, ediDto.ToJsonString());
- var resp = JsonConvert.DeserializeObject<TowcsDto.TowcsResponse<object>>(result);
-
- if (resp != null && resp.code == "0")
- {
- // 鏇存柊琛ㄥご鐘舵��
- BaseDal.Db.Updateable<Dt_DeliveryOrder>()
- .SetColumns(o => new Dt_DeliveryOrder { OutStatus = "寮�濮�" })
- .Where(o => o.Id == order.Id)
- .ExecuteCommand();
-
- // 鏇存柊鏄庣粏鐘舵��
- BaseDal.Db.Updateable<Dt_DeliveryOrderDetail>()
- .SetColumns(d => new Dt_DeliveryOrderDetail { Status = 1, OotDetailStatus = "寮�濮�" })
- .Where(d => d.DeliveryOrderId == order.Id && d.Status == 0)
- .ExecuteCommand();
- Console.WriteLine($"璁㈠崟 {order.Out_no} 鎺ㄩ�佹垚鍔�");
- }
- else
- {
- SendErrorToUpstream(3, order.Out_no, resp?.msg ?? "WCS 鎺ㄩ�佸け璐�", "");
- Console.WriteLine($"璁㈠崟 {order.Out_no} 鎺ㄩ�佸け璐ワ細{resp?.msg}");
- }
- //鍒犻櫎鍏ㄩ儴鐘朵负宸插畬鎴愮殑鏄庣粏鍜岃〃澶达紝绉诲叆鍘嗗彶琛�
- }
- catch (Exception ex)
- {
- SendErrorToUpstream(3, order.Out_no, ex.Message, "");
- Console.WriteLine($"璁㈠崟 {order.Out_no} 鎺ㄩ�佸紓甯革細{ex.Message}");
- }
- }
-
- return responseContent.OK("鍑哄簱璁㈠崟鎺ㄩ�佸畬鎴�");
- }
- catch (Exception ex)
- {
- Console.WriteLine("EdiOut 寮傚父锛�" + ex.Message);
- return responseContent.Error("鍑哄簱璁㈠崟鎺ㄩ�佸け璐ワ細" + ex.Message);
- }
- }
-
-
//鐩樼偣 鎷挎暣涓壒娆′俊鎭〃鐨勫晢鍝佹壒鍙峰拰鍟嗗搧缂栧彿鏉ヨ繘琛岀洏鐐�
public WebResponseContent InventoryGood(string batchNo, string goodsNo)
{
@@ -832,88 +619,6 @@
catch (Exception ex)
{
return response.Error("鐩樼偣澶辫触锛�" + ex.Message);
- }
- }
-
-
-
-
- /// <summary>
- /// 鍑哄簱鎶ュ畬鎴愭帴鍙�
- /// </summary>
- /// <param name="out_no">鍑哄簱鍗曞彿</param>
- /// <returns></returns>
- public WebResponseContent CompleteAllOutOrders()
- {
- var responseContent = new WebResponseContent();
- try
- {
- #region 鏌ユ壘鎵�鏈夊凡瀹屾垚鍑哄簱鍗�
- var outorders = BaseDal.QueryData(x => x.OutStatus == "宸插畬鎴�").Select(x => x.Out_no).Distinct().ToList();
- foreach (var outorder in outorders)
- {
- var Orders = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == outorder).Includes(x => x.Details).ToList();
- if (!Orders.Where(x => x.OutStatus != "宸插畬鎴�").Any())
- {
- BaseDal.Db.Ado.BeginTran();
- BaseDal.DeleteAndMoveIntoHty(Orders, OperateTypeEnum.鑷姩瀹屾垚);
- foreach (var item in Orders)
- {
- _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.鑷姩瀹屾垚);
- }
- var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
- var requestDate = new
- {
- order_no = outorder
- };
- var result = HttpHelper.Post(url, requestDate.ToJsonString());
- var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
- if (response.resultCode == "0") BaseDal.Db.Ado.CommitTran();
- else
- {
- BaseDal.Db.Ado.RollbackTran();
- SendErrorToUpstream(4, "", $"涓婃父鎺ュ彛杩斿洖澶辫触: {response.resultMsg}", outorder);
- }
- }
- }
- #endregion
-
- return responseContent.OK();
- }
- catch (Exception ex)
- {
- BaseDal.Db.Ado.RollbackTran();
- return responseContent.Error("鎵归噺澶勭悊澶辫触锛�" + ex.Message);
- }
- }
-
-
-
-
- /// <summary>
- /// 鎺ㄩ�佸紓甯镐俊鎭粰涓婃父绯荤粺 1.鍏ュ簱鍗曟帴鍙o紱2.鍏ュ簱鍗曟姤瀹屾垚鎺ュ彛锛�3.鍑哄簱鍗曟帴鍙o紱4.鍑哄簱鎶ュ畬鎴愭帴鍙o紱5.鑽搧鍩虹淇℃伅鍚屾鎺ュ彛锛�6.渚涘簲鍟嗕俊鎭帴鍙o紱7.瀹㈡埛淇℃伅鎺ュ彛锛�8.搴撳瓨鏌ヨ鎺ュ彛
- /// </summary>
- public void SendErrorToUpstream(int type, string code, string message, string remark)
- {
- try
- {
- var url = "http://121.37.118.63:80/GYZ2/95fck/exceptionLog";
-
- var requestData = new
- {
- type = type.ToString(),
- code = code,
- message = message,
- remark = remark
- };
-
- var result = HttpHelper.Post(url, requestData.ToJsonString());
- // 鍙互鍙嶅簭鍒楀寲妫�鏌� resultCode 鏄惁涓�0
- }
- catch (Exception e)
- {
- // 杩欓噷涓嶈鍐嶆姏寮傚父浜嗭紝閬垮厤姝诲惊鐜�
- Console.WriteLine("寮傚父鎺ュ彛鎺ㄩ�佸け璐ワ細" + e.Message);
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
index e4c1574..0566819 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
@@ -297,12 +297,13 @@
inventory_Batch.SupplyQuantity = SupplyQuantitys;
_inventory_BatchServices.UpdateData(inventory_Batch);
}
- }
#endregion
+ }
_unitOfWorkManage.CommitTran();
#endregion
content.OK();
+ #endregion
}
catch (Exception ex)
{
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/CabinOrderController.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/CabinOrderController.cs"
index 4c41331..43bade7 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/CabinOrderController.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/CabinOrderController.cs"
@@ -16,13 +16,6 @@
{
}
-
- [HttpPost,Route("GetUpstreamOrder"),AllowAnonymous]
- public WebResponseContent GetUpstreamOrder()
- {
- return Service.GetUpstreamOrder();
- }
-
/// 鏌ヨ鍗曚俊鎭�
/// </summary>
/// <returns></returns>
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/DeliveryOrderController.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/DeliveryOrderController.cs"
index fe51171..7c65587 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/DeliveryOrderController.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/DeliveryOrderController.cs"
@@ -17,13 +17,6 @@
}
- [HttpPost,Route("GetUpstreamOutOrder"),AllowAnonymous]
- public WebResponseContent GetUpstreamOutOrder()
- {
- return Service.GetUpstreamOutOrder();
- }
-
-
/// <summary>
/// 鍒涘缓鐩樼偣浠诲姟
/// </summary>
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs"
index 67f6c64..88862f5 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs"
@@ -5,18 +5,18 @@
{
public class InOrderJob : Job
{
- private readonly ICabinOrderServices _cabinOrderServices;
- public InOrderJob(ICabinOrderServices cabinOrderServices)
+ private readonly IBusiness _business;
+ public InOrderJob(IBusiness business)
{
- _cabinOrderServices = cabinOrderServices;
+ _business = business;
}
//姣忛殧1绉掓墽琛屼竴娆�
[Invoke(Begin = "2025-09-01", Interval = 1000 * 5, IsEnabled = false,SkipWhileExecuting = true)]
public void Run()
{
- _cabinOrderServices.GetUpstreamOrder();
- _cabinOrderServices.EdiIn();
- _cabinOrderServices.CompleteAllOrders();
+ _business.GetUpstreamOrder();
+ _business.EdiIn();
+ _business.CompleteAllOrders();
}
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs"
index 1537ab9..5cca600 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs"
@@ -5,20 +5,20 @@
{
public class OutOrderJob : Job
{
- private readonly IDeliveryOrderServices _deliveryOrderServices;
- public OutOrderJob(IDeliveryOrderServices deliveryOrderServices)
+ private readonly IBusiness _business;
+ public OutOrderJob(IBusiness business)
{
- _deliveryOrderServices = deliveryOrderServices;
+ _business = business;
}
//姣忛殧1绉掓墽琛屼竴娆�
- [Invoke(Begin = "2025-09-01", Interval = 1000 * 5, IsEnabled =true, SkipWhileExecuting = true)]
+ [Invoke(Begin = "2025-09-01", Interval = 1000 * 5, IsEnabled = false, SkipWhileExecuting = true)]
public void Run()
{
//鑾峰彇涓婃父鍑哄簱鍗曟暟鎹�
- _deliveryOrderServices.GetUpstreamOutOrder();
+ _business.GetUpstreamOutOrder();
//涓嬪彂wcs
- //_deliveryOrderServices.EdiOut();
- //_deliveryOrderServices.CompleteAllOutOrders();
+ _business.EdiOut();
+ _business.CompleteAllOutOrders();
}
}
--
Gitblit v1.9.3