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;
|
using Newtonsoft.Json.Linq;
|
using System.Data;
|
using System.Dynamic;
|
|
namespace MESApplication.Controllers.QC;
|
|
[Route("api/[controller]")]
|
[ApiController]
|
public class SJController : ControllerBase
|
{
|
[HttpPost("GetMaxBillNo")]
|
public ResponseResult GetMaxBillNo()
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new SJService().getMaxBillNo();
|
resultInfos.tbBillList = tbBillList;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
|
[HttpPost("GetPage")]
|
public ResponseResult GetPage([FromBody] SJPageResult queryObj)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var (item, totalCount) = new SJService().getPage(queryObj);
|
resultInfos.tbBillList = item;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos,
|
TotalCount = totalCount
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
|
//SetQSItems
|
[HttpPost("SetQSItems")]
|
public ResponseResult SetQSItems([FromBody] JObject data)
|
{
|
var itemNo = data["itemNo"].ToString();
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList = new SJService();
|
var detail021 = tbBillList.SetQSItems(itemNo);
|
resultInfos.tbBillList = detail021;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
[HttpPost("Save")]
|
public ResponseResult Save([FromBody] QsItem item)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList = new SJService();
|
var detail021 = tbBillList.Save(item);
|
resultInfos.tbBillList = detail021;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
//SaveItem
|
[HttpPost("SaveItem")]
|
public ResponseResult SaveItem([FromBody] QsItem item)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList = new SJService();
|
var detail021 = tbBillList.SaveItem(item);
|
resultInfos.tbBillList = detail021;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
//getQSItems
|
[HttpPost("getQSItems")]
|
public ResponseResult getQSItems([FromBody] JObject data)
|
{
|
var pid = data["pid"]?.ToString();
|
var id = data["id"]?.ToString();
|
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList = new SJService();
|
var detail021 = tbBillList.getQSItems(Convert.ToDecimal(pid),
|
Convert.ToDecimal(id));
|
resultInfos.tbBillList = detail021;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
[HttpPost("SetQSItemDetail")]
|
public ResponseResult SetQSItemDetail([FromBody] QsItemIpiItemDetail detail)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList = new SJService();
|
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("getQSItemDetail")]
|
public ResponseResult getQSItemDetail([FromBody] JObject data)
|
{
|
var pid = data["pid"]?.ToString();
|
var gid = data["gid"]?.ToString();
|
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList = new SJService();
|
var detail021 = tbBillList.getQSItemDetail(Convert.ToDecimal(pid),
|
Convert.ToDecimal(gid));
|
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] QsItemIpiItemDetail detail)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList = new SJService();
|
var detail021 = tbBillList.UpdateQSItemDetail(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] QsItem rkjDto)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new SJService().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] QsItem rkjDto)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new SJService().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] QsItem rkjDto)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new SJService().saveRemarksById(rkjDto);
|
resultInfos.tbBillList = tbBillList;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
//removeSJ
|
[HttpPost("removeSJ")]
|
public ResponseResult removeSJ([FromBody] JObject data)
|
{
|
var id = data["id"]?.ToString();
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new SJService().removeXJ(Convert.ToDecimal(id));
|
resultInfos.tbBillList = tbBillList;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
//IqcQaSubmit
|
[HttpPost("SJQaSubmit")]
|
public ResponseResult SJQaSubmit(LLJDto rkjDto)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new SJService().SJQaSubmit(rkjDto);
|
resultInfos.tbBillList = tbBillList;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
/// <summary>
|
/// 获取一致性核对项目
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost("getYzxItem")]
|
public ResponseResult getYzxItem([FromBody] JObject data)
|
{
|
var id = data["id"]?.ToString();
|
try
|
{
|
var tbBillList = new SJService().getYzxBDlist(id);
|
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = tbBillList
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
/// <summary>
|
/// 保存一致性核对项目
|
/// </summary>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
[HttpPost("saveYzxItem")]
|
public ResponseResult saveYzxItem([FromBody] JObject data)
|
{
|
var id = data["id"]?.ToString();
|
var dataDt = data["data"]?.ToString();
|
var dt = JsonConvert.DeserializeObject<DataTable>(dataDt);
|
try
|
{
|
if (!dt.Columns.Contains("id"))
|
{
|
return new ResponseResult
|
{
|
status = 1,
|
message = "请先选择数据再保存!",
|
data = "请先选择数据再保存!"
|
};
|
}
|
new SJService().saveYzxBDlist(id, dt);
|
var msg = new SJService().YzxImgVerify(id);
|
|
return new ResponseResult
|
{
|
status = int.Parse(msg[0]),
|
message = msg[1],
|
data = ""
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
}
|