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

---
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs                           |    1 
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Services/ToMES/Partial/dt_mes_headService.cs                |   39 +++++-
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Services/WCS/Partial/dt_patternService.cs                   |   34 ++++
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs                            |    2 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs                           |    1 
 代码管理/PCS/WCS_Server/WIDESEA_WCS/IServices/ToMES/Partial/Idt_mes_headService.cs              |    2 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs                            |  126 +++++++++++++++++++++
 代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs                              |    3 
 代码管理/PCS/WCS_Client/config/buttons.js                                                       |    9 +
 代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs                    |   48 ++++++-
 代码管理/PCS/WCS_Client/src/extension/widesea_wcs/tomes/dt_mes_head.js                          |   45 ++++++-
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs                                    |    1 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs                     |    2 
 代码管理/PCS/WCS_Client/src/extension/widesea_wcs/wcs/dt_pattern.js                             |    4 
 代码管理/PCS/WCS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WCS/Partial/dt_mes_headController.cs |    6 +
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs                             |    1 
 16 files changed, 287 insertions(+), 37 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/config/buttons.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/config/buttons.js"
index f6a4529..24224ca 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/config/buttons.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/config/buttons.js"
@@ -98,6 +98,15 @@
     onClick: function () {
         // this.FinishWorkOrder();
     }
+}, {
+    name: "鍙栨秷",
+    icon: 'el-icon-delete',
+    type: 'danger',
+    plain: true,
+    value: 'CancelBtn',
+    onClick: function () {
+        // this.FinishWorkOrder();
+    }
 }
     // , {
     //     name: "鏁版嵁缁撴瀯",
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/extension/widesea_wcs/tomes/dt_mes_head.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/extension/widesea_wcs/tomes/dt_mes_head.js"
index 2609539..82ca53f 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/extension/widesea_wcs/tomes/dt_mes_head.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/extension/widesea_wcs/tomes/dt_mes_head.js"
@@ -32,14 +32,43 @@
         //       this.$Message.success('鐐瑰嚮浜嗘寜閽�');
         //     }
         //   });
-        // this.buttons.forEach(x => {
-        //   if(x.value == 'FinishWorkOrder')
-        //   {
-        //     x.name = '瀹屾垚宸ュ崟'
-        //     x.type='success'
-        //     x.icon= 'el-icon-check'
-        //   }
-        // });
+        this.buttons.forEach(x => {
+          if(x.value == 'CancelBtn')
+          {
+            x.name = '鍙栨秷鍑哄簱澶栧崗'
+          }
+        });
+        let CancelBtn = this.buttons.find(r => r.name == "鍙栨秷鍑哄簱澶栧崗");
+        if(null!=CancelBtn){
+          CancelBtn.onClick = function (){
+            let rows = this.$refs.table.getSelected();
+            if (rows.length == 0) return this.$error("璇烽�夋嫨宸ュ崟!");
+            let addkeys = rows.map(x => {
+                return x[this.table.key];
+            });
+            if (!addkeys || addkeys.Length == 0) return this.$error("鏈幏鍙栧埌宸ュ崟!");
+            this.$confirm("鏄惁纭鍙栨秷鍑哄簱澶栧崗锛�","鎻愮ず",{
+                        // iconClass:"el-icon-success",//el-icon-remove鑷畾涔夊浘鏍囨牱寮�
+                        confirmButtonText:"纭",//纭鎸夐挳鏂囧瓧鏇存崲
+                        cancelButtonText:"鍙栨秷",//鍙栨秷鎸夐挳鏂囧瓧鏇存崲
+                        // cancelBtn:"鍙栨秷",//鍙栨秷鎸夐挳鏂囧瓧鏇存崲
+                        showClose: true,//鏄惁鏄剧ず鍙充笂瑙掑叧闂寜閽�
+                        type: "warning",//鎻愮ず绫诲瀷 success:鎴愬姛/info:淇℃伅/warning:璀﹀憡/error:鎶ラ敊
+            }).then(()=>{
+              let params = {
+                MainData: null,
+                DetailData: null,
+                DelKeys: addkeys
+            }
+            this.http.post("/api/dt_mes_head/CancelsorcingWorkOrder", params, "姝e湪澶勭悊宸ュ崟....").then(x => {
+                if (!x.status) return this.$error(x.message);
+                this.$success("澶勭悊宸ュ崟鎴愬姛!");
+                this.refresh();
+            });
+            })
+
+          }
+        }
         let OutsorcingBtn = this.buttons.find(r => r.name == "鍑哄簱澶栧崗");
         if(null!=OutsorcingBtn){
           OutsorcingBtn.onClick = function (){
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/extension/widesea_wcs/wcs/dt_pattern.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/extension/widesea_wcs/wcs/dt_pattern.js"
index 6c8718b..400e74e 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/extension/widesea_wcs/wcs/dt_pattern.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/extension/widesea_wcs/wcs/dt_pattern.js"
@@ -59,7 +59,7 @@
                     // this.request(row);
                   }
                 },
-                '鑷姩'
+                '妯″紡1'
               ),
               h(
                 'span',
@@ -78,7 +78,7 @@
                     // this.request(row);
                   }
                 },
-                '鎵嬪姩'
+                '妯″紡2'
               )
             ]);
           }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/IServices/ToMES/Partial/Idt_mes_headService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/IServices/ToMES/Partial/Idt_mes_headService.cs"
index beefb52..6e7d0f9 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/IServices/ToMES/Partial/Idt_mes_headService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/IServices/ToMES/Partial/Idt_mes_headService.cs"
@@ -9,6 +9,8 @@
 {
     public partial interface Idt_mes_headService
     {
+        WebResponseContent CancelsorcingWorkOrder(SaveModel saveModel);
+
         /// <summary>
         /// 鎵嬪姩瀹屾垚宸ュ崟
         /// </summary>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
index 21d0f97..be0d733 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
@@ -31,7 +31,6 @@
         private void DoAction(IJobExecutionContext context)
         {
             StationTask.CreateTask();//鍏ュ簱
-            OutboundTask.CreateOutboundTask();//鍑哄簱
             RestockHCJ.HCJGetBarcode();//鏇存柊闃熷垪
             EmptyTrayTask.CreateEmptyTrayTask();//鍒涘缓琛ョ┖鎵�
             AutoUpdateWork.FinishMesWork();//澶勭悊宸ュ崟
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Services/ToMES/Partial/dt_mes_headService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Services/ToMES/Partial/dt_mes_headService.cs"
index 4d73059..53182ec 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Services/ToMES/Partial/dt_mes_headService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Services/ToMES/Partial/dt_mes_headService.cs"
@@ -21,6 +21,7 @@
 using WIDESEA_WCS.JobsPart.Common;
 using WIDESEA_Core.ManageUser;
 using WIDESEA_Comm.LogInfo;
+using System.Collections.Generic;
 
 namespace WIDESEA_WCS.Services
 {
@@ -41,20 +42,20 @@
             //澶氱鎴蜂細鐢ㄥ埌杩檌nit浠g爜锛屽叾浠栨儏鍐靛彲浠ヤ笉鐢�
             //base.Init(dbRepository);
         }
-        public WebResponseContent OutsorcingWorkOrder(SaveModel model)
+        public WebResponseContent CancelsorcingWorkOrder(SaveModel saveModel)
         {
             WebResponseContent content = new WebResponseContent();
             string compeletor = UserContext.Current.UserName;
+            List<string> list = new List<string>();
             try
             {
-                List<string> list = new List<string>();
-                foreach (var Key in model.DelKeys)
+                foreach (var Key in saveModel.DelKeys)
                 {
                     var mes_head = _repository.Find(x => x.mes_id.ToString() == Key.ToString()).FirstOrDefault();
                     if (mes_head != null)
                     {
-                        mes_head.area = "澶栧崗";
-                        _repository.Update(mes_head, true);
+                        mes_head.area = null;
+                        _repository.Update(mes_head, x => new { x.area }, true);
                         list.Add(mes_head.jobID);
                     }
                 }
@@ -63,7 +64,33 @@
             }
             catch (Exception ex)
             {
-                WriteDBLog.Error("鎸囧畾宸ュ崟鍑哄簱澶栧崗", $"閿欒淇℃伅锛歿ex.Message}", "PCS", compeletor);
+                WriteDBLog.Error("鍙栨秷宸ュ崟鍑哄簱澶栧崗", $"宸ュ崟缂栧彿锛歿list}\n閿欒淇℃伅锛歿ex.Message}", "PCS", compeletor);
+            }
+            return content;
+        }
+        public WebResponseContent OutsorcingWorkOrder(SaveModel model)
+        {
+            WebResponseContent content = new WebResponseContent();
+            string compeletor = UserContext.Current.UserName;
+            List<string> list = new List<string>();
+            try
+            {
+                foreach (var Key in model.DelKeys)
+                {
+                    var mes_head = _repository.Find(x => x.mes_id.ToString() == Key.ToString()).FirstOrDefault();
+                    if (mes_head != null)
+                    {
+                        mes_head.area = "澶栧崗";
+                        _repository.Update(mes_head, x => new { x.area }, true);
+                        list.Add(mes_head.jobID);
+                    }
+                }
+                content.OK();
+                WriteDBLog.Success("鎸囧畾宸ュ崟鍑哄簱澶栧崗", $"宸ュ崟缂栧彿锛歿list}", "PCS", compeletor);
+            }
+            catch (Exception ex)
+            {
+                WriteDBLog.Error("鎸囧畾宸ュ崟鍑哄簱澶栧崗", $"宸ュ崟缂栧彿锛歿list}\n閿欒淇℃伅锛歿ex.Message}", "PCS", compeletor);
             }
             return content;
         }
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;
         }
-  }
+    }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WCS/Partial/dt_mes_headController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WCS/Partial/dt_mes_headController.cs"
index 95f0b4f..6e45bb2 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WCS/Partial/dt_mes_headController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WCS/Partial/dt_mes_headController.cs"
@@ -49,5 +49,11 @@
         {
             return Service.OutsorcingWorkOrder(saveModel);
         }
+
+        [HttpPost, Authorize, Route("CancelsorcingWorkOrder"), AllowAnonymous]
+        public WebResponseContent CancelsorcingWorkOrder([FromBody] SaveModel saveModel)
+        {
+            return Service.CancelsorcingWorkOrder(saveModel);
+        }
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs"
index cd1a356..dda1b9e 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs"
@@ -17,7 +17,7 @@
     public partial class VV_Mes_Workinfo : BaseEntity
     {
         /// <summary>
-        ///宸ュ崟缂栧彿
+        ///
         /// </summary>
         [Display(Name = "jobID")]
         [MaxLength(40)]
@@ -26,7 +26,7 @@
         public string jobID { get; set; }
 
         /// <summary>
-        ///鐐変唬鍙�
+        ///鐐夊彿
         /// </summary>
         [Display(Name = "heatID")]
         [MaxLength(20)]
@@ -35,7 +35,7 @@
         public string heatID { get; set; }
 
         /// <summary>
-        ///閽㈠澂鍙�
+        ///
         /// </summary>
         [Display(Name = "billetID")]
         [Column(TypeName = "int")]
@@ -88,7 +88,7 @@
         public string reqIDLineNo { get; set; }
 
         /// <summary>
-        ///鐗╂枡缂栫爜
+        ///
         /// </summary>
         [Display(Name = "materialCode")]
         [MaxLength(20)]
@@ -106,7 +106,7 @@
         public string drawingNo { get; set; }
 
         /// <summary>
-        ///鎶�鏈姸鎬�
+        ///
         /// </summary>
         [Display(Name = "drawingNoVer")]
         [MaxLength(10)]
@@ -115,7 +115,7 @@
         public string drawingNoVer { get; set; }
 
         /// <summary>
-        ///浜у搧鍚嶇О
+        ///
         /// </summary>
         [Display(Name = "productName")]
         [MaxLength(40)]
@@ -137,7 +137,7 @@
         [Display(Name = "quantity")]
         [Column(TypeName = "int")]
         [Editable(true)]
-        public int? quantity { get; set; }
+        public int quantity { get; set; }
 
         /// <summary>
         ///
@@ -149,7 +149,7 @@
         public string typeID { get; set; }
 
         /// <summary>
-        ///
+        ///鎵撳寘鏁伴噺
         /// </summary>
         [Key]
         [Display(Name = "stackNoRange")]
@@ -159,7 +159,7 @@
         public int stackNoRange { get; set; }
 
         /// <summary>
-        ///宸ュ崟绫诲瀷 (17-鏈哄姞宸� 28-妫�娴嬬嚎 101-绉诲簱澶栧崗)
+        ///宸ュ崟绫诲瀷 (17-鏈哄姞宸� 28-妫�娴嬬嚎 101绉诲簱澶栧崗)
         /// </summary>
         [Display(Name = "processCode")]
         [MaxLength(20)]
@@ -167,6 +167,36 @@
         [Editable(true)]
         public string processCode { get; set; }
 
+        /// <summary>
+        ///瀹屾垚鏁伴噺
+        /// </summary>
+        [Display(Name = "瀹屾垚鏁伴噺")]
+        [Column(TypeName = "int")]
+        [Editable(true)]
+        public int? finishNum { get; set; }
 
+        /// <summary>
+        ///鍒涘缓鏃堕棿
+        /// </summary>
+        [Display(Name = "鍒涘缓鏃堕棿")]
+        [Column(TypeName = "datetime")]
+        public DateTime CreateTime { get; set; }
+
+        /// <summary>
+        ///瀹屾垚鏃堕棿
+        /// </summary>
+        [Display(Name = "瀹屾垚鏃堕棿")]
+        [Column(TypeName = "datetime")]
+        [Editable(true)]
+        public DateTime? FinishTime { get; set; }
+
+        /// <summary>
+        ///宸ュ崟鐘舵��
+        /// </summary>
+        [Display(Name = "宸ュ崟鐘舵��")]
+        [MaxLength(20)]
+        [Column(TypeName = "nvarchar(20)")]
+        [Editable(true)]
+        public string Status { get; set; }
     }
 }
\ No newline at end of file
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs"
index 6d67997..5d5efe5 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs"
@@ -9,7 +9,6 @@
 using WIDESEA_Core.EFDbContext;
 using WIDESEA_Entity.DomainModels;
 using WIDESEA_WCS.IRepositories;
-using WIDESEA_WCS.JobsPart.Common;
 using WIDESEA_WCS.Repositories;
 using WIDESEA_WMS.IRepositories;
 using WIDESEA_WMS.Repositories;
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs"
index 4fdd1c7..4d96421 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs"
@@ -9,7 +9,6 @@
 using WIDESEA_Common;
 using WIDESEA_Core.EFDbContext;
 using WIDESEA_Entity.ToAGV;
-using WIDESEA_WCS.JobsPart.Common;
 using WIDESEA_WMS.IRepositories;
 using WIDESEA_WMS.Repositories;
 
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs"
index 5fb2730..eb980ec 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs"
@@ -9,7 +9,6 @@
 using WIDESEA_Common;
 using WIDESEA_Core.EFDbContext;
 using WIDESEA_Entity.ToAGV;
-using WIDESEA_WCS.JobsPart.Common;
 using WIDESEA_WMS.IRepositories;
 using WIDESEA_WMS.Repositories;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs"
index 7a954ea..47deee7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs"
@@ -11,7 +11,7 @@
 using WIDESEA_WMS.Repositories;
 using static System.Collections.Specialized.BitVector32;
 
-namespace WIDESEA_WCS.JobsPart.Common
+namespace WIDESEA_WMS.Common
 {
     public class GetStation
     {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs"
index 5d676fa..27b7e4c 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs"
@@ -11,7 +11,7 @@
 using WIDESEA_WMS.IRepositories;
 using WIDESEA_WMS.Repositories;
 
-namespace WIDESEA_WCS.JobsPart.Common
+namespace WIDESEA_WMS.Common
 {
     public class EmptyTray
     {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs"
new file mode 100644
index 0000000..6edd1a4
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs"
@@ -0,0 +1,126 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography.Xml;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Comm.TaskNo;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_Core.Extensions;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_WCS.IRepositories;
+using WIDESEA_WCS.Repositories;
+using WIDESEA_WMS.IRepositories;
+using WIDESEA_WMS.Repositories;
+using static FreeSql.Internal.GlobalFilter;
+using static System.Collections.Specialized.BitVector32;
+
+namespace WIDESEA_WMS.Common
+{
+    public class OutboundTask
+    {
+        /// <summary>
+        /// 鍒涘缓鍑哄簱闃熷垪浠诲姟
+        /// </summary>
+        public static void CreateOutboundTask()
+        {
+            try
+            {
+                VOLContext context = new VOLContext();
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
+                Idt_inventoryRepository inventoryRepository = new dt_inventoryRepository(context);
+                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
+                IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context);
+
+                var Mes_Works = workinfoRepository.Find(x => x.processCode == "28").OrderByDescending(x => x.CreateTime).ToList();
+                foreach (var Mes_Work in Mes_Works)
+                {
+                    var inventory = inventoryRepository.Find(x => x.SN == Mes_Work.SN).FirstOrDefault();
+                    if (inventory != null)
+                    {
+                        var Station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault();//鏌ユ壘搴撳瓨璐т綅
+                        if (Station != null)
+                        {
+
+                            #region 
+
+                            dt_stationinfo stationinfo = null;
+                            //鏌ユ壘褰撳墠璐т綅鍚岃鏄惁瀛樺湪鍏ュ簱浠诲姟
+                            if (GetStation.InBusyStation(Station.stationCode)) continue;
+
+                            stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault();
+                            if (stationinfo != null)
+                            {
+                                if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any()) continue;
+
+                                if (stationinfoRepository.Find(x => x.line == stationinfo.line && x.area == stationinfo.area && x.column > stationinfo.column && !x.enable).Any())
+                                    continue;
+                                if (string.IsNullOrEmpty(stationinfo.bindSN))
+                                {
+                                    stationinfo.remark = "杞﹁疆SN鍙蜂俊鎭紓甯�";
+                                    stationinfo.location_state = "Abnormal";
+                                    stationinfoRepository.Update(stationinfo, true);
+                                    continue;
+                                }
+
+                                if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any()) continue;
+
+                                List<string> lists = new List<string>();
+                                var SNS = stationinfo.bindSN.Split(",");
+                                foreach (var SN in SNS)
+                                {
+                                    if (!string.IsNullOrEmpty(SN))
+                                        lists.Add(SN);
+                                }
+
+                                #region 璐т綅杞﹁疆鍏ㄩ儴鍖呭惈鍦ㄥ伐鍗曞唴鍒欎笅鍙戜换鍔�
+                                var count = 0;
+                                foreach (var SN in lists)
+                                {
+                                    if (workinfoRepository.Find(x => x.processCode == "28" && x.SN == SN).Any()) count++;
+                                    //if (workinfoRepository.Find(x => x.processCode == "28" && x.SN.Contains(SN)).Any()) count++;
+
+                                }
+                                if (count != lists.Count) continue;
+                                dt_agvtask agvtask = new dt_agvtask()
+                                {
+                                    agv_fromaddress = stationinfo.stationCode,
+                                    agv_id = Guid.NewGuid(),
+                                    agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+                                    agv_grade = 2,
+                                    agv_createtime = DateTime.Now,
+                                    agv_taskstate = "Queue",
+                                    agv_materielid = stationinfo.stationType,
+                                    agv_qty = stationinfo.quantity,
+                                    agv_tasktype = "TaskType_Outbound",
+                                    agv_toaddress = "",
+                                    agv_userid = "绯荤粺",
+                                    bindSN = stationinfo.bindSN,
+                                    jobID = Mes_Work.workOrder,
+                                    agv_worktype = Convert.ToInt32(Mes_Work.processCode),
+                                    agv_materbarcode = Mes_Work.materialCode,
+                                    agv_Traytype = stationinfo.tray_type,
+                                    agv_TrayStatus = stationinfo.tray_status
+                                };
+                                stationinfo.location_state = LocationStateEnum.OutBusy.ToString();
+                                stationinfoRepository.Update(stationinfo, true);
+                                agvtaskRepository.Add(agvtask, true);
+                                WriteDBLog.Success("鍒涘缓鍑哄簱浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
+                                continue;
+
+                                #endregion
+                            }
+                            #endregion
+                        }
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                WriteDBLog.Error("鍒涘缓鍑哄簱浠诲姟", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+            }
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs"
index 351e8bd..ac426e7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobQueueTask.cs"
@@ -5,11 +5,12 @@
 {
     public class JobQueueTask : Job
     {
-        [Invoke(Begin = "2024-01-01 00:00", Interval = 1000 * 2, IsEnabled = true, SkipWhileExecuting = true)]
+        [Invoke(Begin = "2024-01-01 00:00", Interval = 1000 * 3, IsEnabled = true, SkipWhileExecuting = true)]
         public void QueueTaskTiem()
         {
             QueueTask.ReplaceTrayTask();
             ToMes.InfoToMes();
+            OutboundTask.CreateOutboundTask();
         }
     }
 }

--
Gitblit v1.9.3