Browse Source

1.前判維修輸入,增加輸入零件位置帶出零件料號

2.後判維修輸入,增加輸入零件位置帶出零件料號
PTD
Marvin 2 years ago
parent
commit
b05c57a8ae
  1. 19
      AMESCoreStudio.Web/Controllers/REPController.cs
  2. 7
      AMESCoreStudio.Web/HttpApis/AMES/IPPS.cs
  3. 35
      AMESCoreStudio.Web/Views/REP/REP001R.cshtml
  4. 68
      AMESCoreStudio.Web/Views/REP/REP002R.cshtml
  5. 173
      AMESCoreStudio.WebApi/Controllers/AMES/PlmBomsController.cs
  6. 24
      AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs
  7. 138
      AMESCoreStudio.WebApi/Models/AMES/PlmBom.cs
  8. 5
      AMESCoreStudio.WebApi/Models/AMESContext.cs

19
AMESCoreStudio.Web/Controllers/REPController.cs

@ -194,6 +194,25 @@ namespace AMESCoreStudio.Web.Controllers
return Json(new { data = item }); return Json(new { data = item });
} }
[HttpPost]
public async Task<JsonResult> GetMaterialNoJson(string wip_no,string location_no)
{
var wip_att = await _pcsApi.GetWipAtt(wip_no);
//E9695A4S001R
var result = await _ppsApi.GetPlmBom4REP001(wip_att.ItemNO, location_no);
//var result = await _ppsApi.GetPlmBom4REP001("E9695A4S001R", location_no);
var item = new List<SelectListItem>();
for (int i = 0; i < result.Count; i++)
{
item.Add(new SelectListItem(result[i].MatnrNew, result[i].MatnrNew.ToString()));
}
//将数据Json化并传到前台视图
return Json(new { data = item });
}
[HttpPost] [HttpPost]
public async Task<JsonResult> GetMaterialDescJson(string part_no) public async Task<JsonResult> GetMaterialDescJson(string part_no)
{ {

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

@ -659,5 +659,12 @@ namespace AMESCoreStudio.Web
/// <returns></returns> /// <returns></returns>
[WebApiClient.Attributes.HttpGet("/api/PlmMeterialInfoe/{id}")] [WebApiClient.Attributes.HttpGet("/api/PlmMeterialInfoe/{id}")]
ITask<List<PlmMeterialInfo>> GetPlmMeterialInfo(string id); ITask<List<PlmMeterialInfo>> GetPlmMeterialInfo(string id);
/// <summary>
/// 根據PLM料號獲取指定資料
/// </summary>
/// <returns></returns>
[WebApiClient.Attributes.HttpGet("/api/PlmBoms/GetPlmBom4REP001")]
ITask<List<PlmBom>> GetPlmBom4REP001(string itemNo,string locationNo);
} }
} }

35
AMESCoreStudio.Web/Views/REP/REP001R.cshtml

@ -148,7 +148,7 @@
</div> </div>
<label asp-for="ngInfo.Wip.WipNO" class="layui-form-label"></label> <label asp-for="ngInfo.Wip.WipNO" class="layui-form-label"></label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input asp-for="ngInfo.Wip.WipNO" class="layui-input" autocomplete="off" /> <input id="txtWipNo" asp-for="ngInfo.Wip.WipNO" class="layui-input" autocomplete="off" />
<span asp-validation-for="ngInfo.Wip.WipNO" class="layui-bg-red"></span> <span asp-validation-for="ngInfo.Wip.WipNO" class="layui-bg-red"></span>
</div> </div>
<label asp-for="ngInfo.Station.TestType" class="layui-form-label"></label> <label asp-for="ngInfo.Station.TestType" class="layui-form-label"></label>
@ -262,7 +262,7 @@
</div> </div>
<label asp-for="ngComponent.LocationNo" class="layui-form-label"></label> <label asp-for="ngComponent.LocationNo" class="layui-form-label"></label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input asp-for="ngComponent.LocationNo" class="layui-input" autocomplete="off" /> <input id="txtLocationNo" asp-for="ngComponent.LocationNo" class="layui-input" autocomplete="off" />
<span asp-validation-for="ngComponent.LocationNo" class="layui-bg-red"></span> <span asp-validation-for="ngComponent.LocationNo" class="layui-bg-red"></span>
</div> </div>
<label asp-for="ngRepair.PartNo" class="layui-form-label"></label> <label asp-for="ngRepair.PartNo" class="layui-form-label"></label>
@ -432,6 +432,28 @@
}); });
}; };
function getMaterialNo(data)
{
$.ajax(
{
url: "@Url.Action("GetMaterialNoJson", "REP")",
dataType: 'json',
data: { "wip_no": $('#txtWipNo').val(),"location_no": data},
type: 'post',
success: function (result)
{
console.info(result.data);
$.each(result.data, function (index, item) {
$("#txtPartNo").val(item.text);
});
},
error: function (result)
{
alert(result);
}
});
};
function getMaterialDesc(data) function getMaterialDesc(data)
{ {
$.ajax( $.ajax(
@ -495,6 +517,15 @@
}); });
$('#txtLocationNo').on('keypress', function (event) {
if (event.keyCode == 13) {
getMaterialNo($('#txtLocationNo').val());
getMaterialDesc($('#txtPartNo').val());
}
});
$('#txtPartNo').on('keypress', function (event) { $('#txtPartNo').on('keypress', function (event) {
if (event.keyCode == 13) { if (event.keyCode == 13) {

68
AMESCoreStudio.Web/Views/REP/REP002R.cshtml

@ -146,7 +146,7 @@
</div> </div>
<label asp-for="ngInfo.Wip.WipNO" class="layui-form-label"></label> <label asp-for="ngInfo.Wip.WipNO" class="layui-form-label"></label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input asp-for="ngInfo.Wip.WipNO" class="layui-input" autocomplete="off" /> <input id="txtWipNo" asp-for="ngInfo.Wip.WipNO" class="layui-input" autocomplete="off" />
<span asp-validation-for="ngInfo.Wip.WipNO" class="layui-bg-red"></span> <span asp-validation-for="ngInfo.Wip.WipNO" class="layui-bg-red"></span>
</div> </div>
<label asp-for="ngInfo.Station.TestType" class="layui-form-label"></label> <label asp-for="ngInfo.Station.TestType" class="layui-form-label"></label>
@ -260,12 +260,13 @@
</div> </div>
<label asp-for="ngComponent.LocationNo" class="layui-form-label"></label> <label asp-for="ngComponent.LocationNo" class="layui-form-label"></label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input asp-for="ngComponent.LocationNo" class="layui-input" autocomplete="off" /> <input id="txtLocationNo" asp-for="ngComponent.LocationNo" class="layui-input" autocomplete="off" />
<span asp-validation-for="ngComponent.LocationNo" class="layui-bg-red"></span> <span asp-validation-for="ngComponent.LocationNo" class="layui-bg-red"></span>
</div> </div>
<label asp-for="ngRepair.PartNo" class="layui-form-label"></label> <label asp-for="ngRepair.PartNo" class="layui-form-label"></label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input asp-for="ngRepair.PartNo" class="layui-input" autocomplete="off" /> <input id="txtPartNo" asp-for="ngRepair.PartNo" class="layui-input" autocomplete="off" />
<input id="txtPartNoDesc" class="layui-input" autocomplete="off" readonly style="width:300px;" />
<span asp-validation-for="ngRepair.PartNo" class="layui-bg-red"></span> <span asp-validation-for="ngRepair.PartNo" class="layui-bg-red"></span>
</div> </div>
</div> </div>
@ -386,6 +387,50 @@
} }
}); });
function getMaterialNo(data)
{
$.ajax(
{
url: "@Url.Action("GetMaterialNoJson", "REP")",
dataType: 'json',
data: { "wip_no": $('#txtWipNo').val(),"location_no": data},
type: 'post',
success: function (result)
{
console.info(result.data);
$.each(result.data, function (index, item) {
$("#txtPartNo").val(item.text);
});
},
error: function (result)
{
alert(result);
}
});
};
function getMaterialDesc(data)
{
$.ajax(
{
url: "@Url.Action("GetMaterialDescJson", "REP")",
dataType: 'json',
data: { "part_no": data},
type: 'post',
success: function (result)
{
console.info(result.data);
$.each(result.data, function (index, item) {
$("#txtPartNoDesc").val(item.text);
});
},
error: function (result)
{
alert(result);
}
});
};
function getRepairResponsible(data) function getRepairResponsible(data)
{ {
$.ajax( $.ajax(
@ -466,6 +511,14 @@
$("#form").submit(); $("#form").submit();
}); });
$('#txtPartNo').on('keypress', function (event) {
if (event.keyCode == 13) {
getMaterialDesc($('#txtPartNo').val());
}
});
$('#txtRepairTypeNo').on('keypress', function (event) { $('#txtRepairTypeNo').on('keypress', function (event) {
if (event.keyCode == 13) { if (event.keyCode == 13) {
@ -475,6 +528,15 @@
}); });
$('#txtLocationNo').on('keypress', function (event) {
if (event.keyCode == 13) {
getMaterialNo($('#txtLocationNo').val());
getMaterialDesc($('#txtPartNo').val());
}
});
$('#txtNgNo').on('keypress', function (event) { $('#txtNgNo').on('keypress', function (event) {
if (event.keyCode == 13) { if (event.keyCode == 13) {

173
AMESCoreStudio.WebApi/Controllers/AMES/PlmBomsController.cs

@ -0,0 +1,173 @@
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;
namespace AMESCoreStudio.WebApi.Controllers.AMES
{
/// <summary>
///
/// </summary>
[Route("api/[controller]")]
[ApiController]
public class PlmBomsController : ControllerBase
{
private readonly AMESContext _context;
/// <summary>
///
/// </summary>
/// <param name="context"></param>
public PlmBomsController(AMESContext context)
{
_context = context;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
// GET: api/PlmBoms
[HttpGet]
public async Task<ActionResult<IEnumerable<PlmBom>>> GetPlmBom()
{
return await _context.PlmBoms.ToListAsync();
}
/// <summary>
/// 根據零件位置查詢料號
/// </summary>
/// <param name="itemNo">料號</param>
/// <param name="locationNo">零件位置</param>
/// <returns></returns>
[HttpGet("GetPlmBom4REP001")]
public async Task<ActionResult<IEnumerable<PlmBom>>> GetPlmBom4REP001(string itemNo,string locationNo)
{
IQueryable<PlmBom> q = _context.PlmBoms;
q = q.Where(p => p.MatnrP.Equals(itemNo) && (p.Ebort1.Contains(locationNo) || p.Ebort2.Contains(locationNo)));
var plmBom = await q.ToListAsync();
return plmBom;
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
// GET: api/PlmBoms/5
[HttpGet("{id}")]
public async Task<ActionResult<PlmBom>> GetPlmBom(string id)
{
var plmBom = await _context.PlmBoms.FindAsync(id);
if (plmBom == null)
{
return NotFound();
}
return plmBom;
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <param name="plmBom"></param>
/// <returns></returns>
// PUT: api/PlmBoms/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<IActionResult> PutPlmBom(string id, PlmBom plmBom)
{
if (id != plmBom.BomID)
{
return BadRequest();
}
_context.Entry(plmBom).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!PlmBomExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return NoContent();
}
/// <summary>
///
/// </summary>
/// <param name="plmBom"></param>
/// <returns></returns>
// POST: api/PlmBoms
// 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.
[HttpPost]
public async Task<ActionResult<PlmBom>> PostPlmBom(PlmBom plmBom)
{
_context.PlmBoms.Add(plmBom);
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateException)
{
if (PlmBomExists(plmBom.BomID))
{
return Conflict();
}
else
{
throw;
}
}
return CreatedAtAction("GetPlmBom", new { id = plmBom.BomID }, plmBom);
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
// DELETE: api/PlmBoms/5
[HttpDelete("{id}")]
public async Task<ActionResult<PlmBom>> DeletePlmBom(string id)
{
var plmBom = await _context.PlmBoms.FindAsync(id);
if (plmBom == null)
{
return NotFound();
}
_context.PlmBoms.Remove(plmBom);
await _context.SaveChangesAsync();
return plmBom;
}
private bool PlmBomExists(string id)
{
return _context.PlmBoms.Any(e => e.BomID == id);
}
}
}

24
AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs

@ -20,11 +20,19 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
{ {
private readonly AMESContext _context; private readonly AMESContext _context;
/// <summary>
///
/// </summary>
/// <param name="context"></param>
public PlmMeterialInfoeController(AMESContext context) public PlmMeterialInfoeController(AMESContext context)
{ {
_context = context; _context = context;
} }
/// <summary>
///
/// </summary>
/// <returns></returns>
// GET: api/PlmMeterialInfoe // GET: api/PlmMeterialInfoe
[HttpGet] [HttpGet]
public async Task<ActionResult<IEnumerable<PlmMeterialInfo>>> GetPlmMeterialInfos() public async Task<ActionResult<IEnumerable<PlmMeterialInfo>>> GetPlmMeterialInfos()
@ -65,6 +73,12 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
return plmMeterialInfo; return plmMeterialInfo;
} }
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <param name="plmMeterialInfo"></param>
/// <returns></returns>
// PUT: api/PlmMeterialInfoe/5 // PUT: api/PlmMeterialInfoe/5
// 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.
@ -97,6 +111,11 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
return NoContent(); return NoContent();
} }
/// <summary>
///
/// </summary>
/// <param name="plmMeterialInfo"></param>
/// <returns></returns>
// POST: api/PlmMeterialInfoe // POST: api/PlmMeterialInfoe
// 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.
@ -123,6 +142,11 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
return CreatedAtAction("GetPlmMeterialInfo", new { id = plmMeterialInfo.MeterialNo }, plmMeterialInfo); return CreatedAtAction("GetPlmMeterialInfo", new { id = plmMeterialInfo.MeterialNo }, plmMeterialInfo);
} }
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
// DELETE: api/PlmMeterialInfoe/5 // DELETE: api/PlmMeterialInfoe/5
[HttpDelete("{id}")] [HttpDelete("{id}")]
public async Task<ActionResult<PlmMeterialInfo>> DeletePlmMeterialInfo(string id) public async Task<ActionResult<PlmMeterialInfo>> DeletePlmMeterialInfo(string id)

138
AMESCoreStudio.WebApi/Models/AMES/PlmBom.cs

@ -0,0 +1,138 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using System.Runtime.Serialization;
#nullable disable
namespace AMESCoreStudio.WebApi.Models.AMES
{
/// <summary>
/// PLM BOM
/// </summary>
[Table("PLM_BOM", Schema = "JHAMES")]
public partial class PlmBom
{
/// <summary>
/// 建BOM日期
/// </summary>
[Column("BOM_DATE")]
[StringLength(8)]
[Required]
[DataMember]
public string BomDate { get; set; }
/// <summary>
/// 建BOM時間
/// </summary>
[Required]
[DataMember]
[Column("BOM_TIME")]
[StringLength(6)]
public string BomTime { get; set; }
/// <summary>
/// BOM_ID
/// </summary>
[Key]
[Required]
[DataMember]
[Column("BOM_ID")]
[StringLength(15)]
public string BomID { get; set; }
/// <summary>
/// MATNR_P
/// </summary>
[Column("MATNR_P")]
[StringLength(18)]
[DataMember]
public string MatnrP { get; set; }
/// <summary>
/// MATNR_OLD
/// </summary>
[Column("MATNR_OLD")]
[StringLength(18)]
[DataMember]
public string MatnrOld { get; set; }
/// <summary>
/// MATNR_NEW
/// </summary>
[Required]
[Column("MATNR_NEW")]
[StringLength(18)]
[DataMember]
public string MatnrNew { get; set; }
/// <summary>
/// QTY
/// </summary>
[Column("QTY")]
[StringLength(18)]
[DataMember]
public float Qty { get; set; }
/// <summary>
/// 狀態
/// </summary>
[Required]
[DataMember]
[Column("STATUS")]
[StringLength(3)]
public string Status { get; set; }
/// <summary>
/// MATNR_GROUP
/// </summary>
[Column("MATNR_GROUP")]
[StringLength(3)]
[DataMember]
public string MatnrGroup { get; set; }
/// <summary>
/// MAIN_SUBSTITUTE
/// </summary>
[Column("MAIN_SUBSTITUTE")]
[StringLength(3)]
[DataMember]
public string MainSubstitute { get; set; }
/// <summary>
/// EBORT1
/// </summary>
[DataMember]
[Column("EBORT1")]
[StringLength(4000)]
public string Ebort1 { get; set; }
/// <summary>
/// EBORT2
/// </summary>
[DataMember]
[Column("EBORT2")]
[StringLength(4000)]
public string Ebort2 { get; set; }
/// <summary>
/// ECN_ID
/// </summary>
[DataMember]
[Column("ECN_ID")]
[StringLength(15)]
public string EcnID { get; set; }
/// <summary>
/// 建立日期
/// </summary>
[Required]
[Column("CREATEDATE")]
[DataMember]
public DateTime CreateDate { get; set; } = DateTime.Now;
}
}

5
AMESCoreStudio.WebApi/Models/AMESContext.cs

@ -934,6 +934,11 @@ namespace AMESCoreStudio.WebApi
/// 清線明細資料 /// 清線明細資料
/// </summary> /// </summary>
public DbSet<WipClearDetail> WipClearDetails { get; set; } public DbSet<WipClearDetail> WipClearDetails { get; set; }
/// <summary>
/// PlmBom資料
/// </summary>
public DbSet<PlmBom> PlmBoms { get; set; }
} }
} }

Loading…
Cancel
Save