using System.Dynamic;
using MES.Service.Dto.service;
using MES.Service.Modes;
using MES.Service.service.QC;
using MES.Service.util;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
namespace MESApplication.Controllers.QC;
[Route("api/[controller]")]
[ApiController]
public class XJController : ControllerBase
{
[HttpPost("getAll")]
public ResponseResult getAll([FromBody] JObject data)
{
var modify1Flag = Convert.ToInt32(data["modify1Flag"].ToString());
try
{
dynamic resultInfos = new ExpandoObject();
// var tbBillList =
// new XJService().getAll(modify1Flag);
// resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//getMaxReleaseNo
[HttpPost("getMaxReleaseNo")]
public ResponseResult getMaxReleaseNo()
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().getMaxReleaseNo();
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//getLine
[HttpPost("getLineAll")]
public ResponseResult getLineAll()
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().getLineAll();
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 获取工单
///
[HttpPost("getDaa001")]
public ResponseResult getDaa001([FromBody] JObject data)
{
var daa020 = data["daa020"].ToString();
var item = data["item"].ToString();
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().getDaa001(daa020, item);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 根据产线获取物料编码 lineNo
///
///
[HttpPost("getBoardItem")]
public ResponseResult getBoardItem([FromBody] JObject data)
{
var lineNo = data["lineNo"].ToString();
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().getBoardItem(lineNo);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//getItem
[HttpPost("getItem")]
public ResponseResult getItem([FromBody] JObject data)
{
var daa001 = data["daa001"].ToString();
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().getItem(daa001);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//setJYItem
[HttpPost("setJYItem")]
public ResponseResult setJYItem([FromBody] JObject data)
{
var itemNo = data["itemNo"].ToString();
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().setJYItem(itemNo);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//save
[HttpPost("save")]
public ResponseResult save([FromBody] XJDto xjDto)
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().save(xjDto);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
[HttpPost("saveItem")]
public ResponseResult saveItem([FromBody] XJDto xjDto)
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().saveItem(xjDto);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//getPage
[HttpPost("getPage")]
public ResponseResult getPage([FromBody] XJPageResult queryObj)
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().getPage(queryObj);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//getJYItem
[HttpPost("getJYItem")]
public ResponseResult getJYItem([FromBody] JObject data)
{
var pid = data["pid"]?.ToString();
var id = data["id"]?.ToString();
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().getJYItem(Convert.ToDecimal(pid),
Convert.ToDecimal(id));
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//getXjDetail02ById
[HttpPost("getXjDetail02ById")]
public ResponseResult getXjDetail02ById([FromBody] JObject data)
{
var id = data["id"]?.ToString();
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().getXjDetail02ById(Convert.ToDecimal(id));
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
[HttpPost("SetQSItemDetail")]
public ResponseResult SetQSItemDetail([FromBody] QsQaItemXj02 detail)
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList = new XJService();
var detail021 = tbBillList.SetQSItemDetail(detail);
resultInfos.tbBillList = detail021;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
[HttpPost("UpdateQSItemDetail")]
public ResponseResult UpdateQSItemDetail(
[FromBody] QsQaItemXj02 detail)
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList = new XJService();
var detail021 = tbBillList.UpdateQSItemDetail(detail);
resultInfos.tbBillList = detail021;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//removeXJ
[HttpPost("removeXJ")]
public ResponseResult removeXJ([FromBody] JObject data)
{
var id = data["id"]?.ToString();
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().removeXJ(Convert.ToDecimal(id));
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//saveRemarksGid
[HttpPost("saveRemarksGid")]
public ResponseResult saveRemarksGid([FromBody] XJDto rkjDto)
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().saveRemarksGid(rkjDto);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//saveRemarksPid
[HttpPost("saveRemarksPid")]
public ResponseResult saveRemarksPid([FromBody] XJDto rkjDto)
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().saveRemarksPid(rkjDto);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//saveRemarksById
[HttpPost("saveRemarksById")]
public ResponseResult saveRemarksById([FromBody] XJDto rkjDto)
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList =
new XJService().saveRemarksById(rkjDto);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
}