|
@@ -629,99 +629,39 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
- public static ResponseMessage InsertOp10Data(SqlSugarClient db, string carrierCode, string hydrocooling_Barcode, int bindOrder,
|
|
|
- int throwingAmount, float cleaningPower, float cleaningPressure, float cleaningSpeed,
|
|
|
- float airKnifeHeight, float cleaningTime, int cleaningCount)
|
|
|
+ public static ResponseMessage InsertOp10Data( string carrierCode, string productBarcode, int bindOrder,
|
|
|
+ int throwingAmount, float cleaningPressure, float cleaningSpeed,
|
|
|
+ float airKnifeHeight, float cleaningTime, int cleaningCount,int remainCount)
|
|
|
{
|
|
|
- #region 新建CarrierBind实体,并将数据插入carrierBind表格
|
|
|
- // 创建 CarrierBind 实体,并通过传入的参数设置字段值
|
|
|
- var CarrierBind_sumRecord = new CarrierBind
|
|
|
- {
|
|
|
- CarrierCode = carrierCode,
|
|
|
- ProductBarcode = hydrocooling_Barcode,
|
|
|
- };
|
|
|
-
|
|
|
// 检查记录是否已经存在
|
|
|
- bool CarrierBind_exists = db.Queryable<CarrierBind>().Any(x => x.CarrierCode == CarrierBind_sumRecord.CarrierCode &&
|
|
|
- x.ProductBarcode == CarrierBind_sumRecord.ProductBarcode);
|
|
|
- if (CarrierBind_exists)
|
|
|
- {
|
|
|
- var maxBindOrder = db.Queryable<CarrierBind>()
|
|
|
- .Where(x => x.CarrierCode == CarrierBind_sumRecord.CarrierCode &&
|
|
|
- x.ProductBarcode == CarrierBind_sumRecord.ProductBarcode);
|
|
|
- db.Deleteable<CarrierBind>().Where(x => x.CarrierCode == carrierCode).ExecuteCommand();
|
|
|
- }
|
|
|
- else
|
|
|
+ bool OP10_exists = db.Queryable<CarrierBind>().Any(x => x.CarrierCode == carrierCode &&
|
|
|
+ x.ProductBarcode == productBarcode);
|
|
|
+ if (OP10_exists)
|
|
|
{
|
|
|
- // 插入数据
|
|
|
- try
|
|
|
- {
|
|
|
- db.Insertable(CarrierBind_sumRecord).ExecuteCommand();
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- return new ResponseMessage { result = true, text = "OP10数据-载具码与产品码绑定失败,错误码:" + ex.Message };
|
|
|
- }
|
|
|
+ var maxBindOrder = db.Queryable<TestData>()
|
|
|
+ .Where(x => x.CarrierCode == carrierCode &&
|
|
|
+ x.ProductBarcode == productBarcode)
|
|
|
+ .Max(x => x.BindOrder); ;
|
|
|
+ bindOrder = maxBindOrder + 1;
|
|
|
}
|
|
|
- #endregion
|
|
|
|
|
|
- #region 新建ProductBind实体,并将数据插入productBind表格
|
|
|
- // 创建 ProductBind 实体,并通过传入的参数设置字段值
|
|
|
- var ProductBind_sumRecord = new ProductBind
|
|
|
- {
|
|
|
- CarrierCode = carrierCode,//载具码
|
|
|
- ProductBarcode = hydrocooling_Barcode, // 水冷壳体条码
|
|
|
- BindOrder = bindOrder // 绑定顺序
|
|
|
- };
|
|
|
-
|
|
|
- // 检查记录是否已经存在
|
|
|
- bool ProductBind_exists = db.Queryable<ProductBind>().Any(x => x.CarrierCode == ProductBind_sumRecord.CarrierCode &&
|
|
|
- x.ProductBarcode == ProductBind_sumRecord.ProductBarcode &&
|
|
|
- x.BindOrder == ProductBind_sumRecord.BindOrder);
|
|
|
- if (ProductBind_exists)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // 插入数据
|
|
|
- try
|
|
|
- {
|
|
|
- db.Insertable(ProductBind_sumRecord).ExecuteCommand();
|
|
|
- logNet.WriteError("OP10-数据插入到 productbind 表格成功!");
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- logNet.WriteError("OP10-数据插入到 productbind 表格出错!错误码:" + ex.Message);
|
|
|
- }
|
|
|
- }
|
|
|
- #endregion
|
|
|
|
|
|
#region 将OP10数据插入testdata表格
|
|
|
- // 检查主键是否存在
|
|
|
- var existingRecord = db.Queryable<TestData>()
|
|
|
- .Where(x => x.CarrierCode == carrierCode && x.ProductBarcode == hydrocooling_Barcode && x.BindOrder == bindOrder)
|
|
|
- .First();
|
|
|
- if (existingRecord != null)
|
|
|
- {
|
|
|
- logNet.WriteError("OP10错误:数据已存在,载具码、水冷壳体码和绑定顺序相同!");
|
|
|
- return new ResponseMessage { result = false, text = "OP10错误:数据已存在,载具码、水冷壳体码和绑定顺序相同!" };
|
|
|
- }
|
|
|
|
|
|
// 创建 Op10 实体,并通过传入的参数设置字段值
|
|
|
var op10 = new TestData
|
|
|
{
|
|
|
CarrierCode = carrierCode, // 载具码
|
|
|
- ProductBarcode = hydrocooling_Barcode,// 水冷壳体码
|
|
|
+ ProductBarcode = productBarcode, // 产品码
|
|
|
BindOrder = bindOrder, // 绑定顺序
|
|
|
|
|
|
OP10_ThrowingAmount = throwingAmount, // 抛料数量
|
|
|
- OP10_CleaningPower = cleaningPower, // 清洗功率
|
|
|
OP10_CleaningPressure = cleaningPressure, // 清洗气压
|
|
|
OP10_CleaningSpeed = cleaningSpeed, // 清洗速度
|
|
|
OP10_AirKnifeHeight = airKnifeHeight, // 风刀高度
|
|
|
OP10_CleaningTime = cleaningTime, // 清洗时间
|
|
|
- OP10_CleaningCount = cleaningCount // 清洗次数
|
|
|
+ OP10_CleaningCount = cleaningCount, // 清洗次数
|
|
|
+ OP10_RemainCount = cleaningCount // 清洗次数
|
|
|
};
|
|
|
|
|
|
try
|
|
@@ -738,73 +678,93 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
- // op20向testdata表格插入数据
|
|
|
- public static ResponseMessage InsertOp20Data( int throwingAmount, string topCover_Barcode)
|
|
|
+ // op20绑定部件码
|
|
|
+ public static ResponseMessage InsertOp20Product(string carrierCode, string productBarcode, string topCover_Barcode)
|
|
|
{
|
|
|
- // 检查上一次插入的记录是否存在
|
|
|
- var lastRecord = db.Queryable<TestData>()
|
|
|
- .Where(x => x.OP10_ThrowingAmount != 0 &&
|
|
|
- x.OP10_CleaningPower != 0.0f &&
|
|
|
- x.OP10_CleaningPressure != 0.0f &&
|
|
|
- x.OP10_CleaningSpeed != 0.0f &&
|
|
|
- x.OP10_AirKnifeHeight != 0.0f &&
|
|
|
- x.OP10_CleaningTime != 0.0f &&
|
|
|
- x.OP10_CleaningCount != 0) // 只查找有效插入的数据
|
|
|
- .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
- .Take(1) // 只取一条记录
|
|
|
- .First(); // 获取第一条记录,若没有则返回null
|
|
|
-
|
|
|
- if (lastRecord == null)
|
|
|
+ int bindOrder = 1;
|
|
|
+ // 检查记录是否已经存在
|
|
|
+ bool Product_exists = db.Queryable<ProductBind>().Any(x => x.CarrierCode == carrierCode &&
|
|
|
+ x.ProductBarcode == productBarcode);
|
|
|
+ if (Product_exists)
|
|
|
{
|
|
|
- logNet.WriteError("OP20错误:OP10插入的记录存在值为空!");
|
|
|
+ var maxBindOrder = db.Queryable<ProductBind>()
|
|
|
+ .Where(x => x.CarrierCode == carrierCode &&
|
|
|
+ x.ProductBarcode == productBarcode)
|
|
|
+ .Max(x => x.BindOrder); ;
|
|
|
+ bindOrder = maxBindOrder + 1;
|
|
|
}
|
|
|
|
|
|
- if (lastRecord.OP20_ThrowingAmount != 0 || lastRecord.TopCover_Barcode != "")
|
|
|
+ #region 新建ProductBind实体,并将数据插入productBind表格
|
|
|
+ // 创建 ProductBind 实体,并通过传入的参数设置字段值
|
|
|
+ var ProductBind_sumRecord = new ProductBind
|
|
|
{
|
|
|
- logNet.WriteError("OP20错误:即将插入的数据存在值不为空,插入失败,请按标准操作!");
|
|
|
- }
|
|
|
-
|
|
|
- #region 往productBind表格中插入topCover_Barcode数据
|
|
|
- // 检查上一次插入的记录是否存在
|
|
|
- var productBind_lastRecord = db.Queryable<ProductBind>()
|
|
|
- .Where(x => x.CarrierCode != "" && x.ProductBarcode != "" && x.BindOrder != 0)
|
|
|
- .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
- .Take(1) // 只取一条记录
|
|
|
- .First(); // 获取第一条记录,若没有则返回null
|
|
|
+ CarrierCode = carrierCode,//载具码
|
|
|
+ ProductBarcode = productBarcode, // 产品条码
|
|
|
+ BindOrder = bindOrder, // 绑定顺序
|
|
|
+ TopCover_Barcode=topCover_Barcode, //部件码
|
|
|
+ };
|
|
|
|
|
|
- if (productBind_lastRecord == null)
|
|
|
+ // 插入数据
|
|
|
+ try
|
|
|
{
|
|
|
- logNet.WriteError("OP20-错误:ProductBind表中最新插入的数据为空!");
|
|
|
+ db.Insertable(ProductBind_sumRecord).ExecuteCommand();
|
|
|
+ return new ResponseMessage { result = true, text = "OP20-产品码绑定部件码成功!" };
|
|
|
}
|
|
|
-
|
|
|
- if (productBind_lastRecord.TopCover_Barcode != "")
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
- logNet.WriteError("OP20-错误:即将插入的数据存在值不为空,插入失败,请按标准操作!");
|
|
|
+ logNet.WriteError("OP20-产品码绑定部件码出错!错误码:" + ex.Message);
|
|
|
+ return new ResponseMessage { result = false, text = "OP20-产品码绑定部件码出错!错误码:" + ex.Message };
|
|
|
}
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
|
|
|
- productBind_lastRecord.TopCover_Barcode = topCover_Barcode;
|
|
|
+ // op20向testdata表格插入数据
|
|
|
+ public static ResponseMessage InsertOp20Data(string carrierCode, string productBarcode, int throwCount, int remainCount)
|
|
|
+ {
|
|
|
+ ////// 检查上一次插入的记录是否存在
|
|
|
+ ////var lastRecord = db.Queryable<TestData>()
|
|
|
+ //// .Where(x => x.CarrierCode== carrierCode && x.ProductBarcode == productBarcode &&
|
|
|
+ //// (x.OP10_ThrowingAmount != 0 ||
|
|
|
+ //// x.OP10_CleaningPressure != 0.0f ||
|
|
|
+ //// x.OP10_CleaningSpeed != 0.0f ||
|
|
|
+ //// x.OP10_AirKnifeHeight != 0.0f ||
|
|
|
+ //// x.OP10_CleaningTime != 0.0f ||
|
|
|
+ //// x.OP10_CleaningCount != 0 ||
|
|
|
+ //// x.OP10_RemainCount != 0)) // 看上一次有无记录数据
|
|
|
+ //// .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
+ //// .Take(1) // 只取一条记录
|
|
|
+ //// .First(); // 获取第一条记录,若没有则返回null
|
|
|
+
|
|
|
+ ////if (lastRecord == null)
|
|
|
+ ////{
|
|
|
+ //// logNet.WriteError("OP20错误:OP10未插入数据!");
|
|
|
+ ////}
|
|
|
|
|
|
- try
|
|
|
+ var lastRecord = db.Queryable<TestData>()
|
|
|
+ .Where(x => x.CarrierCode == carrierCode && x.ProductBarcode == productBarcode )
|
|
|
+ .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
+ .Take(1) // 只取一条记录
|
|
|
+ .First(); // 获取第一条记录,若没有则返回null
|
|
|
+
|
|
|
+ if (lastRecord == null)
|
|
|
{
|
|
|
- db.Updateable(productBind_lastRecord)
|
|
|
- .UpdateColumns(x => new {
|
|
|
- x.TopCover_Barcode
|
|
|
- }).ExecuteCommand();
|
|
|
- logNet.WriteError("OP20往ProductBind表中插入TopCover_Barcode成功!");
|
|
|
+ logNet.WriteError("OP20记录插入出错:MES主数据未成功创建,无法插入OP20数据!");
|
|
|
+ return new ResponseMessage { result = false, text = "OP20错误:MES主数据未成功创建,无法插入OP20数据!" };
|
|
|
}
|
|
|
- catch (Exception ex)
|
|
|
+
|
|
|
+ if (lastRecord.OP20_ThrowCount != 0 || lastRecord.OP20_RemainCount != 0)
|
|
|
{
|
|
|
- logNet.WriteError("OP20往ProductBind表中插入TopCover_Barcode出错!错误码:" + ex.Message);
|
|
|
+ logNet.WriteError("OP20记录插入出错:即将插入的行数据已存在,插入失败!");
|
|
|
+ return new ResponseMessage { result = false, text = "OP20记录插入出错:即将插入的行数据已存在,插入失败!" };
|
|
|
}
|
|
|
- #endregion
|
|
|
|
|
|
- lastRecord.OP20_ThrowingAmount = throwingAmount;
|
|
|
- lastRecord.TopCover_Barcode = topCover_Barcode;
|
|
|
+ lastRecord.OP20_ThrowCount = throwCount;
|
|
|
+ lastRecord.OP20_RemainCount = remainCount;
|
|
|
|
|
|
try
|
|
|
{
|
|
|
db.Updateable(lastRecord)
|
|
|
- .UpdateColumns(x => new { x.OP20_ThrowingAmount, x.TopCover_Barcode })
|
|
|
+ .UpdateColumns(x => new { x.OP20_ThrowCount, x.OP20_RemainCount })
|
|
|
.ExecuteCommand();
|
|
|
logNet.WriteError("OP20记录插入成功!");
|
|
|
return new ResponseMessage { result = false, text = "OP20记录插入成功!" };
|
|
@@ -817,33 +777,45 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
|
|
|
}
|
|
|
|
|
|
// op301向testdata表格插入数据
|
|
|
- public static ResponseMessage InsertOp301Data( float gluingSpeed, float pressureA, float pressureB, float pressureDifferenceAB,
|
|
|
+ public static ResponseMessage InsertOp301Data(string carrierCode, string productBarcode, float gluingSpeed, float pressureAB, float pressureDifferenceAB,
|
|
|
float productHeightInfo, float periodicWeightData, float remainingGlueAmount)
|
|
|
{
|
|
|
- // 检查上一次插入的记录是否存在
|
|
|
+ ////// 检查上一次插入的记录是否存在
|
|
|
+ ////var lastRecord = db.Queryable<TestData>()
|
|
|
+ //// .Where(x => x.CarrierCode == carrierCode && x.ProductBarcode == productBarcode &&
|
|
|
+ //// (x.OP20_ThrowCount != 0 || x.OP20_RemainCount != 0)) // 只查找有效插入的数据
|
|
|
+ //// .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
+ //// .Take(1) // 只取一条记录
|
|
|
+ //// .First(); // 获取第一条记录,若没有则返回null
|
|
|
+
|
|
|
+ ////if (lastRecord == null)
|
|
|
+ ////{
|
|
|
+ //// logNet.WriteError("OP301错误:OP20插入的记录存在值为空!");
|
|
|
+ //// return new ResponseMessage { result = false, text = "OP301错误:OP20插入的记录存在值为空!" };
|
|
|
+ ////}
|
|
|
+
|
|
|
var lastRecord = db.Queryable<TestData>()
|
|
|
- .Where(x => x.OP20_ThrowingAmount != 0 && x.TopCover_Barcode != "") // 只查找有效插入的数据
|
|
|
- .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
- .Take(1) // 只取一条记录
|
|
|
- .First(); // 获取第一条记录,若没有则返回null
|
|
|
+ .Where(x => x.CarrierCode == carrierCode && x.ProductBarcode == productBarcode)
|
|
|
+ .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
+ .Take(1) // 只取一条记录
|
|
|
+ .First(); // 获取第一条记录,若没有则返回null
|
|
|
|
|
|
if (lastRecord == null)
|
|
|
{
|
|
|
- logNet.WriteError("OP301错误:OP20插入的记录存在值为空!");
|
|
|
- return new ResponseMessage { result = false, text = "OP301错误:OP20插入的记录存在值为空!" };
|
|
|
+ logNet.WriteError("OP301错误:MES主数据未成功创建,无法插入OP301数据!");
|
|
|
+ return new ResponseMessage { result = false, text = "OP301错误:MES主数据未成功创建,无法插入OP20数据!" };
|
|
|
}
|
|
|
|
|
|
- if (lastRecord.OP301_GluingSpeed != 0.0f || lastRecord.OP301_PressureA != 0.0f || lastRecord.OP301_PressureB != 0.0f ||
|
|
|
- lastRecord.OP301_PressureDifferenceAB != 0.0f || lastRecord.OP301_ProductHeightInfo != 0.0f ||
|
|
|
- lastRecord.OP301_PeriodicWeightData != 0.0f || lastRecord.OP301_RemainingGlueAmount != 0.0f)
|
|
|
+ if (lastRecord.OP301_GluingSpeed != 0.0f || lastRecord.OP301_PressureAB != 0.0f ||
|
|
|
+ lastRecord.OP301_PressureDifferenceAB != 0.0f || lastRecord.OP301_ProductHeightInfo != 0.0f ||
|
|
|
+ lastRecord.OP301_PeriodicWeightData != 0.0f || lastRecord.OP301_RemainingGlueAmount != 0.0f)
|
|
|
{
|
|
|
- logNet.WriteError("OP301错误:即将插入的数据存在值不为空,插入失败,请按标准操作!");
|
|
|
- return new ResponseMessage { result = false, text = "OP301错误:即将插入的数据存在值不为空,插入失败,请按标准操作!" };
|
|
|
+ logNet.WriteError("OP301记录插入出错:即将插入的行数据已存在,插入失败!");
|
|
|
+ return new ResponseMessage { result = false, text = "OP301记录插入出错:即将插入的行数据已存在,插入失败!" };
|
|
|
}
|
|
|
|
|
|
lastRecord.OP301_GluingSpeed = gluingSpeed; // 供胶速度
|
|
|
- lastRecord.OP301_PressureA = pressureA; // A管气压
|
|
|
- lastRecord.OP301_PressureB = pressureB; // B管气压
|
|
|
+ lastRecord.OP301_PressureAB = pressureAB; // AB管气压
|
|
|
lastRecord.OP301_PressureDifferenceAB = pressureDifferenceAB; // AB管气压差
|
|
|
lastRecord.OP301_ProductHeightInfo = productHeightInfo; // 产品测高信息
|
|
|
lastRecord.OP301_PeriodicWeightData = periodicWeightData; // 定期称重数据
|
|
@@ -854,8 +826,7 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
|
|
|
db.Updateable(lastRecord)
|
|
|
.UpdateColumns(x => new {
|
|
|
x.OP301_GluingSpeed,
|
|
|
- x.OP301_PressureA,
|
|
|
- x.OP301_PressureB,
|
|
|
+ x.OP301_PressureAB,
|
|
|
x.OP301_PressureDifferenceAB,
|
|
|
x.OP301_ProductHeightInfo,
|
|
|
x.OP301_PeriodicWeightData,
|
|
@@ -872,35 +843,47 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
|
|
|
}
|
|
|
|
|
|
// op302向testdata表格插入数据
|
|
|
- public static ResponseMessage InsertOp302Data( float gluingSpeed, float pressureA, float pressureB, float pressureDifferenceAB,
|
|
|
+ public static ResponseMessage InsertOp302Data(string carrierCode, string productBarcode, float gluingSpeed, float pressureAB, float pressureDifferenceAB,
|
|
|
float productHeightInfo, float periodicWeightData, float remainingGlueAmount)
|
|
|
{
|
|
|
- // 检查上一次插入的记录是否存在
|
|
|
+ ////// 检查上一次插入的记录是否存在
|
|
|
+ ////var lastRecord = db.Queryable<TestData>()
|
|
|
+ //// .Where(x => x.OP301_GluingSpeed != 0.0f && x.OP301_PressureA != 0.0f && x.OP301_PressureB != 0.0f &&
|
|
|
+ //// x.OP301_PressureDifferenceAB != 0.0f && x.OP301_ProductHeightInfo != 0.0f &&
|
|
|
+ //// x.OP301_PeriodicWeightData != 0.0f && x.OP301_RemainingGlueAmount != 0.0f) // 只查找有效插入的数据
|
|
|
+ //// .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
+ //// .Take(1) // 只取一条记录
|
|
|
+ //// .First(); // 获取第一条记录,若没有则返回null
|
|
|
+
|
|
|
+ ////if (lastRecord == null)
|
|
|
+ ////{
|
|
|
+ //// logNet.WriteError("OP302错误:OP301插入的记录存在值为空!");
|
|
|
+ //// return new ResponseMessage { result = false, text = "OP302错误:OP301插入的记录存在值为空!" };
|
|
|
+ ////}
|
|
|
+ ///
|
|
|
+
|
|
|
var lastRecord = db.Queryable<TestData>()
|
|
|
- .Where(x => x.OP301_GluingSpeed != 0.0f && x.OP301_PressureA != 0.0f && x.OP301_PressureB != 0.0f &&
|
|
|
- x.OP301_PressureDifferenceAB != 0.0f && x.OP301_ProductHeightInfo != 0.0f &&
|
|
|
- x.OP301_PeriodicWeightData != 0.0f && x.OP301_RemainingGlueAmount != 0.0f) // 只查找有效插入的数据
|
|
|
- .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
- .Take(1) // 只取一条记录
|
|
|
- .First(); // 获取第一条记录,若没有则返回null
|
|
|
+ .Where(x => x.CarrierCode == carrierCode && x.ProductBarcode == productBarcode)
|
|
|
+ .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
+ .Take(1) // 只取一条记录
|
|
|
+ .First(); // 获取第一条记录,若没有则返回null
|
|
|
|
|
|
if (lastRecord == null)
|
|
|
{
|
|
|
- logNet.WriteError("OP302错误:OP301插入的记录存在值为空!");
|
|
|
- return new ResponseMessage { result = false, text = "OP302错误:OP301插入的记录存在值为空!" };
|
|
|
+ logNet.WriteError("OP302记录插入错误:MES主数据未成功创建,无法插入OP302数据!");
|
|
|
+ return new ResponseMessage { result = false, text = "OP302记录插入错误:MES主数据未成功创建,无法插入OP20数据!" };
|
|
|
}
|
|
|
|
|
|
- if (lastRecord.OP302_GluingSpeed != 0.0f || lastRecord.OP302_PressureA != 0.0f || lastRecord.OP302_PressureB != 0.0f ||
|
|
|
+ if (lastRecord.OP302_GluingSpeed != 0.0f || lastRecord.OP302_PressureAB != 0.0f ||
|
|
|
lastRecord.OP302_PressureDifferenceAB != 0.0f || lastRecord.OP302_ProductHeightInfo != 0.0f ||
|
|
|
lastRecord.OP302_PeriodicWeightData != 0.0f || lastRecord.OP302_RemainingGlueAmount != 0.0f)
|
|
|
{
|
|
|
- logNet.WriteError("OP302错误:即将插入的数据存在值不为空,插入失败,请按标准操作!");
|
|
|
- return new ResponseMessage { result = false, text = "OP302错误:即将插入的数据存在值不为空,插入失败,请按标准操作!" };
|
|
|
+ logNet.WriteError("OP302记录插入出错:即将插入的行数据已存在,插入失败!");
|
|
|
+ return new ResponseMessage { result = false, text = "OP302记录插入出错:即将插入的行数据已存在,插入失败!" };
|
|
|
}
|
|
|
|
|
|
lastRecord.OP302_GluingSpeed = gluingSpeed; // 供胶速度
|
|
|
- lastRecord.OP302_PressureA = pressureA; // A管气压
|
|
|
- lastRecord.OP302_PressureB = pressureB; // B管气压
|
|
|
+ lastRecord.OP302_PressureAB = pressureAB; // AB管气压
|
|
|
lastRecord.OP302_PressureDifferenceAB = pressureDifferenceAB; // AB管气压差
|
|
|
lastRecord.OP302_ProductHeightInfo = productHeightInfo; // 产品测高信息
|
|
|
lastRecord.OP302_PeriodicWeightData = periodicWeightData; // 定期称重数据
|
|
@@ -911,8 +894,7 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
|
|
|
db.Updateable(lastRecord)
|
|
|
.UpdateColumns(x => new {
|
|
|
x.OP302_GluingSpeed,
|
|
|
- x.OP302_PressureA,
|
|
|
- x.OP302_PressureB,
|
|
|
+ x.OP302_PressureAB,
|
|
|
x.OP302_PressureDifferenceAB,
|
|
|
x.OP302_ProductHeightInfo,
|
|
|
x.OP302_PeriodicWeightData,
|
|
@@ -929,43 +911,66 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
|
|
|
}
|
|
|
|
|
|
// op40向testdata表格插入数据
|
|
|
- public static ResponseMessage InsertOp40Data( string gluePosition, float glueLineArea,
|
|
|
- float glueLineHeight, string inspectionImagePath)
|
|
|
+ public static ResponseMessage InsertOp40Data(string carrierCode, string productBarcode, float gluePosx, float gluePosy, float glueLineArea,
|
|
|
+ float glueLineHeight,int result, string inspectionImagePath)
|
|
|
{
|
|
|
- // 检查上一次插入的记录是否存在
|
|
|
+ //// 检查上一次插入的记录是否存在
|
|
|
+ //var lastRecord = db.Queryable<TestData>()
|
|
|
+ // .Where(x => x.OP302_GluingSpeed != 0.0f && x.OP302_PressureAB != 0.0f &&
|
|
|
+ // x.OP302_PressureDifferenceAB != 0.0f && x.OP302_ProductHeightInfo != 0.0f &&
|
|
|
+ // x.OP302_PeriodicWeightData != 0.0f && x.OP302_RemainingGlueAmount != 0.0f) // 只查找有效插入的数据
|
|
|
+ // .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
+ // .Take(1) // 只取一条记录
|
|
|
+ // .First(); // 获取第一条记录,若没有则返回null
|
|
|
+
|
|
|
+ //if (lastRecord == null)
|
|
|
+ //{
|
|
|
+ // logNet.WriteError("OP40错误:OP302插入的记录存在值为空!");
|
|
|
+ // return new ResponseMessage { result = false, text = "OP40错误:OP302插入的记录存在值为空!" };
|
|
|
+ //}
|
|
|
+
|
|
|
+ //if (lastRecord.OP40_GluePosition != "" || lastRecord.OP40_GlueLineArea != 0.0f ||
|
|
|
+ // lastRecord.OP40_GlueLineHeight != 0.0f || lastRecord.OP40_InspectionImagePath != "")
|
|
|
+ //{
|
|
|
+ // logNet.WriteError("OP40错误:即将插入的数据存在值不为空,插入失败,请按标准操作!");
|
|
|
+ // return new ResponseMessage { result = false, text = "OP40错误:即将插入的数据存在值不为空,插入失败,请按标准操作!" };
|
|
|
+ //}
|
|
|
+
|
|
|
var lastRecord = db.Queryable<TestData>()
|
|
|
- .Where(x => x.OP302_GluingSpeed != 0.0f && x.OP302_PressureA != 0.0f && x.OP302_PressureB != 0.0f &&
|
|
|
- x.OP302_PressureDifferenceAB != 0.0f && x.OP302_ProductHeightInfo != 0.0f &&
|
|
|
- x.OP302_PeriodicWeightData != 0.0f && x.OP302_RemainingGlueAmount != 0.0f) // 只查找有效插入的数据
|
|
|
- .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
- .Take(1) // 只取一条记录
|
|
|
- .First(); // 获取第一条记录,若没有则返回null
|
|
|
+ .Where(x => x.CarrierCode == carrierCode && x.ProductBarcode == productBarcode)
|
|
|
+ .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
+ .Take(1) // 只取一条记录
|
|
|
+ .First(); // 获取第一条记录,若没有则返回null
|
|
|
|
|
|
if (lastRecord == null)
|
|
|
{
|
|
|
- logNet.WriteError("OP40错误:OP302插入的记录存在值为空!");
|
|
|
- return new ResponseMessage { result = false, text = "OP40错误:OP302插入的记录存在值为空!" };
|
|
|
+ logNet.WriteError("OP40记录插入错误:MES主数据未成功创建,无法插入OP40数据!");
|
|
|
+ return new ResponseMessage { result = false, text = "OP40记录插入错误:MES主数据未成功创建,无法插入OP20数据!" };
|
|
|
}
|
|
|
|
|
|
- if (lastRecord.OP40_GluePosition != "" || lastRecord.OP40_GlueLineArea != 0.0f ||
|
|
|
- lastRecord.OP40_GlueLineHeight != 0.0f || lastRecord.OP40_InspectionImagePath != "")
|
|
|
+ if (lastRecord.OP40_GluePosX != 0.0f || lastRecord.OP40_GluePosY != 0.0f || lastRecord.OP40_GlueLineArea != 0.0f ||
|
|
|
+ lastRecord.OP40_GlueLineHeight != 0.0f || lastRecord.OP40_Result != 0 || lastRecord.OP40_InspectionImagePath != "")
|
|
|
{
|
|
|
- logNet.WriteError("OP40错误:即将插入的数据存在值不为空,插入失败,请按标准操作!");
|
|
|
- return new ResponseMessage { result = false, text = "OP40错误:即将插入的数据存在值不为空,插入失败,请按标准操作!" };
|
|
|
+ logNet.WriteError("OP40记录插入出错:即将插入的行数据已存在,插入失败!");
|
|
|
+ return new ResponseMessage { result = false, text = "OP40记录插入出错:即将插入的行数据已存在,插入失败!" };
|
|
|
}
|
|
|
|
|
|
- lastRecord.OP40_GluePosition = gluePosition; // 点胶位置
|
|
|
+ lastRecord.OP40_GluePosX = gluePosx; // 胶线位置X偏差
|
|
|
+ lastRecord.OP40_GluePosY = gluePosy; // 胶线位置Y偏差
|
|
|
lastRecord.OP40_GlueLineArea = glueLineArea; // 胶线面积
|
|
|
lastRecord.OP40_GlueLineHeight = glueLineHeight; // 胶线高度
|
|
|
+ lastRecord.OP40_Result = result; // 胶线检测结果
|
|
|
lastRecord.OP40_InspectionImagePath = inspectionImagePath; // 检测图片路径
|
|
|
|
|
|
try
|
|
|
{
|
|
|
db.Updateable(lastRecord)
|
|
|
.UpdateColumns(x => new {
|
|
|
- x.OP40_GluePosition,
|
|
|
+ x.OP40_GluePosX,
|
|
|
+ x.OP40_GluePosY,
|
|
|
x.OP40_GlueLineArea,
|
|
|
x.OP40_GlueLineHeight,
|
|
|
+ x.OP40_Result,
|
|
|
x.OP40_InspectionImagePath
|
|
|
}).ExecuteCommand();
|
|
|
logNet.WriteError("OP40记录插入成功!");
|
|
@@ -979,13 +984,13 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
|
|
|
}
|
|
|
|
|
|
//OP50 往product塞数据
|
|
|
- public static ResponseMessage InsertOp50Product( string CarrierCode,string ProductBarcode, string addPCB_Barcode)
|
|
|
+ public static ResponseMessage InsertOp50Product( string carrierCode,string productBarcode, string addPCB_Barcode)
|
|
|
{
|
|
|
|
|
|
#region 往productBind表格中插入addPCB_Barcode数据
|
|
|
// 检查上一次插入的记录是否存在
|
|
|
var productBind_lastRecord = db.Queryable<ProductBind>()
|
|
|
- .Where(x => x.CarrierCode == CarrierCode && x.ProductBarcode == ProductBarcode && x.BindOrder != 0)
|
|
|
+ .Where(x => x.CarrierCode == carrierCode && x.ProductBarcode == productBarcode && x.BindOrder != 0)
|
|
|
.OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
.Take(1) // 只取一条记录
|
|
|
.First(); // 获取第一条记录,若没有则返回null
|
|
@@ -1010,58 +1015,70 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
|
|
|
.UpdateColumns(x => new {
|
|
|
x.AddPCB_Barcode
|
|
|
}).ExecuteCommand();
|
|
|
- logNet.WriteError("OP50往ProductBind表中插入AddPCB_Barcode成功!");
|
|
|
- return new ResponseMessage { result = false, text = "OP50往ProductBind表中插入AddPCB_Barcode成功!" };
|
|
|
+ logNet.WriteError("OP50部件码绑定产品码成功!");
|
|
|
+ return new ResponseMessage { result = false, text = "OP50部件码绑定产品码成功!" };
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- logNet.WriteError("OP50往ProductBind表中插入AddPCB_Barcode出错!错误码:" + ex.Message);
|
|
|
- return new ResponseMessage { result = false, text = "OP50往ProductBind表中插入AddPCB_Barcode出错!错误码:" + ex.Message };
|
|
|
+ logNet.WriteError("OP50部件码绑定产品码失败!错误码:" + ex.Message);
|
|
|
+ return new ResponseMessage { result = false, text = "OP50部件码绑定产品码失败!错误码:" + ex.Message };
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
|
|
|
// op50向testdata表格插入数据
|
|
|
- public static ResponseMessage InsertOp50Data(string CarrierCode,string ProductBarcode,string addPCB_Barcode, int assemblyStatus,
|
|
|
- string reinspectionImagePath, int addBoardStatus, float addBoardPressure)
|
|
|
+ public static ResponseMessage InsertOp50Data(string carrierCode,string productBarcode,int assemblyStatus,
|
|
|
+ int addBoardStatus, float addBoardPressure,int remainCount, string reinspectionImagePath)
|
|
|
{
|
|
|
// 检查上一次插入的记录是否存在
|
|
|
+ //var lastRecord = db.Queryable<TestData>()
|
|
|
+ // .Where(x => x.CarrierCode == CarrierCode && x.ProductBarcode == ProductBarcode && x.OP40_GluePosition != "" && x.OP40_GlueLineArea != 0.0f &&
|
|
|
+ // x.OP40_GlueLineHeight != 0.0f && x.OP40_InspectionImagePath != "") // 只查找有效插入的数据
|
|
|
+ // .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
+ // .Take(1) // 只取一条记录
|
|
|
+ // .First(); // 获取第一条记录,若没有则返回null
|
|
|
+
|
|
|
+ //if (lastRecord == null)
|
|
|
+ //{
|
|
|
+ // logNet.WriteError("OP50错误:OP40插入的记录存在值为空!");
|
|
|
+ // return new ResponseMessage { result = false, text = "OP50错误:OP40插入的记录存在值为空!!" };
|
|
|
+
|
|
|
+
|
|
|
var lastRecord = db.Queryable<TestData>()
|
|
|
- .Where(x => x.CarrierCode == CarrierCode && x.ProductBarcode == ProductBarcode && x.OP40_GluePosition != "" && x.OP40_GlueLineArea != 0.0f &&
|
|
|
- x.OP40_GlueLineHeight != 0.0f && x.OP40_InspectionImagePath != "") // 只查找有效插入的数据
|
|
|
- .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
- .Take(1) // 只取一条记录
|
|
|
- .First(); // 获取第一条记录,若没有则返回null
|
|
|
+ .Where(x => x.CarrierCode == carrierCode && x.ProductBarcode == productBarcode)
|
|
|
+ .OrderBy(x => x.ID, OrderByType.Desc) // 按照ID降序查找最新记录
|
|
|
+ .Take(1) // 只取一条记录
|
|
|
+ .First(); // 获取第一条记录,若没有则返回null
|
|
|
|
|
|
if (lastRecord == null)
|
|
|
{
|
|
|
- logNet.WriteError("OP50错误:OP40插入的记录存在值为空!");
|
|
|
- return new ResponseMessage { result = false, text = "OP50错误:OP40插入的记录存在值为空!!" };
|
|
|
+ logNet.WriteError("OP50记录插入错误:MES主数据未成功创建,无法插入OP40数据!");
|
|
|
+ return new ResponseMessage { result = false, text = "OP50记录插入错误:MES主数据未成功创建,无法插入OP20数据!" };
|
|
|
}
|
|
|
|
|
|
- if (lastRecord.AddPCB_Barcode != "" || lastRecord.OP50_AssemblyStatus != 2 || lastRecord.OP50_ReinspectionImagePath != "" ||
|
|
|
+ if ( lastRecord.OP50_AssemblyStatus != 2 || lastRecord.OP50_ReinspectionImagePath != "" ||
|
|
|
lastRecord.OP50_AddBoardStatus != 2 || lastRecord.OP50_AddBoardPressure != 0.0f)
|
|
|
{
|
|
|
logNet.WriteError("OP50错误:即将插入的数据存在值不为空,插入失败,请按标准操作!");
|
|
|
return new ResponseMessage { result = false, text = "OP50错误:即将插入的数据存在值不为空,插入失败,请按标准操作!" };
|
|
|
}
|
|
|
|
|
|
- lastRecord.AddPCB_Barcode = addPCB_Barcode;
|
|
|
lastRecord.OP50_AssemblyStatus = assemblyStatus; // 组装是否到位
|
|
|
- lastRecord.OP50_ReinspectionImagePath = reinspectionImagePath; // 设备复检图片路径
|
|
|
lastRecord.OP50_AddBoardStatus = addBoardStatus; // ADD板有无
|
|
|
lastRecord.OP50_AddBoardPressure = addBoardPressure; // ADD板压合压力
|
|
|
+ lastRecord.OP50_RemainCount = remainCount; // ADD板余料数
|
|
|
+ lastRecord.OP50_ReinspectionImagePath = reinspectionImagePath; // ADD板余料数
|
|
|
|
|
|
try
|
|
|
{
|
|
|
db.Updateable(lastRecord)
|
|
|
.UpdateColumns(x => new {
|
|
|
- x.AddPCB_Barcode,
|
|
|
x.OP50_AssemblyStatus,
|
|
|
- x.OP50_ReinspectionImagePath,
|
|
|
x.OP50_AddBoardStatus,
|
|
|
- x.OP50_AddBoardPressure
|
|
|
+ x.OP50_AddBoardPressure,
|
|
|
+ x.OP50_RemainCount,
|
|
|
+ x.OP50_ReinspectionImagePath
|
|
|
}).ExecuteCommand();
|
|
|
logNet.WriteError("OP50记录插入成功!");
|
|
|
return new ResponseMessage { result = true, text = "OP50记录插入成功!" };
|
|
@@ -1278,21 +1295,21 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
|
|
|
public int BindOrder { get; set; } = 0; // 绑定顺序
|
|
|
|
|
|
//op10
|
|
|
- public int OP10_ThrowingAmount { get; set; } = 0; // 抛料数量
|
|
|
- public float OP10_CleaningPower { get; set; } = 0.0f; // 清洗功率
|
|
|
+ public int OP10_ThrowingAmount { get; set; } = 0; // 抛料数量 // 清洗功率
|
|
|
public float OP10_CleaningPressure { get; set; } = 0.0f; // 清洗气压
|
|
|
public float OP10_CleaningSpeed { get; set; } = 0.0f; // 清洗速度
|
|
|
public float OP10_AirKnifeHeight { get; set; } = 0.0f; // 风刀高度
|
|
|
public float OP10_CleaningTime { get; set; } = 0.0f; // 清洗时间
|
|
|
public int OP10_CleaningCount { get; set; } = 0; // 清洗次数
|
|
|
+ public int OP10_RemainCount { get; set; } = 0; // 外壳体余料数
|
|
|
|
|
|
//op20
|
|
|
- public int OP20_ThrowingAmount { get; set; } = 0; // 抛料数量
|
|
|
+ public int OP20_ThrowCount { get; set; } = 0; // 抛料数量
|
|
|
+ public int OP20_RemainCount { get; set; } = 0; // 上盖余料数
|
|
|
|
|
|
//op301
|
|
|
public float OP301_GluingSpeed { get; set; } = 0.0f; // 供胶速度
|
|
|
- public float OP301_PressureA { get; set; } = 0.0f; // A管气压
|
|
|
- public float OP301_PressureB { get; set; } = 0.0f; // B管气压
|
|
|
+ public float OP301_PressureAB { get; set; } = 0.0f; // A管气压
|
|
|
public float OP301_PressureDifferenceAB { get; set; } = 0.0f; // AB管气压差
|
|
|
public float OP301_ProductHeightInfo { get; set; } = 0.0f; // 产品测高信息
|
|
|
public float OP301_PeriodicWeightData { get; set; } = 0.0f; // 定期称重数据
|
|
@@ -1300,30 +1317,32 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'订单信息
|
|
|
|
|
|
//op302
|
|
|
public float OP302_GluingSpeed { get; set; } = 0.0f; // 供胶速度
|
|
|
- public float OP302_PressureA { get; set; } = 0.0f; // A管气压
|
|
|
- public float OP302_PressureB { get; set; } = 0.0f; // B管气压
|
|
|
+ public float OP302_PressureAB { get; set; } = 0.0f; // A管气压
|
|
|
public float OP302_PressureDifferenceAB { get; set; } = 0.0f; // AB管气压差
|
|
|
public float OP302_ProductHeightInfo { get; set; } = 0.0f; // 产品测高信息
|
|
|
public float OP302_PeriodicWeightData { get; set; } = 0.0f; // 定期称重数据
|
|
|
public float OP302_RemainingGlueAmount { get; set; } = 0.0f; // 剩余胶量
|
|
|
|
|
|
//op40
|
|
|
- public string OP40_GluePosition { get; set; } = ""; // 点胶位置
|
|
|
+ public float OP40_GluePosX { get; set; } = 0.0f; // 胶线位置X偏差
|
|
|
+ public float OP40_GluePosY { get; set; } = 0.0f; // 胶线位置Y偏差
|
|
|
public float OP40_GlueLineArea { get; set; } = 0.0f; // 胶线面积
|
|
|
public float OP40_GlueLineHeight { get; set; } = 0.0f; // 胶线高度
|
|
|
+ public int OP40_Result { get; set; } = 0; // 胶线检测结果 1:OK 非1:NG
|
|
|
public string OP40_InspectionImagePath { get; set; } = ""; // 检测图片路径
|
|
|
|
|
|
//op50
|
|
|
- public int OP50_AssemblyStatus { get; set; } = 2; // 组装是否到位
|
|
|
+ public int OP50_AssemblyStatus { get; set; } = 0; // 组装是否到位
|
|
|
public string OP50_ReinspectionImagePath { get; set; } = ""; // 设备复检图片路径
|
|
|
- public int OP50_AddBoardStatus { get; set; } = 2; // ADD板有无
|
|
|
+ public int OP50_AddBoardStatus { get; set; } = 0; // ADD板有无
|
|
|
+ public int OP50_RemainCount { get; set; } = 0; // ADD板余料数
|
|
|
public float OP50_AddBoardPressure { get; set; } = 0.0f; // ADD板压合压力
|
|
|
|
|
|
//op60
|
|
|
- public int OP60_AssemblyStatus { get; set; } = 2; // 组装是否到位
|
|
|
- public string OP60_ReinspectionImagePath { get; set; } = ""; // 设备复检图片路径
|
|
|
- public int OP60_TopCoverStatus { get; set; } = 2; // 上盖板有无
|
|
|
+ public int OP60_AssemblyStatus { get; set; } = 0; // 组装是否到位
|
|
|
+ public int OP60_TopCoverStatus { get; set; } = 0; // 上盖板有无
|
|
|
public float OP60_TopCoverPressure { get; set; } = 0.0f; // 上盖板压合压力
|
|
|
+ public string OP60_ReinspectionImagePath { get; set; } = ""; // 设备复检图片路径
|
|
|
|
|
|
//op701
|
|
|
public string OP701_TorqueCurveDataPath { get; set; } = ""; // 扭力曲线数据表位置
|