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;
[ApiController]
[Route("api/[controller]")]
public class MesOqcItemsDetect02Controller : ControllerBase
{
private readonly MesOqcItemsDetect02Manager m = new();
[HttpPost("SetQSItemDetail")]
public ResponseResult SetQSItemDetail(
[FromBody] MesOqcItemsDetectDetail12 detail)
{
try
{
dynamic resultInfos = new ExpandoObject();
var detail021 = m.SetQSItemDetail(detail);
resultInfos.tbBillList = detail021;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//saveRemarksGid 主表添加不合格描述
[HttpPost("saveRemarksGid")]
public ResponseResult saveRemarksGid([FromBody] LLJDto rkjDto)
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList = m.saveRemarksGid(rkjDto);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//IqcQaSubmit
[HttpPost("IqcQaSubmit")]
public ResponseResult IqcQaSubmit(LLJDto rkjDto)
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList = m.IqcQaSubmit(rkjDto);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
[HttpPost("saveRemarksPid")]
public ResponseResult saveRemarksPid([FromBody] LLJDto rkjDto)
{
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList = m.saveRemarksPid(rkjDto);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
[HttpPost("UpdateQSItemDetail")]
public ResponseResult UpdateQSItemDetail(
[FromBody] MesOqcItemsDetectDetail12 detail)
{
try
{
dynamic resultInfos = new ExpandoObject();
var detail021 = m.UpdateQSItemDetail(detail);
resultInfos.tbBillList = detail021;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
[HttpPost("getXjDetail02ById")]
public ResponseResult getXjDetail02ById([FromBody] JObject data)
{
var id = data["id"]?.ToString();
try
{
dynamic resultInfos = new ExpandoObject();
var tbBillList = m.getXjDetail02ById(Convert.ToDecimal(id));
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
//ItemBarCodeSubmit(OQCDto dto)
[HttpPost("ItemBarCodeSubmit")]
public ResponseResult ItemBarCodeSubmit([FromBody] OQCDto dto)
{
try
{
dynamic resultInfos = new ExpandoObject();
var item = m.ItemBarCodeSubmit(dto);
var tbBillList =
resultInfos.tbBillList = item;
return new ResponseResult
{
status = 0,
message = "OK",
data = tbBillList
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
[HttpPost("GetDetail5")]
public ResponseResult GetDetail5([FromBody] OQCDto dto)
{
try
{
dynamic resultInfos = new ExpandoObject();
var item = m.GetDetail5(dto);
var tbBillList =
resultInfos.tbBillList = item;
return new ResponseResult
{
status = 0,
message = "OK",
data = tbBillList
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
[HttpPost("getPage")]
public ResponseResult getPage([FromBody] XJPageResult queryObj)
{
try
{
dynamic resultInfos = new ExpandoObject();
var (item, totalCount) = m.GetPage(queryObj);
var tbBillList =
resultInfos.tbBillList = item;
return new ResponseResult
{
status = 0,
message = "OK",
data = tbBillList,
TotalCount = totalCount
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
[HttpPost("GetItemBarCode")]
public ResponseResult GetItemBarCode(XJPageResult queryObj)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetItemBarCode(queryObj);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 获取所有
///
///
[HttpPost("GetList")]
public ResponseResult GetList()
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetList();
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 根据主键获取
///
///
[HttpPost("GetById")]
public ResponseResult GetById(int id)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetById(id);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 根据主键删除
///
///
[HttpPost("DeleteByIds")]
public ResponseResult DeleteByIds([FromBody] object[] ids)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.DeleteByIds(ids);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 添加
///
///
[HttpPost("Insert")]
public ResponseResult Add([FromBody] MesOqcItemsDetect02 data)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.Insert(data);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 添加返回自增
///
///
[HttpPost("InsertReturnIdentity")]
public ResponseResult InsertReturnIdentity(
[FromBody] MesOqcItemsDetect02 data)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.InsertReturnIdentity(data);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 修改
///
///
[HttpPost("Update")]
public ResponseResult Update([FromBody] MesOqcItemsDetect02 data)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.Update(data);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
}