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 RKJController : ControllerBase
|
{
|
|
//getLine
|
[HttpPost("getLineAll")]
|
public ResponseResult getLineAll()
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new RKJService().getLineNo();
|
resultInfos.tbBillList = tbBillList;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
|
//getDaa001
|
[HttpPost("getDaa001")]
|
public ResponseResult getDaa001([FromBody] JObject data)
|
{
|
var lineNo = data["lineNo"].ToString();
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new RKJService().GetDaa001s(lineNo);
|
resultInfos.tbBillList = tbBillList;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
[HttpPost("setJYItem")]
|
public ResponseResult setJYItem([FromBody] JObject data)
|
{
|
var itemNo = data["itemNo"].ToString();
|
var quantity = Convert.ToDecimal(data["quantity"].ToString());
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new RKJService().SetItems(itemNo, quantity);
|
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] RKJPageResult queryObj)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var service = new RKJService();
|
var (tbBillList, totalCount) = service.getPageWithTotal(queryObj);
|
resultInfos.tbBillList = tbBillList;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos,
|
TotalCount = totalCount
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
|
//getItems
|
[HttpPost("getItems")]
|
public ResponseResult getJYItem([FromBody] JObject data)
|
{
|
var pid = data["pid"]?.ToString();
|
var id = data["id"]?.ToString();
|
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new RKJService().GetItems(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);
|
}
|
}
|
|
//removeXJ
|
[HttpPost("removeXJ")]
|
public ResponseResult removeXJ([FromBody] JObject data)
|
{
|
var id = data["id"]?.ToString();
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new RKJService().removeXJ(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 RKJService().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] QsItemOqcItemDetail detail)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList = new RKJService();
|
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] QsItemOqcItemDetail detail)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList = new RKJService();
|
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] RKJDto rkjDto)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new RKJService().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] RKJDto rkjDto)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new RKJService().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] RKJDto rkjDto)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new RKJService().saveRemarksById(rkjDto);
|
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] RKJDto xjDto)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList =
|
new RKJService().saveItem(xjDto);
|
resultInfos.tbBillList = tbBillList;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
[HttpPost("GenUpdateRKJ")]
|
public ResponseResult GenUpdateRKJ([FromBody] JObject data)
|
{
|
var id = Convert.ToDecimal(data["id"]?.ToString());
|
var no = data["no"]?.ToString();
|
var userNo = data["userNo"]?.ToString();
|
try
|
{
|
var service = new RKJService();
|
var (code, message) = service.GenUpdateRKJ(id, no, userNo);
|
return new ResponseResult
|
{
|
status = code,
|
message = message,
|
data = new ExpandoObject()
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
/// <summary>
|
/// 提交入库检验单
|
/// </summary>
|
/// <param name="data">包含gid和userNo的JSON数据</param>
|
/// <returns>提交结果</returns>
|
[HttpPost("RKJQaSubmit")]
|
public ResponseResult RKJQaSubmit([FromBody] JObject data)
|
{
|
var userNo = data["userNo"]?.ToString();
|
var id = Convert.ToDecimal(data["gid"]?.ToString());
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var tbBillList = new RKJService().RKJQaSubmit(userNo, id);
|
resultInfos.tbBillList = tbBillList;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "提交成功",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
}
|