Jelajahi Sumber

Revert "新增当前地址、目标产线、WCS任务号搜索"

This reverts commit a30ff80e5562a805adda2eb22786ac146b80074d.
林豪 左 3 tahun lalu
induk
melakukan
b1eddd4483

+ 31 - 9
WCS_Client/Extensions/JsonExtensions.cs → WCS_Client/Extensions.cs

@@ -5,13 +5,17 @@ using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
 
 namespace WCS_Client
 {
     /// <summary>
     /// 扩展.json序列反序列化
     /// </summary>
-    public static partial class JsonExtensions
+    public static partial class Extensions
     {
         /// <summary>
         /// 转成json对象
@@ -22,7 +26,6 @@ namespace WCS_Client
         {
             return Json == null ? null : JsonConvert.DeserializeObject(Json);
         }
-
         /// <summary>
         /// 转成json字串
         /// </summary>
@@ -33,7 +36,6 @@ namespace WCS_Client
             var timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
             return JsonConvert.SerializeObject(obj, timeConverter);
         }
-
         /// <summary>
         /// 转成json字串
         /// </summary>
@@ -45,7 +47,6 @@ namespace WCS_Client
             var timeConverter = new IsoDateTimeConverter { DateTimeFormat = datetimeformats };
             return JsonConvert.SerializeObject(obj, timeConverter);
         }
-
         /// <summary>
         /// 字串反序列化成指定对象实体
         /// </summary>
@@ -56,7 +57,6 @@ namespace WCS_Client
         {
             return Json == null ? default(T) : JsonConvert.DeserializeObject<T>(Json);
         }
-
         /// <summary>
         /// 字串反序列化成指定对象实体(列表)
         /// </summary>
@@ -67,7 +67,6 @@ namespace WCS_Client
         {
             return Json == null ? null : JsonConvert.DeserializeObject<List<T>>(Json);
         }
-
         /// <summary>
         /// 字串反序列化成DataTable
         /// </summary>
@@ -77,7 +76,6 @@ namespace WCS_Client
         {
             return Json == null ? null : JsonConvert.DeserializeObject<DataTable>(Json);
         }
-
         /// <summary>
         /// 字串反序列化成linq对象
         /// </summary>
@@ -87,7 +85,6 @@ namespace WCS_Client
         {
             return Json == null ? JObject.Parse("{}") : JObject.Parse(Json.Replace("&nbsp;", ""));
         }
-
         public static DataTable GetAttributesDataTable(this object obj)
         {
             var tb = new DataTable(obj.GetType().Name);
@@ -112,5 +109,30 @@ namespace WCS_Client
             }
             return tb;
         }
+
+        /// <summary>
+        /// 扩展方法,获得枚举的Description
+        /// </summary>
+        /// <param name="value">枚举值</param>
+        /// <param name="nameInstead">当枚举值没有定义DescriptionAttribute,是否使用枚举名代替,默认是使用</param>
+        /// <returns>枚举的Description</returns>
+        public static string GetDescription(this Enum value, Boolean nameInstead = true)
+        {
+            Type type = value.GetType();
+            string name = Enum.GetName(type, value);
+            if (name == null)
+            {
+                return null;
+            }
+
+            FieldInfo field = type.GetField(name);
+            DescriptionAttribute attribute = System.Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute;
+
+            if (attribute == null && nameInstead == true)
+            {
+                return name;
+            }
+            return attribute?.Description;
+        }
     }
-}
+}

+ 0 - 26
WCS_Client/Extensions/DataTableExtensions.cs

@@ -1,26 +0,0 @@
-using System.Collections.Generic;
-using System.Data;
-
-namespace WCS_Client.Extensions
-{
-    /// <summary>
-    /// 数据表扩展
-    /// </summary>
-    public static class DataTableExtensions
-    {
-        /// <summary>
-        /// 添加指定的列
-        /// </summary>
-        /// <param name="dataTable"></param>
-        /// <param name="valus"></param>
-        public static void addDataColumn(this DataTable dataTable, List<string> valus)
-        {
-            foreach (var item in valus)
-            {
-                DataColumn column = new DataColumn();
-                column.ColumnName = item;
-                dataTable.Columns.Add(column);
-            }
-        }
-    }
-}

+ 0 - 34
WCS_Client/Extensions/EnumExtensions.cs

@@ -1,34 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Reflection;
-
-namespace WCS_Client.Extensions
-{
-    public static class EnumExtensions
-    {
-        /// <summary>
-        /// 扩展方法,获得枚举的Description
-        /// </summary>
-        /// <param name="value">枚举值</param>
-        /// <param name="nameInstead">当枚举值没有定义DescriptionAttribute,是否使用枚举名代替,默认是使用</param>
-        /// <returns>枚举的Description</returns>
-        public static string GetDescription(this Enum value, Boolean nameInstead = true)
-        {
-            Type type = value.GetType();
-            string name = Enum.GetName(type, value);
-            if (name == null)
-            {
-                return null;
-            }
-
-            FieldInfo field = type.GetField(name);
-            DescriptionAttribute attribute = System.Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute;
-
-            if (attribute == null && nameInstead == true)
-            {
-                return name;
-            }
-            return attribute?.Description;
-        }
-    }
-}

+ 1 - 23
WCS_Client/Frm/FrmMain.cs

@@ -5,15 +5,12 @@ using System.ComponentModel;
 using System.Data;
 using System.Drawing;
 using System.Linq;
-using FreeRedis;
 using System.Runtime.InteropServices;
 using System.Text;
 using System.Windows.Forms;
 using WCS_Client.Frm;
 using WCS_Client.UC;
 using WCS_Client.Utility;
-using MessagePack;
-using MessagePack.Resolvers;
 
 namespace WCS_Client
 {
@@ -24,7 +21,6 @@ namespace WCS_Client
             InitializeComponent();
             InitFrm();
             WCS_Client.Frm.Current.InitData("wcs_pvc");
-
         }
         private void InitFrm()
         {
@@ -69,24 +65,6 @@ namespace WCS_Client
             #endregion
             RefreshMenu();
             SetMdiForm("系统主页", "系统主页", typeof(FrmHome), false);
-
-            if (eqpData.Redis == null)
-            {
-                RedisClient Redis = new RedisClient("81.69.99.176,database=11");
-                MessagePackSerializer.DefaultOptions = StandardResolver.Options.WithCompression(MessagePackCompression.Lz4Block);
-                Redis.Serialize = obj =>
-                {
-                    var bytes = MessagePackSerializer.Serialize(obj);
-                    return bytes;
-                };
-                Redis.DeserializeRaw = (bytes, type) =>
-                {
-                    var obj = MessagePackSerializer.Deserialize(type, bytes);
-                    return obj;
-                };
-                eqpData.init(Redis);
-            }
-
         }
         private void RefreshMenu()
         {
@@ -100,7 +78,7 @@ namespace WCS_Client
                 }
                 AddMenu("", "MBtn_Task", "任务管理", null, null);
                 AddMenu("", "MBtn_Monitor", "设备监控", null, null);
-                // AddMenu("", "MBtn_Sys", "系统管理", null, null);
+               // AddMenu("", "MBtn_Sys", "系统管理", null, null);
                 AddMenu("", "MBtn_Help", "系统帮助", null, null);
 
                 //MBtn_File

+ 18 - 0
WCS_Client/Frm/MBtn_Monitor/Frm_YongGuanMontior.cs

@@ -33,6 +33,7 @@ namespace WCS_Client.Frm
                 return cp;
             }
         }
+        RedisClient Redis;
         public Frm_YongGuanMontior()
         {
             InitializeComponent();
@@ -117,6 +118,23 @@ namespace WCS_Client.Frm
             _timer.Elapsed += new System.Timers.ElapsedEventHandler(theout);//到达时间的时候执行事件;
             _timer.AutoReset = true;//设置是执行一次(false)还是一直执行(true);
             _timer.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件;
+
+            if (eqpData.Redis == null)
+            {
+                Redis = new RedisClient("81.69.99.176,database=11");
+                MessagePackSerializer.DefaultOptions = StandardResolver.Options.WithCompression(MessagePackCompression.Lz4Block);
+                Redis.Serialize = obj =>
+                {
+                    var bytes = MessagePackSerializer.Serialize(obj);
+                    return bytes;
+                };
+                Redis.DeserializeRaw = (bytes, type) =>
+                {
+                    var obj = MessagePackSerializer.Deserialize(type, bytes);
+                    return obj;
+                };
+            }
+            eqpData.init(Redis);
         }
 
         private static int _theout = 0;

+ 0 - 4
WCS_Client/Frm/MBtn_Task/FrmWCS_Task.cs

@@ -38,7 +38,6 @@ namespace WCS_Client.Frm
                 SuperGridUtil.Get_GridColumn("ADDRCURRENT", "当前地址", 80),
                 SuperGridUtil.Get_GridColumn("ADDRNEXT", "下个地址", 80),
                 SuperGridUtil.Get_GridColumn("ADDRTO", "目的地址", 100),
-                SuperGridUtil.Get_GridColumn("ADDRline", "目标产线", 100),
                 SuperGridUtil.Get_GridColumn("DEVICE", "堆垛机编号", 80),
                 SuperGridUtil.Get_GridColumn("TUNNEL", "巷道", 70),
                 SuperGridUtil.Get_GridColumn("Priority", "优先级", 60),
@@ -62,9 +61,6 @@ namespace WCS_Client.Frm
             };
             List<LayoutControlItem> LCIList = new List<LayoutControlItem>();
 
-            LCIList.Add(LCItemUtil.Add_TextboxX("ID", "WCS任务号:", 20, SubmitMethods, null));
-            LCIList[LCIList.Count - 1].Tag = new LCWhereInfo() { QWhereText = "ID like '%{0}%'" };
-
             LCIList.Add(LCItemUtil.Add_TextboxX("WMSTASK", "WMS任务号:", 20, SubmitMethods, null));
             LCIList[LCIList.Count - 1].Tag = new LCWhereInfo() { QWhereText = "WMSTASK like '%{0}%'" };
 

+ 0 - 10
WCS_Client/Models/WCS_AGVTASKS.cs

@@ -1,9 +1,7 @@
 using SqlSugar;
 using System;
 using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
 using System.Linq;
-using System.Runtime.Serialization;
 using System.Web;
 
 namespace WCS_Client.Models
@@ -38,14 +36,6 @@ namespace WCS_Client.Models
         /// </summary>
         public string TASKTYPE { get; set; }
         /// <summary>
-        /// ID
-        /// </summary>
-        public int ID { get; set; }
-        /// <summary>
-        /// 目标车间
-        /// </summary>
-        public int Workshop { get; set; }
-        /// <summary>
         /// 料车条码
         /// </summary>
         public string MATCARCODE { get; set; }

+ 0 - 4
WCS_Client/Models/WCS_TASK.cs

@@ -19,10 +19,6 @@ namespace WCS_Client.Models
         /// WMS任务号
         /// </summary>
         public string TASK_WMSNO { get; set; }
-
-        /// <summary>
-        /// 任务类型
-        /// </summary>
         public int TASK_COMTYPE { get; set; }
 
         [SugarColumn(IsIgnore = true)]

+ 0 - 3
WCS_Client/Utility/CurrentHelper.cs

@@ -26,9 +26,6 @@ namespace WCS_Client.Utility
             放货 = 4,
             维护 = 99
         }
-        /// <summary>
-        /// 任务类型
-        /// </summary>
         public enum ComTypeEnum
         {
             入库 = 1,

+ 1 - 3
WCS_Client/WCS_Client.csproj

@@ -181,8 +181,7 @@
   <ItemGroup>
     <Compile Include="Database\SugarClient.cs" />
     <Compile Include="eqpData.cs" />
-    <Compile Include="Extensions\EnumExtensions.cs" />
-    <Compile Include="Extensions\JsonExtensions.cs" />
+    <Compile Include="Extensions.cs" />
     <Compile Include="Frm\Current.cs" />
     <Compile Include="Frm\Equipment\ConvSignal.cs" />
     <Compile Include="Frm\Equipment\EquipmentSignal.cs" />
@@ -540,7 +539,6 @@
     <Compile Include="From\From_Montior\LocationPostion2.Designer.cs">
       <DependentUpon>LocationPostion2.cs</DependentUpon>
     </Compile>
-    <Compile Include="Extensions\DataTableExtensions.cs" />
     <Compile Include="Models\WCS_EQUIPMENTINFO.cs" />
     <Compile Include="Models\WCS_PalletizingCode.cs" />
     <Compile Include="Models\WCS_RGVOutInInfo.cs" />

+ 45 - 109
WCS_Client/Workflow/BaseWorkflow.cs

@@ -4,11 +4,9 @@ using System.Collections.Generic;
 using System.Data;
 using System.Linq;
 using System.Text;
-using WCS_Client.Extensions;
-using WCS_Client.Frm;
 using WCS_Client.Models;
 using WCS_Client.Utility;
-using WCS_TASK = WCS_Client.Models.WCS_TASK;
+using WCS_Client.From.From_Montior;
 
 namespace WCS_Client
 {
@@ -20,7 +18,6 @@ namespace WCS_Client
         重下RGV下料 = 4,
         重下任务 = 5
     }
-
     public enum WkStatus
     {
         未下发 = 0,
@@ -33,7 +30,6 @@ namespace WCS_Client
         取消任务 = 106,
         手动过账 = 109
     }
-
     public enum TaskType
     {
         组盘 = 0,
@@ -41,7 +37,6 @@ namespace WCS_Client
         出库 = 2,
         输送 = 5,
     }
-
     public class BaseWorkflow
     {
         public static bool Login(string use_No, string use_Pwd, out string errMsg)
@@ -140,7 +135,6 @@ namespace WCS_Client
             }
             return result;
         }
-
         public static PageData QueryDatatble(DataTable dt, int PageIndex, int PageSize)
         {
             if (PageSize <= 0) PageSize = 2000;
@@ -148,6 +142,7 @@ namespace WCS_Client
             int endRecord = startRecord + PageSize - 1;
             try
             {
+
                 int count = dt.Rows.Count;
                 int PageCount = count / PageSize;
                 if (count % PageSize > 0)
@@ -169,8 +164,8 @@ namespace WCS_Client
             {
             }
             return null;
-        }
 
+        }
         public static PageData QueryPageData(string _SQLText, string orderText, List<string> WhereStringList, int PageIndex, int PageSize)
         {
             var sb = new StringBuilder();
@@ -185,7 +180,6 @@ namespace WCS_Client
             }
             return QueryPageSql(sb.ToString(), orderText, PageIndex, PageSize);
         }
-
         private static PageData QueryPageSql(string SQLText, string OrderText, int PageIndex, int PageSize)
         {
             if (PageSize <= 0) PageSize = 2000;
@@ -201,42 +195,6 @@ namespace WCS_Client
                 TryCachHelper.TryExecute((db) =>
                 {
                     dt = db.Ado.GetDataTable(sql);
-                    //新增列
-                    string ADDRCURRENT = "ADDRCURRENT";
-                    string ADDRline = "ADDRline";
-                    dt.addDataColumn(new List<string> { ADDRCURRENT, ADDRline });
-                    //获取当前所有任务对应的AGV任务
-                    List<int> agvIDs = (from d in dt.AsEnumerable() select d.Field<int>("AgvTask")).Where(p => p > 0).ToList();
-                    string ids = "";
-                    agvIDs.ForEach(p =>
-                    {
-                        ids += p;
-                        if (p != agvIDs[agvIDs.Count - 1]) ids += ",";
-                    });
-                    var _sql = $"select * from WCS_AGVTask where ID in ({ids})";
-                    List<WCS_AGVTask> _AGVTASKs = db.SqlQueryable<WCS_AGVTask>(_sql).ToList();
-                    //向新增列写入数据
-                    for (int i = 0; i < dt.Rows.Count; i++)
-                    {
-                        //写入输送线
-                        dt.Rows[i][ADDRCURRENT] = eqpData.deviceDataPack.StationDatas.Datas.Where(p => p.D521.TASKNUM == (int)dt.Rows[i][1] && p.D521.PH_STATUS).FirstOrDefault()?.Code;
-                        //不在输送线,尝试写入RGV
-                        if (string.IsNullOrEmpty(dt.Rows[i][ADDRCURRENT].ToString()))
-                        {
-                            dt.Rows[i][ADDRCURRENT] = eqpData.deviceDataPack.RGVDatas.Datas.Where(p => p.D521.TaskID == (int)dt.Rows[i][1] && p.D521.PH_Status).FirstOrDefault()?.Code;
-                        }
-                        //不在输送线/RGV,尝试写入堆垛机
-                        if (string.IsNullOrEmpty(dt.Rows[i][ADDRCURRENT].ToString()))
-                        {
-                            dt.Rows[i][ADDRCURRENT] = eqpData.deviceDataPack.SCDatas.Datas.Where(p => p.D521.TaskID == (int)dt.Rows[i][1]).FirstOrDefault()?.Code;
-                        }
-                        var a = _AGVTASKs.Where(p => p.ID == (int)dt.Rows[i]["AgvTask"]).FirstOrDefault()?.Position;
-                        //开始写入产线
-                        dt.Rows[i][ADDRline] = _AGVTASKs.Where(p => p.ID == (int)dt.Rows[i]["AgvTask"]).FirstOrDefault()?.Position;
-
-                        dt.AcceptChanges();
-                    }
-
                     count = Convert.ToInt32(db.Ado.GetScalar(CountStr));
                 });
                 int PageCount = count / PageSize;
@@ -272,7 +230,6 @@ namespace WCS_Client
             }
             return QueryPageSql2(sb.ToString(), orderText, PageIndex, PageSize);
         }
-
         private static PageData QueryPageSql2(string SQLText, string OrderText, int PageIndex, int PageSize)
         {
             if (PageSize <= 0) PageSize = 2000;
@@ -335,7 +292,6 @@ namespace WCS_Client
             }
             return null;
         }
-
         public static DataTable CommonQueryUser(string sql)
         {
             DataTable dt = null;
@@ -373,13 +329,12 @@ namespace WCS_Client
             }
             return dt;
         }
-
         public static DataTable CommonQuery(string sql)
         {
             DataTable dt = null;
             TryCachHelper.TryExecute((db) =>
             {
-                dt = db.Ado.GetDataTable(sql);
+               dt = db.Ado.GetDataTable(sql);
             });
             return dt;
         }
@@ -468,7 +423,7 @@ namespace WCS_Client
             return result;
         }
 
-        public static string AdminModifyPwd(string user_no, string user_pwd)
+        public static string AdminModifyPwd(string user_no,string user_pwd)
         {
             string result = string.Empty;
             try
@@ -516,7 +471,7 @@ namespace WCS_Client
                 //    else
                 //    {
                 //        result = LangConst.UserNotExists;
-                //    }
+                //    } 
                 //}
             }
             catch (Exception ex)
@@ -531,17 +486,14 @@ namespace WCS_Client
         {
             return CommonQuery(string.Format("SELECT *  FROM WCS_Mappingentry where Mep_MappingType='Sex'"));
         }
-
         public static DataTable QueryUse_Role()
         {
             return CommonQuery(string.Format("SELECT *  FROM WCS_Mappingentry where Mep_MappingType='RoleId'"));
         }
-
         public static DataTable QueryTaskType()
         {
             return CommonQuery(string.Format("SELECT *  FROM WCS_Mappingentry where Mep_MappingType='COMTYPE'"));
         }
-
         public static void AddWCS_TASK_DTL(SqlSugarClient db, int task_id, int task_no, string posIdCur, string posIdNext, string msg)
         {
             var task_dtl = new WCS_TASK_DTL();
@@ -554,7 +506,6 @@ namespace WCS_Client
             task_dtl.EXECUTEDATE = DateTime.Now;
             db.Insertable(task_dtl).ExecuteCommand();
         }
-
         public static string UpdateTask(int taskid, TaskStatusType taskStatusType)
         {
             string result = string.Empty;
@@ -817,8 +768,7 @@ namespace WCS_Client
                                               .Where(it => it.EQUIPMENTNO == equipmentNo).ExecuteCommand();
             });
         }
-
-        public static List<Frm.WCS_SC521> QueryStackerdDataDDJ(List<string> plcnameSet)
+        public static List<Frm.WCS_SC521> QueryStackerdDataDDJ(List<string> plcnameSet) 
         {
             var stackerdDataSet = new List<Frm.WCS_SC521>();
             TryCachHelper.TryExecute((db) =>
@@ -827,7 +777,6 @@ namespace WCS_Client
             });
             return stackerdDataSet;
         }
-
         public static List<Frm.WCS_RGV521> QueryStackerdDataRGV(List<string> plcnameSet)
         {
             var stackerdDataSet = new List<Frm.WCS_RGV521>();
@@ -860,7 +809,6 @@ namespace WCS_Client
                 throw new Exception(string.Format("任务[{0}]修改优先级为[{0}]失败", task_no, priority));
             }
         }
-
         /// <summary>
         /// 任务完成
         /// </summary>
@@ -873,7 +821,6 @@ namespace WCS_Client
             message = string.Empty;
             return true;
         }
-
         /// <summary>
         /// 任务取消
         /// </summary>
@@ -885,7 +832,6 @@ namespace WCS_Client
             msg = string.Empty;
             return true;
         }
-
         public static string RestartTask(int task_no)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -897,7 +843,8 @@ namespace WCS_Client
                 }
                 else
                 {
-                    if (task.TYPE == Frm.TaskType.出库 && task.STATUS > 0 && task.STATUS < 99)
+
+                    if (task.TYPE == Frm.TaskType.出库  && task.STATUS > 0 && task.STATUS < 99)
                     {
                         if (db.Updateable<Frm.WCS_TASK>()
                               .UpdateColumns(it => new Frm.WCS_TASK
@@ -918,7 +865,6 @@ namespace WCS_Client
             });
             return result;
         }
-
         public static string SrmInfoSet(string convNo, bool isStop)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -961,7 +907,6 @@ namespace WCS_Client
             });
             return result;
         }
-
         public static string OnUpMatRestart(int task_no)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -997,7 +942,6 @@ namespace WCS_Client
             });
             return result;
         }
-
         public static string OnMatRestart(int task_no)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -1033,7 +977,6 @@ namespace WCS_Client
             });
             return result;
         }
-
         public static string UpMatRestart(int task_no)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -1070,7 +1013,6 @@ namespace WCS_Client
             });
             return result;
         }
-
         public static string FinishTask(int task_no)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -1082,29 +1024,29 @@ namespace WCS_Client
                 }
                 else
                 {
-                    if (task.STATUS > 1)
-                    {
-                        if (db.Updateable<Frm.WCS_TASK>()
-                             .UpdateColumns(it => new Frm.WCS_TASK
-                             {
-                                 STATUS = 99,
-                                 UPDATEUSER = CurrentHelper.User.USER_NO,
-                                 UPDATETIME = DateTime.Now
-                             })
-                             .Where(v => v.ID == task_no).ExecuteCommand() < 0)
+                   
+                        if (task.STATUS > 1)
                         {
-                            throw new Exception(string.Format("任务[{0}]手动完成失败", task_no));
+                            if (db.Updateable<Frm.WCS_TASK>()
+                                 .UpdateColumns(it => new Frm.WCS_TASK
+                                 {
+                                     STATUS = 99,
+                                     UPDATEUSER = CurrentHelper.User.USER_NO,
+                                     UPDATETIME = DateTime.Now
+                                 })
+                                 .Where(v => v.ID == task_no).ExecuteCommand() < 0)
+                            {
+                                throw new Exception(string.Format("任务[{0}]手动完成失败", task_no));
+                            }
+                        }
+                        else
+                        {
+                            throw new Exception(string.Format("任务[{0}]未执行,不能执行[手动完成].", task_no));
                         }
-                    }
-                    else
-                    {
-                        throw new Exception(string.Format("任务[{0}]未执行,不能执行[手动完成].", task_no));
-                    }
                 }
             });
             return result;
         }
-
         public static string ClearTask(int task_no)
         {
             string result = TryCachHelper.TryTranExecute((db) =>
@@ -1116,24 +1058,25 @@ namespace WCS_Client
                 }
                 else
                 {
-                    if (task.STATUS < 99)
-                    {
-                        if (db.Updateable<Frm.WCS_TASK>()
-                              .UpdateColumns(it => new Frm.WCS_TASK
-                              {
-                                  STATUS = 106,
-                                  UPDATETIME = DateTime.Now
-                              })
-                              .Where(v => v.ID == task_no).ExecuteCommand() < 0)
+                    
+                        if (task.STATUS < 99)
                         {
-                            throw new Exception(string.Format("任务[{0}]取消失败", task_no));
+                            if (db.Updateable<Frm.WCS_TASK>()
+                                  .UpdateColumns(it => new Frm.WCS_TASK
+                                  {
+                                      STATUS = 106,
+                                      UPDATETIME = DateTime.Now
+                                  })
+                                  .Where(v => v.ID == task_no).ExecuteCommand() < 0)
+                            {
+                                throw new Exception(string.Format("任务[{0}]取消失败", task_no));
+                            }
+                        }
+                        else
+                        {
+                            throw new Exception(string.Format("任务[{0}]已完成或已取消,不能执行取消动作。", task_no));
                         }
                     }
-                    else
-                    {
-                        throw new Exception(string.Format("任务[{0}]已完成或已取消,不能执行取消动作。", task_no));
-                    }
-                }
             });
             return result;
         }
@@ -1219,7 +1162,7 @@ namespace WCS_Client
             return result;
         }
 
-        public static string UpdateTaskPriority(int task_no, int priority)
+        public static string UpdateTaskPriority(int task_no,int priority)
         {
             string result = TryCachHelper.TryTranExecute((db) =>
             {
@@ -1249,39 +1192,32 @@ namespace WCS_Client
                 result = string.Format("任务[{0}]调整优先级[{1}]成功。", task_no, priority);
             }
             return result;
-        }
+        } 
     }
-
     public class WCS_SCANN
     {
         [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
         public string SCANN_ID { get; set; }
-
         /// <summary>
         /// 扫描位置编号
         /// </summary>
         public string SCANN_STATIONNO { get; set; }
-
         /// <summary>
         /// 扫描到的条码
         /// </summary>
         public string SCANN_BARCODE { get; set; }
-
         /// <summary>
         /// 顺序
         /// </summary>
         public int SCANN_SEQUENCE { get; set; }
-
         /// <summary>
         /// PLC名称
         /// </summary>
         public string SCANN_PLCNAME { get; set; }
-
         /// <summary>
         /// 起点地址
         /// </summary>
         public int SCANN_STARTADDRESS { get; set; }
-
         /// <summary>
         /// 扫描长度
         /// </summary>
@@ -1293,4 +1229,4 @@ namespace WCS_Client
         public DateTime SCANN_UPDATETIME { get; set; }
         public DateTime SYSDATE { get; set; }
     }
-}
+}