|
@@ -9,6 +9,8 @@ using System.Xml.Linq;
|
|
using System;
|
|
using System;
|
|
using System.Threading;
|
|
using System.Threading;
|
|
using System.Text;
|
|
using System.Text;
|
|
|
|
+using EInk.Dtos;
|
|
|
|
+using System.Reflection.Metadata;
|
|
|
|
|
|
namespace EInk.Controllers
|
|
namespace EInk.Controllers
|
|
{
|
|
{
|
|
@@ -22,8 +24,7 @@ namespace EInk.Controllers
|
|
_db = db;
|
|
_db = db;
|
|
}
|
|
}
|
|
|
|
|
|
- // POST api/<Lot3Controller>
|
|
|
|
- [HttpPost("AccessLot3")]
|
|
|
|
|
|
+ [HttpPost("UploadLot3")]
|
|
public IActionResult Lot3Data(string Lot3Data)
|
|
public IActionResult Lot3Data(string Lot3Data)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
@@ -49,16 +50,42 @@ namespace EInk.Controllers
|
|
{
|
|
{
|
|
return Ok(ResultDto.Fail(ex.Message));
|
|
return Ok(ResultDto.Fail(ex.Message));
|
|
}
|
|
}
|
|
- //int id = _db.Ado.GetInt("select max(count) from lot2lot3_info");
|
|
|
|
Lot2Lot3Model lot3model = new()
|
|
Lot2Lot3Model lot3model = new()
|
|
{
|
|
{
|
|
- //id = id + 1,
|
|
|
|
lot_id = lot3Dto.id,
|
|
lot_id = lot3Dto.id,
|
|
- //判断数据是否重复插入,重复插入is_send标记为3
|
|
|
|
- is_send = _db.Ado.GetInt(string.Format("select count(*) from lot2lot3_info where lot_id='{0}'", lot3Dto.id)) == 0 ? 0 : 3,
|
|
|
|
|
|
+ is_send = 0,
|
|
|
|
+ product_no = lot3Dto.slidesNumber,
|
|
content = Lot3Data,
|
|
content = Lot3Data,
|
|
create_time = DateTime.Now
|
|
create_time = DateTime.Now
|
|
};
|
|
};
|
|
|
|
+ //校验是否有id重复的数据
|
|
|
|
+ if (_db.Ado.GetInt(string.Format("select count(*) from lot2lot3_info where lot_id='{0}'", lot3Dto.id)) > 0)
|
|
|
|
+ {
|
|
|
|
+ lot3model.is_send = 3;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //校验是否有片号重复的数据
|
|
|
|
+ List<Lot2Lot3Model> lot_list = _db.Queryable<Lot2Lot3Model>().Where(x => x.product_no == lot3Dto.slidesNumber).OrderByDescending(x => x.id).ToList();
|
|
|
|
+ if (lot_list.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ Lot2Lot3Dto lot3Dto_db = JsonConvert.DeserializeObject<Lot2Lot3Dto>(lot_list[0].content);
|
|
|
|
+ if (Convert.ToDateTime(lot3Dto.createTime) > Convert.ToDateTime(lot3Dto_db.createTime))
|
|
|
|
+ {
|
|
|
|
+ if (lot3Dto_db.result == "NG") lot3Dto.result = "NG";
|
|
|
|
+ foreach (var item in lot3Dto.itemCheckDatas)
|
|
|
|
+ {
|
|
|
|
+ lot3Dto_db.itemCheckDatas.Add(item);
|
|
|
|
+ }
|
|
|
|
+ lot3Dto.itemCheckDatas = lot3Dto_db.itemCheckDatas;
|
|
|
|
+ lot3model.content = JsonConvert.SerializeObject(lot3Dto);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ lot3model.is_send = 3;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
_db.Insertable(lot3model).ExecuteCommand();
|
|
_db.Insertable(lot3model).ExecuteCommand();
|
|
return Ok(ResultDto.Success());
|
|
return Ok(ResultDto.Success());
|
|
}
|
|
}
|
|
@@ -68,7 +95,63 @@ namespace EInk.Controllers
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // POST api/<Lot3Controller>
|
|
|
|
|
|
+
|
|
|
|
+ [HttpPost("UploadColourCast")]
|
|
|
|
+ public IActionResult ColourCastData(string ColourCastData)
|
|
|
|
+ {
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ if (String.IsNullOrEmpty(ColourCastData))
|
|
|
|
+ {
|
|
|
|
+ return Ok(ResultDto.Fail("Components is null"));
|
|
|
|
+ }
|
|
|
|
+ ColourCastDto colourcastDto = new ColourCastDto();
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ colourcastDto = JsonConvert.DeserializeObject<ColourCastDto>(ColourCastData);
|
|
|
|
+ }
|
|
|
|
+ catch (Exception)
|
|
|
|
+ {
|
|
|
|
+ return Ok(ResultDto.Fail("Incorrect Json format"));
|
|
|
|
+ }
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ colourcastDto.Valid();
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex)
|
|
|
|
+ {
|
|
|
|
+ return Ok(ResultDto.Fail(ex.Message));
|
|
|
|
+ };
|
|
|
|
+ ColourCastModel colourcastmodel = new()
|
|
|
|
+ {
|
|
|
|
+ slidesNumber = colourcastDto.slidesNumber,
|
|
|
|
+ is_send = 0,
|
|
|
|
+ content = ColourCastData,
|
|
|
|
+ create_time = DateTime.Now
|
|
|
|
+ };
|
|
|
|
+ List<ColourCastModel> colourcast_list = _db.Queryable<ColourCastModel>().Where(x => x.slidesNumber == colourcastDto.slidesNumber).OrderByDescending(x => x.id).ToList();
|
|
|
|
+ if (colourcast_list.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ ColourCastDto colourcastDto_db = JsonConvert.DeserializeObject<ColourCastDto>(colourcast_list[0].content);
|
|
|
|
+ if (Convert.ToDateTime(colourcastDto.createTime) > Convert.ToDateTime(colourcastDto_db.createTime))
|
|
|
|
+ {
|
|
|
|
+ colourcastmodel.is_send = 0;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ colourcastmodel.is_send = 3;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ _db.Insertable(colourcastmodel).ExecuteCommand();
|
|
|
|
+ return Ok(ResultDto.Success());
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex)
|
|
|
|
+ {
|
|
|
|
+ return Ok(ResultDto.Fail("error:" + ex.Message));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
[HttpPost("UpdateDefectInfo")]
|
|
[HttpPost("UpdateDefectInfo")]
|
|
public IActionResult UpdateDefectInfo(IFormFile file)
|
|
public IActionResult UpdateDefectInfo(IFormFile file)
|
|
{
|
|
{
|
|
@@ -100,7 +183,7 @@ namespace EInk.Controllers
|
|
}
|
|
}
|
|
_db.Ado.CommitTran();
|
|
_db.Ado.CommitTran();
|
|
}
|
|
}
|
|
- catch(Exception ex)
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
_db.Ado.RollbackTran();
|
|
_db.Ado.RollbackTran();
|
|
return Ok(ResultDto.Fail(ex.Message));
|
|
return Ok(ResultDto.Fail(ex.Message));
|