|
|
|
@ -23,7 +23,7 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 入库业务逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class OffLineBusiness
|
|
|
|
|
public class OffLineBusiness
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region 单例实现
|
|
|
|
@ -36,7 +36,7 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
//public OffLineBusiness(){}
|
|
|
|
|
// public OffLineBusiness(){}
|
|
|
|
|
|
|
|
|
|
#region 变量定义
|
|
|
|
|
public static OffLineInfo TempOffLineInfo = new OffLineInfo();
|
|
|
|
@ -71,7 +71,12 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
|
public delegate void RefreshScanMateriaCode(string materialCode, string materialName, string spaceName, string materialType);
|
|
|
|
|
public event RefreshScanMateriaCode RefreshScanMateriaCodeEvent;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取入库方向
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="materialType">物料类型</param>
|
|
|
|
|
public delegate string getDirection(string materialType);
|
|
|
|
|
public event getDirection getDirectioneEvent;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 变量定义
|
|
|
|
@ -82,17 +87,15 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async void test()
|
|
|
|
|
{
|
|
|
|
|
BaseOrderInfo order = await _baseOrderInfoServices.FirstAsync();
|
|
|
|
|
|
|
|
|
|
BaseOrderInfo order = await _baseOrderInfoServices.FirstAsync();
|
|
|
|
|
Console.WriteLine(order);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 处理条码
|
|
|
|
|
/// </summary>
|
|
|
|
@ -104,492 +107,516 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
bool BackResult = await HandleMaterialBarCode(code.Trim()); //处理条码信息
|
|
|
|
|
TempOffLineInfo.ReadFlag = 0;
|
|
|
|
|
if (BackResult == true)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// // 如果校验失败,下发报警
|
|
|
|
|
// if ("N".Equals(result.Substring(0, 1)))
|
|
|
|
|
//{
|
|
|
|
|
// sendPlcError();
|
|
|
|
|
// // 刷新页面提示信息 result.Substring(2)
|
|
|
|
|
// return false;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//3.分垛A,B库逻辑(先左边读到的条码分A库,右边读到的B库==>预留分库逻辑)
|
|
|
|
|
|
|
|
|
|
////4.下发plc信号
|
|
|
|
|
//bool flag = SendPlcPass();
|
|
|
|
|
//if (!flag)
|
|
|
|
|
//{
|
|
|
|
|
// log.Error("获取plc反馈失败");
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//Console.WriteLine(code);
|
|
|
|
|
//return;
|
|
|
|
|
//5.调条码系统保存入库接口SaveBarcodeInfo
|
|
|
|
|
string saveResult = await _productOffLineServices.SaveBarcodeInfo("333", "ILS_SORT", "11111", 1);
|
|
|
|
|
if (string.IsNullOrEmpty(saveResult) || "E".Equals(saveResult.Substring(0, 1)))
|
|
|
|
|
{
|
|
|
|
|
log.Error("条码系统保存接口出错");
|
|
|
|
|
sendPlcError();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//6.更新mes数据库完成数量和时间(BASE_ORDERINFO,PRODUCT_PLANINFO) 注意:查询的字段可能需要修改,确保数据一致
|
|
|
|
|
TempOffLineInfo.ProductRefreshFlag = true;
|
|
|
|
|
// 更新mes数据库
|
|
|
|
|
int a = await _offLineInfoServices.AddAsync(TempOffLineInfo);
|
|
|
|
|
log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo.ProductOrderNo.Replace("0000", ""), TempOffLineInfo.OrderQty));
|
|
|
|
|
if (a > 0)
|
|
|
|
|
{
|
|
|
|
|
// 先查询分垛方向A或者B eg:000000009001000718
|
|
|
|
|
string direction = getDirectioneEvent?.Invoke(TempOffLineInfo.ProductCode.Replace("00000000", ""));
|
|
|
|
|
|
|
|
|
|
//6.1截取订单号去查询更新BASE_ORDERINFO,全放到service处理
|
|
|
|
|
string orderCode = "11215484";
|
|
|
|
|
List<BaseOrderInfo> orders = await _baseOrderInfoServices.QueryAsync(x => x.OrderCode == orderCode);
|
|
|
|
|
BaseOrderInfo order = orders.FirstOrDefault();
|
|
|
|
|
if (order.CompleteAmount == 0)
|
|
|
|
|
{
|
|
|
|
|
order.CompleteAmount++;
|
|
|
|
|
order.BeginDate = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
|
if (order.CompleteAmount == order.OrderAmount)
|
|
|
|
|
{
|
|
|
|
|
order.EndDate = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
|
order.UpdatedTime = DateTime.Now;
|
|
|
|
|
_baseOrderInfoServices.UpdateAsync(order);
|
|
|
|
|
//6.2根据订单号去更新PRODUCT_PLANINFO
|
|
|
|
|
List<ProductPlanInfo> productInfos = await _productPlanInfoServices.QueryAsync(x => x.OrderCode == orderCode);
|
|
|
|
|
ProductPlanInfo productInfo = productInfos.FirstOrDefault();
|
|
|
|
|
if (productInfo.CompleteAmount == 0)
|
|
|
|
|
{
|
|
|
|
|
productInfo.CompleteAmount++;
|
|
|
|
|
productInfo.BeginTime = DateTime.Now;
|
|
|
|
|
// DownLoadPassFlag(BackResult); //下发plc放行信号,分垛AB库
|
|
|
|
|
TempOffLineInfo.ReadFlag = 1; //放行成功
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.ReadFlag = 2; //保存条码失败
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (productInfo.CompleteAmount == productInfo.PlanAmount)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
productInfo.EndTime = DateTime.Now;
|
|
|
|
|
log.Info("条码验证失败");
|
|
|
|
|
TempOffLineInfo.ReadFlag = 3; // 条码验证失败
|
|
|
|
|
}
|
|
|
|
|
productInfo.UpdatedTime = DateTime.Now;
|
|
|
|
|
await _productPlanInfoServices.UpdateAsync(productInfo);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 去条码系统查询校验并保存
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="BarCode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<bool> HandleMaterialBarCode(string BarCode)
|
|
|
|
|
|
|
|
|
|
// // 如果校验失败,下发报警
|
|
|
|
|
// if ("N".Equals(result.Substring(0, 1)))
|
|
|
|
|
//{
|
|
|
|
|
// sendPlcError();
|
|
|
|
|
// // 刷新页面提示信息 result.Substring(2)
|
|
|
|
|
// return false;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//3.分垛A,B库逻辑(先左边读到的条码分A库,右边读到的B库==>预留分库逻辑)
|
|
|
|
|
|
|
|
|
|
////4.下发plc信号
|
|
|
|
|
//bool flag = SendPlcPass();
|
|
|
|
|
//if (!flag)
|
|
|
|
|
//{
|
|
|
|
|
// log.Error("获取plc反馈失败");
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//Console.WriteLine(code);
|
|
|
|
|
//return;
|
|
|
|
|
//5.调条码系统保存入库接口SaveBarcodeInfo
|
|
|
|
|
//string saveResult = await _productOffLineServices.SaveBarcodeInfo("333", "ILS_SORT", "11111", 1);
|
|
|
|
|
//if (string.IsNullOrEmpty(saveResult) || "E".Equals(saveResult.Substring(0, 1)))
|
|
|
|
|
//{
|
|
|
|
|
// log.Error("条码系统保存接口出错");
|
|
|
|
|
// sendPlcError();
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
////6.更新mes数据库完成数量和时间(BASE_ORDERINFO,PRODUCT_PLANINFO) 注意:查询的字段可能需要修改,确保数据一致
|
|
|
|
|
|
|
|
|
|
////6.1截取订单号去查询更新BASE_ORDERINFO,全放到service处理
|
|
|
|
|
//string orderCode = "11215484";
|
|
|
|
|
//List<BaseOrderInfo> orders = await _baseOrderInfoServices.QueryAsync(x => x.OrderCode == orderCode);
|
|
|
|
|
//BaseOrderInfo order = orders.FirstOrDefault();
|
|
|
|
|
//if (order.CompleteAmount == 0)
|
|
|
|
|
//{
|
|
|
|
|
// order.CompleteAmount++;
|
|
|
|
|
// order.BeginDate = DateTime.Now;
|
|
|
|
|
//}
|
|
|
|
|
//if (order.CompleteAmount == order.OrderAmount)
|
|
|
|
|
//{
|
|
|
|
|
// order.EndDate = DateTime.Now;
|
|
|
|
|
//}
|
|
|
|
|
//order.UpdatedTime = DateTime.Now;
|
|
|
|
|
//_baseOrderInfoServices.UpdateAsync(order);
|
|
|
|
|
////6.2根据订单号去更新PRODUCT_PLANINFO
|
|
|
|
|
//List<ProductPlanInfo> productInfos = await _productPlanInfoServices.QueryAsync(x => x.OrderCode == orderCode);
|
|
|
|
|
//ProductPlanInfo productInfo = productInfos.FirstOrDefault();
|
|
|
|
|
//if (productInfo.CompleteAmount == 0)
|
|
|
|
|
//{
|
|
|
|
|
// productInfo.CompleteAmount++;
|
|
|
|
|
// productInfo.BeginTime = DateTime.Now;
|
|
|
|
|
//}
|
|
|
|
|
//if (productInfo.CompleteAmount == productInfo.PlanAmount)
|
|
|
|
|
//{
|
|
|
|
|
// productInfo.EndTime = DateTime.Now;
|
|
|
|
|
//}
|
|
|
|
|
//productInfo.UpdatedTime = DateTime.Now;
|
|
|
|
|
//await _productPlanInfoServices.UpdateAsync(productInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 去条码系统查询校验并保存
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="BarCode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<bool> HandleMaterialBarCode(string BarCode)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.ProductSNCode = BarCode.Trim(); //SN码
|
|
|
|
|
TempOffLineInfo.ProductScanTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
TempOffLineInfo.ProductSNCode = BarCode.Trim(); //SN码
|
|
|
|
|
TempOffLineInfo.ProductScanTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
TempOffLineInfo.ProductOrderNo = "";
|
|
|
|
|
log.Info("条码验证开始:" + BarCode);
|
|
|
|
|
TempOffLineInfo.ProductOrderNo = "";
|
|
|
|
|
log.Info("条码验证开始:" + BarCode);
|
|
|
|
|
|
|
|
|
|
//1.查询条码系统
|
|
|
|
|
string result = await _productOffLineServices.QueryChecked(BarCode);
|
|
|
|
|
// string result = "Y@1104@16160030000000910780@000010034895@@ @000000@000000009000000807@BCD-160C,家电下乡@@BCD-160C@皓月白-家电下乡@161601300@160@1-00版@家电下乡产品@默认@2010-09-01";
|
|
|
|
|
//1.查询条码系统
|
|
|
|
|
string result = await _productOffLineServices.QueryChecked(BarCode);
|
|
|
|
|
// string result = "Y@1104@16160030000000910780@000010034895@@ @000000@000000009000000807@BCD-160C,家电下乡@@BCD-160C@皓月白-家电下乡@161601300@160@1-00版@家电下乡产品@默认@2010-09-01";
|
|
|
|
|
|
|
|
|
|
//查询到的数据分割处理,结果中用"@"号分隔,刷新页面显示
|
|
|
|
|
string[] FArrayList = result.Split('@');
|
|
|
|
|
if (FArrayList[0].ToUpper() == "Y") //查询数据成功
|
|
|
|
|
{
|
|
|
|
|
//查询到的数据分割处理,结果中用"@"号分隔,刷新页面显示
|
|
|
|
|
string[] FArrayList = result.Split('@');
|
|
|
|
|
if (FArrayList[0].ToUpper() == "Y") //查询数据成功
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
log.Info(BarCode + "成功返回验证信息:" + result);
|
|
|
|
|
#region 实体赋值
|
|
|
|
|
TempOffLineInfo.MsgInfo = "获取信息成功" + BarCode + " 返回值:" + FArrayList[0].ToUpper();
|
|
|
|
|
TempOffLineInfo.ProductFactoryCode = FArrayList[1];
|
|
|
|
|
TempOffLineInfo.ProductSNCode = FArrayList[2];
|
|
|
|
|
TempOffLineInfo.ProductOrderNo = DBToString(FArrayList[3]);
|
|
|
|
|
TempOffLineInfo.ProductSaleNo = DBToString(FArrayList[4]);
|
|
|
|
|
TempOffLineInfo.ProductSaleLineNo = DBToString(FArrayList[5]);
|
|
|
|
|
TempOffLineInfo.ProductCheckInfo = DBToString(FArrayList[6]); //验证组合
|
|
|
|
|
TempOffLineInfo.ProductCode = DBToString(FArrayList[7]);
|
|
|
|
|
TempOffLineInfo.ProductName = DBToString(FArrayList[8]); //产品描述
|
|
|
|
|
TempOffLineInfo.ProductType = FArrayList[9];
|
|
|
|
|
TempOffLineInfo.ProductModel = FArrayList[10]; //产品型号
|
|
|
|
|
TempOffLineInfo.ProductRemark = DBToString(FArrayList[11]);
|
|
|
|
|
TempOffLineInfo.ProductBarNo = FArrayList[12];
|
|
|
|
|
TempOffLineInfo.ProductMasterModel = FArrayList[13]; //产品主型号
|
|
|
|
|
TempOffLineInfo.ProductVersion = FArrayList[14];
|
|
|
|
|
TempOffLineInfo.ProductUseInfo = FArrayList[15];//产品用途
|
|
|
|
|
TempOffLineInfo.ProductCirculate = FArrayList[16];//流通特性
|
|
|
|
|
TempOffLineInfo.ProductCreateDate = FArrayList[17];
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
// 多码系统校验,是否需要待定,现场看情况
|
|
|
|
|
bool flag = TestBarCode(TempOffLineInfo);
|
|
|
|
|
if (!flag)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证通过!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
log.Info(BarCode + "成功返回验证信息:" + result);
|
|
|
|
|
#region 实体赋值
|
|
|
|
|
TempOffLineInfo.MsgInfo = "获取信息成功" + BarCode + " 返回值:" + FArrayList[0].ToUpper();
|
|
|
|
|
TempOffLineInfo.ProductFactoryCode = FArrayList[1];
|
|
|
|
|
TempOffLineInfo.ProductSNCode = FArrayList[2];
|
|
|
|
|
TempOffLineInfo.ProductOrderNo = DBToString(FArrayList[3]);
|
|
|
|
|
TempOffLineInfo.ProductSaleNo = DBToString(FArrayList[4]);
|
|
|
|
|
TempOffLineInfo.ProductSaleLineNo = DBToString(FArrayList[5]);
|
|
|
|
|
TempOffLineInfo.ProductCheckInfo = DBToString(FArrayList[6]); //验证组合
|
|
|
|
|
TempOffLineInfo.ProductCode = DBToString(FArrayList[7]);
|
|
|
|
|
TempOffLineInfo.ProductName = DBToString(FArrayList[8]); //产品描述
|
|
|
|
|
TempOffLineInfo.ProductType = FArrayList[9];
|
|
|
|
|
TempOffLineInfo.ProductModel = FArrayList[10]; //产品型号
|
|
|
|
|
TempOffLineInfo.ProductRemark = DBToString(FArrayList[11]);
|
|
|
|
|
TempOffLineInfo.ProductBarNo = FArrayList[12];
|
|
|
|
|
TempOffLineInfo.ProductMasterModel = FArrayList[13]; //产品主型号
|
|
|
|
|
TempOffLineInfo.ProductVersion = FArrayList[14];
|
|
|
|
|
TempOffLineInfo.ProductUseInfo = FArrayList[15];//产品用途
|
|
|
|
|
TempOffLineInfo.ProductCirculate = FArrayList[16];//流通特性
|
|
|
|
|
TempOffLineInfo.ProductCreateDate = FArrayList[17];
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
// 多码系统校验,是否需要待定,现场看情况
|
|
|
|
|
bool flag = TestBarCode(TempOffLineInfo);
|
|
|
|
|
if (!flag)
|
|
|
|
|
{
|
|
|
|
|
log.Info(BarCode + "失败返回验证信息:" + FArrayList[1]);
|
|
|
|
|
#region 实体赋值
|
|
|
|
|
TempOffLineInfo.ProductDataFlag = true;
|
|
|
|
|
TempOffLineInfo.MsgAlarmFlag = true;
|
|
|
|
|
TempOffLineInfo.MsgInfo = "获取信息失败. " + BarCode + " 返回值:" + FArrayList[0].ToString();
|
|
|
|
|
TempOffLineInfo.ProductOrderNo = "";
|
|
|
|
|
TempOffLineInfo.ProductSaleNo = "";
|
|
|
|
|
TempOffLineInfo.ProductSaleLineNo = "";
|
|
|
|
|
TempOffLineInfo.ProductCheckInfo = ""; //验证组合
|
|
|
|
|
TempOffLineInfo.ProductCode = "";
|
|
|
|
|
TempOffLineInfo.ProductName = ""; //产品描述
|
|
|
|
|
TempOffLineInfo.ProductType = "";
|
|
|
|
|
TempOffLineInfo.ProductModel = ""; //产品型号
|
|
|
|
|
TempOffLineInfo.ProductRemark = "";
|
|
|
|
|
TempOffLineInfo.ProductBarNo = ""; ;
|
|
|
|
|
TempOffLineInfo.ProductMasterModel = ""; //产品主型号
|
|
|
|
|
TempOffLineInfo.ProductVersion = "";
|
|
|
|
|
TempOffLineInfo.ProductUseInfo = "";//产品用途
|
|
|
|
|
TempOffLineInfo.ProductCirculate = "";//流通特性
|
|
|
|
|
TempOffLineInfo.ProductCreateDate = "";
|
|
|
|
|
TempOffLineInfo.oneCode = "";
|
|
|
|
|
TempOffLineInfo.serialNumber = "";
|
|
|
|
|
TempOffLineInfo.rfid = "";
|
|
|
|
|
TempOffLineInfo.sim = "";
|
|
|
|
|
TempOffLineInfo.number1 = "";
|
|
|
|
|
#endregion
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// mes查询订单数据, 异常处理:后期可能根据SN码查箱体码,查订单号并检查更新订单数据
|
|
|
|
|
BaseOrderInfo order = await _baseOrderInfoServices.FirstAsync(x => x.OrderCode == TempOffLineInfo.ProductOrderNo.Replace("0000", ""));
|
|
|
|
|
//2.上传条码系统
|
|
|
|
|
if (!string.IsNullOrEmpty(TempOffLineInfo.ProductOrderNo))
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证通过!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Info(BarCode + "失败返回验证信息:" + FArrayList[1]);
|
|
|
|
|
#region 实体赋值
|
|
|
|
|
TempOffLineInfo.ProductDataFlag = true;
|
|
|
|
|
TempOffLineInfo.MsgAlarmFlag = true;
|
|
|
|
|
TempOffLineInfo.MsgInfo = "获取信息失败. " + BarCode + " 返回值:" + FArrayList[0].ToString();
|
|
|
|
|
TempOffLineInfo.ProductOrderNo = "";
|
|
|
|
|
TempOffLineInfo.ProductSaleNo = "";
|
|
|
|
|
TempOffLineInfo.ProductSaleLineNo = "";
|
|
|
|
|
TempOffLineInfo.ProductCheckInfo = ""; //验证组合
|
|
|
|
|
TempOffLineInfo.ProductCode = "";
|
|
|
|
|
TempOffLineInfo.ProductName = ""; //产品描述
|
|
|
|
|
TempOffLineInfo.ProductType = "";
|
|
|
|
|
TempOffLineInfo.ProductModel = ""; //产品型号
|
|
|
|
|
TempOffLineInfo.ProductRemark = "";
|
|
|
|
|
TempOffLineInfo.ProductBarNo = ""; ;
|
|
|
|
|
TempOffLineInfo.ProductMasterModel = ""; //产品主型号
|
|
|
|
|
TempOffLineInfo.ProductVersion = "";
|
|
|
|
|
TempOffLineInfo.ProductUseInfo = "";//产品用途
|
|
|
|
|
TempOffLineInfo.ProductCirculate = "";//流通特性
|
|
|
|
|
TempOffLineInfo.ProductCreateDate = "";
|
|
|
|
|
TempOffLineInfo.oneCode = "";
|
|
|
|
|
TempOffLineInfo.serialNumber = "";
|
|
|
|
|
TempOffLineInfo.rfid = "";
|
|
|
|
|
TempOffLineInfo.sim = "";
|
|
|
|
|
TempOffLineInfo.number1 = "";
|
|
|
|
|
#endregion
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// mes查询订单数据, 异常处理:后期可能根据SN码查箱体码,查订单号并检查更新订单数据
|
|
|
|
|
BaseOrderInfo order = await _baseOrderInfoServices.FirstAsync(x => x.OrderCode == TempOffLineInfo.ProductOrderNo.Replace("0000", ""));
|
|
|
|
|
//2.上传条码系统
|
|
|
|
|
if (!string.IsNullOrEmpty(TempOffLineInfo.ProductOrderNo))
|
|
|
|
|
{
|
|
|
|
|
string strSave = await _productOffLineServices.SaveBarcodeInfo(BarCode.Trim(), "ILS_SORT", TempOffLineInfo.ProductOrderNo, 1);
|
|
|
|
|
if (!string.IsNullOrEmpty(strSave))
|
|
|
|
|
{
|
|
|
|
|
string strSave = await _productOffLineServices.SaveBarcodeInfo(BarCode.Trim(), "ILS_SORT", TempOffLineInfo.ProductOrderNo, 1);
|
|
|
|
|
if (!string.IsNullOrEmpty(strSave))
|
|
|
|
|
if (strSave == "Y")
|
|
|
|
|
{
|
|
|
|
|
if (strSave == "Y")
|
|
|
|
|
{
|
|
|
|
|
log.Info(BarCode + "上传条码成功:" + strSave);
|
|
|
|
|
log.Info(BarCode + "上传条码成功:" + strSave);
|
|
|
|
|
|
|
|
|
|
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",上传条码成功" + strSave;
|
|
|
|
|
if (order != null)
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.OrderQty = order.OrderAmount;
|
|
|
|
|
TempOffLineInfo.ActQty = order.CompleteAmount;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",上传条码成功" + strSave;
|
|
|
|
|
if (order != null)
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.OrderQty = order.OrderAmount;
|
|
|
|
|
TempOffLineInfo.ActQty = order.CompleteAmount;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Info(BarCode + "上传条码失败:" + strSave);
|
|
|
|
|
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",上传条码失败" + strSave;
|
|
|
|
|
if (strSave.Contains("条码重复"))
|
|
|
|
|
{
|
|
|
|
|
log.Info(BarCode + "上传条码失败:" + strSave);
|
|
|
|
|
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",上传条码失败" + strSave;
|
|
|
|
|
if (strSave.Contains("条码重复"))
|
|
|
|
|
// 查询本地数据库是否有数据
|
|
|
|
|
OffLineInfo offLineInfo = await _offLineInfoServices.FirstAsync(x => x.ProductSNCode == BarCode);
|
|
|
|
|
if (offLineInfo != null)
|
|
|
|
|
{
|
|
|
|
|
// 查询本地数据库是否有数据
|
|
|
|
|
OffLineInfo offLineInfo = await _offLineInfoServices.FirstAsync(x => x.ProductSNCode == BarCode);
|
|
|
|
|
if (offLineInfo != null)
|
|
|
|
|
{
|
|
|
|
|
log.Info(BarCode + "条码重复,本地已存在");
|
|
|
|
|
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",上传条码失败" + strSave + "上传日期:" + DBToString(offLineInfo.ProductScanTime);
|
|
|
|
|
log.Info(BarCode + "条码重复,本地已存在");
|
|
|
|
|
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",上传条码失败" + strSave + "上传日期:" + DBToString(offLineInfo.ProductScanTime);
|
|
|
|
|
|
|
|
|
|
if (TempOffLineInfo.ChkOut == true)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (TempOffLineInfo.ChkOut == true)
|
|
|
|
|
{
|
|
|
|
|
log.Info(BarCode + "条码重复,本地不存在,已上传中");
|
|
|
|
|
await _offLineInfoServices.AddAsync(TempOffLineInfo);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Info(BarCode + "条码重复,本地不存在,已上传中");
|
|
|
|
|
await _offLineInfoServices.AddAsync(TempOffLineInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",生产单号异常";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.MsgInfo = "获取产品条码异常:" + ex.Message;
|
|
|
|
|
TempOffLineInfo.MsgAlarmFlag = true;
|
|
|
|
|
|
|
|
|
|
log.Info(BarCode + "条码验证异常:" + ex.Message.ToString());
|
|
|
|
|
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",生产单号异常";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.ProductRefreshFlag = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.MsgInfo = "获取产品条码异常:" + ex.Message;
|
|
|
|
|
TempOffLineInfo.MsgAlarmFlag = true;
|
|
|
|
|
|
|
|
|
|
log.Info(BarCode + "条码验证异常:" + ex.Message.ToString());
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.ProductRefreshFlag = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region plc交互
|
|
|
|
|
private SemaphoreSlim semaphore = new SemaphoreSlim(0);
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下发plc放行信号,根据接收到的scannerNo不同,两条道的plc信号地址也不同
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
|
private bool SendPlcPass(int scannerNo)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region plc交互
|
|
|
|
|
private SemaphoreSlim semaphore = new SemaphoreSlim(0);
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下发plc放行信号,根据接收到的scannerNo不同,两条道的plc信号地址也不同
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
|
private bool SendPlcPass(int scannerNo)
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
try
|
|
|
|
|
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
|
|
|
|
|
if (obj != null)
|
|
|
|
|
{
|
|
|
|
|
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
|
|
|
|
|
if (obj != null)
|
|
|
|
|
if (obj.plc.IsConnected)
|
|
|
|
|
{
|
|
|
|
|
if (obj.plc.IsConnected)
|
|
|
|
|
if (scannerNo == 1)
|
|
|
|
|
{
|
|
|
|
|
if (scannerNo == 1)
|
|
|
|
|
{
|
|
|
|
|
// 写入入库方向,两条道plc地址不同
|
|
|
|
|
obj.plc.WriteInt32("D100", scannerNo);
|
|
|
|
|
// 往plc写入放行信号
|
|
|
|
|
obj.plc.WriteInt32("D102", 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// 写入入库方向,两条道plc地址不同
|
|
|
|
|
obj.plc.WriteInt32("D200", scannerNo);
|
|
|
|
|
// 往plc写入放行信号
|
|
|
|
|
obj.plc.WriteInt32("D202", 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 等待plc反馈信号
|
|
|
|
|
waitPlcSignal(scannerNo);
|
|
|
|
|
// semaphore.Wait();
|
|
|
|
|
result = true;
|
|
|
|
|
// 写入入库方向,两条道plc地址不同
|
|
|
|
|
obj.plc.WriteInt32("D100", scannerNo);
|
|
|
|
|
// 往plc写入放行信号
|
|
|
|
|
obj.plc.WriteInt32("D102", 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Info("成品下线plc连接失败,请检查plc连接");
|
|
|
|
|
// 写入入库方向,两条道plc地址不同
|
|
|
|
|
obj.plc.WriteInt32("D200", scannerNo);
|
|
|
|
|
// 往plc写入放行信号
|
|
|
|
|
obj.plc.WriteInt32("D202", 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 等待plc反馈信号
|
|
|
|
|
waitPlcSignal(scannerNo);
|
|
|
|
|
// semaphore.Wait();
|
|
|
|
|
result = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Info("获取plc连接对象信息为空");
|
|
|
|
|
log.Info("成品下线plc连接失败,请检查plc连接");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Error("下发plc放行信号方法SendPlcPass()出现异常,ex:" + ex);
|
|
|
|
|
log.Info("获取plc连接对象信息为空");
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 读取plc放行反馈
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
|
private void waitPlcSignal(int scannerNo)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
bool isFlag = true;
|
|
|
|
|
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
|
|
|
|
|
log.Error("下发plc放行信号方法SendPlcPass()出现异常,ex:" + ex);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 读取plc放行反馈
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
|
private void waitPlcSignal(int scannerNo)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
bool isFlag = true;
|
|
|
|
|
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
|
|
|
|
|
|
|
|
|
|
if (obj != null && obj.plc.IsConnected)
|
|
|
|
|
if (obj != null && obj.plc.IsConnected)
|
|
|
|
|
{
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
do
|
|
|
|
|
if (scannerNo == 1)
|
|
|
|
|
{
|
|
|
|
|
if (scannerNo == 1)
|
|
|
|
|
// 读取plc反馈信号
|
|
|
|
|
if (obj.plc.ReadInt32("D102") == 2)
|
|
|
|
|
{
|
|
|
|
|
// 读取plc反馈信号
|
|
|
|
|
if (obj.plc.ReadInt32("D102") == 2)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("收到plc放行成功");
|
|
|
|
|
// 清空数据
|
|
|
|
|
obj.plc.WriteInt32("D100", 0);
|
|
|
|
|
obj.plc.WriteInt32("D102", 0);
|
|
|
|
|
isFlag = false;
|
|
|
|
|
}
|
|
|
|
|
Console.WriteLine("收到plc放行成功");
|
|
|
|
|
// 清空数据
|
|
|
|
|
obj.plc.WriteInt32("D100", 0);
|
|
|
|
|
obj.plc.WriteInt32("D102", 0);
|
|
|
|
|
isFlag = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// 读取plc反馈信号
|
|
|
|
|
if (obj.plc.ReadInt32("D202") == 2)
|
|
|
|
|
{
|
|
|
|
|
// 读取plc反馈信号
|
|
|
|
|
if (obj.plc.ReadInt32("D202") == 2)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("收到plc放行成功");
|
|
|
|
|
// 清空数据
|
|
|
|
|
obj.plc.WriteInt32("D200", 0);
|
|
|
|
|
obj.plc.WriteInt32("D202", 0);
|
|
|
|
|
isFlag = false;
|
|
|
|
|
}
|
|
|
|
|
Console.WriteLine("收到plc放行成功");
|
|
|
|
|
// 清空数据
|
|
|
|
|
obj.plc.WriteInt32("D200", 0);
|
|
|
|
|
obj.plc.WriteInt32("D202", 0);
|
|
|
|
|
isFlag = false;
|
|
|
|
|
}
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
|
} while (isFlag);
|
|
|
|
|
// 释放信号量
|
|
|
|
|
//semaphore.Release();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Info("成品下线plc连接失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
|
} while (isFlag);
|
|
|
|
|
// 释放信号量
|
|
|
|
|
//semaphore.Release();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Error("读取plc放行反馈方法waitPlcSignal()出现异常,ex:" + ex);
|
|
|
|
|
log.Info("成品下线plc连接失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
log.Error("读取plc放行反馈方法waitPlcSignal()出现异常,ex:" + ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下发plc报警信号
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void sendPlcError()
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下发plc报警信号
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void sendPlcError()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
|
|
|
|
|
if (obj != null)
|
|
|
|
|
{
|
|
|
|
|
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
|
|
|
|
|
if (obj != null)
|
|
|
|
|
if (obj.plc.IsConnected)
|
|
|
|
|
{
|
|
|
|
|
if (obj.plc.IsConnected)
|
|
|
|
|
{
|
|
|
|
|
// 下发报警信号
|
|
|
|
|
obj.plc.WriteInt32("D104", 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Info("成品下线plc连接失败,请检查plc连接");
|
|
|
|
|
}
|
|
|
|
|
// 下发报警信号
|
|
|
|
|
obj.plc.WriteInt32("D104", 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Info("获取plc连接对象信息为空");
|
|
|
|
|
log.Info("成品下线plc连接失败,请检查plc连接");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Error("下发plc放报警信号方法sendPlcError()出现异常,ex:" + ex);
|
|
|
|
|
log.Info("获取plc连接对象信息为空");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
log.Error("下发plc放报警信号方法sendPlcError()出现异常,ex:" + ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 工具方法
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="refData"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string DBToString(object refData)
|
|
|
|
|
#region 工具方法
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="refData"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string DBToString(object refData)
|
|
|
|
|
{
|
|
|
|
|
if (refData == null)
|
|
|
|
|
return "";
|
|
|
|
|
else
|
|
|
|
|
return refData == DBNull.Value ? "" : refData.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 多码系统校验
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="TempOffLineInfo"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool TestBarCode(OffLineInfo TempOffLineInfo)
|
|
|
|
|
{
|
|
|
|
|
if (TempOffLineInfo.ProductCode.Replace("00000000", "") == "9002005518" || TempOffLineInfo.ProductCode.Replace("00000000", "") == "9002005517")
|
|
|
|
|
{
|
|
|
|
|
if (refData == null)
|
|
|
|
|
return "";
|
|
|
|
|
else
|
|
|
|
|
return refData == DBNull.Value ? "" : refData.ToString();
|
|
|
|
|
TempOffLineInfo.ProductRemark = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 多码系统校验
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="TempOffLineInfo"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool TestBarCode(OffLineInfo TempOffLineInfo)
|
|
|
|
|
if (TempOffLineInfo.ProductRemark != "")
|
|
|
|
|
{
|
|
|
|
|
if (TempOffLineInfo.ProductCode.Replace("00000000", "") == "9002005518" || TempOffLineInfo.ProductCode.Replace("00000000", "") == "9002005517")
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.ProductRemark = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TempOffLineInfo.ProductRemark != "")
|
|
|
|
|
{
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 验证组合:" + TempOffLineInfo.ProductRemark);
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 验证组合:" + TempOffLineInfo.ProductRemark);
|
|
|
|
|
|
|
|
|
|
string strCheck = TempOffLineInfo.ProductRemark.Replace("wb", "");
|
|
|
|
|
string strCheck = TempOffLineInfo.ProductRemark.Replace("wb", "");
|
|
|
|
|
|
|
|
|
|
Boolean blnY = strCheck.Contains("Y");
|
|
|
|
|
Boolean blnZ = strCheck.Contains("Z");
|
|
|
|
|
Boolean blnX = strCheck.Contains("X");
|
|
|
|
|
Boolean blnG = strCheck.Contains("G");
|
|
|
|
|
//Boolean blnC = strCheck.Contains("C");
|
|
|
|
|
Boolean blnY = strCheck.Contains("Y");
|
|
|
|
|
Boolean blnZ = strCheck.Contains("Z");
|
|
|
|
|
Boolean blnX = strCheck.Contains("X");
|
|
|
|
|
Boolean blnG = strCheck.Contains("G");
|
|
|
|
|
//Boolean blnC = strCheck.Contains("C");
|
|
|
|
|
|
|
|
|
|
int iCheck = 0;
|
|
|
|
|
int iCheck = 0;
|
|
|
|
|
|
|
|
|
|
if (blnY == true)
|
|
|
|
|
iCheck = iCheck + 1;
|
|
|
|
|
if (blnY == true)
|
|
|
|
|
iCheck = iCheck + 1;
|
|
|
|
|
|
|
|
|
|
if (blnZ == true)
|
|
|
|
|
iCheck = iCheck + 1;
|
|
|
|
|
if (blnZ == true)
|
|
|
|
|
iCheck = iCheck + 1;
|
|
|
|
|
|
|
|
|
|
if (blnX == true)
|
|
|
|
|
iCheck = iCheck + 1;
|
|
|
|
|
if (blnX == true)
|
|
|
|
|
iCheck = iCheck + 1;
|
|
|
|
|
|
|
|
|
|
if (blnG == true)
|
|
|
|
|
iCheck = iCheck + 1;
|
|
|
|
|
if (blnG == true)
|
|
|
|
|
iCheck = iCheck + 1;
|
|
|
|
|
|
|
|
|
|
//if (blnC == true)
|
|
|
|
|
// iCheck = iCheck + 1;
|
|
|
|
|
//if (blnC == true)
|
|
|
|
|
// iCheck = iCheck + 1;
|
|
|
|
|
|
|
|
|
|
//y一维码,公司条码 oneCode
|
|
|
|
|
//z资产号 serialNumber
|
|
|
|
|
//x芯片 rfid
|
|
|
|
|
//g模块信息 sim
|
|
|
|
|
//wb不需要验证
|
|
|
|
|
//c是摄像头码 number1
|
|
|
|
|
if (blnY == true && iCheck > 1)
|
|
|
|
|
//y一维码,公司条码 oneCode
|
|
|
|
|
//z资产号 serialNumber
|
|
|
|
|
//x芯片 rfid
|
|
|
|
|
//g模块信息 sim
|
|
|
|
|
//wb不需要验证
|
|
|
|
|
//c是摄像头码 number1
|
|
|
|
|
if (blnY == true && iCheck > 1)
|
|
|
|
|
{
|
|
|
|
|
if (blnY || blnZ || blnX || blnG) //|| blnC
|
|
|
|
|
{
|
|
|
|
|
if (blnY || blnZ || blnX || blnG) //|| blnC
|
|
|
|
|
var client = new RestClient("http://10.100.83.113/syong/test.php");
|
|
|
|
|
client.Timeout = -1;
|
|
|
|
|
var request = new RestRequest(Method.POST);
|
|
|
|
|
request.AlwaysMultipartFormData = true;
|
|
|
|
|
request.AddParameter("oneCode", TempOffLineInfo.ProductSNCode);
|
|
|
|
|
request.AddParameter("Werks", "2701");
|
|
|
|
|
request.AddParameter("mark", "YZX");
|
|
|
|
|
IRestResponse response = client.Execute(request);
|
|
|
|
|
Console.WriteLine(response.Content);
|
|
|
|
|
var chkInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<AucmaBarCodeModel>(response.Content);
|
|
|
|
|
|
|
|
|
|
TempOffLineInfo.oneCode = DBToString(chkInfo.oneCode);
|
|
|
|
|
TempOffLineInfo.serialNumber = DBToString(chkInfo.serialNumber);
|
|
|
|
|
TempOffLineInfo.rfid = DBToString(chkInfo.rfid);
|
|
|
|
|
TempOffLineInfo.sim = DBToString(chkInfo.sim);
|
|
|
|
|
TempOffLineInfo.number1 = DBToString(chkInfo.number1);
|
|
|
|
|
|
|
|
|
|
if (blnY == true && DBToString(chkInfo.oneCode) == "")
|
|
|
|
|
{
|
|
|
|
|
var client = new RestClient("http://10.100.83.113/syong/test.php");
|
|
|
|
|
client.Timeout = -1;
|
|
|
|
|
var request = new RestRequest(Method.POST);
|
|
|
|
|
request.AlwaysMultipartFormData = true;
|
|
|
|
|
request.AddParameter("oneCode", TempOffLineInfo.ProductSNCode);
|
|
|
|
|
request.AddParameter("Werks", "2701");
|
|
|
|
|
request.AddParameter("mark", "YZX");
|
|
|
|
|
IRestResponse response = client.Execute(request);
|
|
|
|
|
Console.WriteLine(response.Content);
|
|
|
|
|
var chkInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<AucmaBarCodeModel>(response.Content);
|
|
|
|
|
|
|
|
|
|
TempOffLineInfo.oneCode = DBToString(chkInfo.oneCode);
|
|
|
|
|
TempOffLineInfo.serialNumber = DBToString(chkInfo.serialNumber);
|
|
|
|
|
TempOffLineInfo.rfid = DBToString(chkInfo.rfid);
|
|
|
|
|
TempOffLineInfo.sim = DBToString(chkInfo.sim);
|
|
|
|
|
TempOffLineInfo.number1 = DBToString(chkInfo.number1);
|
|
|
|
|
|
|
|
|
|
if (blnY == true && DBToString(chkInfo.oneCode) == "")
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.MsgInfo = "多码验证,公司条码验证失败";
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,公司条码验证失败");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (blnZ == true && DBToString(chkInfo.serialNumber) == "")
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.MsgInfo = "多码验证,资产号验证失败";
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,资产号验证失败");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
TempOffLineInfo.MsgInfo = "多码验证,公司条码验证失败";
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,公司条码验证失败");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (blnX == true && DBToString(chkInfo.rfid) == "")
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.MsgInfo = "多码验证,芯片验证失败";
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,芯片验证失败");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (blnZ == true && DBToString(chkInfo.serialNumber) == "")
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.MsgInfo = "多码验证,资产号验证失败";
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,资产号验证失败");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (blnG == true && DBToString(chkInfo.sim) == "")
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.MsgInfo = "多码验证,模块信息验证失败";
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,模块信息验证失败");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (blnX == true && DBToString(chkInfo.rfid) == "")
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.MsgInfo = "多码验证,芯片验证失败";
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,芯片验证失败");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
if (blnG == true && DBToString(chkInfo.sim) == "")
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo.MsgInfo = "多码验证,模块信息验证失败";
|
|
|
|
|
log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,模块信息验证失败");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|