diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs
index 571b0f7d..fc93499c 100644
--- a/AMESCoreStudio.Web/Controllers/PCSController.cs
+++ b/AMESCoreStudio.Web/Controllers/PCSController.cs
@@ -1507,6 +1507,20 @@ namespace AMESCoreStudio.Web.Controllers
var result = await _basApi.GetRuninTime(itemNo);
return Json(new Result() { success = true, data = result.FirstOrDefault() });
}
+
+ ///
+ /// 取It提供的工單EAN
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task GetItApiEcnByWipNo(string wipNo)
+ {
+ var result = await _pcsApi.GetItApiEcnByWipNo(wipNo);
+ var json = JsonConvert.DeserializeObject(result);
+ return Json(new Result() { success = true, data = json });
+ }
+
#endregion
/////
@@ -2579,7 +2593,7 @@ namespace AMESCoreStudio.Web.Controllers
await WipDataSelectAll(model.wipAtt.WipNO, model.wipAtt.ItemNO, model.wipInfo.UnitNO);
GetCheckboxApproveLogo(model.wipLabel != null ? model.wipLabel.ApproveLogo : null);
- GetCheckboxCompanyLogo(model.wipLabel != null ? model.wipLabel.CompanyLogo : null);
+ GetCheckboxCompanyLogo(model.wipLabel != null ? model.wipLabel.CompanyLogo : "A");
GetCheckboxPrintMode(model.wipLabel != null ? model.wipLabel.PrintMode : null);
GetCheckboxWipAttr(model.wipLabel != null ? model.wipLabel.WipAttr : null);
GetCheckboxDIP(model.wipBoard != null ? model.wipBoard.DipSide : "");
diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
index 79416ef4..bd45f75d 100644
--- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
+++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
@@ -1567,6 +1567,13 @@ namespace AMESCoreStudio.Web
#endregion
-
+ #region 取IT提供的工單ECN資料
+ ///
+ /// 取IT提供的工單ECN資料
+ ///
+ /// 工單號碼
+ [WebApiClient.Attributes.HttpGet("api/aValueAPI/GetProductDetail")]
+ ITask GetItApiEcnByWipNo(string wipNo);
+ #endregion
}
}
diff --git a/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs
index fa38b958..06d9d22f 100644
--- a/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs
+++ b/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs
@@ -22,7 +22,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS
wipInfoBlobs = new List();
wipMACs = new List();
wipBarcodeOther = new WipBarcodeOther();
-
+ wipLabel = new WipLabel();
}
///
diff --git a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml
index 82ce45ed..3c6cd489 100644
--- a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml
+++ b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml
@@ -1959,25 +1959,25 @@
// 更新ECN or ECR
function GetPLM_ECN() {
$.ajax({
- url: "@Url.Action("FQC007GetPLMECN", "FQC")",
+ url: "@Url.Action("GetItApiEcnByWipNo", "PCS")",
type: "Post",
async: true,
- data: { "ItemNo": '@Model.wipAtt.ItemNO' },
+ data: { "wipNo": '@Model.wipInfo.WipNO' },
success: function (result) {
if (result.success) {
- var result_msg = result.msg;
- if ('@Model.wipAtt.ECN' != result_msg) {
+ var result_data = result.data.eaN_NO;
+ console.log(result_data.eaN_NO);
+ if (result_data.length == 0) {
+ hg.msghide("不需要更新!");
+ }
+ else if ('@Model.wipAtt.ECN' != result_data) {
layer.confirm('比對與PLM ECN/ECR不一樣,確定更新ECN/ECR嗎?', {
btn: ['確定', '取消']
}, function () {
layer.closeAll('dialog');
- $("#wipAtt_ECN").val(result_msg);
+ $("#wipAtt_ECN").val(result_data);
})
}
- else {
- hg.msghide("不需要更新!");
- //parent.hg.msg(result.msg);
- }
}
},
error: function (result) {
diff --git a/AMESCoreStudio.WebApi/Controllers/aValue_API/aValueAPIController.cs b/AMESCoreStudio.WebApi/Controllers/aValue_API/aValueAPIController.cs
new file mode 100644
index 00000000..b6df65c8
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Controllers/aValue_API/aValueAPIController.cs
@@ -0,0 +1,78 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using AMESCoreStudio.CommonTools.Result;
+using Microsoft.Extensions.Configuration;
+using Newtonsoft.Json;
+using System.Text;
+
+namespace AMESCoreStudio.WebApi.Controllers.aValue_API
+{
+ [Route("api/[controller]")]
+ [ApiController]
+ public class aValueAPIController : ControllerBase
+ {
+ private readonly IConfiguration _config;
+
+ ///
+ /// 建構式
+ ///
+ public aValueAPIController(IConfiguration config)
+ {
+ _config = config;
+ }
+
+ ///
+ /// GetPLM ECN
+ ///
+ /// 工單號碼
+ ///
+ [HttpGet("GetProductDetail")]
+ public string GetProductDetail(string wipNo)
+ {
+ // aValueAPI Url
+ string aValueAPI_Url = _config.GetSection("aValueAPI").Value;
+
+ var client = new HttpClient();
+ //設定Header - Accept的資料型別
+ client.Timeout = TimeSpan.FromHours(1);//1小時
+ client.DefaultRequestHeaders.Accept.Clear();
+ client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+ //client.BaseAddress = new Uri($"{aValueAPI_Url}/get_Product_Detail/api/ProductDetail");//ProductDetail
+
+ // {
+ // "Key":"Avalue@Product_Detail#",
+ // "MOID":"9930001896"
+ //}
+ var myClass = new
+ {
+ Key = "Avalue@Product_Detail#",
+ MOID = wipNo
+ };
+ try
+ {
+ HttpResponseMessage response = client.PostAsync($"{aValueAPI_Url}/get_Product_Detail/api/ProductDetail",
+ new StringContent(JsonConvert.SerializeObject(myClass),
+ Encoding.UTF8, "application/json")).Result;
+
+ if (response.IsSuccessStatusCode)
+ {
+ var jsonString = response.Content.ReadAsStringAsync();
+ jsonString.Wait();
+ return jsonString.Result;
+ }
+ //可能會發生錯誤
+ return "error";
+
+ }
+ catch (Exception ex)
+ {
+ return ex.Message;
+ }
+ }
+ }
+}
diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipLabel.cs b/AMESCoreStudio.WebApi/Models/AMES/WipLabel.cs
index ec16a112..20968524 100644
--- a/AMESCoreStudio.WebApi/Models/AMES/WipLabel.cs
+++ b/AMESCoreStudio.WebApi/Models/AMES/WipLabel.cs
@@ -50,7 +50,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES
///
[Column("COMPANY_LOGO")]
[DataMember]
- public string CompanyLogo { get; set; }
+ public string CompanyLogo { get; set; } = "A";
///
/// 工單屬性
@@ -74,8 +74,8 @@ namespace AMESCoreStudio.WebApi.Models.AMES
[DataMember]
public string NonstandardWoMemo { get; set; }
-
-
+
+
///
/// 建立UserID
diff --git a/AMESCoreStudio.WebApi/Models/aValue_API/ProductDetail.cs b/AMESCoreStudio.WebApi/Models/aValue_API/ProductDetail.cs
new file mode 100644
index 00000000..2ed1d50c
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Models/aValue_API/ProductDetail.cs
@@ -0,0 +1,28 @@
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Runtime.Serialization;
+using Microsoft.EntityFrameworkCore;
+using System;
+
+#nullable disable
+
+namespace AMESCoreStudio.WebApi.Models.aValue_API
+{
+
+ public partial class ProductDetail
+ {
+ public string MRP_CONTROLLER { get; set; }
+ public string MATERIAL { get; set; }
+ public float TARGET_QUANTITY { get; set; }
+ public string EAN_NO { get; set; }
+ public string WORK_CENTER { get; set; }
+ public string MATL_GROUP { get; set; }
+ public string Z_VIP { get; set; }
+ public string FINISH_DATE { get; set; }
+ public string START_DATE { get; set; }
+ public string CHANGE_NO { get; set; }
+ public string PUR_STATUS { get; set; }
+ public string UNLOAD_PT { get; set; }
+ public string E_MAIL { get; set; }
+ public string TDLINE { get; set; }
+ }
+}