diff --git a/AMESCoreStudio.Web/Controllers/BASController.cs b/AMESCoreStudio.Web/Controllers/BASController.cs
index 80570f77..5fea0bd2 100644
--- a/AMESCoreStudio.Web/Controllers/BASController.cs
+++ b/AMESCoreStudio.Web/Controllers/BASController.cs
@@ -1413,28 +1413,29 @@ namespace AMESCoreStudio.Web.Controllers
         [HttpGet]
         public async Task<IActionResult> BAS011UAsync(string id)
         {
-            int ruleStationID = int.Parse(id.Split('_')[0]);
-            string status = id.Split('_')[1];
-            int nextStationID = int.Parse(id.Split('_')[2]);
+            int ruleID = int.Parse(id);
+            var result = await _basApi.GetRules(ruleID);
 
             await GetFlowRuleList();
-            var result2 = await _basApi.GetRuleStation(ruleStationID);
+
+            //var result1 = await _basApi.GetRules(result[0].RuleStationID, result[0].RuleStatus, result[0].NextStationID);
+
+            var result2 = await _basApi.GetRuleStation(result[0].RuleStationID);
             int flowId = result2[0].FlowRuleID;
             await GetRuleStationList(flowId);
             await GetNextStationList(flowId);
 
-            var result = await _basApi.GetRules(ruleStationID, status, nextStationID);
-
             if (result.Count == 0)
             {
                 return View();
             }
+
             return View(result[0]);
         }
 
-        public async Task<IActionResult> BAS011DAsync(int id,string status,int nextStationID)
+        public async Task<IActionResult> BAS011DAsync(int id)
         {
-            var result = await _basApi.DeleteRules(id, status, nextStationID);
+            var result = await _basApi.DeleteRules(id);
             return Json(new Result() { success = true, msg = "" });
         }
 
@@ -1442,13 +1443,12 @@ namespace AMESCoreStudio.Web.Controllers
         {
             if (ids.Length > 0)
             {
-                int id = int.Parse(ids[0].Split('_')[0]);
-                string status = ids[0].Split('_')[1];
-                int nextStationID = int.Parse(ids[0].Split('_')[2]);
-                var result = await _basApi.DeleteRules(id, status, nextStationID);
+                int id = int.Parse(ids[0]);
+
+                var result = await _basApi.DeleteRules(id);
                 for (int i = 1; i < ids.Length; i++)
                 {
-                    result = await _basApi.DeleteRules(int.Parse(ids[i].Split('_')[0]), ids[i].Split('_')[1], int.Parse(ids[i].Split('_')[2]));
+                    result = await _basApi.DeleteRules(int.Parse(ids[i]));
                 }
 
                 return Json(new Result() { success = true, msg = "" });
@@ -1473,7 +1473,7 @@ namespace AMESCoreStudio.Web.Controllers
                 }
                 else
                 {
-                    result = await _basApi.PutRules(model.RuleStationID, model.RuleStatus, model.NextStationID, JsonConvert.SerializeObject(model));
+                    result = await _basApi.PutRules(model.RuleID, JsonConvert.SerializeObject(model));
                 }
 
                 if (result.Success)
@@ -1485,7 +1485,7 @@ namespace AMESCoreStudio.Web.Controllers
                 }
                 else
                 {
-                    if (result.Errors.Count > 0)
+                    if (result.Errors != null)
                     {
                         ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg);
                     }
diff --git a/AMESCoreStudio.Web/Controllers/SYSController.cs b/AMESCoreStudio.Web/Controllers/SYSController.cs
index 0b9d7a36..8d5a6aac 100644
--- a/AMESCoreStudio.Web/Controllers/SYSController.cs
+++ b/AMESCoreStudio.Web/Controllers/SYSController.cs
@@ -37,11 +37,11 @@ namespace AMESCoreStudio.Web.Controllers
             var result = await _sysApi.GetSystemInfoes();
 
             var SystemItems = new List<SelectListItem>();
-            for (int i = 0; i < result.Count; i++)
+            foreach (var item in result.Data)
             {
-                //SystemItems.Add(new SelectListItem(result[i].SystemNo + result[i].SystemName, result[i].SystemID.ToString()));
-                SystemItems.Add(new SelectListItem(result[i].SystemName, result[i].SystemID.ToString()));
+                SystemItems.Add(new SelectListItem(item.SystemName, item.SystemID.ToString()));
             }
+
             ViewBag.SystemList = SystemItems;
         }
 
@@ -62,10 +62,11 @@ namespace AMESCoreStudio.Web.Controllers
             var result = await _sysApi.GetModuleInfoesBySystem(id, 0, 10);
 
             var ModuleItems = new List<SelectListItem>();
-            for (int i = 0; i < result.Count; i++)
+            foreach (var item in result.Data)
             {
-                ModuleItems.Add(new SelectListItem(result[i].ModuleNo + result[i].ModuleName, result[i].ModuleID.ToString()));
+                ModuleItems.Add(new SelectListItem(item.ModuleNo + item.ModuleName, item.ModuleID.ToString()));
             }
+
             ViewBag.ModuleList = ModuleItems;
         }
 
@@ -125,9 +126,9 @@ namespace AMESCoreStudio.Web.Controllers
             var item = new List<SelectListItem>();
             item.Add(new SelectListItem("全部", "0"));
 
-            for (int i = 0; i < result.Count; i++)
+            foreach (var data in result.Data)
             {
-                item.Add(new SelectListItem(result[i].ModuleNo + result[i].ModuleName, result[i].ModuleID.ToString()));
+                item.Add(new SelectListItem(data.ModuleNo + data.ModuleName, data.ModuleID.ToString()));
             }
             //将数据Json化并传到前台视图
             return Json(new { data = item });
@@ -198,14 +199,14 @@ namespace AMESCoreStudio.Web.Controllers
                     result = await _sysApi.PutSystemInfo(model.SystemID, JsonConvert.SerializeObject(model));
                 }
 
-                if (!result.Success)
+                if (result.Success)
                 {
                     var _msg = model.SystemID == 0 ? "添加成功!" : "修改成功!";
                     return RedirectToAction("Refresh", "Home", new { msg = _msg });
                 }
                 else
                 {
-                    if (result.Errors.Count > 0)
+                    if (result.Errors != null)
                     {
                         ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg);
                     }
@@ -227,11 +228,10 @@ namespace AMESCoreStudio.Web.Controllers
         public async Task<IActionResult> GetSystemInfoesAsync(int page = 0, int limit = 10)
         {
             var result = await _sysApi.GetSystemInfoes(page,limit);
-            var result_total = await _sysApi.GetSystemInfoes(0, limit);
 
-            if (result.Count > 0)
+            if (result.DataTotal > 0)
             {
-                return Json(new Table() { code = 0, msg = "", data = result, count = result_total.Count });
+                return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal });
             }
 
             return Json(new Table() { count = 0, data = null });
@@ -296,14 +296,14 @@ namespace AMESCoreStudio.Web.Controllers
                     result = await _sysApi.PutModuleInfo(model.ModuleID, JsonConvert.SerializeObject(model));
                 }
 
-                if (!result.Success)
+                if (result.Success)
                 {
                     var _msg = model.ModuleID == 0 ? "添加成功!" : "修改成功!";
                     return RedirectToAction("Refresh", "Home", new { msg = _msg });
                 }
                 else
                 {
-                    if (result.Errors.Count > 0)
+                    if (result.Errors != null)
                     {
                         ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg);
                     }
@@ -339,12 +339,11 @@ namespace AMESCoreStudio.Web.Controllers
         public async Task<IActionResult> GetModuleInfoesBySystemAsync(int systemID, int page = 0, int limit = 10)
         {
             var result = await _sysApi.GetModuleInfoesBySystem(systemID, page, limit);
-            var result_total = await _sysApi.GetModuleInfoesBySystem(systemID, 0, limit);
 
 
-            if (result.Count > 0)
+            if (result.DataTotal > 0)
             {
-                return Json(new Table() { code = 0, msg = "", data = result, count = result_total.Count });
+                return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal });
             }
 
             return Json(new Table() { count = 0, data = null });
diff --git a/AMESCoreStudio.Web/HttpApis/IBAS.cs b/AMESCoreStudio.Web/HttpApis/IBAS.cs
index 451094c9..e4a8a2a8 100644
--- a/AMESCoreStudio.Web/HttpApis/IBAS.cs
+++ b/AMESCoreStudio.Web/HttpApis/IBAS.cs
@@ -436,20 +436,27 @@ namespace AMESCoreStudio.Web
         /// </summary>
         /// <returns></returns>
         [WebApiClient.Attributes.HttpPut("api/Rules/{id}")]
-        ITask<ResultModel<Rules>> PutRules(int id, string ruleStatus, int nextStationID, [FromBody, RawJsonContent] string model);
+        ITask<ResultModel<Rules>> PutRules(int id, [FromBody, RawJsonContent] string model);
 
         /// <summary>
         /// 刪除流程站別
         /// </summary>
         /// <returns></returns>
         [WebApiClient.Attributes.HttpDelete("api/Rules/{id}")]
-        ITask<ResultModel<string>> DeleteRules(int id, string ruleStatus, int nextStationID);
+        ITask<ResultModel<string>> DeleteRules(int id);
 
         /// <summary>
-        /// 根據ID獲取指定流程站別資料
+        /// 根據規則ID獲取指定流程站別資料
         /// </summary>
         /// <returns></returns>
         [WebApiClient.Attributes.HttpGet("api/Rules/{id}")]
+        ITask<List<Rules>> GetRules(int id);
+
+        /// <summary>
+        /// 根據ID獲取指定流程站別資料
+        /// </summary>
+        /// <returns></returns>
+        [WebApiClient.Attributes.HttpGet("api/Rules/GetRules")]
         ITask<List<Rules>> GetRules(int id, string ruleStatus, int nextStationID);
 
         /// <summary>
diff --git a/AMESCoreStudio.Web/HttpApis/ISYS.cs b/AMESCoreStudio.Web/HttpApis/ISYS.cs
index 1200b578..04a03802 100644
--- a/AMESCoreStudio.Web/HttpApis/ISYS.cs
+++ b/AMESCoreStudio.Web/HttpApis/ISYS.cs
@@ -32,7 +32,7 @@ namespace AMESCoreStudio.Web
         /// </summary>
         /// <returns></returns>
         [WebApiClient.Attributes.HttpDelete("api/SystemInfoes/{id}")]
-        ITask<ResultModel<string>> DeleteSystemInfo(int id);
+        ITask<ResultModel<SystemInfo>> DeleteSystemInfo(int id);
 
         /// <summary>
         /// 根據ID獲取指定系統資料
@@ -46,7 +46,7 @@ namespace AMESCoreStudio.Web
         /// </summary>
         /// <returns></returns>
         [WebApiClient.Attributes.HttpGet("api/SystemInfoes")]
-        ITask<List<SystemInfo>> GetSystemInfoes(int page = 0, int limit = 10);
+        ITask<ResultModel<SystemInfo>> GetSystemInfoes(int page = 0, int limit = 10);
 
         #endregion
 
@@ -71,7 +71,7 @@ namespace AMESCoreStudio.Web
         /// </summary>
         /// <returns></returns>
         [WebApiClient.Attributes.HttpDelete("api/ModuleInfoes/{id}")]
-        ITask<ResultModel<string>> DeleteModuleInfo(int id);
+        ITask<ResultModel<ModuleInfo>> DeleteModuleInfo(int id);
 
         /// <summary>
         /// 根據ID獲取指定模組資料
@@ -92,7 +92,7 @@ namespace AMESCoreStudio.Web
         /// </summary>
         /// <returns></returns>
         [WebApiClient.Attributes.HttpGet("api/ModuleInfoes/System/{id}")]
-        ITask<List<ModuleInfo>> GetModuleInfoesBySystem(int id, int page = 0, int limit = 10);
+        ITask<ResultModel<ModuleInfo>> GetModuleInfoesBySystem(int id, int page = 0, int limit = 10);
 
         #endregion
 
diff --git a/AMESCoreStudio.Web/Views/BAS/BAS011.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS011.cshtml
index 5fa4aee3..c01828bd 100644
--- a/AMESCoreStudio.Web/Views/BAS/BAS011.cshtml
+++ b/AMESCoreStudio.Web/Views/BAS/BAS011.cshtml
@@ -76,7 +76,7 @@
         var tableCols = [[
             { type: 'checkbox' },
             {
-                field: 'ruleStationID',
+                field: 'ruleID',
                 width: 120,
                 title: '编号',
                 sort: true
@@ -124,17 +124,17 @@
         ];
         //通过行tool编辑,lay-event="edit"
         function edit(obj) {
-            if (obj.data.ruleStationID) {
-                hg.open('修改流程規則', '/BAS/BAS011U/' + obj.data.ruleStationID + '_' + obj.data.ruleStatus + '_' + obj.data.nextStationID, 600, 400);
+            if (obj.data.ruleID) {
+                hg.open('修改流程規則', '/BAS/BAS011U/' + obj.data.ruleID, 600, 400);
             }
         }
         //通过行tool删除,lay-event="del"
         function del(obj) {
-            if (obj.data.ruleStationID) {
+            if (obj.data.ruleID) {
                 hg.confirm("流程規則:" + obj.data.nextStation['stationName'] + ",确定要删除吗?", function () {
                     $.ajax({
                         url: '/BAS/BAS011D',
-                        data: { id: obj.data.ruleStationID, status: obj.data.ruleStatus, nextStationID: obj.data.nextStationID },
+                        data: { id: obj.data.ruleID },
                         type: 'POST',
                         success: function (data) {
                             if (data.success) {
@@ -159,12 +159,12 @@
             class: 'layui-btn-danger',
             handler: function (obj, row) {
                 if (obj.checkstatus && obj.checkstatus.data.length > 0) {
-                    console.log(obj.checkstatus.data.map(function (x) { return x.ruleStationID + '_' + x.ruleStatus + '_' + x.nextStationID }).join(','))
+                    console.log(obj.checkstatus.data.map(function (x) { return x.ruleID }).join(','))
 
                     hg.confirm("批量删除所有选中的数据,确定要删除吗?", function () {
                         $.ajax({
                             url: '/BAS/BAS011DAll',
-                            data: { ids: obj.checkstatus.data.map(function (x) { return x.ruleStationID + '_' + x.ruleStatus + '_' + x.nextStationID }) },
+                            data: { ids: obj.checkstatus.data.map(function (x) { return x.ruleID }) },
                             type: 'POST',
                             success: function (data) {
                                 if (data.success) {
diff --git a/AMESCoreStudio.Web/Views/BAS/BAS011U.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS011U.cshtml
index 44ad2d50..8c8326bd 100644
--- a/AMESCoreStudio.Web/Views/BAS/BAS011U.cshtml
+++ b/AMESCoreStudio.Web/Views/BAS/BAS011U.cshtml
@@ -15,9 +15,9 @@
     <div class="col-sm-12">
         <form enctype="multipart/form-data" method="post" asp-action="BAS011Save">
             <div asp-validation-summary="ModelOnly" class="text-danger"></div>
+            <input type="hidden" asp-for="RuleID" />
             <input type="hidden" asp-for="RuleStationID" />
             <input type="hidden" asp-for="RuleStatus" />
-            <input type="hidden" asp-for="NextStationID" />
             <input type="hidden" asp-for="CreateDate" />
 
             <div class="form-group form-inline my-sm-1">
@@ -46,7 +46,7 @@
             </div>
             <div class="form-group form-inline my-sm-1">
                 <label asp-for="NextStationID" class="control-label col-sm-3"></label>
-                <select asp-for="NextStationID" asp-items="@ViewBag.NextStationList" class="custom-select col-sm-9" disabled></select>
+                <select asp-for="NextStationID" asp-items="@ViewBag.NextStationList" class="custom-select col-sm-9"></select>
                 <span asp-validation-for="NextStationID" class="text-danger offset-sm-3 my-sm-1"></span>
             </div>
             <div class="form-group form-inline my-sm-1">
diff --git a/AMESCoreStudio.WebApi/Code/Helper.cs b/AMESCoreStudio.WebApi/Code/Helper.cs
index 9fa704bf..ab0dc371 100644
--- a/AMESCoreStudio.WebApi/Code/Helper.cs
+++ b/AMESCoreStudio.WebApi/Code/Helper.cs
@@ -36,7 +36,7 @@ namespace AMESCoreStudio.WebApi
                 IDKey aID = new IDKey();
                 aID.IDName = idName;
                 aID.StartNum = 1000;
-                aID.LimitNum = Int64.MaxValue;
+                aID.LimitNum = Int32.MaxValue;
                 aID.CurrentNum = 1000;
                 aID.DeltaNum = 1;
                 aID.CreateDateTime = DateTime.Now;
@@ -68,7 +68,7 @@ namespace AMESCoreStudio.WebApi
 
             }
             idkey = await _context.IDKeys.Where(m => m.IDName == idName).FirstOrDefaultAsync();
-            key = (int)idkey.CurrentNum;
+            key = Convert.ToInt32(idkey.CurrentNum);
 
             return key;
         }
@@ -85,7 +85,7 @@ namespace AMESCoreStudio.WebApi
             if (idkey == null)
                 return key;
             else
-                return key = (int)idkey.CurrentNum;
+                return key = Convert.ToInt32(idkey.CurrentNum);
         }
     }
 }
diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs
index 02f1f241..cd4f6b7a 100644
--- a/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs
@@ -129,6 +129,29 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
             return rules;
         }
 
+        /// <summary>
+        /// 根據流程規則編號查詢指定單一資料
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        // GET: api/Rules/5
+        [HttpGet("{id}")]
+        public async Task<ActionResult<IEnumerable<Rules>>> GetRules(int id)
+        {
+            IQueryable<Rules> q = _context.Ruleses;
+
+            q = q.Where(p => p.RuleID.Equals(id));
+
+            var rules = await q.ToListAsync();
+
+            if (rules == null)
+            {
+                return NotFound();
+            }
+            
+            return rules;
+        }
+
         /// <summary>
         /// 根據流程站別ID+状态+下一站查詢指定單一資料
         /// </summary>
@@ -137,7 +160,8 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
         /// <param name="nextStationId"></param>
         /// <returns></returns>
         // GET: api/Rules/5
-        [HttpGet("{id}")]
+        [Route("[action]")]
+        [HttpGet]
         public async Task<ActionResult<IEnumerable<Rules>>> GetRules(int id, string ruleStatus, int nextStationId)
         {
             IQueryable<Rules> q = _context.Ruleses;
@@ -188,49 +212,47 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
         /// 更新流程规则资料
         /// </summary>
         /// <param name="id"></param>
-        /// <param name="ruleStatus"></param>
-        /// <param name="nextStationId"></param>
         /// <param name="rules"></param>
         /// <returns></returns>
         // PUT: api/Rules/5
         // To protect from overposting attacks, enable the specific properties you want to bind to, for
         // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
         [HttpPut("{id}")]
-        public async Task<ResultModel<Rules>> PutRules(int id, string ruleStatus, int nextStationId, [FromBody] Rules rules)
+        public async Task<ResultModel<Rules>> PutRules(int id, [FromBody] Rules rules)
         {
             ResultModel<Rules> result = new ResultModel<Rules>();
 
-            var rule = await _context.Ruleses.Where(p => p.RuleStationID.Equals(id) && p.RuleStatus.Equals(ruleStatus) && p.NextStationID.Equals(nextStationId)).FirstOrDefaultAsync();
-
-            if (rule == null)
+            if (id != rules.RuleID)
             {
+                result.Msg = "流程規則編號錯誤";
                 result.Success = false;
-                result.Msg = "流程站別規則不存在";
                 return result;
             }
 
-            rule.RuleDesc = rules.RuleDesc;
-            rule.RuleSeq = rules.RuleSeq;
-            rule.UpdateDate = DateTime.Now;
-
-            _context.Ruleses.Attach(rule);
+            rules.UpdateDate = DateTime.Now;
+            _context.Entry(rules).State = EntityState.Modified;
 
-            // 指定更新某個欄位
-            _context.Entry(rule).Property(p => p.RuleDesc).IsModified = true;
-            _context.Entry(rule).Property(p => p.RuleSeq).IsModified = true;
 
             try
             {
                 await _context.SaveChangesAsync();
-                result.Success = true;
-                result.Msg = "OK";
             }
-            catch (Exception ex)
+            catch (DbUpdateConcurrencyException)
             {
-                result.Success = false;
-                result.Msg = ex.InnerException.Message;
+                if (!RulesExists(id))
+                {
+                    result.Msg = "流程規則編號不存在";
+                    result.Success = false;
+                    return result;
+                }
+                else
+                {
+                    throw;
+                }
             }
 
+            result.Msg = "OK";
+            result.Success = true;
             return result;
         }
 
@@ -246,6 +268,9 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
         public async Task<ResultModel<Rules>> PostRules([FromBody] Rules rules)
         {
             ResultModel<Rules> result = new ResultModel<Rules>();
+            Helper helper = new Helper(_context);
+            rules.RuleID = helper.GetIDKey("RULE_ID").Result;
+
             rules.CreateDate = DateTime.Now;
 
             _context.Ruleses.Add(rules);
@@ -271,16 +296,14 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
         /// 删除流程规则
         /// </summary>
         /// <param name="id"></param>
-        /// <param name="ruleStatus"></param>
-        /// <param name="nextStationId"></param>
         /// <returns></returns>
         // DELETE: api/Rules/5
         [HttpDelete("{id}")]
-        public async Task<ResultModel<Rules>> DeleteRules(int id, string ruleStatus, int nextStationId)
+        public async Task<ResultModel<Rules>> DeleteRules(int id)
         {
             ResultModel<Rules> result = new ResultModel<Rules>();
 
-            var rules = await _context.Ruleses.Where(p => p.RuleStationID.Equals(id) && p.RuleStatus.Equals(ruleStatus) && p.NextStationID.Equals(nextStationId)).FirstOrDefaultAsync();
+            var rules = await _context.Ruleses.Where(p => p.RuleID.Equals(id)).FirstOrDefaultAsync();
 
             if (rules == null)
             {
@@ -305,5 +328,9 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
             return result;
         }
 
+        private bool RulesExists(int id)
+        {
+            return _context.Ruleses.Any(e => e.RuleID == id);
+        }
     }
 }
diff --git a/AMESCoreStudio.WebApi/Controllers/SYS/ModuleInfoesController.cs b/AMESCoreStudio.WebApi/Controllers/SYS/ModuleInfoesController.cs
index 09b3d872..9b8fb55b 100644
--- a/AMESCoreStudio.WebApi/Controllers/SYS/ModuleInfoesController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/SYS/ModuleInfoesController.cs
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.EntityFrameworkCore;
 using AMESCoreStudio.WebApi.Models.SYS;
+using AMESCoreStudio.CommonTools.Result;
 
 namespace AMESCoreStudio.WebApi.Controllers.SYS
 {
@@ -52,14 +53,18 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
         /// <returns></returns>
         // GET: api/ModuleInfoes/System/5
         [HttpGet("System/{id}")]
-        public async Task<ActionResult<IEnumerable<ModuleInfo>>> GetModuleInfoBySystem(int id, int page = 0, int limit = 10)
+        public async Task<ResultModel<ModuleInfo>> GetModuleInfoBySystem(int id, int page = 0, int limit = 10)
         {
+            ResultModel<ModuleInfo> result = new ResultModel<ModuleInfo>();
+
             IQueryable<ModuleInfo> q = _context.ModuleInfoes;
 
             if (id > 0)
             {
                 q = q.Where(p => p.SystemID.Equals(id));
             }
+            result.DataTotal = q.ToList().Count;
+
             if (page > 0)
             {
                 q = q.OrderBy(p => p.SortSeq).Skip((page - 1) * limit).Take(limit);
@@ -73,21 +78,28 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
             {
                 var moduleInfo = await q.ToListAsync();
 
-                
+                result.Data = moduleInfo;
 
                 if (moduleInfo == null)
                 {
-                    return NotFound();
+                    result.Msg = "查無資料";
+                    result.Success = false;
+                    return result;
                 }
 
-                return moduleInfo;
+                result.Msg = "OK";
+                result.Success = true;
+                return result;
             }
             catch (Exception e1)
             {
                 string msg = e1.Message;
             }
 
-            return NotFound();
+
+            result.Msg = "OK";
+            result.Success = true;
+            return result;
 
 
         }
@@ -126,11 +138,15 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
         // To protect from overposting attacks, enable the specific properties you want to bind to, for
         // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
         [HttpPut("{id}")]
-        public async Task<ActionResult<ModuleInfo>> PutModuleInfo(int id, [FromBody] ModuleInfo moduleInfo)
+        public async Task<ResultModel<ModuleInfo>> PutModuleInfo(int id, [FromBody] ModuleInfo moduleInfo)
         {
+            ResultModel<ModuleInfo> result = new ResultModel<ModuleInfo>();
+
             if (id != moduleInfo.ModuleID)
             {
-                return BadRequest();
+                result.Msg = "模組編號錯誤";
+                result.Success = false;
+                return result;
             }
 
             _context.Entry(moduleInfo).State = EntityState.Modified;
@@ -143,7 +159,9 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
             {
                 if (!ModuleInfoExists(id))
                 {
-                    return NotFound();
+                    result.Msg = "模組編號不存在";
+                    result.Success = false;
+                    return result;
                 }
                 else
                 {
@@ -151,8 +169,9 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
                 }
             }
 
-            return moduleInfo;
-            //return NoContent();
+            result.Msg = "OK";
+            result.Success = true;
+            return result;
         }
 
         /// <summary>
@@ -164,8 +183,10 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
         // To protect from overposting attacks, enable the specific properties you want to bind to, for
         // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
         [HttpPost]
-        public async Task<ActionResult<ModuleInfo>> PostModuleInfo([FromBody] ModuleInfo moduleInfo)
+        public async Task<ResultModel<ModuleInfo>> PostModuleInfo([FromBody] ModuleInfo moduleInfo)
         {
+            ResultModel<ModuleInfo> result = new ResultModel<ModuleInfo>();
+
             Helper helper = new Helper(_context);
             moduleInfo.ModuleID = helper.GetIDKey("MODULE_ID").Result;
             moduleInfo.CreateDateTime = DateTime.Now;
@@ -174,7 +195,9 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
             _context.ModuleInfoes.Add(moduleInfo);
             await _context.SaveChangesAsync();
 
-            return CreatedAtAction("GetModuleInfo", new { id = moduleInfo.ModuleID }, moduleInfo);
+            result.Msg = "OK";
+            result.Success = true;
+            return result;
         }
 
         /// <summary>
@@ -184,19 +207,24 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
         /// <returns></returns>
         // DELETE: api/ModuleInfoes/5
         [HttpDelete("{id}")]
-        public async Task<ActionResult<ModuleInfo>> DeleteModuleInfo(int id)
+        public async Task<ResultModel<ModuleInfo>> DeleteModuleInfo(int id)
         {
-            //var moduleInfo = await _context.ModuleInfoes.FindAsync(id);
+            ResultModel<ModuleInfo> result = new ResultModel<ModuleInfo>();
+
             var moduleInfo = await _context.ModuleInfoes.Where(m => m.ModuleID == id).FirstOrDefaultAsync();
             if (moduleInfo == null)
             {
-                return NotFound();
+                result.Msg = "模組編號不存在";
+                result.Success = false;
+                return result;
             }
 
             _context.ModuleInfoes.Remove(moduleInfo);
             await _context.SaveChangesAsync();
 
-            return moduleInfo;
+            result.Msg = "OK";
+            result.Success = true;
+            return result;
         }
 
         private bool ModuleInfoExists(int id)
diff --git a/AMESCoreStudio.WebApi/Controllers/SYS/SystemInfoesController.cs b/AMESCoreStudio.WebApi/Controllers/SYS/SystemInfoesController.cs
index d9e1b3ba..e7b0ed95 100644
--- a/AMESCoreStudio.WebApi/Controllers/SYS/SystemInfoesController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/SYS/SystemInfoesController.cs
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.EntityFrameworkCore;
 using AMESCoreStudio.WebApi.Models.SYS;
+using AMESCoreStudio.CommonTools.Result;
 
 namespace AMESCoreStudio.WebApi.Controllers.SYS
 {
@@ -34,10 +35,13 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
         /// <returns></returns>
         // GET: api/SystemInfoes
         [HttpGet]
-        public async Task<ActionResult<IEnumerable<SystemInfo>>> GetSystemInfo(int page = 0, int limit = 10)
+        public async Task<ResultModel<SystemInfo>> GetSystemInfo(int page = 0, int limit = 10)
         {
+            ResultModel<SystemInfo> result = new ResultModel<SystemInfo>();
             IQueryable<SystemInfo> q = _context.SystemInfoes;
 
+            result.DataTotal = q.ToList().Count;
+
             if (page > 0)
             {
                 q = q.OrderBy(p => p.SystemID).Skip((page - 1) * limit).Take(limit); ;
@@ -47,13 +51,20 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
                 q = q.OrderBy(p => p.SystemID);
             }
 
-            //q = q.OrderByDescending(p => p.SystemID);
-
             var systemInfo = await q.ToListAsync();
 
-            //return await _context.SystemInfoes.ToListAsync();
+            result.Data = systemInfo;
 
-            return systemInfo;
+            if (systemInfo == null)
+            {
+                result.Msg = "查無資料";
+                result.Success = false;
+                return result;
+            }
+
+            result.Success = true;
+            result.Msg = "OK";
+            return result;
         }
 
         /// <summary>
@@ -89,11 +100,15 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
         // To protect from overposting attacks, enable the specific properties you want to bind to, for
         // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
         [HttpPut("{id}")]
-        public async Task<ActionResult<SystemInfo>> PutSystemInfo(int id, [FromBody] SystemInfo systemInfo)
+        public async Task<ResultModel<SystemInfo>> PutSystemInfo(int id, [FromBody] SystemInfo systemInfo)
         {
+            ResultModel<SystemInfo> result = new ResultModel<SystemInfo>();
+
             if (id != systemInfo.SystemID)
             {
-                return BadRequest();
+                result.Success = false;
+                result.Msg = "系統編號錯誤";
+                return result;
             }
 
             _context.Entry(systemInfo).State = EntityState.Modified;
@@ -108,7 +123,9 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
             {
                 if (!SystemInfoExists(id))
                 {
-                    return NotFound();
+                    result.Success = false;
+                    result.Msg = "系統編號不存在";
+                    return result;
                 }
                 else
                 {
@@ -116,8 +133,9 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
                 }
             }
 
-            return systemInfo;
-            //return NoContent();
+            result.Success = true;
+            result.Msg = "OK";
+            return result;
         }
 
         /// <summary>
@@ -129,8 +147,10 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
         // To protect from overposting attacks, enable the specific properties you want to bind to, for
         // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
         [HttpPost]
-        public async Task<ActionResult<SystemInfo>> PostSystemInfo([FromBody] SystemInfo systemInfo)
+        public async Task<ResultModel<SystemInfo>> PostSystemInfo([FromBody] SystemInfo systemInfo)
         {
+            ResultModel<SystemInfo> result = new ResultModel<SystemInfo>();
+
             Helper helper = new Helper(_context);
             systemInfo.SystemID = helper.GetIDKey("SYSTEM_ID").Result;
             systemInfo.CreateDateTime = DateTime.Now;
@@ -139,7 +159,9 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
             _context.SystemInfoes.Add(systemInfo);
             await _context.SaveChangesAsync();
 
-            return CreatedAtAction("GetSystemInfo", new { id = systemInfo.SystemID }, systemInfo);
+            result.Success = true;
+            result.Msg = "OK";
+            return result;
         }
 
         /// <summary>
@@ -149,19 +171,24 @@ namespace AMESCoreStudio.WebApi.Controllers.SYS
         /// <returns></returns>
         // DELETE: api/SystemInfoes/5
         [HttpDelete("{id}")]
-        public async Task<ActionResult<SystemInfo>> DeleteSystemInfo(int id)
+        public async Task<ResultModel<SystemInfo>> DeleteSystemInfo(int id)
         {
-            //var systemInfo = await _context.SystemInfo.FindAsync(id);
+            ResultModel<SystemInfo> result = new ResultModel<SystemInfo>();
+
             var systemInfo = await _context.SystemInfoes.Where(m => m.SystemID == id).FirstOrDefaultAsync();
             if (systemInfo == null)
             {
-                return NotFound();
+                result.Success = false;
+                result.Msg = "系統編號不存在";
+                return result;
             }
 
             _context.SystemInfoes.Remove(systemInfo);
             await _context.SaveChangesAsync();
 
-            return systemInfo;
+            result.Success = true;
+            result.Msg = "OK";
+            return result;
         }
 
         private bool SystemInfoExists(int id)
diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs
index 40de7d55..19ac7d5a 100644
--- a/AMESCoreStudio.WebApi/Models/AMESContext.cs
+++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs
@@ -36,7 +36,7 @@ namespace AMESCoreStudio.WebApi
                 .HasOne(m => m.Module);
             */
 
-            modelBuilder.Entity<Rules>().HasKey(c => new { c.RuleStationID, c.RuleStatus, c.NextStationID });
+            modelBuilder.Entity<Rules>().HasKey(c => new { c.RuleID });
             modelBuilder.Entity<WipBarcode>().HasKey(c => new { c.WipNO, c.StartNO, c.EndNO });
             modelBuilder.Entity<WipLog>().HasKey(c => new { c.WipID, c.CreateDate });
             modelBuilder.Entity<PartMap>().HasKey(c => new { c.CorpSN });
diff --git a/AMESCoreStudio.WebApi/Models/BAS/Rules.cs b/AMESCoreStudio.WebApi/Models/BAS/Rules.cs
index e76b6035..bdd36c45 100644
--- a/AMESCoreStudio.WebApi/Models/BAS/Rules.cs
+++ b/AMESCoreStudio.WebApi/Models/BAS/Rules.cs
@@ -11,10 +11,18 @@ namespace AMESCoreStudio.WebApi.Models.BAS
     [Table("RULES", Schema = "JHAMES")]
     public class Rules
     {
+        /// <summary>
+        /// 流程規則編號
+        /// </summary>
+        [Key, Column("RULE_ID")]
+        [Display(Name = "流程規則編號")]
+        [DataMember]
+        public int RuleID { get; set; }
+
         /// <summary>
         /// 流程站別編號
         /// </summary>
-        [Key,Column("RULE_STATION_ID",Order =0)]
+        [Column("RULE_STATION_ID")]
         [Display(Name = "流程站別編號")]
         [DataMember]
         public int RuleStationID { get; set; }
@@ -32,7 +40,7 @@ namespace AMESCoreStudio.WebApi.Models.BAS
         /// <summary>
         /// 規則狀態
         /// </summary>
-        [Key,Column("RULE_STATUS",Order =1)]
+        [Column("RULE_STATUS")]
         [Display(Name = "規則狀態")]
         [DataMember]
         public string RuleStatus { get; set; }
@@ -40,7 +48,7 @@ namespace AMESCoreStudio.WebApi.Models.BAS
         /// <summary>
         /// 下一站別編號
         /// </summary>
-        [Key,Column("NEXT_STATION_ID",Order =2)]
+        [Column("NEXT_STATION_ID")]
         [Display(Name = "下一站別編號")]
         [DataMember]
         public int NextStationID { get; set; }
diff --git a/AMESCoreStudio.WebApi/Models/SYS/IDKey.cs b/AMESCoreStudio.WebApi/Models/SYS/IDKey.cs
index 542d9288..f9c1d160 100644
--- a/AMESCoreStudio.WebApi/Models/SYS/IDKey.cs
+++ b/AMESCoreStudio.WebApi/Models/SYS/IDKey.cs
@@ -26,28 +26,28 @@ namespace AMESCoreStudio.WebApi.Models.SYS
         /// </summary>
         [Column("CURRENT_NUM")]
         [Required]
-        public Int64 CurrentNum { get; set; }
+        public int CurrentNum { get; set; }
 
         /// <summary>
         /// 初始值
         /// </summary>
         [Column("START_NUM")]
         [Required]
-        public Int64 StartNum { get; set; }
+        public int StartNum { get; set; }
 
         /// <summary>
         /// 最大值
         /// </summary>
         [Column("LIMIT_NUM")]
         [Required]
-        public Int64 LimitNum { get; set; }
+        public int LimitNum { get; set; }
 
         /// <summary>
         /// 增量
         /// </summary>
         [Column("DELTA_NUM")]
         [Required]
-        public Int32 DeltaNum { get; set; }
+        public int DeltaNum { get; set; }
 
         /// <summary>
         /// 建立時間