diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs
index ba0eaf64..b59ca822 100644
--- a/AMESCoreStudio.Web/Controllers/PCSController.cs
+++ b/AMESCoreStudio.Web/Controllers/PCSController.cs
@@ -39,7 +39,7 @@ namespace AMESCoreStudio.Web.Controllers
///
private async Task GetProductType()
{
-
+
var result = await _pcsApi.GetProductTypes();
var ProductTypes = new List();
@@ -685,11 +685,11 @@ namespace AMESCoreStudio.Web.Controllers
return View();
}
-
-
- public async Task PCS004SAsync(string unitno ,string wipno)
+
+
+ public async Task PCS004QueryAsync(string unitno, string wipno)
{
- var result = await _pcsApi.GetWipInfoSelectParameter(unitno,wipno);
+ var result = await _pcsApi.GetWipInfoSelectParameter(unitno, wipno);
if (result.Count > 0)
{
@@ -712,7 +712,7 @@ namespace AMESCoreStudio.Web.Controllers
if (!result.Success)
{
var _msg = "新增成功!";
- return RedirectToAction("PCS004C", "PCS", new { id = model.WipInfo.WipID , msg = _msg});
+ return RedirectToAction("PCS004C", "PCS", new { id = model.WipInfo.WipID, msg = _msg });
}
else
{
@@ -744,7 +744,7 @@ namespace AMESCoreStudio.Web.Controllers
}
#endregion
- public async Task PCS004C(string id , string msg = null)
+ public async Task PCS004C(string id, string msg = null)
{
ViewBag.Msg = msg;
await GetLineInfo();
@@ -769,6 +769,130 @@ namespace AMESCoreStudio.Web.Controllers
}
#endregion
+ #region PCS006 工單開線收線作業
+ [ResponseCache(Duration = 0)]
+ [HttpGet]
+ public async Task PCS006()
+ {
+ await GetFactoryUnit();
+ return View();
+ }
+
+ [ResponseCache(Duration = 0)]
+ [HttpGet]
+ public async Task PCS006QueryAsync()
+ {
+ var result_Info = await _pcsApi.GetWipInfoSelectParameter();
+ List result = new List();
+ bool c = true;
+ string fn = "OFF";
+ string ass = "Stop";
+ foreach (var item in result_Info)
+ {
+ if (!c)
+ {
+ fn = "ON";
+ ass = "Active";
+ }
+
+ var result_Log = await _pcsApi.GetWipLog(item.WipID);
+ result.Add(new {
+ item.WipID,
+ item.WipNO,
+ item.PlanQTY,
+ item.WipScheduleDate,
+ statusNO = result_Log.StatusNO,
+ fn,
+ ass
+ });
+ c = false;
+ }
+
+
+
+ if (result.Count > 0)
+ {
+ return Json(new Table() { code = 0, msg = "", data = result, count = result.Count });
+ }
+ return Json(new Table() { count = 0, data = null });
+ }
+
+ [HttpPost]
+ public async Task PCS006ActionStopAsync(int wipID, string statusNO)
+ {
+ IActionResult result;
+
+ WipLog wipLog = new WipLog();
+ wipLog.WipID = wipID;
+ wipLog.WipDesc = ".";
+ wipLog.StatusNO = statusNO;
+
+
+ result = await _pcsApi.PostWipLog(JsonConvert.SerializeObject(wipLog));
+
+ //if (result.)
+ //{
+ // var msg = "修改失敗!";
+ // return Json(msg);
+ //}
+ var _msg = "修改成功!";
+ return Json(_msg);
+ }
+
+ [HttpPost]
+ public async Task PCS006OffOnAsync(WipAllViewModel model)
+ {
+ IResultModel result;
+ // Checkbox轉換
+ model.WipInfo.ECNCheck = model.WipInfo.ECNCheck == "true" ? "Y" : "N";
+ model.WipInfo.ModelCheck = model.WipInfo.ModelCheck == "true" ? "Y" : "N";
+ model.WipInfo.InputFlag = model.WipInfo.InputFlag == "true" ? "Y" : "N";
+ model.WipInfo.Priority = model.WipInfo.Priority == "true" ? "Y" : "N";
+
+ if (model.WipInfo.WipID == 0)
+ {
+ result = await _pcsApi.PostWipInfo(JsonConvert.SerializeObject(model.WipInfo));
+ model.WipAtt.WipNO = model.WipInfo.WipNO;
+ result = await _pcsApi.PostWipAtt(JsonConvert.SerializeObject(model.WipAtt));
+ if (!string.IsNullOrWhiteSpace(model.WipBarcode.StartNO))
+ {
+ model.WipBarcode.WipID = model.WipInfo.WipID;
+ model.WipBarcode.WipNO = model.WipInfo.WipNO;
+ model.WipBarcode.UnitNO = model.WipInfo.UnitNO;
+ result = await _pcsApi.PostWipBarcode(JsonConvert.SerializeObject(model.WipBarcode));
+ }
+ }
+ else
+ {
+ result = await _pcsApi.PostWipInfo(JsonConvert.SerializeObject(model.WipInfo));
+ }
+
+ if (!result.Success)
+ {
+ var _msg = model.WipInfo.WipID == 0 ? "添加成功!" : "修改成功!";
+ return RedirectToAction("Refresh", "Home", new { msg = _msg });
+ }
+ else
+ {
+ if (result.Errors.Count > 0)
+ {
+ ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg);
+ }
+ else
+ {
+ ModelState.AddModelError("error", result.Msg);
+ }
+ }
+ //}
+ if (model.WipInfo.WipID == 0)
+ {
+ return View("PCS001", model);
+ }
+ return View("PCS001", model);
+ }
+
+ #endregion
+
#region PCS010 工單對應站別鎖定
public async Task PCS010()
{
diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
index a3e6a9e9..5e9db5ce 100644
--- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
+++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
@@ -128,12 +128,23 @@ namespace AMESCoreStudio.Web
ITask> GetWipBarcode(string id);
#endregion
+ #region WipLog 工單投產纪錄資料文件 PCS006
+ [WebApiClient.Attributes.HttpGet("api/WipLog")]
+ ITask> GetWipLog();
+
+ [WebApiClient.Attributes.HttpGet("api/WipLog/{id}")]
+ ITask GetWipLog(int id);
+
+ [WebApiClient.Attributes.HttpPost("api/WipLog")]
+ ITask PostWipLog([FromBody, RawJsonContent] string model);
+ #endregion
+
///
/// 新增工單鎖定資料檔
///
///
- [WebApiClient.Attributes.HttpPost("api/WipLock")]
- ITask> PostWipLock([FromBody, RawJsonContent] string model);
+ [WebApiClient.Attributes.HttpPost("api/WipLog")]
+ ITask> PostWipLock(string wip);
///
/// 工單鎖定資料檔
diff --git a/AMESCoreStudio.Web/Views/Home/Framework.cshtml b/AMESCoreStudio.Web/Views/Home/Framework.cshtml
index c4059de7..85081088 100644
--- a/AMESCoreStudio.Web/Views/Home/Framework.cshtml
+++ b/AMESCoreStudio.Web/Views/Home/Framework.cshtml
@@ -193,6 +193,9 @@
工單條碼區間設定
+
+ 工單開線收線作業
+
工單對應站別鎖定
diff --git a/AMESCoreStudio.Web/Views/PCS/PCS004.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS004.cshtml
index 9ab00f33..acef969f 100644
--- a/AMESCoreStudio.Web/Views/PCS/PCS004.cshtml
+++ b/AMESCoreStudio.Web/Views/PCS/PCS004.cshtml
@@ -129,7 +129,7 @@
}
//基本数据表格
- var table = hg.table.datatable('test', '條碼狀態維護', '/PCS/PCS004S', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']);
+ var table = hg.table.datatable('test', '條碼狀態維護', '/PCS/PCS004Query', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']);
// var table = hg.table.datatable('test', '條碼狀態維護', '/PCS/GetWipInfo', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']);
}
\ No newline at end of file
diff --git a/AMESCoreStudio.Web/Views/PCS/PCS006.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS006.cshtml
new file mode 100644
index 00000000..bd9004ed
--- /dev/null
+++ b/AMESCoreStudio.Web/Views/PCS/PCS006.cshtml
@@ -0,0 +1,161 @@
+@{
+ ViewData["Title"] = "工單條碼區間設定";
+ Layout = "~/Views/Shared/_AMESLayout.cshtml";
+}
+
+
+
+
+
+
+@section Scripts{
+
+
+
+
+
+
+}
\ No newline at end of file
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs
index fbceadb6..1bd9d4d0 100644
--- a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs
@@ -157,13 +157,5 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
return CreatedAtAction("PostWipInfo", new { id = WipInfo.WipID }, WipInfo);
}
- public class TodoSelectParameter
- {
- public string unitno { get; set; }
-
- public string wipno { get; set; }
-
- public string name1 { get; set; }
- }
}
}
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipLogController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipLogController.cs
new file mode 100644
index 00000000..ceb0b078
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipLogController.cs
@@ -0,0 +1,87 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+using AMESCoreStudio.WebApi.Models.AMES;
+
+namespace AMESCoreStudio.WebApi.Controllers.AMES
+{
+ ///
+ ///
+ ///
+ [Route("api/[controller]")]
+ [ApiController]
+ public class WipLogController : Controller
+ {
+ private readonly AMESContext _context;
+
+ ///
+ ///
+ ///
+ ///
+ public WipLogController(AMESContext context)
+ {
+ _context = context;
+ }
+
+ ///
+ /// 工單投產纪錄資料文件
+ ///
+ ///
+ [HttpGet]
+ public async Task>> GetWipLog()
+ {
+ IQueryable q = _context.WipLogs;
+ q = q.OrderBy(p => p.WipID);
+ var WipLog = await q.ToListAsync();
+ return WipLog;
+ }
+
+ ///
+ /// 工單投產纪錄資料文件 to WipID
+ ///
+ /// 工單ID
+ ///
+ // GET: api/RolePrograms/5
+ [HttpGet("{id}")]
+ public async Task> GetWipLog(int id)
+ {
+ IQueryable q = _context.WipLogs;
+
+ var WipLog = await q.Where(p => p.WipID == id).OrderBy(o => o.CreateDate).FirstOrDefaultAsync();
+
+
+ if (WipLog == null)
+ {
+ return NotFound();
+ }
+
+ return WipLog;
+ }
+
+ ///
+ /// 新增工單投產纪錄資料文件
+ ///
+ /// 工單ID
+ ///
+ [HttpPost]
+ public async Task PostWipLog([FromBody]WipLog wipLog)
+ {
+
+ _context.WipLogs.Add(wipLog);
+ try
+ {
+ await _context.SaveChangesAsync();
+ }
+ catch (Exception ex)
+ {
+
+ }
+ return Ok();
+ //return ;
+ }
+ }
+}
diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipInfo.cs b/AMESCoreStudio.WebApi/Models/AMES/WipInfo.cs
index 041ed5ea..9c00808b 100644
--- a/AMESCoreStudio.WebApi/Models/AMES/WipInfo.cs
+++ b/AMESCoreStudio.WebApi/Models/AMES/WipInfo.cs
@@ -19,7 +19,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES
[Column("WIP_ID")]
[Required(ErrorMessage = "{0},不能空白")]
[DataMember]
- public decimal WipID { get; set; }
+ public int WipID { get; set; }
///
/// 工單號碼
diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipLog.cs b/AMESCoreStudio.WebApi/Models/AMES/WipLog.cs
index 38776631..5a7e64dd 100644
--- a/AMESCoreStudio.WebApi/Models/AMES/WipLog.cs
+++ b/AMESCoreStudio.WebApi/Models/AMES/WipLog.cs
@@ -16,7 +16,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES
/// 工單ID
///
[Key]
- [Column("WIP_ID")]
+ [Column("WIP_ID", Order = 0)]
[DataMember]
public decimal WipID { get; set; }
@@ -59,7 +59,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES
/// 建立日期
///
[Key]
- [Column("CREATE_DATE")]
+ [Column("CREATE_DATE", Order = 1)]
[DataMember]
[Display(Name = "建立日期")]
public DateTime CreateDate { get; set; } = DateTime.Now;
diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs
index 1e52b899..c9cd2c5e 100644
--- a/AMESCoreStudio.WebApi/Models/AMESContext.cs
+++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs
@@ -83,6 +83,7 @@ namespace AMESCoreStudio.WebApi
modelBuilder.Entity().HasKey(c => new { c.RuleStationID, c.RuleStatus });
modelBuilder.Entity().HasKey(c => new { c.WipNO, c.StartNO, c.EndNO });
+ modelBuilder.Entity().HasKey(c => new { c.WipID, c.CreateDate});
}
///
@@ -230,6 +231,12 @@ namespace AMESCoreStudio.WebApi
///
public DbSet ErrorReasons { get; set; }
+ ///
+ /// 工單投產纪錄資料文件
+ ///
+ public DbSet WipLogs { get; set; }
+
+
}
}