You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.8 KiB
90 lines
2.8 KiB
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using AMESCoreStudio.WebApi.Models.AMES;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using AMESCoreStudio.CommonTools.Result;
|
|
|
|
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
|
|
|
namespace AMESCoreStudio.WebApi.Controllers.AMES
|
|
{
|
|
/// <summary>
|
|
/// 條碼變更資料表
|
|
/// </summary>
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class CZmomaterialListController : ControllerBase
|
|
{
|
|
|
|
private readonly AMESContext _context;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
public CZmomaterialListController(AMESContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 工單發料資料表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<ActionResult<IEnumerable<CZmomaterialList>>> GetCZmomaterialLists()
|
|
{
|
|
IQueryable<CZmomaterialList> q = _context.CZmomaterialLists;
|
|
return await q.ToListAsync();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 工單發料資料表 查詢POWER CORD,E17 by ByMoID 查詢
|
|
/// </summary>
|
|
/// <param name="id">MoID</param>
|
|
/// <returns></returns>
|
|
[HttpGet("ByMoID/{id}")]
|
|
public async Task<ActionResult<IEnumerable<dynamic>>> GetCZmomaterialListByMoID(string id)
|
|
{
|
|
var q = from q1 in _context.CZmomaterialLists.Where(w => w.MoID == id)
|
|
join q2 in _context.PlmMeterialInfos.Where(w => w.MeterialDesc.ToUpper().Contains("POWER CORD") && w.MeterialNo.StartsWith("E17")) on q1.MaterialNo equals q2.MeterialNo
|
|
select new
|
|
{
|
|
q1.MoID,
|
|
q1.MaterialNo,
|
|
q1.DemandQty,
|
|
q1.RealsendQty
|
|
|
|
};
|
|
|
|
return await q.ToListAsync();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 工單發料資料表 查詢工單所有發料 by ByMoID 查詢
|
|
/// </summary>
|
|
/// <param name="id">MoID</param>
|
|
/// <returns></returns>
|
|
[HttpGet("ByMoID_ALL/{id}")]
|
|
public async Task<ActionResult<IEnumerable<dynamic>>> GetCZmomaterialListByMoID_ALL(string id)
|
|
{
|
|
var q = from q1 in _context.CZmomaterialLists.Where(w => w.MoID == id)
|
|
select new
|
|
{
|
|
q1.MoID,
|
|
q1.MaterialNo,
|
|
q1.DemandQty,
|
|
q1.RealsendQty
|
|
|
|
};
|
|
|
|
return await q.ToListAsync();
|
|
}
|
|
|
|
}
|
|
}
|
|
|