From a99c58ff6aef4f984cb5095db9de25151cbfa40f Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 21 Mar 2022 19:09:36 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=B7=A5=E5=96=AE=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B3=87=E6=96=99=E5=8A=A0=E5=85=A5AutoComplete?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 114 +- AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 18 +- .../ViewModels/PCS/PCS001RViewModel.cs | 35 - .../ViewModels/PCS/WipViewModel.cs | 22 +- .../ViewModels/PCS/WipViewModelNew.cs | 72 - AMESCoreStudio.Web/Views/PCS/PCS001.cshtml | 32 +- AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml | 2 +- AMESCoreStudio.Web/Views/PCS/PCS003.cshtml | 314 +-- .../wwwroot/js/layAutoComplete.js | 2232 +---------------- .../AMES/PlmMeterialInfoeController.cs | 12 + .../Controllers/AMES/WipAttsController.cs | 9 - .../Controllers/AMES/WipCheckController.cs | 50 +- .../Controllers/AMES/WipInfosController.cs | 59 +- AMESCoreStudio.WebApi/Models/AMES/WipCheck.cs | 32 +- 14 files changed, 468 insertions(+), 2535 deletions(-) delete mode 100644 AMESCoreStudio.Web/ViewModels/PCS/PCS001RViewModel.cs delete mode 100644 AMESCoreStudio.Web/ViewModels/PCS/WipViewModelNew.cs diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 78d1db01..b24b5d73 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -964,7 +964,7 @@ namespace AMESCoreStudio.Web.Controllers /// /// [HttpPost] - public async Task GetFactoryUnitJson(string id) + public async Task GetFactoryUnitJson(string id, string search) { var result = await _basApi.GetFactoryUnits(); @@ -978,6 +978,13 @@ namespace AMESCoreStudio.Web.Controllers { FactoryUnit.Add(new SelectListItem("N/A", null)); } + + if (!string.IsNullOrWhiteSpace(search)) + { + FactoryUnit = FactoryUnit.Where(w => w.Text.ToUpper().Contains(search.ToUpper()) + || w.Value.ToUpper().Contains(search.ToUpper())).ToList(); + } + //将数据Json化并传到前台视图 return Json(new { data = FactoryUnit }); } @@ -1002,6 +1009,35 @@ namespace AMESCoreStudio.Web.Controllers //将数据Json化并传到前台视图 return Json(new { data = item }); } + + /// + /// 回傳PLM料號品名 + /// + /// + /// + [HttpPost] + public async Task getPLMMeterial(string value) + { + var result = await _pcsApi.GetPlmMeterialInfo(value); + //将数据Json化并传到前台视图 + if (result == null) + return Json(new { data = "" }); + else + + return Json(new { data = result.MeterialDesc }); + } + + /// + /// 回傳PLM料號品名_AutoComplete + /// + /// + /// + [HttpPost] + public async Task getPLMMeterialAutoComplete(string search) + { + var result = await _pcsApi.GetPlmMeterialInfoAutoComplete(search); + return Json(new { data = result }); + } #endregion [ResponseCache(Duration = 0)] @@ -1031,16 +1067,25 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } + + + /// + /// 回傳工單號碼相關資料 + /// + /// 工單號碼 + /// [HttpPost] - public async Task getPLMMeterial(string value) + public async Task getCreateWipNo_Detail(string value) { - var result = await _pcsApi.GetPlmMeterialInfo(value); + var result_WipAtt = await _pcsApi.GetWipAtt(value); + var result = new WipNoDetailViewModel(); + result.wipAtt = result_WipAtt; //将数据Json化并传到前台视图 if (result == null) return Json(new { data = "" }); else - return Json(new { data = result.MeterialDesc }); + return Json(new { data = result }); } #region PCS001 工單資料維護 @@ -1296,7 +1341,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS001R(int id) { - WipDataViewModelNew model = new WipDataViewModelNew(); + WipDataViewModel model = new WipDataViewModel(); var q = await _pcsApi.GetWipInfo(id); if (q.Count != 0) { @@ -1351,7 +1396,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS003(int id) { - WipDataViewModelNew model = new WipDataViewModelNew(); + WipDataViewModel model = new WipDataViewModel(); var q = await _pcsApi.GetWipInfo(id); if (q.Count != 0) { @@ -1415,7 +1460,7 @@ namespace AMESCoreStudio.Web.Controllers return View(model); } [HttpPost] - public async Task PCS003Async(WipDataViewModelNew model, string action) + public async Task PCS003Async(WipDataViewModel model, string action) { #region 選單 await GetProductType(); @@ -1596,12 +1641,13 @@ namespace AMESCoreStudio.Web.Controllers } } - WipCheck wipCheck = new WipCheck{ + WipCheck wipCheck = new WipCheck + { WipNo = model.wipInfo.WipNO }; - if (action == "PM確認") + if (action == "生管確認") { - await _pcsApi.PutWipCheckByPM(JsonConvert.SerializeObject(wipCheck)); + await _pcsApi.PutWipCheckByPMC(JsonConvert.SerializeObject(wipCheck)); } else if (action == "工程確認") { @@ -1609,7 +1655,7 @@ namespace AMESCoreStudio.Web.Controllers } else if (action == "製造確認") { - await _pcsApi.PutWipCheckByMA(JsonConvert.SerializeObject(wipCheck)); + await _pcsApi.PutWipCheckByMF(JsonConvert.SerializeObject(wipCheck)); } if (result.Success) @@ -3843,52 +3889,6 @@ namespace AMESCoreStudio.Web.Controllers #endregion - public async Task PCS998() - { - WipDataViewModelNew model = new WipDataViewModelNew(); - await GetFactoryUnit(); - var q = await _pcsApi.GetWipInfo(1013); - if (q.Count != 0) - { - // 判斷工單號碼是否已經開線 - var resultLineInfo = await _basApi.GetLineInfoes(); - var resultWipNo = await _pcsApi.GetWipInfoByWipNO(q.FirstOrDefault().WipNO); - var WipIDs = resultWipNo.Select(s => s.WipID); - - - model.wipInfo = q.FirstOrDefault(); - model.wipAtt = await _pcsApi.GetWipAtt(model.wipInfo.WipNO); - model.wipBarcodes = await _pcsApi.GetWipBarcode(model.wipInfo.WipNO); - model.ruleStations = await _pcsApi.GetRuleStationByWipNo(model.wipInfo.WipNO); - - var q1 = await _pcsApi.GetMaterialSopQuery(itemNo: model.wipAtt.ItemNO); - model.materialSops = q1.Data; - - model.WipKps = await _pcsApi.GetWipKpByWipNo(model.wipInfo.WipNO); - - model.wipBoard = await _pcsApi.GetWipBoard(model.wipInfo.WipNO); - - model.wipSystem = await _pcsApi.GetWipSystem(model.wipInfo.WipNO); - - model.wipMAC = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); - - model.wipLabel = await _pcsApi.GetWipLabel(model.wipInfo.WipNO); - - model.wipBarcodeOther = await _pcsApi.GetWipBarcodeOther(model.wipInfo.WipNO); - - model.Outfits = await _pcsApi.GetMaterialOutfitByItemNo(model.wipAtt.ItemNO); - } - return View(model); - } - - //頁面提交,id=0 添加,id>0 修改 - [HttpPost] - public async Task PCS998Async(WipDataViewModelNew model) - { - var aa = "string"; - return View(model); - } - public async Task PCS999() { return View(); diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index b443b335..c18eaddf 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -144,7 +144,7 @@ namespace AMESCoreStudio.Web ITask> PutWipAtt([FromBody, RawJsonContent] string model); /// - /// 查詢工單基本資料-WipID + /// 查詢工單基本資料-WipNo /// /// [WebApiClient.Attributes.HttpGet("api/WipAtts/{id}")] @@ -888,17 +888,25 @@ namespace AMESCoreStudio.Web /// [WebApiClient.Attributes.HttpGet("api/PlmMeterialInfoe/{id}")] ITask GetPlmMeterialInfo(string id); + + /// + /// 查詢PLM轉入料號說明_AutoComplete + /// + /// PLM料號 + /// + [WebApiClient.Attributes.HttpGet("api/PlmMeterialInfoe/AutoComplete/{id}")] + ITask> GetPlmMeterialInfoAutoComplete(string id); #endregion #region WipCheck 工單資訊確認 [WebApiClient.Attributes.HttpPut("api/WipCheck/ByPE")] ITask> PutWipCheckByPE([FromBody, RawJsonContent] string model); - [WebApiClient.Attributes.HttpPut("api/WipCheck/ByMA")] - ITask> PutWipCheckByMA([FromBody, RawJsonContent] string model); + [WebApiClient.Attributes.HttpPut("api/WipCheck/ByMF")] + ITask> PutWipCheckByMF([FromBody, RawJsonContent] string model); - [WebApiClient.Attributes.HttpPut("api/WipCheck/ByPM")] - ITask> PutWipCheckByPM([FromBody, RawJsonContent] string model); + [WebApiClient.Attributes.HttpPut("api/WipCheck/ByPMC")] + ITask> PutWipCheckByPMC([FromBody, RawJsonContent] string model); #endregion } diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS001RViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS001RViewModel.cs deleted file mode 100644 index e050b1e4..00000000 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS001RViewModel.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using AMESCoreStudio.WebApi.Models.AMES; -using AMESCoreStudio.WebApi.Models.BAS; -using AMESCoreStudio.WebApi.DTO.AMES; - -namespace AMESCoreStudio.Web.ViewModels.PCS -{ - public class PCS001RViewModel - { - public WipInfo wipInfo { get; set; } - - public WipAtt wipAtt { get; set; } - - public WipBoard wipBoard { get; set; } - - public WipSystem wipSystem { get; set; } - - public IEnumerable wipBarcode { get; set; } - - public IEnumerable ruleStation { get; set; } - - public IEnumerable materialSop { get; set; } - - public IEnumerable materialKp { get; set; } - - public WipLabel wipLabel { get; set; } - - public WipMAC wipMAC { get; set; } - - public WipBarcodeOther wipBarcodeOther { get; set; } - } -} diff --git a/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs index 6696be7d..73a33eed 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs @@ -8,15 +8,8 @@ using AMESCoreStudio.WebApi.DTO.AMES; namespace AMESCoreStudio.Web.ViewModels.PCS { - public class WipDataViewModel + public class WipNoDetailViewModel { - - /// - /// 工單資料 - /// - public WipInfo wipInfo { get; set; } - - /// /// 工單屬性 /// @@ -39,11 +32,13 @@ namespace AMESCoreStudio.Web.ViewModels.PCS public IEnumerable wipBarcodes { get; set; } - public IEnumerable ruleStations { get; set; } + public IEnumerable ruleStations { get; set; } public IEnumerable materialSops { get; set; } - public IEnumerable materialKps { get; set; } + public IEnumerable WipKps { get; set; } + + public IEnumerable Outfits { get; set; } /// /// @@ -64,7 +59,14 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// 條碼區間設定 /// public WipBarcodeOther wipBarcodeOther { get; set; } + } + public class WipDataViewModel: WipNoDetailViewModel + { + /// + /// 工單資料 + /// + public WipInfo wipInfo { get; set; } } } diff --git a/AMESCoreStudio.Web/ViewModels/PCS/WipViewModelNew.cs b/AMESCoreStudio.Web/ViewModels/PCS/WipViewModelNew.cs deleted file mode 100644 index b787ef34..00000000 --- a/AMESCoreStudio.Web/ViewModels/PCS/WipViewModelNew.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using AMESCoreStudio.WebApi.Models.AMES; -using AMESCoreStudio.WebApi.Models.BAS; -using AMESCoreStudio.WebApi.DTO.AMES; - -namespace AMESCoreStudio.Web.ViewModels.PCS -{ - public class WipDataViewModelNew - { - - /// - /// 工單資料 - /// - public WipInfo wipInfo { get; set; } - - - /// - /// 工單屬性 - /// - public WipAtt wipAtt { get; set; } - - /// - /// 生產序號 - /// - public WipBarcode wipBarcode { get; set; } - - /// - /// 板卡資訊 - /// - public WipBoard wipBoard { get; set; } - - /// - /// 系統組裝 - /// - public WipSystem wipSystem { get; set; } - - public IEnumerable wipBarcodes { get; set; } - - public IEnumerable ruleStations { get; set; } - - public IEnumerable materialSops { get; set; } - - public IEnumerable WipKps { get; set; } - - public IEnumerable Outfits { get; set; } - - /// - /// - /// - public WipSop wipSop { get; set; } - - /// - /// 標籤 - /// - public WipLabel wipLabel { get; set; } - - /// - /// MAC - /// - public WipMAC wipMAC { get; set; } - - /// - /// 條碼區間設定 - /// - public WipBarcodeOther wipBarcodeOther { get; set; } - - - } -} diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml index 50d36d6a..b2b01104 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml @@ -17,20 +17,20 @@
-
+
- +
- +
@@ -39,7 +39,7 @@
- +
@@ -1081,7 +1081,7 @@ function RuleStation(id) { if (id == null) { id = 1; - } + }; var tableCols_rule = [[ { @@ -1104,6 +1104,26 @@ ]; var tableruleStation = hg.table.datatable('ruleStation', '', '/BAS/GetRuleStationsByFlow?flowId='+id, {}, tableCols_rule,'', false, 'full-100'); tableruleStation; - } + }; + + //PLM料號 + function getCreateWipNo_Detail(val) { + $.ajax( + { + url: "@Url.Action("getCreateWipNo_Detail", "PCS")", + dataType: 'json', + data: { "value": val.value}, + type: 'post', + success: function (result) + { + console.log(result); + $('#PCS001').html(result); + }, + error: function (result) + { + alert(result); + } + }); + }; } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml index 4f306565..4942b75c 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml @@ -1,4 +1,4 @@ -@model AMESCoreStudio.Web.ViewModels.PCS.WipDataViewModelNew +@model AMESCoreStudio.Web.ViewModels.PCS.WipDataViewModel @{ ViewData["Title"] = "PCS001C"; diff --git a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml index 8fad3b3a..32e99cb1 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml @@ -1,4 +1,4 @@ -@model AMESCoreStudio.Web.ViewModels.PCS.WipDataViewModelNew +@model AMESCoreStudio.Web.ViewModels.PCS.WipDataViewModel @{ ViewData["Title"] = "PCS003"; @@ -345,70 +345,70 @@ } +
+ +
@* 生產流程sheet *@ -
-
-
- -
- +
+
+
+ +
+ +
+
- -
-
- -
-
- - - - - - - - - - - - @foreach (var index in Model.ruleStations) - { +
+ +
+
- 生產單位 - - 流程名稱 - - 站別描述 - - 站別順序 - - 站別類型 -
+ + - - - - - + + + + + - } - -
- @index.UnitNoName - - @index.FlowRuleName - - @index.StationDesc - - @index.Sequence - - @index.StationType - + 生產單位 + + 流程名稱 + + 站別描述 + + 站別順序 + + 站別類型 +
-
-
- + + + @foreach (var index in Model.ruleStations) + { + + + @index.UnitNoName + + + @index.FlowRuleName + + + @index.StationDesc + + + @index.Sequence + + + @index.StationType + + + } + + +
-
@* 板卡-工程資訊sheet *@
@@ -609,27 +609,13 @@
-
- -
- -
- -
- -
-
-
- -
-
- +
@@ -652,7 +638,7 @@
- +
@@ -667,7 +653,7 @@
- +
@@ -682,7 +668,7 @@
- +
@@ -697,7 +683,7 @@
- +
@@ -712,7 +698,7 @@
- +
@@ -720,6 +706,19 @@
+
+
+ +
+ +
+ +
+ +
+
+
+
@@ -756,90 +755,90 @@
@* 治具組合sheet *@ -
- - @{ int j = 0;} - - - - - - - - - @foreach (var index in Model.Outfits) - { +
+
- 治具NO - - 治具名稱 - - 流程名稱ID -
+ @{ int j = 0;} + - - - + + + - j++; - } - -
- - @index.OutfitNo - - @index.StationType - - @index.RuleStationID - + 治具NO + + 治具名稱 + + 流程名稱ID +
-
- + + + @foreach (var index in Model.Outfits) + { + + + + @index.OutfitNo + + + @index.StationType + + + @index.RuleStationID + + + j++; + } + +
-
@* SOP文件 sheet *@
+
+ +
@* 標籤選項sheet *@ -
-
- - -
+
+
+ + +
-
- -
- +
+ +
+ +
+
-
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
+
+
+
-
-
-
-
@Html.ValidationMessage("error") @@ -868,7 +867,13 @@ getLineInfoList($("#unitNo").val()); }); - layui.use(['form', 'laydate', 'element','table'], function () { + layui.config({ + base: '/js/' //假设这是test.js所在的目录 + }).extend({ //设定模块别名 + autocomplete: 'layAutoComplete' + }); + + layui.use(['form', 'laydate', 'element', 'table', 'autocomplete'], function () { var form = layui.form, laydate = layui.laydate, layer = layui.layer, @@ -890,6 +895,23 @@ , theme: 'grid' }); + // 關鍵字 + $(".autocomplete").each(function () { + layui.autocomplete({ + element: this, + display: 'meterialNo', + shortcut: 'modelName', + num: 2, + count: 10, + url: '/PCS/getPLMMeterialAutoComplete', + query: {}, + resArray: 'data', + done: function (item) { + $(this.element).closest('div.layui-inline').find('input[id*=' + this.element.id + '_Desc]').val(item.meterialDesc); + } + }); + }) + element.on('tab(test2)', function (data) { alert("TAB"); table && table.reload(data); @@ -952,7 +974,7 @@ }; //PLM料號 - function getPLMMeterial(val) { + @*function getPLMMeterial(val) { $.ajax( { url: "@Url.Action("getPLMMeterial", "PCS")", @@ -968,7 +990,7 @@ alert(result); } }); - }; + };*@ var tableCols = [[ { diff --git a/AMESCoreStudio.Web/wwwroot/js/layAutoComplete.js b/AMESCoreStudio.Web/wwwroot/js/layAutoComplete.js index f69e11d8..cc9420a0 100644 --- a/AMESCoreStudio.Web/wwwroot/js/layAutoComplete.js +++ b/AMESCoreStudio.Web/wwwroot/js/layAutoComplete.js @@ -1,2095 +1,137 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - layui-autocomplete/layAutoComplete.js at master · gavincilp/layui-autocomplete · GitHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Skip to content - - - - - - - - - - -
- -
- - - - - - - -
- - - -
- - - - - - - - - - -
-
-
- - - - - - - - - - - - - -
- - - - - - -
- - -
- - - - - - -Permalink - -
- -
-
- - - master - - - - -
-
-
- Switch branches/tags - -
- - - -
- -
- -
- - -
- -
- - - - - - - - - - - - - - - - -
- - -
-
-
-
- -
- -
- - - Go to file - -
- - - - -
-
-
- - - - - - - - - -
- -
-
-
 
-
- -
-
 
- Cannot retrieve contributors at this time -
-
- - - - - - - - -
- -
- - -
- - 137 lines (132 sloc) - - 5.53 KB -
- -
- - - - -
- - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
-
- - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
layui.define(['jquery'], function (exports) {
var $ = layui.$
var defaultOption = {
num: 2,
array: null,
display: 'name',
shortcut: 'pinyin',
url: null,
query: {},
resArray: 'data',
element: null,
count: 10,
done: null
}
-
function init(tmpOption) {
var $el = $(tmpOption.element)
var option = {}
if ($el.data('option')) {
option = $.extend($el.data('option'), tmpOption)
} else {
option = $.extend({}, defaultOption, tmpOption)
var $out = $('<div></div>')
$out.css('position','relative')
-
$el.after($out)
$el.remove()
$out.append($el)
var $panel = $('<div class="layui-anim-upbit layui-anim" style="position: absolute;' +
'top: 36px;' +
'display: none;' +
'border: 1px solid #eee;' +
'padding: 10px;' +
'z-index: 1000;' +
'background-color: white;' +
'margin-top: 5px;"></div>')
$out.append($panel)
$panel.on('click', '.layui-autocomplete-item', function (e) {
select(e.target)
e.preventDefault()
})
-
function display(tempArray) {
$panel.css('top', $el.height()).css('width', $el.width() - 10)
$panel.empty()
for (var i = 0; i < tempArray.length && i < option.count; i++) {
var temp
if (option.display != null) {
temp = $('<div class="layui-autocomplete-item">' + tempArray[i][option.display] + '</div>')
} else {
temp = $('<div class="layui-autocomplete-item">' + tempArray[i] + '</div>')
}
temp.data('item', tempArray[i])
$panel.append(temp)
}
if (tempArray.length != 0) {
$panel.show()
} else {
$panel.hide()
}
}
-
function select(item) {
if (option.display) {
$el.val($(item).data("item")[option.display])
} else {
$el.val($(item).data("item"))
}
if (option.done != null && typeof option.done == 'function') {
option.done($(item).data("item"))
}
$panel.hide()
}
var debounceTimeout;
$el.keyup(function (e) {
if (e.which == 40 && $panel.css('display') != 'none') {
var $active = $panel.find('.layui-autocomplete-active')
if ($active.length > 0 && $active.next().length > 0) {
var $next = $active.next()
$next.addClass('layui-autocomplete-active')
$active.removeClass('layui-autocomplete-active')
$next.focus()
} else {
$panel.find('.layui-autocomplete-active').removeClass('layui-autocomplete-active')
var $next = $($panel.find('.layui-autocomplete-item').get(0))
$next.addClass('layui-autocomplete-active')
$next.focus()
}
return
} else if (e.which == 38 && $panel.css('display') != 'none') {
var $active = $panel.find('.layui-autocomplete-active')
if ($active.length > 0 && $active.prev().length > 0) {
var $next = $active.prev()
$next.addClass('layui-autocomplete-active')
$active.removeClass('layui-autocomplete-active')
$next.focus()
}
return false;
} else if (e.which == 13 && $panel.find('.layui-autocomplete-active').length > 0) {
select($panel.find('.layui-autocomplete-active'))
return false;
}
var value = $el.val()
if (value.length >= option.num) {
if (option.array != null) {
var tempArray = []
for (var i = 0; i < option.array.length; i++) {
var item = option.array[i]
if (item[option.display].toLowerCase().search(value.toLowerCase()) > -1 || (option.shortcut && item[option.shortcut].toLowerCase().search(value.toLowerCase()) > -1)) {
tempArray.push(item)
}
}
display(tempArray)
} else {
clearTimeout(debounceTimeout)
debounceTimeout=setTimeout(function(){
$.post(option.url, $.extend({search:value},option.query), function (res) {
display(res[resArray])
})
},500);
}
} else {
$panel.empty()
$panel.hide()
}
})
-
$el.blur(function () {
setTimeout(function(){
$panel.hide(500)
},100)
})
}
$el.data('option', option)
}
exports('autocomplete', init)
})
-
- - - -
- -
- - - - -
- - -
- - -
-
- - - - -
- -
- - -
- -
-
- -
- - - - - - - - - - - - - - - - - - - - - +layui.define(['jquery'], function (exports) { + var $ = layui.$ + var defaultOption = { + num: 2, + array: null, + display: 'name', + shortcut: 'pinyin', + url: null, + query: {}, + resArray: 'data', + element: null, + count: 10, + done: null + } + + function init(tmpOption) { + var $el = $(tmpOption.element) + var option = {} + if ($el.data('option')) { + option = $.extend($el.data('option'), tmpOption) + } else { + option = $.extend({}, defaultOption, tmpOption) + var $out = $('
') + $out.css('position', 'relative') + + $el.after($out) + $el.remove() + $out.append($el) + var $panel = $('
') + $out.append($panel) + $panel.on('click', '.layui-autocomplete-item', function (e) { + select(e.target) + e.preventDefault() + }) + + function display(tempArray) { + $panel.css('top', $el.height()).css('width', $el.width() - 10) + $panel.empty() + for (var i = 0; i < tempArray.length && i < option.count; i++) { + var temp + if (option.display != null) { + temp = $('
' + tempArray[i][option.display] + '
') + } else { + temp = $('
' + tempArray[i] + '
') + } + temp.data('item', tempArray[i]) + $panel.append(temp) + } + if (tempArray.length != 0) { + $panel.show() + } else { + $panel.hide() + } + } + + function select(item) { + if (option.display) { + $el.val($(item).data("item")[option.display]) + } else { + $el.val($(item).data("item")) + } + if (option.done != null && typeof option.done == 'function') { + option.done($(item).data("item")) + } + $panel.hide() + } + var debounceTimeout; + $el.keyup(function (e) { + if (e.which == 40 && $panel.css('display') != 'none') { + var $active = $panel.find('.layui-autocomplete-active') + if ($active.length > 0 && $active.next().length > 0) { + var $next = $active.next() + $next.addClass('layui-autocomplete-active') + $active.removeClass('layui-autocomplete-active') + $next.focus() + } else { + $panel.find('.layui-autocomplete-active').removeClass('layui-autocomplete-active') + var $next = $($panel.find('.layui-autocomplete-item').get(0)) + $next.addClass('layui-autocomplete-active') + $next.focus() + } + return + } else if (e.which == 38 && $panel.css('display') != 'none') { + var $active = $panel.find('.layui-autocomplete-active') + if ($active.length > 0 && $active.prev().length > 0) { + var $next = $active.prev() + $next.addClass('layui-autocomplete-active') + $active.removeClass('layui-autocomplete-active') + $next.focus() + } + return false; + } else if (e.which == 13 && $panel.find('.layui-autocomplete-active').length > 0) { + select($panel.find('.layui-autocomplete-active')) + return false; + } + var value = $el.val() + if (value.length >= option.num) { + if (option.array != null) { + var tempArray = [] + for (var i = 0; i < option.array.length; i++) { + var item = option.array[i] + if (item[option.display].toLowerCase().search(value.toLowerCase()) > -1 || (option.shortcut && item[option.shortcut].toLowerCase().search(value.toLowerCase()) > -1)) { + tempArray.push(item) + } + } + display(tempArray) + } else { + clearTimeout(debounceTimeout) + debounceTimeout = setTimeout(function () { + $.post(option.url, $.extend({ search: value }, option.query), function (res) { + display(res[option.resArray]) + }) + }, 500); + } + } else { + $panel.empty() + $panel.hide() + } + }) + + $el.blur(function () { + setTimeout(function () { + $panel.hide(500) + }, 100) + }) + } + $el.data('option', option) + } + exports('autocomplete', init) +}) \ No newline at end of file diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs index dc9bf334..818df101 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs @@ -44,6 +44,18 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return plmMeterialInfo; } + /// + /// 關鍵字查詢 + /// + /// PLM料號 + /// + [HttpGet("AutoComplete/{id}")] + public async Task>> GetPlmMeterialInfoAutoComplete(string id) + { + var plmMeterialInfo = await _context.PlmMeterialInfos.Where(w => w.MeterialNo.ToUpper().Contains(id.ToUpper())).ToListAsync(); + return plmMeterialInfo; + } + // PUT: api/PlmMeterialInfoe/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. diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs index 528a08db..727916a8 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipAttsController.cs @@ -54,20 +54,11 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// /// 工單號碼 /// - // GET: api/WipAtts/4 [HttpGet("{id}")] public async Task> GetWipAtt(string id) { - IQueryable q = _context.WipAtts.Where(p => p.WipNO == id); - var WipAtt = await q.ToListAsync(); - - if (WipAtt == null || WipAtt.Count == 0) - { - return NotFound(); - } - return WipAtt.FirstOrDefault(); } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipCheckController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipCheckController.cs index 289191b5..89e03f4b 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipCheckController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipCheckController.cs @@ -46,7 +46,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES } /// - /// + /// 更新工程確認 /// /// /// @@ -57,12 +57,12 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES _context.Entry(wipCheck).State = EntityState.Modified; //設置容器空間某一個模型的某一個欄位 不提交到資料庫 //DbContent.Entry是要更新到資料庫的整個對象 - _context.Entry(wipCheck).Property("MaUserID").IsModified = false; - _context.Entry(wipCheck).Property("MaCheckdate").IsModified = false; - _context.Entry(wipCheck).Property("PMUserID").IsModified = false; - _context.Entry(wipCheck).Property("PMCheckdate").IsModified = false; - wipCheck.PeUserID = 0; - wipCheck.PeCheckdate = DateTime.Now; + _context.Entry(wipCheck).Property("MFUserID").IsModified = false; + _context.Entry(wipCheck).Property("MFCheckdate").IsModified = false; + _context.Entry(wipCheck).Property("PMCUserID").IsModified = false; + _context.Entry(wipCheck).Property("PMCCheckdate").IsModified = false; + wipCheck.PEUserID = 0; + wipCheck.PECheckdate = DateTime.Now; try { @@ -80,23 +80,23 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES } /// - /// + /// 更新製造確認 /// /// /// - [HttpPut("ByMA")] - public async Task> PutWipCheckByMA(WipCheck wipCheck) + [HttpPut("ByMF")] + public async Task> PutWipCheckByMF(WipCheck wipCheck) { ResultModel result = new ResultModel(); _context.Entry(wipCheck).State = EntityState.Modified; //設置容器空間某一個模型的某一個欄位 不提交到資料庫 //DbContent.Entry是要更新到資料庫的整個對象 - _context.Entry(wipCheck).Property("PeUserID").IsModified = false; - _context.Entry(wipCheck).Property("PeCheckdate").IsModified = false; - _context.Entry(wipCheck).Property("PMUserID").IsModified = false; - _context.Entry(wipCheck).Property("PMCheckdate").IsModified = false; - wipCheck.MaUserID = 0; - wipCheck.MaCheckdate = DateTime.Now; + _context.Entry(wipCheck).Property("PEUserID").IsModified = false; + _context.Entry(wipCheck).Property("PECheckdate").IsModified = false; + _context.Entry(wipCheck).Property("PMCUserID").IsModified = false; + _context.Entry(wipCheck).Property("PMCCheckdate").IsModified = false; + wipCheck.MFUserID = 0; + wipCheck.MFCheckdate = DateTime.Now; try { @@ -114,23 +114,23 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES } /// - /// + /// 更新生管確認 /// /// /// - [HttpPut("ByPM")] - public async Task> PutWipCheckByPM(WipCheck wipCheck) + [HttpPut("ByPMC")] + public async Task> PutWipCheckByPMC(WipCheck wipCheck) { ResultModel result = new ResultModel(); _context.Entry(wipCheck).State = EntityState.Modified; //設置容器空間某一個模型的某一個欄位 不提交到資料庫 //DbContent.Entry是要更新到資料庫的整個對象 - _context.Entry(wipCheck).Property("PeUserID").IsModified = false; - _context.Entry(wipCheck).Property("PeCheckdate").IsModified = false; - _context.Entry(wipCheck).Property("MaUserID").IsModified = false; - _context.Entry(wipCheck).Property("MaCheckdate").IsModified = false; - wipCheck.PMUserID = 0; - wipCheck.PMCheckdate = DateTime.Now; + _context.Entry(wipCheck).Property("PEUserID").IsModified = false; + _context.Entry(wipCheck).Property("PECheckdate").IsModified = false; + _context.Entry(wipCheck).Property("MFUserID").IsModified = false; + _context.Entry(wipCheck).Property("MFCheckdate").IsModified = false; + wipCheck.PMCUserID = 0; + wipCheck.PMCCheckdate = DateTime.Now; try { diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs index 70b575dc..a8325b67 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs @@ -185,54 +185,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } - /// - /// 查詢工單資料+是否過站 by SelectParameter - /// - /// - //[Route("[action]")] - //[HttpGet] - //public async Task> GetWipInfoSelectParameterInBarCodeStation([FromQuery] WipInfoDto value, int page = 0, int limit = 10) - //{ - - //ResultModel result = new ResultModel(); - //var result = GetWipInfoSelectParameter(value, page, limit); - //// 判斷是否已經有過站紀錄 - //BarcodeStationController barcodeStation = new BarcodeStationController(_context); - //var WipArray = result.Result.Data.GroupBy(o => o.WipNO) - // .Select(s => new - // { - // s.Key, - // WipID = result.Result.Data.Where(w => w.WipNO == s.Key) - // .Select(s1 => (decimal)s1.WipID).ToList() - // }).ToList(); - - //foreach (var item in WipArray) - //{ - // var q1 = barcodeStation.GetBarcodeStationByWipIDList(item.WipID); - // if (q1 == null) - // { - // result.Result.Data = result.Result.Data.Where(w => w.WipNO == item.Key) - // .Select(s => new { s , BarcodeStation = "N"}).ToList(); - // } - // else - // { - // result.Result.Data = result.Result.Data.Where(w => w.WipNO == item.Key) - // .Select(s => { s.BarcodeStation = "Y"; return s; }).ToList(); - // } - //} - - //if (result.Result.Data == null) - //{ - // result.Result.Msg = "查無資料"; - // result.Result.Success = false; - // return await result; - //} - - //result.Result.Success = true; - //result.Result.Msg = "OK"; - //return; - //} - /// /// 查詢工單資料Info By WipID /// @@ -280,9 +232,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// /// /// - // POST: api/SystemInfoes - // 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> PostWipInfo([FromBody] WipInfo WipInfo) { @@ -314,9 +263,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// 工單ID /// 狀態 /// - // PUT: api/RuleStations/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}/{statusno}")] public async Task> PutWipinfoToStatusNO(int id = 0, string statusno = null) { @@ -349,12 +295,9 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// - /// 工單資本資料 + /// 更新工單資本資料 /// /// - // PUT: api/RuleStations/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] public async Task> PutWipinfo([FromBody] WipInfo wipInfo) { diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipCheck.cs b/AMESCoreStudio.WebApi/Models/AMES/WipCheck.cs index dcda9359..59ed02cb 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WipCheck.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WipCheck.cs @@ -24,45 +24,45 @@ namespace AMESCoreStudio.WebApi.Models.AMES public string WipNo { get; set; } /// - /// + /// 生管UsesID /// [DataMember] - [Column("PM_USERID")] - public int? PMUserID { get; set; } + [Column("PMC_USERID")] + public int? PMCUserID { get; set; } /// - /// + /// 生管確認時間 /// [DataMember] - [Column("PM_CHECKDATE")] - public DateTime? PMCheckdate { get; set; } + [Column("PMC_CHECKDATE")] + public DateTime? PMCCheckdate { get; set; } /// - /// + /// 製造UserID /// [DataMember] - [Column("MA_USERID")] - public int? MaUserID { get; set; } + [Column("MF_USERID")] + public int? MFUserID { get; set; } /// - /// + /// 製造UserID /// [DataMember] - [Column("MA_CHECKDATE")] - public DateTime? MaCheckdate { get; set; } + [Column("MF_CHECKDATE")] + public DateTime? MFCheckdate { get; set; } /// - /// + /// 工程確認時間 /// [DataMember] [Column("PE_USERID")] - public int? PeUserID { get; set; } + public int? PEUserID { get; set; } /// - /// + /// 工程確認時間 /// [DataMember] [Column("PE_CHECKDATE")] - public DateTime? PeCheckdate { get; set; } + public DateTime? PECheckdate { get; set; } } }