From 9086b238cd9fbb9fbeae7cab11d59576cd9d2853 Mon Sep 17 00:00:00 2001
From: liulijun <liulijun@hnkhzn.com>
Date: 星期一, 24 十一月 2025 10:27:01 +0800
Subject: [PATCH] 合并

---
 项目代码/WMS/WMSServices/WIDESEA_OutboundService/OutLineViewService.cs |   89 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 89 insertions(+), 0 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutLineViewService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutLineViewService.cs"
new file mode 100644
index 0000000..055f04e
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutLineViewService.cs"
@@ -0,0 +1,89 @@
+锘縰sing AutoMapper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Common.TaskEnum;
+using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
+using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Helper;
+using WIDESEA_IBasicRepository;
+using WIDESEA_IOutboundRepository;
+using WIDESEA_IOutboundService;
+using WIDESEA_Model.Models;
+
+namespace WIDESEA_OutboundService
+{
+    public class OutLineViewService : ServiceBase<Dt_OutLineView, IOutLineViewRepository>, IOutLineViewService
+    {
+        public IOutLineViewRepository Repository => BaseDal;
+        private IBasicRepository _basicRepository;
+        private readonly IMapper _mapper;
+        private readonly IUnitOfWorkManage _unitOfWorkManage;
+
+        public OutLineViewService(IOutLineViewRepository BaseDal, IBasicRepository basicRepository, IMapper mapper, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
+        {
+            _basicRepository = basicRepository;
+            _mapper = mapper;
+            _unitOfWorkManage = unitOfWorkManage;
+        }
+        /// <summary>
+        /// 鑾峰彇绾夸綋鍘熺焊
+        /// </summary>
+        /// <returns></returns>
+        public WebResponseContent GetOutLineView()
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                //鑾峰彇鏁版嵁
+                List<Dt_OutLineView> lineViews = BaseDal.QueryData().OrderBy(x=>x.CreateDate).ToList();
+                int taskCount = BaseDal.Db.Queryable<Dt_Task>().Where(x=>x.TaskType==TaskTypeEnum.OldYLOutbound.ObjToInt() && x.TaskStatus==TaskStatusEnum.Line_Executing.ObjToInt()).Count(); 
+                content.OK($"{taskCount}", lineViews);
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            return content;
+        }
+        /// <summary>
+        /// 瀛樺叆鏈�鏂扮殑鍑哄簱绾稿嵎淇℃伅
+        /// </summary>
+        /// <param name="outStockLockInfos"></param>
+        /// <returns></returns>
+        public WebResponseContent SaveLineView(List<Dt_OutStockLockInfo> outStockLockInfos)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                //鑾峰彇褰撳墠鑰佸巶缂撳瓨鎵�鏈夌焊鍗蜂俊鎭�
+                List<Dt_OutLineView> outLineViews = BaseDal.QueryData();
+                //鑾峰彇褰撳墠绾稿嵎涓暟
+                int? outLineCount = outLineViews?.Select(x => x.PalletCode).Distinct().Count();
+                if (outLineViews==null || outLineViews.Count<=0 || outLineCount<=2)
+                {
+                    List<Dt_OutLineView> outLineViewsAdd = outStockLockInfos.Select(x => _mapper.Map<Dt_OutLineView>(x)).ToList();
+                    BaseDal.AddData(outLineViewsAdd);
+                }
+                else
+                {
+                    //鑾峰彇鏈�鏃╃殑绾稿嵎淇℃伅
+                    string? code= outLineViews.FirstOrDefault()?.PalletCode;
+                    List<Dt_OutLineView> outLineViewsDel = outLineViews.Where(x=>x.PalletCode==code).ToList();
+                    List<Dt_OutLineView> outLineViewsAdd = outStockLockInfos.Select(x => _mapper.Map<Dt_OutLineView>(x)).ToList();
+                    BaseDal.DeleteData(outLineViewsDel);
+                    BaseDal.AddData(outLineViewsAdd);
+                }
+                content.OK("鎴愬姛");
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            return content;
+        }
+    }
+}

--
Gitblit v1.9.3