Browse Source

1. 修正FQC檢視會更新資料問題

2. FQC009 檢驗項目可以針對勾選作匯出
PTD
Sai 2 years ago
committed by Ray
parent
commit
58ef0640e5
  1. 80
      AMESCoreStudio.Web/Controllers/PCSController.cs
  2. 2
      AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs
  3. 14
      AMESCoreStudio.Web/Views/FQC/FQC007.cshtml
  4. 30
      AMESCoreStudio.Web/Views/FQC/FQC007A.cshtml
  5. 32
      AMESCoreStudio.Web/Views/FQC/FQC009.cshtml

80
AMESCoreStudio.Web/Controllers/PCSController.cs

@ -3864,10 +3864,8 @@ namespace AMESCoreStudio.Web.Controllers
model.WipInfo = q.FirstOrDefault(); model.WipInfo = q.FirstOrDefault();
model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO);
model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO); model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO);
model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID);
model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" :
model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單";
//model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence);
} }
return View(model); return View(model);
} }
@ -3883,10 +3881,8 @@ namespace AMESCoreStudio.Web.Controllers
model.WipInfo = q.FirstOrDefault(); model.WipInfo = q.FirstOrDefault();
model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO);
model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO); model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO);
model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID);
model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" :
model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單";
//model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence);
} }
return View(model); return View(model);
} }
@ -3897,6 +3893,70 @@ namespace AMESCoreStudio.Web.Controllers
var result = await _pcsApi.DeleteWipBarcode(WipNo, StrNo, EndNo); var result = await _pcsApi.DeleteWipBarcode(WipNo, StrNo, EndNo);
return Json(new Result() { success = true, msg = "" }); return Json(new Result() { success = true, msg = "" });
} }
/// <summary>
/// KP整批Excel匯入
/// </summary>
/// <param name="Uploader"></param>
/// <returns></returns>
[HttpPost]
public async Task<JsonResult> PCS004ExcelImport(IFormFile Uploader)
{
List<WipBarcode> wipBarcodes = new List<WipBarcode>();
string Msg = string.Empty;
//通過上傳檔案流初始化Mapper
using (var workbook = new XLWorkbook(Uploader.OpenReadStream()))
{
try
{
var worksheet = workbook.Worksheet(1);
// 定義資料起始/結束 Cell
var firstCell = worksheet.FirstCellUsed();
var lastCell = worksheet.LastCellUsed();
// 使用資料起始/結束 Cell,來定義出一個資料範圍
var data = worksheet.Range(firstCell.Address, lastCell.Address);
var rowCount = data.RowCount();
var columnCount = data.ColumnCount();
for (int i = 1; i <= rowCount; i++)
{
WipBarcode wipBarcode = new WipBarcode();
for (int j = 1; j <= columnCount; j++)
{
if (data.Cell(i, j).Value != null)
{
wipBarcode.StartNO = data.Cell(i, j).Value.ToString();
wipBarcode.EndNO = data.Cell(i, j).Value.ToString();
}
}
wipBarcodes.Add(wipBarcode);
}
// 先確認資料是否有重複
if (wipBarcodes.GroupBy(g => g.StartNO).Any(a => a.Count() > 1))
{
var error = wipBarcodes.GroupBy(g => g.StartNO).Where(w => w.Count() > 1)
.Select(s => s.Key).ToList();
return Json(new
{
data = $"有條碼重複:{string.Join(",", error)}",
success = false
});
}
}
catch (Exception ex)
{
return Json(new { data = ex.Message, success = false });
}
}
if (!string.IsNullOrWhiteSpace(Msg))
return Json(new { data = Msg, success = false });
else
//将数据Json化并传到前台视图
return Json(new { data = Print, success = true });
}
#endregion #endregion
#region PCS005 工單資料查詢 #region PCS005 工單資料查詢
@ -5523,8 +5583,6 @@ namespace AMESCoreStudio.Web.Controllers
IResultModel result; IResultModel result;
model.WipBarcode.WipNO = model.WipInfo.WipNO; model.WipBarcode.WipNO = model.WipInfo.WipNO;
model.WipBarcode.CreateUserID = GetLogInUserID(); model.WipBarcode.CreateUserID = GetLogInUserID();
//model.WipBarcode.WipID = model.WipInfo.WipID;
//model.WipBarcode.UnitNO = model.WipInfo.UnitNO;
result = await _pcsApi.PostWipBarcode(JsonConvert.SerializeObject(model.WipBarcode)); result = await _pcsApi.PostWipBarcode(JsonConvert.SerializeObject(model.WipBarcode));
@ -5560,10 +5618,8 @@ namespace AMESCoreStudio.Web.Controllers
model.WipInfo = q.FirstOrDefault(); model.WipInfo = q.FirstOrDefault();
model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO);
model.WipBarcodeOther = await _pcsApi.GetWipBarcodeOther(model.WipInfo.WipNO); model.WipBarcodeOther = await _pcsApi.GetWipBarcodeOther(model.WipInfo.WipNO);
model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID);
model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" :
model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單";
//model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence);
} }
return View(model); return View(model);
} }
@ -5579,10 +5635,8 @@ namespace AMESCoreStudio.Web.Controllers
model.WipInfo = q.FirstOrDefault(); model.WipInfo = q.FirstOrDefault();
model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO);
model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO); model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO);
model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID);
model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" :
model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單";
//model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence);
} }
return View(model); return View(model);
} }
@ -5767,8 +5821,6 @@ namespace AMESCoreStudio.Web.Controllers
IResultModel result; IResultModel result;
model.WipBarcode.WipNO = model.WipInfo.WipNO; model.WipBarcode.WipNO = model.WipInfo.WipNO;
model.WipBarcode.CreateUserID = GetLogInUserID(); model.WipBarcode.CreateUserID = GetLogInUserID();
//model.WipBarcode.WipID = model.WipInfo.WipID;
//model.WipBarcode.UnitNO = model.WipInfo.UnitNO;
result = await _pcsApi.PostWipBarcode(JsonConvert.SerializeObject(model.WipBarcode)); result = await _pcsApi.PostWipBarcode(JsonConvert.SerializeObject(model.WipBarcode));
@ -5804,10 +5856,8 @@ namespace AMESCoreStudio.Web.Controllers
model.WipInfo = q.FirstOrDefault(); model.WipInfo = q.FirstOrDefault();
model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO);
model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO); model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO);
model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID);
model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" :
model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單";
//model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence);
} }
return View(model); return View(model);
} }
@ -5823,10 +5873,8 @@ namespace AMESCoreStudio.Web.Controllers
model.WipInfo = q.FirstOrDefault(); model.WipInfo = q.FirstOrDefault();
model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO);
model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO); model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO);
model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID);
model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" :
model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單";
//model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence);
} }
return View(model); return View(model);
} }

2
AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs

@ -19,8 +19,6 @@ namespace AMESCoreStudio.Web.ViewModels.PCS
public IEnumerable<WipBarcode> WipBarcodes { get; set; } public IEnumerable<WipBarcode> WipBarcodes { get; set; }
public IEnumerable<RuleStation> RuleStation { get; set; }
public IEnumerable<WipBarcodeOther> WipBarcodeOthers { get; set; } public IEnumerable<WipBarcodeOther> WipBarcodeOthers { get; set; }
// 序號綁定 Type SN:內部序號 SSN:出貨序號 // 序號綁定 Type SN:內部序號 SSN:出貨序號

14
AMESCoreStudio.Web/Views/FQC/FQC007.cshtml

@ -556,12 +556,6 @@
}); });
//通过行tool檢視,lay-event="detail" //通过行tool檢視,lay-event="detail"
function detail(obj) { function detail(obj) {
var data = $("#FQC007Form").serialize();
$.ajax({
url: "@Url.Action("FQC007AjaxJson", "FQC")",
type: "POST",
data: data,
success: function (result) {
let InhouseNo = $("#hInhouseNo").val().trim(); let InhouseNo = $("#hInhouseNo").val().trim();
let SeqID = $("#hSeqID").val().trim(); let SeqID = $("#hSeqID").val().trim();
layui.use('layer', function () { layui.use('layer', function () {
@ -580,14 +574,6 @@
} }
}); });
}); });
},
error: function (result) {
alert(`呼叫API失敗`);
}
});
//hg.open('FQC細項資料', '/FQC/FQC007V?inhouseNo=' + InhouseNo + '&seqID=' + SeqID + '&boxNo=' + obj, '1000', '500');
} }
//UserName //UserName

30
AMESCoreStudio.Web/Views/FQC/FQC007A.cshtml

@ -1,6 +1,7 @@
 @model AMESCoreStudio.WebApi.DTO.AMES.FqcDto
@model AMESCoreStudio.WebApi.DTO.AMES.FqcDto @{
@{ Layout = "~/Views/Shared/_AMESLayout.cshtml"; } Layout = "~/Views/Shared/_AMESLayout.cshtml";
}
<style> <style>
.control-label { .control-label {
@ -24,8 +25,10 @@
</script> </script>
@section Scripts { @section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); @{
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } await Html.RenderPartialAsync("_ValidationScriptsPartial");
await Html.RenderPartialAsync("_FileinputScriptsPartial");
}
<script type="text/javascript"> <script type="text/javascript">
@ -45,7 +48,7 @@
defaultToolbar: ['filter', 'print', 'exports'], defaultToolbar: ['filter', 'print', 'exports'],
cols: tableCols, cols: tableCols,
response: { msgName: 'msg' }, response: { msgName: 'msg' },
where: {itemNo:'@Model.ItemNo',wipNo:'@Model.WipNo'}, where: { itemNo: '@Model.ItemNo', wipNo: '@Model.WipNo' },
done: function (res, curr, count) { done: function (res, curr, count) {
//迴圈所有資料,找出對應關係,設定checkbox選中狀態 //迴圈所有資料,找出對應關係,設定checkbox選中狀態
for (var i = 0; i < res.data.length; i++) { for (var i = 0; i < res.data.length; i++) {
@ -72,7 +75,7 @@
hg.confirm("確定要綁定有勾選的檢驗工項嗎?", function () { hg.confirm("確定要綁定有勾選的檢驗工項嗎?", function () {
$.ajax({ $.ajax({
url: '/FQC/FQC007A', url: '/FQC/FQC007A',
data: { 'itemID': itemID, 'groupID': groupID, 'wipNo':'@Model.WipNo','itemNo':'@Model.ItemNo'}, data: { 'itemID': itemID, 'groupID': groupID, 'wipNo': '@Model.WipNo', 'itemNo': '@Model.ItemNo' },
type: 'POST', type: 'POST',
success: function (data) { success: function (data) {
if (data.success) { if (data.success) {
@ -97,6 +100,17 @@
} }
} }
}); });
// 監聽工具欄的匯出按鈕
table.on('toolbar(tableQuery)', function (obj) {
if (obj.event === 'LAYTABLE_EXPORT') {
var checkStatus = table.checkStatus(obj.config.id);
// 获取被勾选的数据行
var selectedRows = checkStatus.data;
// 导出 Excel
table.exportFile(obj.config.id, selectedRows, 'xls');
}
});
}); });
$(document).ready(function () { $(document).ready(function () {
@ -108,7 +122,7 @@
//监听表单提交事件 //监听表单提交事件
var tableCols = [[ var tableCols = [[
{ type: 'checkbox', title:'全選' }, { type: 'checkbox', title: '全選' },
{ {
field: 'groupNameCN', field: 'groupNameCN',
title: '類別中文', title: '類別中文',

32
AMESCoreStudio.Web/Views/FQC/FQC009.cshtml

@ -1,6 +1,7 @@
 @{
@{ ViewData["Title"] = "料號檢驗工項維護"; ViewData["Title"] = "料號檢驗工項維護";
Layout = "~/Views/Shared/_AMESLayout.cshtml"; } Layout = "~/Views/Shared/_AMESLayout.cshtml";
}
<style> <style>
.control-label { .control-label {
@ -43,8 +44,10 @@
@section Scripts { @section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); @{
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } await Html.RenderPartialAsync("_ValidationScriptsPartial");
await Html.RenderPartialAsync("_FileinputScriptsPartial");
}
<script type="text/javascript"> <script type="text/javascript">
//搜索 //搜索
@ -76,7 +79,7 @@
defaultToolbar: ['filter', 'print', 'exports'], defaultToolbar: ['filter', 'print', 'exports'],
cols: tableCols, cols: tableCols,
response: { msgName: 'msg' }, response: { msgName: 'msg' },
where: {itemNo:itemNo}, where: { itemNo: itemNo },
done: function (res, curr, count) { done: function (res, curr, count) {
// //
if (res.msg != '') { if (res.msg != '') {
@ -120,7 +123,7 @@
hg.confirm("確定要綁定有勾選的檢驗工項嗎?", function () { hg.confirm("確定要綁定有勾選的檢驗工項嗎?", function () {
$.ajax({ $.ajax({
url: '/FQC/FQC009', url: '/FQC/FQC009',
data: { 'itemID': itemID, 'groupID': groupID ,'itemNo': $('#itemNo').val().toUpperCase() }, data: { 'itemID': itemID, 'groupID': groupID, 'itemNo': $('#itemNo').val().toUpperCase() },
type: 'POST', type: 'POST',
success: function (data) { success: function (data) {
if (data.success) { if (data.success) {
@ -145,6 +148,17 @@
} }
}); });
// 監聽工具欄的匯出按鈕
table.on('toolbar(tableQuery)', function (obj) {
if (obj.event === 'LAYTABLE_EXPORT') {
var checkStatus = table.checkStatus(obj.config.id);
// 获取被勾选的数据行
var selectedRows = checkStatus.data;
// 导出 Excel
table.exportFile(obj.config.id, selectedRows, 'xls');
}
});
/** /**
* 复选框的点击事件 * 复选框的点击事件
* 主要操作为: * 主要操作为:
@ -213,7 +227,7 @@
// table && table.reload(data); // table && table.reload(data);
//}); //});
var tableCols = [[ var tableCols = [[
{ type: 'checkbox', title:'全選' }, { type: 'checkbox', title: '全選' },
{ {
field: 'groupNameCN', field: 'groupNameCN',
title: '類別中文', title: '類別中文',
@ -250,7 +264,7 @@
hg.confirm("確定要綁定有勾選的檢驗工項嗎?", function () { hg.confirm("確定要綁定有勾選的檢驗工項嗎?", function () {
$.ajax({ $.ajax({
url: '/FQC/FQC009C', url: '/FQC/FQC009C',
data: { 'ids': obj.checkstatus.data.map(function (x) { return x.itemID }).join(','), 'itemNo':'aaa' }, data: { 'ids': obj.checkstatus.data.map(function (x) { return x.itemID }).join(','), 'itemNo': 'aaa' },
type: 'POST', type: 'POST',
success: function (data) { success: function (data) {
if (data.success) { if (data.success) {

Loading…
Cancel
Save