Browse Source

修正中央治據庫、工時資料等資訊

PTD
BB.Wang 2 years ago
parent
commit
fd3ea06884
  1. 291
      AMESCoreStudio.Web/Controllers/JIGController.cs
  2. 15
      AMESCoreStudio.Web/Controllers/PCSController.cs
  3. 15
      AMESCoreStudio.Web/Controllers/WHSController.cs
  4. 41
      AMESCoreStudio.Web/HttpApis/AMES/IJIG.cs
  5. 3
      AMESCoreStudio.Web/HttpApis/AMES/IWHS.cs
  6. 3
      AMESCoreStudio.Web/Views/JIG/JIG002.cshtml
  7. 10
      AMESCoreStudio.Web/Views/JIG/JIG002C.cshtml
  8. 3
      AMESCoreStudio.Web/Views/JIG/JIG003.cshtml
  9. 8
      AMESCoreStudio.Web/Views/JIG/JIG004.cshtml
  10. 12
      AMESCoreStudio.Web/Views/JIG/JIG004C.cshtml
  11. 14
      AMESCoreStudio.Web/Views/JIG/JIG004U.cshtml
  12. 11
      AMESCoreStudio.Web/Views/WHS/WHS003.cshtml
  13. 29
      AMESCoreStudio.Web/Views/WHS/WHS011C.cshtml
  14. 2
      AMESCoreStudio.Web/Views/WHS/WHS018.cshtml
  15. 8
      AMESCoreStudio.Web/Views/WHS/WHS019.cshtml
  16. 43
      AMESCoreStudio.Web/Views/WHS/WHS019C.cshtml
  17. 154
      AMESCoreStudio.WebApi/Controllers/AMES/OutfitInfoBlobController.cs
  18. 86
      AMESCoreStudio.WebApi/Controllers/AMES/WipBoxController.cs
  19. 1
      AMESCoreStudio.WebApi/Controllers/AMES/WorkGroupsController.cs
  20. 6
      AMESCoreStudio.WebApi/Models/AMES/OutfitInfo.cs
  21. 92
      AMESCoreStudio.WebApi/Models/AMES/OutfitInfoBlob.cs

291
AMESCoreStudio.Web/Controllers/JIGController.cs

@ -165,19 +165,21 @@ namespace AMESCoreStudio.Web.Controllers
}
ViewBag.UserID = user_id;
}
private async Task GetOutfitFactoryInfosList() //YIRU
//yiru 2022-09-19
private async Task GetOutfitFactoryInfosList()
{
var result = await _jigApi.GetOutfitFactoryInfos();
var GroupList = new List<SelectListItem>();
for (int i = 0; i < result.Count; i++)
{
GroupList.Add(new SelectListItem(result[i].OutfitFactoryName, result[i].OutfitFactoryID.ToString()));
GroupList.Add(new SelectListItem(result[i].OutfitFactoryName, result[i].OutfitFactoryNo.ToString()));
}
ViewBag.OutfitFactoryList = GroupList;
}
//yiru add end
#endregion
#region JIG001 設備種類維護相關
@ -337,6 +339,20 @@ namespace AMESCoreStudio.Web.Controllers
var result = await _jigApi.DeleteOutfitVarityInfo(id);
return Json(new Result() { success = true, msg = "" });
}
public async Task<IActionResult> GetOutfitInfoBlobByOutfitIDAsync(int id)
{
if (id == 0)
return Json(new Table() { count = 0, data = null });
var result = await _jigApi.GetOutfitInfoBlobByOutfitID(id);
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<IActionResult> JIG002CSaveAsync(OutfitVarityInfo model)
@ -408,85 +424,6 @@ namespace AMESCoreStudio.Web.Controllers
}
//YIRU ADD
//public async Task<IActionResult> JIG002RSaveAsync(InspectionResultBlob model, IFormFile formFile)
//{
// IResultModel result;
// var userID = "";
// HttpContext.Request.Cookies.TryGetValue("UserID", out userID);
// int user_id = 0;
// if (userID != null)
// {
// if (int.Parse(userID.ToString()) >= 0)
// {
// user_id = int.Parse(userID.ToString());
// }
// }
// model.CreateUserID = user_id;
// model.CreateDate = System.DateTime.Now;
// model.UpdateUserID = user_id;
// model.UpdateDate = System.DateTime.Now;
// string FileName = string.Empty;
// string NewName = string.Empty;
// string FilePath = string.Empty;
// if (formFile != null)
// {
// if (formFile.Length > 0)
// {
// //取得使用者上傳檔案的原始檔名
// FileName = Path.GetFileName(formFile.FileName);
// //取原始檔名中的副檔名
// var fileExt = Path.GetExtension(FileName);
// //為避免使用者上傳的檔案名稱發生重複,重新給一個亂數名稱
// NewName = Path.GetRandomFileName() + fileExt;
// //指定要寫入的路徑、檔名和副檔名
// FilePath = $"\\PCSFile\\";//本機目錄
// using (var stream = new FileStream(_env.WebRootPath + FilePath + NewName, FileMode.Create))
// {
// await formFile.CopyToAsync(stream);
// }
// //var fileProvider = _fileServerProvider.GetProvider("/aa");
// //var fileInfo = fileProvider.GetFileInfo(formFile.FileName);
// //fileInfo = fileProvider.GetFileInfo(formFile.FileName);
// ////遠端目錄
// //using (var stream = new FileStream(fileInfo.PhysicalPath, FileMode.Create))
// //{
// // await formFile.CopyToAsync(stream);
// model.ImageName = FileName;
// model.NewName = NewName;
// model.FilePath = FilePath;// fileInfo.PhysicalPath;
// result = await _spcApi.PostInspectionResultBlob(JsonConvert.SerializeObject(model));
// if (result.Success)
// {
// //var _msg = "上傳成功!";
// ViewBag.ItemID = model.InspectionItemID;
// ViewBag.MasterID = model.InspectionID;
// return View("SPC005R");
// }
// else
// {
// ModelState.AddModelError("error", result.Msg);
// }
// }
// }
// else
// {
// ModelState.AddModelError("error", "請選擇要上傳檔案");
// }
// ViewBag.ItemID = model.InspectionItemID;
// ViewBag.MasterID = model.InspectionID;
// return View("SPC005R");
//}
//YIRU ADD
[ResponseCache(Duration = 0)]
[HttpGet]
public async Task<IActionResult> GetOutfitVarityInfoesAsync()
@ -611,7 +548,7 @@ namespace AMESCoreStudio.Web.Controllers
#endregion
#region JIG004巡檢結果維護相關
#region JIG004巡檢結果維護相關 YIRU Modify 2022-09-23
public async Task<IActionResult> JIG004()
{
@ -623,7 +560,7 @@ namespace AMESCoreStudio.Web.Controllers
public async Task<IActionResult> JIG004C(int id)
{
GetUserID();
await GetFactoryList();
// await GetFactoryList();
await GetOutfitCommodityInfoesList();
await GetOutfitVarityInfoesList();
await GetOutfitVendorInfoesList();
@ -634,10 +571,11 @@ namespace AMESCoreStudio.Web.Controllers
{
GetUserID();
await GetFactoryList();
// await GetFactoryList();
await GetOutfitCommodityInfoesList();
await GetOutfitVarityInfoesList();
await GetOutfitVendorInfoesList();
await GetOutfitFactoryInfosList();
var result = await _jigApi.GetOutfitInfo(id);
if (result.Count == 0)
@ -657,7 +595,7 @@ namespace AMESCoreStudio.Web.Controllers
{
var msg = "";
GetUserID();
await GetFactoryList();
// await GetFactoryList();
await GetOutfitCommodityInfoesList();
await GetOutfitVarityInfoesList();
await GetOutfitVendorInfoesList();
@ -666,51 +604,72 @@ namespace AMESCoreStudio.Web.Controllers
{
IResultModel result;
var commodity = await _jigApi.GetOutfitCommodityInfo(model.CommodityID);
model.TypeFlag = commodity[0].TypeFlag;
//yiru add 自動產生治具編碼 (取最大號 往後累加產生)
var commodityno = commodity[0].CommodityNo.PadLeft(3,'0'); //類別代號(3碼)
//yiru 2022-09-19 add 自動產生治具編碼 (取最大號 往後累加產生) ==== BEGIN
var commodityno = commodity[0].CommodityNo.PadLeft(3, '0'); //類別代號(3碼)
var varity = await _jigApi.GetOutfitVarityInfo(model.VarietyID);
var varityno = varity[0].VarityNo.PadLeft(4,'0'); //種類代號(4碼)
var varityno = varity[0].VarityNo.PadLeft(4, '0'); //種類代號(4碼)
var outfitinfo = await _jigApi.GetOutfitInfoes();
var outfitinfo_Max = outfitinfo.Where(w => w.OutfitNo.Contains(model.FactoryCode + commodityno + varityno)).OrderBy(o => o.OutfitNo).Select(s => s.OutfitNo).LastOrDefault();
var outfitinfo_num = 0;
if (outfitinfo_Max!= null)
{
outfitinfo_num = int.Parse(outfitinfo_Max.Substring(outfitinfo_Max.Length -4,4));
}
for (int i = 0; i < model.StockQty; i++)
if (varityno.Length > 4)
{
model.OutfitNo = model.FactoryCode + commodityno + varityno + (outfitinfo_num + i +1).ToString().PadLeft(4,'0');
model.QANo = model.OutfitNo;
result = await _jigApi.PostOutfitInfo(JsonConvert.SerializeObject(model));
msg = "種類代碼超出4碼 無法產生設備編碼";
}
result = await _jigApi.PostOutfitInfo(JsonConvert.SerializeObject(model));
//yiru add ====
if (result.Success)
else if (commodityno.Length > 4)
{
var _msg = "添加成功!";
return RedirectToAction("Refresh", "Home", new { msg = _msg });
msg = "類別代號超出3碼 無法產生設備編碼";
}
else
{
msg = result.Msg;
var outfitinfo_Max = outfitinfo.Where(w => w.OutfitNo.Contains(model.OutfitFactoryNo + commodityno + varityno)).OrderBy(o => o.OutfitNo).Select(s => s.OutfitNo).LastOrDefault();
var outfitinfo_num = 0;
if (outfitinfo_Max != null)
{
outfitinfo_num = int.Parse(outfitinfo_Max.Substring(outfitinfo_Max.Length - 4, 4));
}
List<string> msglist = new List<string>();
for (int i = 0; i < model.StockQty; i++)
{
model.OutfitNo = model.OutfitFactoryNo + commodityno + varityno + (outfitinfo_num + i + 1).ToString().PadLeft(4, '0');
model.QANo = model.OutfitNo;
result = await _jigApi.PostOutfitInfo(JsonConvert.SerializeObject(model));
if (result.Success)
{
msglist.Add(model.OutfitNo + " 添加成功!");
}
else
{
msglist.Add(model.OutfitNo + " error: " + result.Msg);
}
}
//yiru 2022-09-19 add ==== END
if (msglist.Where(w => w.Contains("error")) == null)
{
var _msg = "添加成功!共" + msglist.Count + "筆設備編號";
return RedirectToAction("Refresh", "Home", new { msg = _msg });
}
else
{
ModelState.AddModelError("error", string.Join(",", msglist));
return View("JIG004C", model);
}
}
}
if (msg == "") msg = "缺少必填資料";
ModelState.AddModelError("error", msg);
ModelState.AddModelError("error", msg );
return View("JIG004C", model);
}
public async Task<IActionResult> JIG004USaveAsync(OutfitInfo model)
{
var msg = "";
GetUserID();
await GetFactoryList();
// await GetFactoryList();
await GetOutfitCommodityInfoesList();
await GetOutfitVarityInfoesList();
await GetOutfitVendorInfoesList();
@ -737,6 +696,108 @@ namespace AMESCoreStudio.Web.Controllers
return View("JIG004U", model);
}
// YIRU ADD
public async Task<IActionResult> JIG004RDAsync(int id)
{
var result = await _jigApi.DeleteOutfitInfoBlob(id);
return Json(new Result() { success = true, msg = "" });
}
public async Task<IActionResult> JIG004RSaveAsync(OutfitInfoBlob model, IFormFile formFile)
{
IResultModel result;
var userID = "";
HttpContext.Request.Cookies.TryGetValue("UserID", out userID);
int user_id = 0;
if (userID != null)
{
if (int.Parse(userID.ToString()) >= 0)
{
user_id = int.Parse(userID.ToString());
}
}
model.CreateUserID = user_id;
model.CreateDate = System.DateTime.Now;
model.UpdateUserID = user_id;
model.UpdateDate = System.DateTime.Now;
string FileName = string.Empty;
string NewName = string.Empty;
string FilePath = string.Empty;
if (formFile != null)
{
if (formFile.Length > 0)
{
//取得使用者上傳檔案的原始檔名
FileName = Path.GetFileName(formFile.FileName);
//為避免使用者上傳的檔案名稱發生重複,重新給一個名稱 設備代號-原檔名
NewName = model.OutfitID + "-" + FileName ;//Path.GetRandomFileName() + fileExt;
//指定要寫入的路徑、檔名和副檔名
FilePath = $"\\JIGFile\\";//本機目錄
using (var stream = new FileStream(_env.WebRootPath + FilePath + NewName, FileMode.Create))
{
await formFile.CopyToAsync(stream);
}
//var fileProvider = _fileServerProvider.GetProvider("/aa");
//var fileInfo = fileProvider.GetFileInfo(formFile.FileName);
//fileInfo = fileProvider.GetFileInfo(formFile.FileName);
////遠端目錄
//using (var stream = new FileStream(fileInfo.PhysicalPath, FileMode.Create))
//{
// await formFile.CopyToAsync(stream);
model.NewName = NewName;
model.ImageName = FileName;
model.FilePath = FilePath;// fileInfo.PhysicalPath;
var result1 = await _jigApi.GetOutfitInfoBlobByOutfitID(model.OutfitID);
if (result1.Count > 0)
{
result = await _jigApi.PutOutfitInfoBlob(model.OutfitID, JsonConvert.SerializeObject(model));
string ExitingFile = Path.Combine(_env.WebRootPath + FilePath, result1.Select(s => s.NewName).FirstOrDefault());
System.IO.File.Delete(ExitingFile);
}
else
result = await _jigApi.PostOutfitInfoBlob(JsonConvert.SerializeObject(model));
if (result.Success)
{
//var _msg = "上傳成功!";
ViewBag.OutfitID = model.OutfitID;
return View("JIG004R");
}
else
{
ModelState.AddModelError("error", result.Msg);
}
}
}
else
{
ModelState.AddModelError("error", "請選擇要上傳檔案");
}
ViewBag.OutfitID = model.OutfitID;
return View("JIG004R");
}
public async Task<IActionResult> JIG004RAsync(int id)
{
await GetOutfitCommodityInfoesList();
ViewBag.OutfitID = id;
// GetUserID();
return View();
}
// YIRU ADD
[ResponseCache(Duration = 0)]
[HttpGet]
public async Task<IActionResult> GetOutfitInfoesAsync()
@ -878,7 +939,7 @@ namespace AMESCoreStudio.Web.Controllers
if (result.Success)
{
//yiru add 更新outift_into sche
//yiru 2022-09-19 add 更新outift_into sche_return_day BEGIN
OutfitInfo[0].ScheReturnDay = model.StatusDate;
result = await _jigApi.PutOutfitInfo(model.OutfitID, JsonConvert.SerializeObject(OutfitInfo[0]));
if (result.Success)
@ -891,7 +952,7 @@ namespace AMESCoreStudio.Web.Controllers
{
msg = result.Msg;
}
//yiru add
//yiru 2022-09-19 END
}
else
{
@ -1053,7 +1114,7 @@ namespace AMESCoreStudio.Web.Controllers
#endregion
#region JIG010設備未歸還查詢相關 yiru
#region JIG010設備未歸還查詢相關 yiru 2022-09-19
public IActionResult JIG010()
{
return View();
@ -1099,7 +1160,7 @@ namespace AMESCoreStudio.Web.Controllers
#endregion
#region JIG014 設備基本數據查詢 yiru
#region JIG014 設備基本數據查詢 yiru 2022-09-19
public async Task<IActionResult> JIG014()
{
@ -1109,7 +1170,7 @@ namespace AMESCoreStudio.Web.Controllers
#endregion
#region JIG015設備廠區維護相關
#region JIG015設備廠區維護相關 yiru 2022-09-19
public IActionResult JIG015()
{
return View();

15
AMESCoreStudio.Web/Controllers/PCSController.cs

@ -6666,9 +6666,9 @@ namespace AMESCoreStudio.Web.Controllers
var FlowRule_result = await _basApi.GetRuleStationsByFlow(FlowStation_result.Select(s => s.FlowRuleID).First());
if (FlowRule_result.Count() != 0)
{
var LastRuleStationID = FlowRule_result.Where(w => w.StationID != 1000).OrderBy(o => o.Sequence).Select(s => s.RuleStationID).Last();
var LastStationID = FlowRule_result.Where(w => w.StationID != 1000).OrderBy(o => o.Sequence).Select(s => s.StationID).Last();
if (item.StationID != LastRuleStationID || item.RuleStatus != "P" || item.StatusID != -1)
if (item.StationID != LastStationID || item.RuleStatus != "P" || item.StatusID != -1)
{
_msg += "序號【" + item.BarcodeNo + "】,流程尚未完成,不可入庫!<br>";
}
@ -6690,8 +6690,10 @@ namespace AMESCoreStudio.Web.Controllers
var FlowRules_result = await _basApi.GetFlowRulesByUnit("W");
if (FlowRules_result.Count() != 0)
{
var ruleStations_result = await GetRuleStationByFlowRuleID(FlowRules_result.Select(s => s.FlowRuleID).First());
var RuleStationID = ruleStations_result.Select(s => s.RuleStationID).First();
var FlowRuleID = FlowRules_result.Select(s => s.FlowRuleID).First();
var ruleStations_result = await GetRuleStationByFlowRuleID(FlowRuleID);
var StationID = ruleStations_result.Select(s => s.StationID).First();
var Wipinfo_result = await _pcsApi.GetWipInfo(result.Select(s => s.WipID).First());
var Wipinfo_LineID = Wipinfo_result.Select(s => s.LineID).First(); //lineid
@ -6709,7 +6711,7 @@ namespace AMESCoreStudio.Web.Controllers
BarcodeID = item.BarcodeID,
BarcodeNo = item.BarcodeNo,
StatusNo = item.StatusNo,
StationID = RuleStationID,
StationID = StationID,
RuleStatus = "P",//F 不良
BoxNo = item.BoxNo,
WipID = item.WipID,
@ -6727,7 +6729,8 @@ namespace AMESCoreStudio.Web.Controllers
{
BarcodeID = item.BarcodeID,
WipID = item.WipID,
StationID = RuleStationID,
StationID = StationID,
FlowRuleID = FlowRuleID,
RuleStatus = "P",
InputDate = DateTime.Now,
LineId = (int)Wipinfo_LineID,

15
AMESCoreStudio.Web/Controllers/WHSController.cs

@ -289,7 +289,7 @@ namespace AMESCoreStudio.Web.Controllers
result = await _whsApi.PostWorkGroups(JsonConvert.SerializeObject(model));
if (!result.Success)
if (result.Success) //yiru modify 2022-09-27
{
var _msg = "添加成功!";
return RedirectToAction("Refresh", "Home", new { msg = _msg });
@ -311,13 +311,13 @@ namespace AMESCoreStudio.Web.Controllers
public async Task<IActionResult> WHS001USaveAsync(WorkGroup model)
{
if (ModelState.IsValid)
if (ModelState.IsValid)
{
IResultModel result;
result = await _whsApi.PutWorkGroups(model.GroupID, JsonConvert.SerializeObject(model));
if (!result.Success)
if (result.Success) //yiru modify 2022 - 09 - 27
{
var _msg = "修改成功!";
return RedirectToAction("Refresh", "Home", new { msg = _msg });
@ -391,14 +391,14 @@ namespace AMESCoreStudio.Web.Controllers
[HttpPost]
public async Task<IActionResult> WHS002CSaveAsync(WorkClass model)
{
if (ModelState.IsValid)
if (ModelState.IsValid) //yiru modify 2022-09-27
{
IResultModel result;
result = await _whsApi.PostWorkClass(JsonConvert.SerializeObject(model));
if (!result.Success)
if (result.Success) //yiru modify 2022-09-27
{
var _msg = "添加成功!";
return RedirectToAction("Refresh", "Home", new { msg = _msg });
@ -426,7 +426,7 @@ namespace AMESCoreStudio.Web.Controllers
result = await _whsApi.PutWorkClass(model.ClassID, JsonConvert.SerializeObject(model));
if (!result.Success)
if (result.Success) //yiru modify 2022-09-27
{
var _msg = "修改成功!";
return RedirectToAction("Refresh", "Home", new { msg = _msg });
@ -502,7 +502,7 @@ namespace AMESCoreStudio.Web.Controllers
[HttpPost]
public async Task<IActionResult> WHS003CSaveAsync(StandardWorkTime model)
{
if (ModelState.IsValid)
if (ModelState.IsValid) //yiru modify 2022-09-27
{
IResultModel result;
@ -2267,6 +2267,7 @@ namespace AMESCoreStudio.Web.Controllers
return View("WHS019E", model);
}
[ResponseCache(Duration = 0)]
[HttpGet]
public async Task<IActionResult> GetWorkingHoursCollectionByQuery4WHS019Async(string unitNo, string lineid, string stationid, string wipno, string itemno, string user, string sdate, string edate)

41
AMESCoreStudio.Web/HttpApis/AMES/IJIG.cs

@ -189,6 +189,47 @@ namespace AMESCoreStudio.Web
[WebApiClient.Attributes.HttpGet("api/OutfitInfoes/Query/{TypeFlag}/{CommodityID}/{VarityID}/{Status}/{QANo}/{PartNo}/{UseStatus}")]
ITask<List<OutfitInfo>> GetOutfitInfoesByQuery(int TypeFlag, int CommodityID, int VarityID, string Status, string QANo, string PartNo, string UseStatus);
//yiru 2022-09-20 add BEGIN
/// <summary>
/// 新增 檢驗結果上傳圖檔資料表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[WebApiClient.Attributes.HttpPost("api/OutfitInfoBlob")]
ITask<ResultModel<OutfitInfoBlob>> PostOutfitInfoBlob([FromBody, RawJsonContent] string model);
/// <summary>
/// 更新 檢驗結果上傳圖檔資料表
/// </summary>
/// <returns></returns>
[WebApiClient.Attributes.HttpPut("api/OutfitInfoBlob/{id}")]
ITask<ResultModel<OutfitInfoBlob>> PutOutfitInfoBlob(int id,[FromBody, RawJsonContent] string model);
/// <summary>
/// 查詢 檢驗結果上傳圖檔資料表 By OUTFITID
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[WebApiClient.Attributes.HttpGet("api/OutfitInfoBlob/ByOutfitID/{id}")]
ITask<List<OutfitInfoBlob>> GetOutfitInfoBlobByOutfitID(int id);
/// <summary>
/// 刪除圖檔資料表
/// </summary>
/// <returns></returns>
[WebApiClient.Attributes.HttpDelete("api/OutfitInfoBlob/{id}")]
ITask<ResultModel<string>> DeleteOutfitInfoBlob(int id);
//yiru 2022-09-20 add END
#endregion
#region JIG005 設備狀態紀錄維護

3
AMESCoreStudio.Web/HttpApis/AMES/IWHS.cs

@ -419,8 +419,7 @@ namespace AMESCoreStudio.Web
/// </summary>
/// <returns></returns>
[WebApiClient.Attributes.HttpDelete("api/ExceptionClasses/{id}")]
ITask<ResultModel<ExceptionClass>> DeleteExceptionClass(string id);
ITask<ResultModel<string>> DeleteExceptionClass(string id); //yiru modify
/// <summary>
/// 根據ID獲取指定異常工時類別查詢資料
/// </summary>

3
AMESCoreStudio.Web/Views/JIG/JIG002.cshtml

@ -100,6 +100,8 @@
}]
];
//通过行tool编辑,lay-event="edit"
function edit(obj) {
if (obj.data.varityID) {
@ -142,6 +144,7 @@
class: 'layui-btn-normal',
handler: function () {
hg.open('新增設備規格', '/JIG/JIG002C', 640, 320);
// hg.open('修改設備規格', '/JIG/JIG002R', 640, 320);
}
}

10
AMESCoreStudio.Web/Views/JIG/JIG002C.cshtml

@ -62,6 +62,15 @@
</select>
<span asp-validation-for="Status" class="text-danger offset-sm-3 my-sm-1"></span>
</div>*@
<div style="text-align:center">
<div class="layui-inline">
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span>
@* <input type="submit" id="asubmit" value="上傳" class="layui-btn layui-btn-normal layui-btn-xs layui-icon " /> *@
</div>
</div>
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span>
<div class="form-group">
<input type="submit" value="保存" class="btn btn-primary offset-sm-3" />
@ -82,6 +91,7 @@
parent.hg.msg(error);
}
});
</script>

3
AMESCoreStudio.Web/Views/JIG/JIG003.cshtml

@ -62,6 +62,7 @@
}
}
//通过行tool删除,lay-event="del"
function del(obj) {
if (obj.data.vendorID) {
@ -80,7 +81,7 @@
}
},
error: function () {
hg.msg("网络请求失败!");
hg.msg("网络请求失败!" );
}
});
});

8
AMESCoreStudio.Web/Views/JIG/JIG004.cshtml

@ -134,12 +134,20 @@
btn += ' <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">停用</a>';
else
btn += ' <a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="del">啟用</a>';
btn += '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="Upload">上傳</a> ';
return btn
//return '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a> <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">删除</a>'
}
}]
];
function Upload(obj) {
if (obj.data.outfitID) {
hg.open('上傳檔案', '/JIG/JIG004R/' + obj.data.outfitID, 640, 320);
}
};
//通过行tool编辑,lay-event="edit"
function edit(obj) {
if (obj.data.outfitID) {

12
AMESCoreStudio.Web/Views/JIG/JIG004C.cshtml

@ -1,7 +1,7 @@
@model AMESCoreStudio.WebApi.Models.AMES.OutfitInfo
@{ ViewData["Title"] = "SPC004C";
@{ ViewData["Title"] = "JIG004C";
Layout = "~/Views/Shared/_FormLayout.cshtml"; }
@ -24,11 +24,11 @@
<input type="hidden" asp-for="UseStatusNo" value="N" />
<div class="form-group form-inline my-sm-1">
<label asp-for="FactoryCode" class="control-label col-sm-3"></label>
<select asp-for="FactoryCode" asp-items="@ViewBag.OutfitFactoryList" class="custom-select col-sm-9">
<label asp-for="OutfitFactoryNo" class="control-label col-sm-3"></label>
<select asp-for="OutfitFactoryNo" asp-items="@ViewBag.OutfitFactoryList" class="custom-select col-sm-9">
<option value="">請選擇</option>
</select>
<span asp-validation-for="FactoryCode" class="text-danger offset-sm-3 my-sm-1"></span>
<span asp-validation-for="OutfitFactoryNo" class="text-danger offset-sm-3 my-sm-1"></span>
</div>
<div class="form-group form-inline my-sm-1">
<label asp-for="CommodityID" class="control-label col-sm-3"></label>
@ -51,7 +51,7 @@
</div>
<div class="form-group form-inline my-sm-1">
<label asp-for="QANo" class="control-label col-sm-3"></label>
<input asp-for="QANo" class="form-control col-sm-9" value="系統自動產生" /> @* yiru *@
<input asp-for="QANo" class="form-control col-sm-9" value="系統自動產生" /> @* yiru 2022-09-19 *@
<span asp-validation-for="QANo" class="text-danger offset-sm-3 my-sm-1"></span>
</div>
<div class="form-group form-inline my-sm-1">
@ -61,7 +61,7 @@
</div>
<div class="form-group form-inline my-sm-1">
<label asp-for="OutfitNo" class="control-label col-sm-3"></label>
<input asp-for="OutfitNo" class="form-control col-sm-9" value="系統自動產生" /> @* yiru *@
<input asp-for="OutfitNo" class="form-control col-sm-9" value="系統自動產生" /> @* yiru 2022-09-19 *@
<span asp-validation-for="OutfitNo" class="text-danger offset-sm-3 my-sm-1"></span>
</div>
<div class="form-group form-inline my-sm-1">

14
AMESCoreStudio.Web/Views/JIG/JIG004U.cshtml

@ -25,11 +25,11 @@
<div class="form-group form-inline my-sm-1">
<label asp-for="FactoryCode" class="control-label col-sm-3"></label>
<select asp-for="FactoryCode" asp-items="@ViewBag.Factory" class="custom-select col-sm-9">
<label asp-for="OutfitFactoryNo" class="control-label col-sm-3"></label>
<select asp-for="OutfitFactoryNo" asp-items="@ViewBag.OutfitFactoryList" class="custom-select col-sm-9">
<option value="">請選擇</option>
</select>
<span asp-validation-for="FactoryCode" class="text-danger offset-sm-3 my-sm-1"></span>
<span asp-validation-for="OutfitFactoryNo" class="text-danger offset-sm-3 my-sm-1"></span>
</div>
<div class="form-group form-inline my-sm-1">
<label asp-for="CommodityID" class="control-label col-sm-3"></label>
@ -52,7 +52,7 @@
</div>
<div class="form-group form-inline my-sm-1">
<label asp-for="QANo" class="control-label col-sm-3"></label>
<input asp-for="QANo" class="form-control col-sm-9" disabled /> @* yiru *@
<input asp-for="QANo" class="form-control col-sm-9" disabled /> @* yiru 2022-09-19 *@
<span asp-validation-for="QANo" class="text-danger offset-sm-3 my-sm-1"></span>
</div>
<div class="form-group form-inline my-sm-1">
@ -62,9 +62,9 @@
</div>
<div class="form-group form-inline my-sm-1">
<label asp-for="OutfitNo" class="control-label col-sm-3"></label>
<input asp-for="OutfitNo" class="form-control col-sm-9" disabled /> @* yiru *@
<span asp-validation-for="OutfitNo" class="text-danger offset-sm-3 my-sm-1"></span>
</div>
<input asp-for="OutfitNo" class="form-control col-sm-9" disabled /> @* yiru 2022-09-19 *@
<span asp-validation-for="OutfitNo" class="text-danger offset-sm-3 my-sm-1"></span>
</div>
<div class="form-group form-inline my-sm-1">
<label asp-for="VendorID" class="control-label col-sm-3"></label>
<select asp-for="VendorID" asp-items="@ViewBag.VendorList" class="custom-select col-sm-9">

11
AMESCoreStudio.Web/Views/WHS/WHS003.cshtml

@ -208,11 +208,16 @@
$('#btnAdd').click(function () {
var unit = $("#unitNo").val();
var lineID = $('#lineID').val();
if (lineID) {
hg.open('新增標準工時', '/WHS/WHS003C?unit=' + unit + "&lineID=" + lineID, 480, 480);
if (unit != 0) {
if (lineID != -99) {
hg.open('新增標準工時', '/WHS/WHS003C?unit=' + unit + "&lineID=" + lineID, 480, 480);
}
else {
alert("請選擇線別!!");
}
}
else {
alert("請選擇線別!!");
alert("請選擇製程單位!!");
}

29
AMESCoreStudio.Web/Views/WHS/WHS011C.cshtml

@ -28,7 +28,7 @@
</div>
<div class="form-group form-inline my-sm-1">
<label asp-for="ItemNo" class="control-label col-sm-3"></label>
<input asp-for="ItemNo" class="form-control col-sm-9" />
<input id="searchItemNo" asp-for="ItemNo" class="form-control col-sm-9" />
<span asp-validation-for="ItemNo" class="text-danger offset-sm-3 my-sm-1"></span>
</div>
<div class="form-group form-inline my-sm-1">
@ -54,14 +54,37 @@
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial");
await Html.RenderPartialAsync("_FileinputScriptsPartial"); }
<script type="text/javascript">
<script type="text/javascript">
$(document).ready(function () {
var error = '@Html.ValidationMessage("error")';
if ($(error).text() != '') {
parent.hg.msg(error);
}
});
</script>
$("#WipNo").change(function () {
var data = $("#WipNo").val();
$.ajax({
url: "/WHS/GetWipAtt",
dataType: 'json',
data: { id: data },
contentType: "application/json",
type: 'get',
success: function (result) {
if (result.data) {
//console.info(result.data);//確認itemNO/modelNO
$("#searchItemNo").val(result.data.itemNO);
}
else {
alert("查無資料,請確認工單是否正確!");
}
}
});
})
</script>
}

2
AMESCoreStudio.Web/Views/WHS/WHS018.cshtml

@ -76,7 +76,7 @@
<div class="layui-inline">
<label class="layui-form-label">工單號碼:</label>
<div class="layui-input-inline" style="width:150px">
<input id="wipNo" name="wipNo" class="layui-input" readonly="">
<input id="wipNo" name="wipNo" class="layui-input" >
</div>
</div>
</div>

8
AMESCoreStudio.Web/Views/WHS/WHS019.cshtml

@ -79,7 +79,7 @@
<div class="layui-inline">
<label class="layui-form-label">工單號碼:</label>
<div class="layui-input-inline" style="width:150px">
<input id="wipNo" name="wipNo" class="layui-input" readonly="">
<input id="wipNo" name="wipNo" class="layui-input" >
</div>
</div>
</div>
@ -323,13 +323,13 @@
//通过行tool编辑,lay-event="edit"
function edit(obj) {
if (obj.data.timeSheetID) {
hg.open('修改生產工時', '/WHS/WHS019U/' + obj.data.timeSheetID, 800,720);
hg.open('修改生產工時', '/WHS/WHS019U/' + obj.data.timeSheetID, 600, 520);
}
}
//通过行tool编辑,lay-event="finish"
function finish(obj) {
if (obj.data.timeSheetID) {
hg.open('完工', '/WHS/WHS019E/' + obj.data.timeSheetID, 800, 800);
hg.open('完工', '/WHS/WHS019E/' + obj.data.timeSheetID, 600, 520);
}
}
//通过行tool删除,lay-event="del"
@ -361,7 +361,7 @@
layuiicon: '&#xe608;',
class: 'layui-btn-normal',
handler: function () {
hg.open('開工', '/WHS/WHS019C', 800, 720);
hg.open('開工', '/WHS/WHS019C', 600, 520);
}
}

43
AMESCoreStudio.Web/Views/WHS/WHS019C.cshtml

@ -106,30 +106,30 @@
parent.hg.msg(error);
}
});
$('#searchItemNo').click(function () {
$("#WipNo").change(function () {
var data = $("#WipNo").val();
if (data) {
$.ajax({
url: "/WHS/GetWipAtt",
dataType: 'json',
data: { id: data },
contentType: "application/json",
type: 'get',
success: function (result) {
if (result.data) {
//console.info(result.data);//確認itemNO/modelNO
$("#searchItemNo").val(result.data.modelNO);
}
else {
alert("查無資料,請確認工單是否正確!");
}
$.ajax({
url: "/WHS/GetWipAtt",
dataType: 'json',
data: { id: data },
contentType: "application/json",
type: 'get',
success: function (result) {
if (result.data) {
//console.info(result.data);//確認itemNO/modelNO
$("#searchItemNo").val(result.data.itemNO);
}
});
} else {
alert("請填寫工單!");
}
else {
alert("查無資料,請確認工單是否正確!");
}
}
});
})
});
$('#countTime').click(function () {
var data = "";
var data1 = $("#StartTime").val();
@ -164,7 +164,6 @@
getStations(data);
getStations2(data);
});
function getUserInfoes(data) {
$.ajax({
url: "/SYS/GetUserInfoes",

154
AMESCoreStudio.WebApi/Controllers/AMES/OutfitInfoBlobController.cs

@ -0,0 +1,154 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using AMESCoreStudio.WebApi;
using AMESCoreStudio.WebApi.Models.AMES;
using AMESCoreStudio.CommonTools.Result;
namespace AMESCoreStudio.WebApi.Controllers.AMES
{ //YIRU 2022-09-20
/// <summary>
/// 設備上傳圖檔資料表
/// </summary>
[Route("api/[controller]")]
[ApiController]
public class OutfitInfoBlobController : ControllerBase
{
private readonly AMESContext _context;
public OutfitInfoBlobController(AMESContext context)
{
_context = context;
}
// GET: api/OutfitInfoBlob
[HttpGet]
public async Task<ActionResult<IEnumerable<OutfitInfoBlob>>> GetOutfitInfoBlobs()
{
return await _context.OutfitInfoBlobs.ToListAsync();
}
// GET: api/OutfitInfoBlob/5
[HttpGet("{id}")]
public async Task<ActionResult<OutfitInfoBlob>> GetOutfitInfoBlob(int id)
{
var OutfitInfoBlob = await _context.OutfitInfoBlobs.FindAsync(id);
if (OutfitInfoBlob == null)
{
return NotFound();
}
return OutfitInfoBlob;
}
/// <summary>
/// 設備上傳圖檔資料表 By OutfitID
/// </summary>
/// <param name="id">OutfitID</param>
/// <returns></returns>
[HttpGet("ByOutfitID/{id}")]
public async Task<ActionResult<IEnumerable<OutfitInfoBlob>>> GetOutfitInfoBlobByOutfitID(int id)
{
var OutfitInfoBlobs = await _context.OutfitInfoBlobs.Where(w => w.OutfitID == id).ToListAsync();
return OutfitInfoBlobs;
}
/// <summary>
/// 更新上傳圖檔資料
/// </summary>
/// <param name="id"></param>
/// <param name="OutfitInfoBlob"></param>
/// <returns></returns>
// PUT: api/OutfitInfoes/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}")]
public async Task<ResultModel<OutfitInfoBlob>> PutOutfitInfo(int id, [FromBody] OutfitInfoBlob OutfitInfoBlob)
{
ResultModel<OutfitInfoBlob> result = new ResultModel<OutfitInfoBlob>();
if (id != OutfitInfoBlob.OutfitID)
{
result.Success = false;
result.Msg = "序號錯誤";
return result;
}
_context.Entry(OutfitInfoBlob).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (Exception ex)
{
result.Success = false;
result.Msg = ex.Message;
return result;
}
result.Success = true;
result.Msg = "OK";
return result;
}
/// <summary>
/// 新增 設備上傳圖檔資料表
/// </summary>
/// <param name="OutfitInfoBlob"></param>
/// <returns></returns>
[HttpPost]
public async Task<ResultModel<OutfitInfoBlob>> PostOutfitInfoBlob(OutfitInfoBlob OutfitInfoBlob)
{
ResultModel<OutfitInfoBlob> result = new ResultModel<OutfitInfoBlob>();
OutfitInfoBlob.CreateDate = DateTime.Now;
OutfitInfoBlob.UpdateDate = DateTime.Now;
_context.OutfitInfoBlobs.Add(OutfitInfoBlob);
try
{
await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
}
catch (Exception ex)
{
result.Success = false;
result.Msg = ex.InnerException.Message;
}
return result;
}
/// <summary>
/// 刪除 設備上上傳圖檔資料表
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpDelete("{id}")]
public async Task<ActionResult<OutfitInfoBlob>> DeleteOutfitInfoBlob(int id)
{
var OutfitInfoBlob = await _context.OutfitInfoBlobs.FindAsync(id);
if (OutfitInfoBlob == null)
{
return NotFound();
}
_context.OutfitInfoBlobs.Remove(OutfitInfoBlob);
await _context.SaveChangesAsync();
return OutfitInfoBlob;
}
private bool OutfitInfoBlobExists(int id)
{
return _context.OutfitInfoBlobs.Any(e => e.OutfitID == id);
}
}
}

86
AMESCoreStudio.WebApi/Controllers/AMES/WipBoxController.cs

@ -130,6 +130,92 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
return wipBox;
}
//Yiru Add --------------------------------------------------------------------------------------------
/// <summary>
/// 自動裝箱
/// </summary>
/// <param name="id">BarcodeID</param>
/// <returns></returns>
[HttpPost("ByBeerAP")]
public async Task<ActionResult<ResultModel<string>>> PostWipBox(int id)
{
ResultModel<string> resultModel = new ResultModel<string> { Success = false };
#region 宣告Coltroller
BarcodeInfoesController barcodeInfoesController = new BarcodeInfoesController(_context);
WipInfosController wipInfosController = new WipInfosController(_context);
#endregion
try
{
var BarcodeInfos = await barcodeInfoesController.GetBarcodeInfoes(id);
int wipID = BarcodeInfos.Value.Select(s => s.WipID).FirstOrDefault(); //當前工單ID
var WipInfos = await wipInfosController.GetWipInfo(wipID);
var WipNo = WipInfos.Value.Select(s => s.WipNO).FirstOrDefault(); //當前工單
var BoxCnt = WipInfos.Value.Select(s => s.BoxCNT).FirstOrDefault(); //當前工單單箱入數
var wipBoxs = await GetWipBoxByWipID(wipID);
//// 當前箱號
var NowBoxNo = string.Empty;
if (wipBoxs.Value.Where(w => w.BoxStatus != 0).Count() == 0)
NowBoxNo = "BOX" + WipNo + "001";
else
NowBoxNo = wipBoxs.Value.Where(w => w.BoxStatus != 0).FirstOrDefault().BoxNo;
var query_barCode = await barcodeInfoesController.GetBarcodeInfoesByBoxNo(NowBoxNo);
var ByBox = query_barCode.Value.Count().ToString();// 本箱已裝數量
bool checkbox = false; //是否已滿箱需裝箱
int boxQty = int.Parse(ByBox) + 1;
if (boxQty == BoxCnt) //當滿箱=>自動裝箱=true
checkbox = true;
var wipBox = new WipBox
{
WipID = wipID,
BoxNo = NowBoxNo,
BoxCnt = int.Parse(ByBox) + 1,
BoxStatus = checkbox ? 0 : 1
};
var query_wipBox = await GetWipBox(NowBoxNo);
if (query_wipBox.Value.BoxNo == null)
await PostWipBox(wipBox);
else
await PutWipBox(wipBox);
//// 自動裝箱
if (checkbox)
{
string BoxNoOrder = NowBoxNo.Substring(NowBoxNo.Length - 3, 3);
BoxNoOrder = (int.Parse(BoxNoOrder) + 1).ToString().PadLeft(3, '0');
NowBoxNo = NowBoxNo.Substring(0, NowBoxNo.Length - 3) + BoxNoOrder;
wipBox.BoxNo = NowBoxNo;
wipBox.BoxStatus = 1;
wipBox.BoxCnt = 0;
await PostWipBox(wipBox);
}
}
catch (Exception ex)
{
resultModel.Success = false;
resultModel.Msg = ex.InnerException.Message;
return resultModel;
}
resultModel.Success = true;
resultModel.Msg = "裝箱完成";
return resultModel;
}
//------------------------------------------------------------------------------------------------------
private bool WipBoxExists(string id)
{
return _context.WipBoxs.Any(e => e.BoxNo == id);

1
AMESCoreStudio.WebApi/Controllers/AMES/WorkGroupsController.cs

@ -166,6 +166,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
try
{
_context.WorkGroups.Remove(workGroup); //yiru add 2022-09-27
await _context.SaveChangesAsync();
}
catch (Exception ex)

6
AMESCoreStudio.WebApi/Models/AMES/OutfitInfo.cs

@ -168,11 +168,11 @@ namespace AMESCoreStudio.WebApi.Models.AMES
/// <summary>
/// 廠別代碼
/// </summary>
[Column("FACTORY_CODE")]
[StringLength(5)]
[Column("OUTFIT_FACTORY_NO")]
[StringLength(2)]
[DataMember]
[Display(Name = "廠別")]
public string FactoryCode { get; set; } = "NA";
public string OutfitFactoryNo { get; set; } = "NA";
/// <summary>
/// 購置日期

92
AMESCoreStudio.WebApi/Models/AMES/OutfitInfoBlob.cs

@ -0,0 +1,92 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
using Microsoft.EntityFrameworkCore;
#nullable disable
namespace AMESCoreStudio.WebApi.Models.AMES
{ // YIRU 2022-90-20
/// <summary>
/// 設備圖
/// </summary>
[Table("OUTFIT_INFO_BLOB", Schema = "JHAMES")]
public partial class OutfitInfoBlob
{
/// <summary>
/// 治具ID
/// </summary>
[Column("OUTFIT_ID")]
[DataMember]
[Key]
[Required]
public int OutfitID { get; set; }
/// <summary>
/// 檔名
/// </summary>
[Column("IMAGE_NAME")]
[StringLength(50)]
[Display(Name = "檔名")]
[DataMember]
[Required(ErrorMessage = "{0},不能空白")]
public string ImageName { get; set; }
/// <summary>
/// 新檔名
/// </summary>
[Column("NEWNAME")]
[DataMember]
public string NewName { get; set; }
/// <summary>
/// 圖檔
/// </summary>
[Column("IMAGE_BLOB")]
[StringLength(50)]
[Display(Name = "圖檔")]
[DataMember]
public byte[] ImageBlob { get; set; }
/// <summary>
/// 儲存路徑
/// </summary>
[Column("FILEPATH")]
[StringLength(100)]
[Display(Name = "儲存路徑")]
[DataMember]
public string FilePath { get; set; }
/// <summary>
/// 創建者ID
/// </summary>
[Column("CREATE_USERID")]
[DataMember]
public int CreateUserID { get; set; } = 0;
/// <summary>
/// 創建日期
/// </summary>
[Column("CREATE_DATE")]
[DataMember]
public DateTime CreateDate { get; set; } = System.DateTime.Now;
/// <summary>
/// 更新者ID
/// </summary>
[Column("UPDATE_USERID")]
[DataMember]
public int UpdateUserID { get; set; } = 0;
/// <summary>
/// 更新日期
/// </summary>
[Column("UPDATE_DATE")]
[DataMember]
public DateTime UpdateDate { get; set; } = System.DateTime.Now;
}
}
Loading…
Cancel
Save