From fdf6494705b9bcddb2e16b933b231262497fc227 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 07 六月 2024 17:04:58 +0800
Subject: [PATCH] 添加取消出库外协功能,设置模式1和模式2

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Services/WCS/Partial/dt_patternService.cs |   34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Services/WCS/Partial/dt_patternService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Services/WCS/Partial/dt_patternService.cs"
index c9977db..91c04eb 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Services/WCS/Partial/dt_patternService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Services/WCS/Partial/dt_patternService.cs"
@@ -19,6 +19,9 @@
 using WIDESEA_WCS.IRepositories;
 using Microsoft.AspNetCore.Mvc.RazorPages;
 using Newtonsoft.Json;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_WCS.Repositories;
+using WIDESEA_Comm;
 
 namespace WIDESEA_WCS.Services
 {
@@ -39,29 +42,50 @@
             //澶氱鎴蜂細鐢ㄥ埌杩檌nit浠g爜锛屽叾浠栨儏鍐靛彲浠ヤ笉鐢�
             //base.Init(dbRepository);
         }
+        /// <summary>
+        /// 妯″紡1
+        /// </summary>
+        /// <param name="v"></param>
+        /// <returns></returns>
         public WebResponseContent UpdateAuto(string v)
         {
             WebResponseContent content = new WebResponseContent();
+            VOLContext context = new VOLContext();
+            Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
+            var stations = stationinfoRepository.Find(x => x.stationCode == "X01001001" || x.stationCode == "X01001002" || x.stationCode == "X02001001" || x.stationCode == "X02001002").ToList();
+            if (stations.Where(x => x.tray_status == TrayStateEnum.StrogeTray.ToString()).Any())
+                return content.Error("璁剧疆涓烘ā寮�1澶辫触锛佷笅鏂欎綅瀛樺湪杞﹁疆锛�");
+
             var model = JsonConvert.DeserializeObject<dt_pattern>(v);
             model.pattern_state = 1;
             var cont = _repository.Update(model, true);
             if (cont > 0)
-                content.OK(model.pattern_name + "璁剧疆涓鸿嚜鍔ㄥ叆搴撴垚鍔燂紒");
+                content.OK(model.pattern_name + "璁剧疆涓烘ā寮�1鎴愬姛锛�");
             else
-                content.Error(model.pattern_name + "璁剧疆涓鸿嚜鍔ㄥ叆搴撳け璐ワ紒");
+                content.Error(model.pattern_name + "璁剧疆涓烘ā寮�1澶辫触锛�");
             return content;
         }
+        /// <summary>
+        /// 妯″紡2
+        /// </summary>
+        /// <param name="v"></param>
+        /// <returns></returns>
         public WebResponseContent UpdateManual(string v)
         {
             WebResponseContent content = new WebResponseContent();
+            VOLContext context = new VOLContext();
+            Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
+            var stations = stationinfoRepository.Find(x => x.stationCode == "X01001001" || x.stationCode == "X01001002" || x.stationCode == "X02001001" || x.stationCode == "X02001002").ToList();
+            if (stations.Where(x => x.tray_status == TrayStateEnum.StrogeTray.ToString()).Any())
+                return content.Error("璁剧疆涓烘ā寮�2澶辫触锛佷笅鏂欎綅瀛樺湪杞﹁疆锛�");
             var model = JsonConvert.DeserializeObject<dt_pattern>(v);
             model.pattern_state = 0;
             var cont = _repository.Update(model, true);
             if (cont > 0)
-                content.OK(model.pattern_name + "璁剧疆涓烘墜鍔ㄥ叆搴撴垚鍔燂紒");
+                content.OK(model.pattern_name + "璁剧疆涓烘ā寮�2鎴愬姛锛�");
             else
-                content.Error(model.pattern_name + "璁剧疆涓烘墜鍔ㄥ叆搴撳け璐ワ紒");
+                content.Error(model.pattern_name + "璁剧疆涓烘ā寮�2澶辫触锛�");
             return content;
         }
-  }
+    }
 }

--
Gitblit v1.9.3