瀏覽代碼

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

林豪 左 3 年之前
父節點
當前提交
a30ff80e55

+ 26 - 0
WCS_Client/Extensions/DataTableExtensions.cs

@@ -0,0 +1,26 @@
+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);
+            }
+        }
+    }
+}

+ 34 - 0
WCS_Client/Extensions/EnumExtensions.cs

@@ -0,0 +1,34 @@
+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;
+        }
+    }
+}

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

@@ -5,17 +5,13 @@ 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 Extensions
+    public static partial class JsonExtensions
     {
         /// <summary>
         /// 转成json对象
@@ -26,6 +22,7 @@ namespace WCS_Client
         {
             return Json == null ? null : JsonConvert.DeserializeObject(Json);
         }
+
         /// <summary>
         /// 转成json字串
         /// </summary>
@@ -36,6 +33,7 @@ namespace WCS_Client
             var timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
             return JsonConvert.SerializeObject(obj, timeConverter);
         }
+
         /// <summary>
         /// 转成json字串
         /// </summary>
@@ -47,6 +45,7 @@ namespace WCS_Client
             var timeConverter = new IsoDateTimeConverter { DateTimeFormat = datetimeformats };
             return JsonConvert.SerializeObject(obj, timeConverter);
         }
+
         /// <summary>
         /// 字串反序列化成指定对象实体
         /// </summary>
@@ -57,6 +56,7 @@ namespace WCS_Client
         {
             return Json == null ? default(T) : JsonConvert.DeserializeObject<T>(Json);
         }
+
         /// <summary>
         /// 字串反序列化成指定对象实体(列表)
         /// </summary>
@@ -67,6 +67,7 @@ namespace WCS_Client
         {
             return Json == null ? null : JsonConvert.DeserializeObject<List<T>>(Json);
         }
+
         /// <summary>
         /// 字串反序列化成DataTable
         /// </summary>
@@ -76,6 +77,7 @@ namespace WCS_Client
         {
             return Json == null ? null : JsonConvert.DeserializeObject<DataTable>(Json);
         }
+
         /// <summary>
         /// 字串反序列化成linq对象
         /// </summary>
@@ -85,6 +87,7 @@ 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);
@@ -109,30 +112,5 @@ 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;
-        }
     }
-}
+}

+ 23 - 1
WCS_Client/Frm/FrmMain.cs

@@ -5,12 +5,15 @@ 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
 {
@@ -21,6 +24,7 @@ namespace WCS_Client
             InitializeComponent();
             InitFrm();
             WCS_Client.Frm.Current.InitData("wcs_pvc");
+
         }
         private void InitFrm()
         {
@@ -65,6 +69,24 @@ 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()
         {
@@ -78,7 +100,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

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

@@ -33,7 +33,6 @@ namespace WCS_Client.Frm
                 return cp;
             }
         }
-        RedisClient Redis;
         public Frm_YongGuanMontior()
         {
             InitializeComponent();
@@ -118,23 +117,6 @@ 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;

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

@@ -38,6 +38,7 @@ 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),
@@ -61,6 +62,9 @@ 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}%'" };
 

+ 10 - 0
WCS_Client/Models/WCS_AGVTASKS.cs

@@ -1,7 +1,9 @@
 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
@@ -36,6 +38,14 @@ 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; }

+ 4 - 0
WCS_Client/Models/WCS_TASK.cs

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

+ 3 - 0
WCS_Client/Utility/CurrentHelper.cs

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

+ 3 - 1
WCS_Client/WCS_Client.csproj

@@ -181,7 +181,8 @@
   <ItemGroup>
     <Compile Include="Database\SugarClient.cs" />
     <Compile Include="eqpData.cs" />
-    <Compile Include="Extensions.cs" />
+    <Compile Include="Extensions\EnumExtensions.cs" />
+    <Compile Include="Extensions\JsonExtensions.cs" />
     <Compile Include="Frm\Current.cs" />
     <Compile Include="Frm\Equipment\ConvSignal.cs" />
     <Compile Include="Frm\Equipment\EquipmentSignal.cs" />
@@ -539,6 +540,7 @@
     <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" />

+ 109 - 45
WCS_Client/Workflow/BaseWorkflow.cs

@@ -4,9 +4,11 @@ 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_Client.From.From_Montior;
+using WCS_TASK = WCS_Client.Models.WCS_TASK;
 
 namespace WCS_Client
 {
@@ -18,6 +20,7 @@ namespace WCS_Client
         重下RGV下料 = 4,
         重下任务 = 5
     }
+
     public enum WkStatus
     {
         未下发 = 0,
@@ -30,6 +33,7 @@ namespace WCS_Client
         取消任务 = 106,
         手动过账 = 109
     }
+
     public enum TaskType
     {
         组盘 = 0,
@@ -37,6 +41,7 @@ namespace WCS_Client
         出库 = 2,
         输送 = 5,
     }
+
     public class BaseWorkflow
     {
         public static bool Login(string use_No, string use_Pwd, out string errMsg)
@@ -135,6 +140,7 @@ namespace WCS_Client
             }
             return result;
         }
+
         public static PageData QueryDatatble(DataTable dt, int PageIndex, int PageSize)
         {
             if (PageSize <= 0) PageSize = 2000;
@@ -142,7 +148,6 @@ namespace WCS_Client
             int endRecord = startRecord + PageSize - 1;
             try
             {
-
                 int count = dt.Rows.Count;
                 int PageCount = count / PageSize;
                 if (count % PageSize > 0)
@@ -164,8 +169,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();
@@ -180,6 +185,7 @@ 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;
@@ -195,6 +201,42 @@ 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;
@@ -230,6 +272,7 @@ 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;
@@ -292,6 +335,7 @@ namespace WCS_Client
             }
             return null;
         }
+
         public static DataTable CommonQueryUser(string sql)
         {
             DataTable dt = null;
@@ -329,12 +373,13 @@ 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;
         }
@@ -423,7 +468,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
@@ -471,7 +516,7 @@ namespace WCS_Client
                 //    else
                 //    {
                 //        result = LangConst.UserNotExists;
-                //    } 
+                //    }
                 //}
             }
             catch (Exception ex)
@@ -486,14 +531,17 @@ 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();
@@ -506,6 +554,7 @@ 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;
@@ -768,7 +817,8 @@ 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) =>
@@ -777,6 +827,7 @@ namespace WCS_Client
             });
             return stackerdDataSet;
         }
+
         public static List<Frm.WCS_RGV521> QueryStackerdDataRGV(List<string> plcnameSet)
         {
             var stackerdDataSet = new List<Frm.WCS_RGV521>();
@@ -809,6 +860,7 @@ namespace WCS_Client
                 throw new Exception(string.Format("任务[{0}]修改优先级为[{0}]失败", task_no, priority));
             }
         }
+
         /// <summary>
         /// 任务完成
         /// </summary>
@@ -821,6 +873,7 @@ namespace WCS_Client
             message = string.Empty;
             return true;
         }
+
         /// <summary>
         /// 任务取消
         /// </summary>
@@ -832,6 +885,7 @@ namespace WCS_Client
             msg = string.Empty;
             return true;
         }
+
         public static string RestartTask(int task_no)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -843,8 +897,7 @@ 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
@@ -865,6 +918,7 @@ namespace WCS_Client
             });
             return result;
         }
+
         public static string SrmInfoSet(string convNo, bool isStop)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -907,6 +961,7 @@ namespace WCS_Client
             });
             return result;
         }
+
         public static string OnUpMatRestart(int task_no)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -942,6 +997,7 @@ namespace WCS_Client
             });
             return result;
         }
+
         public static string OnMatRestart(int task_no)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -977,6 +1033,7 @@ namespace WCS_Client
             });
             return result;
         }
+
         public static string UpMatRestart(int task_no)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -1013,6 +1070,7 @@ namespace WCS_Client
             });
             return result;
         }
+
         public static string FinishTask(int task_no)
         {
             string result = TryCachHelper.TryExecute((db) =>
@@ -1024,29 +1082,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)
-                            {
-                                throw new Exception(string.Format("任务[{0}]手动完成失败", task_no));
-                            }
-                        }
-                        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)
                         {
-                            throw new Exception(string.Format("任务[{0}]未执行,不能执行[手动完成].", task_no));
+                            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) =>
@@ -1058,25 +1116,24 @@ 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)
-                            {
-                                throw new Exception(string.Format("任务[{0}]取消失败", task_no));
-                            }
-                        }
-                        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)
                         {
-                            throw new Exception(string.Format("任务[{0}]已完成或已取消,不能执行取消动作。", task_no));
+                            throw new Exception(string.Format("任务[{0}]取消失败", task_no));
                         }
                     }
+                    else
+                    {
+                        throw new Exception(string.Format("任务[{0}]已完成或已取消,不能执行取消动作。", task_no));
+                    }
+                }
             });
             return result;
         }
@@ -1162,7 +1219,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) =>
             {
@@ -1192,32 +1249,39 @@ 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>
@@ -1229,4 +1293,4 @@ namespace WCS_Client
         public DateTime SCANN_UPDATETIME { get; set; }
         public DateTime SYSDATE { get; set; }
     }
-}
+}