Browse Source

1. 工單基本資料修正

PTD
ray 3 years ago
parent
commit
72e1525636
  1. 43
      AMESCoreStudio.Web/Controllers/PCSController.cs
  2. 7
      AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
  3. 4
      AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs
  4. 2
      AMESCoreStudio.Web/Views/PCS/PCS001.cshtml
  5. 2
      AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml
  6. 109
      AMESCoreStudio.Web/Views/PCS/PCS003.cshtml
  7. 69
      AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeController.cs
  8. 67
      AMESCoreStudio.WebApi/Controllers/AMES/WipCheckController.cs
  9. 9
      AMESCoreStudio.WebApi/Controllers/AMES/WipInfoBlobController.cs
  10. 33
      AMESCoreStudio.WebApi/Controllers/AMES/WipLabelController.cs
  11. 2
      AMESCoreStudio.WebApi/Models/AMES/WipBarcode.cs
  12. 8
      AMESCoreStudio.WebApi/Models/AMES/WipInfo.cs

43
AMESCoreStudio.Web/Controllers/PCSController.cs

@ -1504,6 +1504,7 @@ 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.wipBarcode = model.wipBarcodes.FirstOrDefault();
model.ruleStations = await _pcsApi.GetRuleStationByWipNo(model.wipInfo.WipNO); model.ruleStations = await _pcsApi.GetRuleStationByWipNo(model.wipInfo.WipNO);
var q1 = await _pcsApi.GetMaterialSopQuery(itemNo: model.wipAtt.ItemNO); var q1 = await _pcsApi.GetMaterialSopQuery(itemNo: model.wipAtt.ItemNO);
@ -1546,14 +1547,6 @@ namespace AMESCoreStudio.Web.Controllers
model.WipSops = await _pcsApi.GetWipSopByWipNo(model.wipInfo.WipNO); model.WipSops = await _pcsApi.GetWipSopByWipNo(model.wipInfo.WipNO);
model.wipInfoBlobs = await _pcsApi.GetWipInfoBlob(model.wipInfo.WipNO); model.wipInfoBlobs = await _pcsApi.GetWipInfoBlob(model.wipInfo.WipNO);
// 抓料號流程備註
var q2 = await _pcsApi.GetMaterialFlowsByQuery(model.wipAtt.ItemNO, model.wipInfo.UnitNO);
if (q2.Where(w => w.FlowRuleID == model.wipInfo.FlowRuleID).FirstOrDefault() != null)
{
model.MaterialFlowRemark = q2.Where(w => w.FlowRuleID == model.wipInfo.FlowRuleID).FirstOrDefault().MaterialFlowRemark;
}
} }
await GetItemsList(); await GetItemsList();
await GetProductType(); await GetProductType();
@ -1602,6 +1595,7 @@ 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.wipBarcode = model.wipBarcodes.FirstOrDefault();
model.ruleStations = await _pcsApi.GetRuleStationByWipNo(model.wipInfo.WipNO); model.ruleStations = await _pcsApi.GetRuleStationByWipNo(model.wipInfo.WipNO);
//var q1 = await _pcsApi.GetMaterialSopQuery(itemNo: model.wipAtt.ItemNO); //var q1 = await _pcsApi.GetMaterialSopQuery(itemNo: model.wipAtt.ItemNO);
@ -1641,14 +1635,6 @@ namespace AMESCoreStudio.Web.Controllers
model.WipSops = await _pcsApi.GetWipSopByWipNo(model.wipInfo.WipNO); model.WipSops = await _pcsApi.GetWipSopByWipNo(model.wipInfo.WipNO);
model.wipInfoBlobs = await _pcsApi.GetWipInfoBlob(model.wipInfo.WipNO); model.wipInfoBlobs = await _pcsApi.GetWipInfoBlob(model.wipInfo.WipNO);
// 抓料號流程備註
var q1 = await _pcsApi.GetMaterialFlowsByQuery(model.wipAtt.ItemNO, model.wipInfo.UnitNO);
if (q1.Where(w => w.FlowRuleID == model.wipInfo.FlowRuleID).FirstOrDefault() != null)
{
model.MaterialFlowRemark = q1.Where(w => w.FlowRuleID == model.wipInfo.FlowRuleID).FirstOrDefault().MaterialFlowRemark;
}
} }
await GetItemsList(); await GetItemsList();
await GetProductType(); await GetProductType();
@ -1814,22 +1800,15 @@ namespace AMESCoreStudio.Web.Controllers
// await _pcsApi.PostWipSop(JsonConvert.SerializeObject(model.wipSop)); // await _pcsApi.PostWipSop(JsonConvert.SerializeObject(model.wipSop));
//} //}
//// 內部條碼 // 內部條碼
//if (!string.IsNullOrWhiteSpace(model.wipBarcode.StartNO) && !string.IsNullOrWhiteSpace(model.wipBarcode.EndNO)) if (!string.IsNullOrWhiteSpace(model.wipBarcode.Remarks))
//{ {
// model.wipBarcode.WipID = wipID; model.wipBarcode.WipID = model.wipInfo.WipID;
// model.wipBarcode.WipNO = model.wipInfo.WipNO; model.wipBarcode.WipNO = model.wipInfo.WipNO;
// model.wipBarcode.UnitNO = model.wipInfo.UnitNO; model.wipBarcode.UnitNO = model.wipInfo.UnitNO;
// result = await _pcsApi.PostWipBarcode(JsonConvert.SerializeObject(model.wipBarcode)); result = await _pcsApi.PutWipBarcode(JsonConvert.SerializeObject(model.wipBarcode));
// // 工單條碼規則設定文件檔 }
// WipRule wipRule = new WipRule();
// wipRule.WipNO = model.wipInfo.WipNO;
// wipRule.KeyNo = "00";
// wipRule.BarcodeLen = 14;
// wipRule.BarcodeFormat = model.wipInfo.UnitNO;
// result = await _pcsApi.PostWipRule(JsonConvert.SerializeObject(wipRule));
//}
// 出貨序號 // 出貨序號
if (!string.IsNullOrWhiteSpace(model.wipBarcodeOther.StartNO) && !string.IsNullOrWhiteSpace(model.wipBarcodeOther.EndNO)) if (!string.IsNullOrWhiteSpace(model.wipBarcodeOther.StartNO) && !string.IsNullOrWhiteSpace(model.wipBarcodeOther.EndNO))

7
AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs

@ -231,6 +231,13 @@ namespace AMESCoreStudio.Web
[WebApiClient.Attributes.HttpPost("api/WipBarcode")] [WebApiClient.Attributes.HttpPost("api/WipBarcode")]
ITask<ResultModel<WipBarcode>> PostWipBarcode([FromBody, RawJsonContent] string model); ITask<ResultModel<WipBarcode>> PostWipBarcode([FromBody, RawJsonContent] string model);
/// <summary>
/// 更新工單條碼起迄資料檔
/// </summary>
/// <returns></returns>
[WebApiClient.Attributes.HttpPut("api/WipBarcode")]
ITask<ResultModel<WipBarcode>> PutWipBarcode([FromBody, RawJsonContent] string model);
/// <summary> /// <summary>
/// 查詢工單條碼資料-WipNo /// 查詢工單條碼資料-WipNo
/// </summary> /// </summary>

4
AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs

@ -86,10 +86,6 @@ namespace AMESCoreStudio.Web.ViewModels.PCS
/// </summary> /// </summary>
public WipInfoBlob wipInfoBlob { get; set; } public WipInfoBlob wipInfoBlob { get; set; }
/// <summary>
/// 流程作業備註
/// </summary>
public string MaterialFlowRemark { get; set; }
} }
public class WipDataViewModel : WipNoDetailViewModel public class WipDataViewModel : WipNoDetailViewModel

2
AMESCoreStudio.Web/Views/PCS/PCS001.cshtml

@ -990,7 +990,7 @@
}); });
$('#GetBarCode').click(function () { $('#GetBarCode').click(function () {
var wipNO = $('#wipInfo_WipNO').val(); var wipNO = $('#wipInfo_WipNO').val().toUpperCase();
var planQTY = $('#wipInfo_PlanQTY').val(); var planQTY = $('#wipInfo_PlanQTY').val();
if (wipNO == '' || !wipNO) { if (wipNO == '' || !wipNO) {
parent.hg.msg("請輸入工單號碼"); parent.hg.msg("請輸入工單號碼");

2
AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml

@ -365,7 +365,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">作業流程註解</label> <label class="layui-form-label">作業流程註解</label>
<div class="layui-input-block"> <div class="layui-input-block">
<textarea placeholder="請輸入作業流程註解" asp-for="MaterialFlowRemark" class="layui-textarea"></textarea> <textarea placeholder="請輸入作業流程註解" asp-for="wipInfo.FlowRemark" class="layui-textarea"></textarea>
</div> </div>
</div> </div>
<table id="rulestionOld" class="layui-table"> <table id="rulestionOld" class="layui-table">

109
AMESCoreStudio.Web/Views/PCS/PCS003.cshtml

@ -232,7 +232,7 @@
@* 序號編碼sheet *@ @* 序號編碼sheet *@
<div class="layui-tab-item"> <div class="layui-tab-item">
@*<label class="layui-form-label">生產序號</label> <label class="layui-form-label">生產序號</label>
<table id="MydataTable" class="layui-table"> <table id="MydataTable" class="layui-table">
<thead> <thead>
<tr> <tr>
@ -258,8 +258,8 @@
</tr> </tr>
} }
</tbody> </tbody>
</table>*@ </table>
<div class="layui-form-item"> @*<div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">生產序號</label> <label class="layui-form-label">生產序號</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
@ -273,7 +273,7 @@
<input id="GetBarCode" class="layui-btn layui-btn-primary layui-border-blue layui-btn-sm" type="button" value="產生條碼" /> <input id="GetBarCode" class="layui-btn layui-btn-primary layui-border-blue layui-btn-sm" type="button" value="產生條碼" />
</div> </div>
</div> </div>
</div> </div>*@
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
@ -395,7 +395,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">作業流程註解</label> <label class="layui-form-label">作業流程註解</label>
<div class="layui-input-block"> <div class="layui-input-block">
<textarea placeholder="請輸入作業流程註解" asp-for="MaterialFlowRemark" class="layui-textarea"></textarea> <textarea placeholder="請輸入作業流程註解" asp-for="wipInfo.FlowRemark" class="layui-textarea"></textarea>
</div> </div>
</div> </div>
<table class="layui-hide" id="ruleStation" lay-filter="ruleStation"></table> <table class="layui-hide" id="ruleStation" lay-filter="ruleStation"></table>
@ -1095,19 +1095,71 @@
} }
if ($("#unitNo").val() == "B" || $("#unitNo").val() == "P" || $("#unitNo").val() == "T") { if ($("#unitNo").val() == "B" || $("#unitNo").val() == "P" || $("#unitNo").val() == "T") {
$("#system").show(); $("#system").show();
$("#board").hide(); $("#board").hide();
} }
else { else {
$("#system").hide(); $("#system").hide();
$("#board").show(); $("#board").show();
} }
if ($('#wipMAC_StartNO').val() != "" && $('#wipMAC_EndNO').val() != "") { if ($('#wipMAC_StartNO').val() != "" && $('#wipMAC_EndNO').val() != "") {
$("#GetMAC").hide(); $("#GetMAC").hide();
} }
getLineInfoList($("#unitNo").val()); getLineInfoList($("#unitNo").val());
// 產生條碼
$('#GetBarCode').click(function () {
var wipNO = $('#wipInfo_WipNO').val().toUpperCase();
var planQTY = $('#wipInfo_PlanQTY').val();
if (wipNO == '' || !wipNO) {
parent.hg.msg("請輸入工單號碼");
return;
}
if (planQTY == '' || !planQTY || planQTY == 0) {
parent.hg.msg("請確認計畫數量");
return;
}
$("#wipBarcode_StartNO").val(wipNO + PrefixInteger(1, 4));
$("#wipBarcode_EndNO").val(wipNO + PrefixInteger(planQTY, 4));
});
// 產生MAC
$("#GetMAC").click(function (event) {
var wipNO = $('#wipAtt_ItemNO').val();
var planQTY = $('#wipInfo_PlanQTY').val();
if (wipNO == '' || !wipNO) {
parent.hg.msg("請輸入料號");
return;
}
if (planQTY == '' || !planQTY || planQTY == 0) {
parent.hg.msg("請確認計畫數量");
return;
}
$.ajax({
url: '@Url.Action("GetMAC", "PCS")',
dataType: 'json',
data: { "itemno": $("#wipAtt_ItemNO").val(), "planQTY": $('#wipInfo_PlanQTY').val() },
cache: false,
type: "POST",
success: function (data, textStatus, jqXHR) {
if (data._msg != undefined) {
parent.hg.msg(data._msg);
}
$("#wipMAC_StartNO").val(data.mix);
$("#wipMAC_EndNO").val(data.max);
},
error: function (jqXHR, textStatus, errorThrown) {
alert("Found error when using Ajax!!");
}
});
});
function PrefixInteger(num, length) {
return (Array(length).join('0') + num).slice(-length);
};
}); });
layui.config({ layui.config({
@ -1253,7 +1305,7 @@
type: 'post', type: 'post',
success: function (result) success: function (result)
{ {
$("#MaterialFlowRemark").val(result.data); $("#wipInfo_FlowRemark").val(result.data);
}, },
error: function (result) error: function (result)
{ {
@ -1461,36 +1513,7 @@
return a; return a;
} }
// 產生MAC
$("#GetMAC").click(function (event) {
var wipNO = $('#wipAtt_ItemNO').val();
var planQTY = $('#wipInfo_PlanQTY').val();
if (wipNO == '' || !wipNO) {
parent.hg.msg("請輸入料號");
return;
}
if (planQTY == '' || !planQTY || planQTY == 0) {
parent.hg.msg("請確認計畫數量");
return;
}
$.ajax({
url: '@Url.Action("GetMAC", "PCS")',
dataType:'json',
data: { "itemno": $("#wipAtt_ItemNO").val(), "planQTY": $('#wipInfo_PlanQTY').val()},
cache: false,
type: "POST",
success: function (data, textStatus, jqXHR) {
if (data._msg != undefined) {
parent.hg.msg(data._msg);
}
$("#wipMAC_StartNO").val(data.mix);
$("#wipMAC_EndNO").val(data.max);
},
error: function (jqXHR, textStatus, errorThrown) {
alert("Found error when using Ajax!!");
}
});
});
</script> </script>

69
AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeController.cs

@ -6,6 +6,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using AMESCoreStudio.WebApi.Models.AMES; using AMESCoreStudio.WebApi.Models.AMES;
using AMESCoreStudio.CommonTools.Result;
namespace AMESCoreStudio.WebApi.Controllers.AMES namespace AMESCoreStudio.WebApi.Controllers.AMES
{ {
/// <summary> /// <summary>
@ -90,18 +91,72 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
// To protect from overposting attacks, enable the specific properties you want to bind to, for // 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. // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
[HttpPost] [HttpPost]
public async Task<ActionResult<WipBarcode>> PostWipBarcode([FromBody] WipBarcode wipBarcode) public async Task<ResultModel<WipBarcode>> PostWipBarcode([FromBody] WipBarcode wipBarcode)
{ {
Helper helper = new Helper(_context); ResultModel<WipBarcode> result = new ResultModel<WipBarcode>();
wipBarcode.WipID = wipBarcode.WipID == 0 ? helper.GetIDKeyNoPost("WIP_ID").Result : wipBarcode.WipID; try
wipBarcode.CreateUserID = 0; {
Helper helper = new Helper(_context);
wipBarcode.WipID = wipBarcode.WipID == 0 ? helper.GetIDKeyNoPost("WIP_ID").Result : wipBarcode.WipID;
wipBarcode.CreateUserID = 0;
_context.WipBarcodes.Add(wipBarcode); _context.WipBarcodes.Add(wipBarcode);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException ex)
{
result.Success = false;
result.Msg = ex.InnerException.Message;
}
return CreatedAtAction("PostWipBarcode", new { id = wipBarcode.WipID }, wipBarcode);
return result;
} }
/// <summary>
/// 更新工單資料-條碼Barcode
/// </summary>
/// <param name="wipBarcode"></param>
/// <returns></returns>
[HttpPut]
public async Task<ResultModel<WipBarcode>> PutWipBarcode([FromBody] WipBarcode wipBarcode)
{
ResultModel<WipBarcode> result = new ResultModel<WipBarcode>();
var wipNo = wipBarcode.WipNO;
try
{
var result_old = _context.WipBarcodes.Where(w => w.WipNO == wipNo).ToList();
if (result_old.Count != 0)
{
foreach (var item in result_old)
{
_context.Entry(item).State = EntityState.Modified;
_context.Entry<WipBarcode>(item).Property("CreateDate").IsModified = false;
_context.Entry<WipBarcode>(item).Property("CreateUserID").IsModified = false;
item.UpdateDate = DateTime.Now;
item.Remarks = wipBarcode.Remarks;
}
}
else
{
_context.WipBarcodes.Add(wipBarcode);
}
await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
}
catch (Exception ex)
{
result.Success = false;
result.Msg = ex.InnerException.Message;
}
return result;
}
/// <summary> /// <summary>
/// 刪除工單條碼區間 /// 刪除工單條碼區間
/// </summary> /// </summary>

67
AMESCoreStudio.WebApi/Controllers/AMES/WipCheckController.cs

@ -54,18 +54,24 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
public async Task<ResultModel<WipCheck>> PutWipCheckByPE(WipCheck wipCheck) public async Task<ResultModel<WipCheck>> PutWipCheckByPE(WipCheck wipCheck)
{ {
ResultModel<WipCheck> result = new ResultModel<WipCheck>(); ResultModel<WipCheck> result = new ResultModel<WipCheck>();
_context.Entry(wipCheck).State = EntityState.Modified;
//設置容器空間某一個模型的某一個欄位 不提交到資料庫
//DbContent.Entry是要更新到資料庫的整個對象
_context.Entry<WipCheck>(wipCheck).Property("MFUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("MFCheckdate").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PMCUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PMCCheckdate").IsModified = false;
wipCheck.PEUserID = 0; wipCheck.PEUserID = 0;
wipCheck.PECheckdate = DateTime.Now; wipCheck.PECheckdate = DateTime.Now;
var wipNo = wipCheck.WipNo;
try try
{ {
if (_context.WipChecks.Any(e => e.WipNo == wipNo))
{
_context.Entry(wipCheck).State = EntityState.Modified;
_context.Entry<WipCheck>(wipCheck).Property("MFUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("MFCheckdate").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PMCUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PMCCheckdate").IsModified = false;
}
else
{
_context.WipChecks.Add(wipCheck);
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true; result.Success = true;
result.Msg = "OK"; result.Msg = "OK";
@ -88,18 +94,25 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
public async Task<ResultModel<WipCheck>> PutWipCheckByMF(WipCheck wipCheck) public async Task<ResultModel<WipCheck>> PutWipCheckByMF(WipCheck wipCheck)
{ {
ResultModel<WipCheck> result = new ResultModel<WipCheck>(); ResultModel<WipCheck> result = new ResultModel<WipCheck>();
_context.Entry(wipCheck).State = EntityState.Modified; var wipNo = wipCheck.WipNo;
//設置容器空間某一個模型的某一個欄位 不提交到資料庫
//DbContent.Entry是要更新到資料庫的整個對象
_context.Entry<WipCheck>(wipCheck).Property("PEUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PECheckdate").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PMCUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PMCCheckdate").IsModified = false;
wipCheck.MFUserID = 0; wipCheck.MFUserID = 0;
wipCheck.MFCheckdate = DateTime.Now; wipCheck.MFCheckdate = DateTime.Now;
try try
{ {
if (_context.WipChecks.Any(e => e.WipNo == wipNo))
{
_context.Entry(wipCheck).State = EntityState.Modified;
_context.Entry<WipCheck>(wipCheck).Property("PEUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PECheckdate").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PMCUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PMCCheckdate").IsModified = false;
}
else
{
_context.WipChecks.Add(wipCheck);
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true; result.Success = true;
result.Msg = "OK"; result.Msg = "OK";
@ -122,18 +135,24 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
public async Task<ResultModel<WipCheck>> PutWipCheckByPMC(WipCheck wipCheck) public async Task<ResultModel<WipCheck>> PutWipCheckByPMC(WipCheck wipCheck)
{ {
ResultModel<WipCheck> result = new ResultModel<WipCheck>(); ResultModel<WipCheck> result = new ResultModel<WipCheck>();
_context.Entry(wipCheck).State = EntityState.Modified;
//設置容器空間某一個模型的某一個欄位 不提交到資料庫
//DbContent.Entry是要更新到資料庫的整個對象
_context.Entry<WipCheck>(wipCheck).Property("PEUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PECheckdate").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("MFUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("MFCheckdate").IsModified = false;
wipCheck.PMCUserID = 0; wipCheck.PMCUserID = 0;
wipCheck.PMCCheckdate = DateTime.Now; wipCheck.PMCCheckdate = DateTime.Now;
var wipNo = wipCheck.WipNo;
try try
{ {
if (_context.WipChecks.Any(e => e.WipNo == wipNo))
{
_context.Entry(wipCheck).State = EntityState.Modified;
_context.Entry<WipCheck>(wipCheck).Property("PEUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("PECheckdate").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("MFUserID").IsModified = false;
_context.Entry<WipCheck>(wipCheck).Property("MFCheckdate").IsModified = false;
}
else
{
_context.WipChecks.Add(wipCheck);
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true; result.Success = true;
result.Msg = "OK"; result.Msg = "OK";

9
AMESCoreStudio.WebApi/Controllers/AMES/WipInfoBlobController.cs

@ -97,7 +97,14 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
ResultModel<WipInfoBlob> result = new ResultModel<WipInfoBlob>(); ResultModel<WipInfoBlob> result = new ResultModel<WipInfoBlob>();
Helper helper = new Helper(_context); Helper helper = new Helper(_context);
wipInfoBlob.WipBlobID= helper.GetIDKey("WIP_BLOB_ID").Result; wipInfoBlob.WipBlobID= helper.GetIDKey("WIP_BLOB_ID").Result;
HttpContext.Request.Cookies.TryGetValue("UserID", out string userID);
if (userID != null)
{
if (int.Parse(userID.ToString()) >= 0)
{
wipInfoBlob.CreateUserID = int.Parse(userID.ToString());
}
}
try try
{ {
_context.WipInfoBlobs.Add(wipInfoBlob); _context.WipInfoBlobs.Add(wipInfoBlob);

33
AMESCoreStudio.WebApi/Controllers/AMES/WipLabelController.cs

@ -143,27 +143,22 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
public async Task<ResultModel<WipLabel>> PutWipLabel(WipLabel wipLabel) public async Task<ResultModel<WipLabel>> PutWipLabel(WipLabel wipLabel)
{ {
ResultModel<WipLabel> result = new ResultModel<WipLabel>(); ResultModel<WipLabel> result = new ResultModel<WipLabel>();
var wipNo = wipLabel.WipNO;
var getwipLabel = GetWipLabel(wipLabel.WipNO).Result.Value;
if (getwipLabel != null)
{
_context.Entry(getwipLabel).State = EntityState.Modified;
getwipLabel.ApproveLogo = wipLabel.ApproveLogo;
getwipLabel.CompanyLogo = wipLabel.CompanyLogo;
getwipLabel.PrintMode = wipLabel.PrintMode;
getwipLabel.PrintPage = wipLabel.PrintPage;
getwipLabel.WipAttr = wipLabel.WipAttr;
getwipLabel.UpdateDate = DateTime.Now;
getwipLabel.UpdateUserID = 0;
}
else
{
_context.WipLabels.Add(wipLabel);
}
try try
{ {
if (_context.WipLabels.Any(e => e.WipNO == wipNo))
{
_context.Entry(wipLabel).State = EntityState.Modified;
_context.Entry<WipLabel>(wipLabel).Property("CreateDate").IsModified = false;
_context.Entry<WipLabel>(wipLabel).Property("CreateUserID").IsModified = false;
wipLabel.UpdateDate = DateTime.Now;
wipLabel.UpdateUserID = 0;
}
else
{
_context.WipLabels.Add(wipLabel);
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true; result.Success = true;
result.Msg = "OK"; result.Msg = "OK";

2
AMESCoreStudio.WebApi/Models/AMES/WipBarcode.cs

@ -48,7 +48,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES
[Column("WIP_ID")] [Column("WIP_ID")]
[DataMember] [DataMember]
[Display(Name = "工單ID")] [Display(Name = "工單ID")]
public decimal? WipID { get; set; } = -1; public int? WipID { get; set; } = -1;
/// <summary> /// <summary>
/// 生產單位 /// 生產單位

8
AMESCoreStudio.WebApi/Models/AMES/WipInfo.cs

@ -331,6 +331,14 @@ namespace AMESCoreStudio.WebApi.Models.AMES
[Display(Name = "客戶料號")] [Display(Name = "客戶料號")]
public string CustomerItemNO { get; set; } public string CustomerItemNO { get; set; }
/// <summary>
/// 作業流程備註
/// </summary>
[Column("FLOW_REMARK")]
[DataMember]
[Display(Name = "作業流程備註")]
public string FlowRemark { get; set; }
/// <summary> /// <summary>
/// 生產單位 /// 生產單位
/// </summary> /// </summary>

Loading…
Cancel
Save