diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml
index bd37c775..639cdc26 100644
--- a/Admin.Core.Api/Admin.Core.Model.xml
+++ b/Admin.Core.Api/Admin.Core.Model.xml
@@ -406,6 +406,16 @@
SAP计划员(100=成品;200=箱体;300=门体)
+
+
+ 69码,成品下线校验使用
+
+
+
+
+ 69码对应的商品名称
+
+
SAP订单信息
diff --git a/Admin.Core.Model/Model_New/BaseMaterialInfo.cs b/Admin.Core.Model/Model_New/BaseMaterialInfo.cs
index 0863ad8a..935e9f82 100644
--- a/Admin.Core.Model/Model_New/BaseMaterialInfo.cs
+++ b/Admin.Core.Model/Model_New/BaseMaterialInfo.cs
@@ -110,5 +110,17 @@ namespace Admin.Core.Model
///
[SugarColumn(ColumnName = "DISPO")]
public string Dispo { get; set; }
+
+ ///
+ /// 69码,成品下线校验使用
+ ///
+ [SugarColumn(ColumnName = "PRODUCT_CODE")]
+ public string ProductCode { get; set; }
+
+ ///
+ /// 69码对应的商品名称
+ ///
+ [SugarColumn(ColumnName = "PRODUCT_NAME")]
+ public string ProductName { get; set; }
}
}
diff --git a/Aucma.Core.ProductOffLine/Business/GunBusiness.cs b/Aucma.Core.ProductOffLine/Business/GunBusiness.cs
index 168a647d..7c50c110 100644
--- a/Aucma.Core.ProductOffLine/Business/GunBusiness.cs
+++ b/Aucma.Core.ProductOffLine/Business/GunBusiness.cs
@@ -29,12 +29,19 @@ namespace Aucma.Core.ProductOffLine.Business
#region 单例实现
private static readonly GunBusiness lazy = new GunBusiness();
+ #region 变量定义
+ //成品码
+ private static string ProductCode = string.Empty;
+ // 69码
+ private static string Code69 = string.Empty;
+ #endregion
+
///
/// 扫码委托
///
///
///
- public delegate void RefreshMaterialCodeStr(string materialCodeStr, string ip);
+ public delegate void RefreshMaterialCodeStr(string ProductCode, string Code69, string ip);
public static event RefreshMaterialCodeStr RefreshMaterialCodeStrEvent;
public static GunBusiness Instance
@@ -93,13 +100,26 @@ namespace Aucma.Core.ProductOffLine.Business
StringBuilder sb = new StringBuilder();
string str = Encoding.ASCII.GetString(receiveBytes).Replace("\r\n", "");
- string ip = DirectionToIP();
- if (!string.IsNullOrEmpty(ip))
+ if(str.Length == 20)
{
-
- RefreshMaterialCodeStrEvent?.Invoke(str,ip);
- int direction = -1;
- appConfig.GunDirection = direction.ToString();
+ ProductCode = str;
+ }else if(str.Length == 13)
+ {
+ Code69 = str;
+ }
+ // 业务处理
+ if(!string.IsNullOrEmpty(ProductCode) && !string.IsNullOrEmpty(Code69))
+ {
+ string ip = DirectionToIP();
+ if (!string.IsNullOrEmpty(ip))
+ {
+ RefreshMaterialCodeStrEvent?.Invoke(ProductCode,Code69, ip);
+ int direction = -1;
+ appConfig.GunDirection = direction.ToString();
+ }
+ // 清空
+ ProductCode = string.Empty;
+ Code69 = string.Empty;
}
sb.Clear();
}
diff --git a/Aucma.Core.ProductOffLine/Business/MvCodeHelper.cs b/Aucma.Core.ProductOffLine/Business/MvCodeHelper.cs
index 12224662..aafcccd6 100644
--- a/Aucma.Core.ProductOffLine/Business/MvCodeHelper.cs
+++ b/Aucma.Core.ProductOffLine/Business/MvCodeHelper.cs
@@ -43,7 +43,7 @@ namespace Aucma.Core.ProductOffLine.Business
///
///
///
- public delegate void RefreshMaterialCodeStr(string materialCodeStr, string ip);
+ public delegate void RefreshMaterialCodeStr(string ProductCode,string Code69, string ip);
public static event RefreshMaterialCodeStr RefreshMaterialCodeStrEvent;
///
@@ -65,58 +65,52 @@ namespace Aucma.Core.ProductOffLine.Business
public static void ShellImageCallbackFunc(IntPtr pData, IntPtr pstFrameInfoEx2, IntPtr pUser)
{
+ string Code69 = string.Empty;
+ string ProductCode = string.Empty;
var stFrameInfo = (MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)Marshal.PtrToStructure(pstFrameInfoEx2, typeof(MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2));
MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2 stBcrResult = (MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2)Marshal.PtrToStructure(stFrameInfo.UnparsedBcrList.pstCodeListEx2, typeof(MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2));
-
- // Console.WriteLine("CodeNum[" + Convert.ToString(stBcrResult.nCodeNum) + "]");
- if (stBcrResult.nCodeNum == 0)
+ //更新扫码器存活时间
+ ShellLiveTime = DateTime.Now;
+
+ if (stBcrResult.nCodeNum <2)
{
Console.WriteLine(DateTime.Now + ":外侧--->No Read 处理");
log.Info(DateTime.Now + ":外侧--->No Read 处理");
- //更新扫码器存活时间
- ShellLiveTime = DateTime.Now;
+
}
- for (Int32 i = 0; i < stBcrResult.nCodeNum; i++)
+ else
{
- bool bIsValidUTF8 = IsTextUTF8(stBcrResult.stBcrInfoEx2[i].chCode);
- if (bIsValidUTF8)
- {
- string strCode = Encoding.UTF8.GetString(stBcrResult.stBcrInfoEx2[i].chCode);
- Console.WriteLine(DateTime.Now + ":Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
-
- }
- else
+ for (Int32 i = 0; i < stBcrResult.nCodeNum; i++)
{
- string strCode = Encoding.GetEncoding("GB2312").GetString(stBcrResult.stBcrInfoEx2[i].chCode);
- Console.WriteLine(DateTime.Now + ":外侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
- log.Info(DateTime.Now + ":外侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
- // RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), ShellScannerIp);
- if (strCode.Trim().TrimEnd('\0').Length == 20)
- {
- //更新扫码器存活时间
- ShellLiveTime = DateTime.Now;
- RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), ShellScannerIp);
- // 业务处理
- }
- else
+ bool bIsValidUTF8 = IsTextUTF8(stBcrResult.stBcrInfoEx2[i].chCode);
+ if (!bIsValidUTF8)
{
- // 更新存活时间
- LinerLiveTime = DateTime.Now;
- Console.WriteLine(DateTime.Now + ":外侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20,当做No Read 处理");
- log.Info(DateTime.Now + ":外侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20,当做No Read 处理");
- }
+ string strCode = Encoding.GetEncoding("GB2312").GetString(stBcrResult.stBcrInfoEx2[i].chCode);
+ Console.WriteLine(DateTime.Now + ":外侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
+ log.Info(DateTime.Now + ":外侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
+ if (strCode.Trim().TrimEnd('\0').Length == 20)
+ {
+ ProductCode = strCode;
+ // RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), ShellScannerIp);
+ // 业务处理
+ }
+ if (strCode.Trim().TrimEnd('\0').Length == 13)
+ {
+ Code69 = strCode;
+ // RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), ShellScannerIp);
+ // 业务处理
+ }
+ }
}
+ Console.WriteLine("69:" + Code69);
+ Console.WriteLine("成品:" + ProductCode);
+ RefreshMaterialCodeStrEvent?.Invoke(ProductCode,Code69, ShellScannerIp);
}
+
- MvCodeReader.MV_CODEREADER_OCR_INFO_LIST stOcrInfo = (MvCodeReader.MV_CODEREADER_OCR_INFO_LIST)Marshal.PtrToStructure(stFrameInfo.UnparsedOcrList.pstOcrList, typeof(MvCodeReader.MV_CODEREADER_OCR_INFO_LIST));
-
- for (int i = 0; i < stOcrInfo.nOCRAllNum; i++)
- {
- string strOcrCharCode = Encoding.UTF8.GetString(stOcrInfo.stOcrRowInfo[i].chOcr);
- // Console.WriteLine("Get OcrInfo:" + "ocrNum[" + i.ToString() + "], ocrLen[" + Convert.ToString(stOcrInfo.stOcrRowInfo[i].nOcrLen) + "], ocrChar[" + strOcrCharCode.Trim().TrimEnd('\0') + "]");
- }
+
}
@@ -125,55 +119,46 @@ namespace Aucma.Core.ProductOffLine.Business
var stFrameInfo = (MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)Marshal.PtrToStructure(pstFrameInfoEx2, typeof(MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2));
MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2 stBcrResult = (MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2)Marshal.PtrToStructure(stFrameInfo.UnparsedBcrList.pstCodeListEx2, typeof(MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2));
+ string Code69 = string.Empty;
+ string ProductCode = string.Empty;
+ //更新扫码器存活时间
+ LinerLiveTime = DateTime.Now;
- // Console.WriteLine("CodeNum[" + Convert.ToString(stBcrResult.nCodeNum) + "]");
- if (stBcrResult.nCodeNum == 0)
+ if (stBcrResult.nCodeNum < 2)
{
- Console.WriteLine(DateTime.Now+":内侧--->No Read 处理");
+ Console.WriteLine(DateTime.Now + ":内侧--->No Read 处理");
log.Info(DateTime.Now + ":内侧--->No Read 处理");
- // 更新存活时间
- LinerLiveTime = DateTime.Now;
+
}
- for (Int32 i = 0; i < stBcrResult.nCodeNum; i++)
+ else
{
- bool bIsValidUTF8 = IsTextUTF8(stBcrResult.stBcrInfoEx2[i].chCode);
- if (bIsValidUTF8)
- {
- string strCode = Encoding.UTF8.GetString(stBcrResult.stBcrInfoEx2[i].chCode);
- Console.WriteLine(DateTime.Now + ":Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
- }
- else
+ for (Int32 i = 0; i < stBcrResult.nCodeNum; i++)
{
- string strCode = Encoding.GetEncoding("GB2312").GetString(stBcrResult.stBcrInfoEx2[i].chCode);
- Console.WriteLine(DateTime.Now + ":内侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
- log.Info(DateTime.Now + ":内侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
- // RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), LinerScannerIp);
- if (strCode.Trim().TrimEnd('\0').Length == 20)
- {
- // 更新存活时间
- LinerLiveTime = DateTime.Now;
- // 业务处理
- RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), LinerScannerIp);
- }
- else
+ bool bIsValidUTF8 = IsTextUTF8(stBcrResult.stBcrInfoEx2[i].chCode);
+ if (!bIsValidUTF8)
+
{
- // 更新存活时间
- LinerLiveTime = DateTime.Now;
- Console.WriteLine(DateTime.Now + "内侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20,当做No Read 处理");
- log.Info(DateTime.Now + "内侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20,当做No Read 处理");
+ string strCode = Encoding.GetEncoding("GB2312").GetString(stBcrResult.stBcrInfoEx2[i].chCode);
+ Console.WriteLine(DateTime.Now + ":内侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
+ log.Info(DateTime.Now + ":内侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
+ // RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), LinerScannerIp);
+ if (strCode.Trim().TrimEnd('\0').Length == 20)
+ {
+ ProductCode = strCode;
+
+ }
+ if (strCode.Trim().TrimEnd('\0').Length == 13)
+ {
+ Code69 = strCode;
+
+ }
}
-
}
+ Console.WriteLine("69:" + Code69);
+ Console.WriteLine("成品:" + ProductCode);
+ RefreshMaterialCodeStrEvent?.Invoke(ProductCode,Code69, LinerScannerIp);
}
-
- MvCodeReader.MV_CODEREADER_OCR_INFO_LIST stOcrInfo = (MvCodeReader.MV_CODEREADER_OCR_INFO_LIST)Marshal.PtrToStructure(stFrameInfo.UnparsedOcrList.pstOcrList, typeof(MvCodeReader.MV_CODEREADER_OCR_INFO_LIST));
-
- Console.WriteLine("ocrAllNum[" + Convert.ToString(stOcrInfo.nOCRAllNum) + "]");
- for (int i = 0; i < stOcrInfo.nOCRAllNum; i++)
- {
- string strOcrCharCode = Encoding.UTF8.GetString(stOcrInfo.stOcrRowInfo[i].chOcr);
- Console.WriteLine("Get OcrInfo:" + "ocrNum[" + i.ToString() + "], ocrLen[" + Convert.ToString(stOcrInfo.stOcrRowInfo[i].nOcrLen) + "], ocrChar[" + strOcrCharCode.Trim().TrimEnd('\0') + "]");
- }
+
}
diff --git a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs
index 204b1d64..ef6ed2c8 100644
--- a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs
+++ b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs
@@ -37,7 +37,7 @@ namespace Aucma.Core.ProductOffLine.Business
///
/// 成品下线业务逻辑
///
- public class OffLineBusiness
+ public class OffLineBusiness
{
#region 单例实现
@@ -79,7 +79,9 @@ namespace Aucma.Core.ProductOffLine.Business
private readonly IOffLineInfoServices? _offLineInfoServices = App.ServiceProvider.GetService();
// 过点数据表,物料完成记录MaterialCompletion
private readonly IMaterialCompletionServices? _iMaterialCompletionServices = App.ServiceProvider.GetService();
-
+
+ private readonly IBaseMaterialInfoServices? _baseMaterialInfoServices = App.ServiceProvider.GetService();
+
private readonly ICodeBindingRecordServices? _codeBindingServices = App.ServiceProvider.GetService();
// 质检记录
private readonly IReportQualityInspectionServices? _reportQualityInspectionServices = App.ServiceProvider.GetService();
@@ -90,10 +92,10 @@ namespace Aucma.Core.ProductOffLine.Business
///
/// 扫码信息刷新
///
- public delegate void RefreshScanMateriaCode(TempInfo tempInfo);
+ public delegate void RefreshScanMateriaCode(TempInfo tempInfo);
public static event RefreshScanMateriaCode? RefreshScanMateriaCodeEvent;
-
-
+
+
///
/// 图表刷新
///
@@ -107,13 +109,13 @@ namespace Aucma.Core.ProductOffLine.Business
public event getDirection getDirectioneEvent;
#endregion
- public OffLineBusiness()
+ public OffLineBusiness()
{
MvCodeHelper.RefreshMaterialCodeStrEvent += MaterialBarScan;
GunBusiness.RefreshMaterialCodeStrEvent += MaterialBarScan;
HandSendPlcWindow.SendPlcPassEvent += DownLoadPassFlag;
-
- // test();
+
+ // test();
}
#region 变量定义
///
@@ -123,75 +125,40 @@ namespace Aucma.Core.ProductOffLine.Business
#endregion
- public void test()
+ public void test()
{
-
-
- //OffLineInfo info11 = new OffLineInfo();
- //info11.ProductSNCode = "test11";
- //info11.PlcResult = 1;
- //int flag = _offLineInfoServices.AddAsync(info11).Result;
- //OffLineInfo info = _offLineInfoServices.FirstAsync(x => x.ProductSNCode == "test11").Result;
- //info.PlcResult = 2;
- //bool result = _offLineInfoServices.UpdateAsync(info).Result;
- //Thread.Sleep(5000);
- //TempOffLineInfo1.MsgInfo = "条码重复,上传间隔超过五分钟禁止放行,人工处理,上传时间:" + DateTime.Now;
- //TempOffLineInfo1.MsgAlarmFlag = true;
- //RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo1);
- //OffLineInfo info11 = new OffLineInfo();
- //info11.ProductSNCode = "test111";
- //int flag = _offLineInfoServices.AddAsync(info11).Result;
-
-
-
- // private static readonly log4net.ILog log = LogManager.GetLogger(typeof(OffLineBusiness));
- // string result = _productOffLineServices.QueryChecked("1520870000099E2V0004");
- // string result = _productOffLineServices.QueryChecked("1530080CD0098E1V1714");
- // Console.WriteLine(result);System.AggregateException:“One or more errors occurred. (ORA-01653: 表 C##AUCMA_SCADA.PRODUCT_OFFLINE 无法通过 8 (在表空间 AUCMA_SCADA 中) 扩展)”
-
- // string strSave = _productOffLineServices.SaveBarcodeInfo("1520870000099E2V0004", "ILS_SORT", result.Replace("0000",""), 1);
- // LogHelper.Info("成品码:1520870000099E2V0004"+strSave);
- // string tt = "Y@1104@16160030000000910780@000010034895@@ @000000@000000009000004899@BCD-160C,家电下乡@@BCD-160C@皓月白-家电下乡@161601300@160@1-00版@家电下乡产品@默认@2010-09-01";
-
- // string aa = appConfig.BarCodeAccount;
- // string bb = appConfig.ProductlineCode;
- // appConfig.BarCodeAccount = "123";
- //TempOffLineInfo1.QualityResult = "失败";
- //TempOffLineInfo1.ProductSNCode = "323222444"; //产品SN条码*1
- //TempOffLineInfo1.ProductScanTime = System.DateTime.Now; // 扫码时间*2
- //TempOffLineInfo1.MsgInfo = "条码质检失败:";
- //RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo1);
- // Random random = new Random();
- // MaterialBarScan("32160030000000912" + random.Next(100, 999), "10.10.92.141");
-
- //Thread.Sleep(3000);
- //Random random1 = new Random();
- //MaterialBarScan("99160030000000912" + random1.Next(100, 999), "10.10.92.141");
- //Thread.Sleep(3000);
- //Random random2 = new Random();
- //MaterialBarScan("44160030000000912" + random2.Next(100, 999), "10.10.92.141");
- // }
-
- // Thread.Sleep(1000);
- // MaterialBarScanEvent("33160030000000910780", "192.168.1.20");
+
+ #region 成品条码与69码校验
+ //BaseMaterialInfo materialInfo = _baseMaterialInfoServices.FirstAsync(x => x.ProductCode == "6933973114570").Result;
+ //if (materialInfo == null)
+ //{
+ // Console.WriteLine();
+ //}
+ //if (!"BCD-212CFT".Contains(materialInfo.ProductName))
+ //{
+ // Console.WriteLine();
+ //}
+ #endregion
+
}
- public void MaterialBarScan(string code, string scannerIp)
+ public void MaterialBarScan(string ProductCode, string Code69, string scannerIp)
{
Task.Run(() =>
{
- MaterialBarScanHandle(code, scannerIp);
+ MaterialBarScanHandle(ProductCode, Code69, scannerIp);
});
}
- ///
- /// 处理条码
- ///
- ///
- /// 扫码器IP
- public void MaterialBarScanHandle(string code,string scannerIp)
- {
+ ///
+ /// 条码处理
+ ///
+ /// 成品码
+ /// 69码
+ ///
+ public void MaterialBarScanHandle(string code, string code69, string scannerIp)
+ {
try
- {
+ {
ScannerModel model = allScanners.FirstOrDefault(x => x.Ip == scannerIp);
int ScannerNo = model.Id; // 确定是哪个扫码器
log.Info("扫码器ip:" + scannerIp + "编号:[" + ScannerNo + "]扫描到条码:" + code);
@@ -201,7 +168,7 @@ namespace Aucma.Core.ProductOffLine.Business
if (ScannerNo == 1) //内侧
{
//1.扫描的SN条码去条码系统校验
- BackResult = HandleMaterialBarCode(code.Trim(), TempOffLineInfo1); //扫码器1
+ BackResult = HandleMaterialBarCode(code, code69, TempOffLineInfo1); //扫码器1
materialType = TempOffLineInfo1.ProductCode;
if (!BackResult)
{
@@ -209,10 +176,10 @@ namespace Aucma.Core.ProductOffLine.Business
return;
}
- // TempOffLineInfo1.ProductRefreshFlag = true;
+ // TempOffLineInfo1.ProductRefreshFlag = true;
// 2.更新mes数据库
- bool MesResult = updateMesData(TempOffLineInfo1);
-
+ bool MesResult = updateMesData(TempOffLineInfo1);
+
// 3.plc放行
if (MesResult)
{
@@ -239,10 +206,10 @@ namespace Aucma.Core.ProductOffLine.Business
log.Info("更新mes数据库应答字为2失败");
}
}
-
+
}
log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo1.ProductOrderNo, TempOffLineInfo1.OrderQty));
-
+
}
else
{
@@ -257,7 +224,7 @@ namespace Aucma.Core.ProductOffLine.Business
// 扫码器2
else if (ScannerNo == 2) // 外侧
{
- BackResult = HandleMaterialBarCode(code.Trim(), TempOffLineInfo2); //扫码器2
+ BackResult = HandleMaterialBarCode(code, code69, TempOffLineInfo2); //扫码器2
materialType = TempOffLineInfo2.ProductCode;
if (!BackResult)
{
@@ -267,7 +234,7 @@ namespace Aucma.Core.ProductOffLine.Business
// TempOffLineInfo2.ProductRefreshFlag = true;
// 2.更新mes数据库
bool MesResult = updateMesData(TempOffLineInfo2);
-
+
//BackResult = true;
// 3.plc放行
if (MesResult)
@@ -299,7 +266,7 @@ namespace Aucma.Core.ProductOffLine.Business
}
log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo2.ProductOrderNo, TempOffLineInfo2.OrderQty));
-
+
}
else
{
@@ -314,7 +281,7 @@ namespace Aucma.Core.ProductOffLine.Business
}
catch (Exception ex)
{
- log.Error("MaterialBarScanHandle异常:"+ex.Message.ToString());
+ log.Error("MaterialBarScanHandle异常:" + ex.Message.ToString());
}
}
@@ -345,9 +312,9 @@ namespace Aucma.Core.ProductOffLine.Business
try
{
OffLineInfo info11 = MapperTwo(TempOffLineInfo);
-
- CodeBindingRecord bindingRecord1 = _codeBindingServices.FirstAsync(x=>x.ProductCode == info11.ProductSNCode).Result;
-
+
+ CodeBindingRecord bindingRecord1 = _codeBindingServices.FirstAsync(x => x.ProductCode == info11.ProductSNCode).Result;
+
if (bindingRecord1 == null)
{
log.Info(info11.ProductCode + "mes数据库未查询到条码绑定记录");
@@ -357,11 +324,11 @@ namespace Aucma.Core.ProductOffLine.Business
}
else
{
- // log.Info("条码绑定表查到记录:"+JsonHelper.ObjectToJson(bindingRecord1));
+ // log.Info("条码绑定表查到记录:"+JsonHelper.ObjectToJson(bindingRecord1));
info11.BoxCode = bindingRecord1.BoxCode;
}
-
+
// 产线
info11.ProductLineCode = "CX_02";
info11.SaveRetuenInfo = TempOffLineInfo.MsgInfo;
@@ -369,13 +336,13 @@ namespace Aucma.Core.ProductOffLine.Business
info11.PlcResult = 1;
// 查询本地数据库是否有数据
OffLineInfo offLineInfo = _offLineInfoServices.FirstAsync(x => x.ProductSNCode == TempOffLineInfo.ProductSNCode).Result;
- if(offLineInfo == null)
+ if (offLineInfo == null)
{
info11.ProductOrderNo = "0000" + info11.ProductOrderNo;
- int flag = _offLineInfoServices.AddAsync(info11).Result;
+ int flag = _offLineInfoServices.AddAsync(info11).Result;
if (flag < 0)
{
- log.Info(TempOffLineInfo.ProductSNCode+"插入下线记录失败");
+ log.Info(TempOffLineInfo.ProductSNCode + "插入下线记录失败");
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + "插入下线记录失败";
TempOffLineInfo.MsgAlarmFlag = true;
//界面刷新
@@ -391,7 +358,7 @@ namespace Aucma.Core.ProductOffLine.Business
BaseOrderInfo order = _baseOrderInfoServices.FirstAsync(x => x.OrderCode == TempOffLineInfo.ProductOrderNo).Result;
if (order == null)
{
- log.Info("条码:"+TempOffLineInfo.ProductBarNo+" 订单号:"+TempOffLineInfo.ProductOrderNo+" 查询mes订单失败");
+ log.Info("条码:" + TempOffLineInfo.ProductBarNo + " 订单号:" + TempOffLineInfo.ProductOrderNo + " 查询mes订单失败");
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + "查询mes订单失败";
TempOffLineInfo.MsgAlarmFlag = true;
//界面刷新
@@ -406,7 +373,7 @@ namespace Aucma.Core.ProductOffLine.Business
}
order.UpdatedTime = DateTime.Now;
bool uploadOrder = _baseOrderInfoServices.UpdateAsync(order).Result;
- if(!uploadOrder)
+ if (!uploadOrder)
{
log.Info("条码:" + TempOffLineInfo.ProductBarNo + " 订单号:" + TempOffLineInfo.ProductOrderNo + " 更新mes订单完成数失败");
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + "更新mes订单完成数失败";
@@ -417,7 +384,7 @@ namespace Aucma.Core.ProductOffLine.Business
}
#region 更新过点数据
- if(bindingRecord1!=null && bindingRecord1.BoxCode!="")
+ if (bindingRecord1 != null && bindingRecord1.BoxCode != "")
{
PrintBarCode print = _printBarCodeServices.FirstAsync(x => x.MaterialBarcode == bindingRecord1.BoxCode).Result;
if (print != null)
@@ -440,7 +407,7 @@ namespace Aucma.Core.ProductOffLine.Business
#endregion
}
-
+
return true;
}
@@ -452,151 +419,178 @@ namespace Aucma.Core.ProductOffLine.Business
}
- ///
- /// 去条码系统查询校验并保存
- ///
- ///
- ///
- public bool HandleMaterialBarCode(string BarCode,TempInfo TempOffLineInfo)
- {
- try
- {
- // 1.质检
- // List qualityList = _reportQualityInspectionServices.JudgeIsQualified(BarCode);
- // if (qualityList != null)
- //{
- // TempOffLineInfo.QualityResult = "失败";
- // TempOffLineInfo.ProductSNCode = BarCode.Trim(); //产品SN条码*1
- // TempOffLineInfo.ProductScanTime = System.DateTime.Now; // 扫码时间*2
- // TempOffLineInfo.MsgInfo = "条码质检失败:";
-
- // foreach(ReportQualityInsPection item in qualityList)
- // {
- // TempOffLineInfo.MsgInfo += item.QualityDefectName;
- // }
- // TempOffLineInfo.MsgAlarmFlag = true;
- // //界面刷新
- // // TempOffLineInfo.ProductRefreshFlag = true;
- // RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
- // return false;
- //}
+ ///
+ /// 去条码系统查询,与69码校验并保存条码系统
+ ///
+ ///
+ /// 69码
+ ///
+ ///
+ public bool HandleMaterialBarCode(string BarCode, string code69, TempInfo TempOffLineInfo)
+ {
+ try
+ {
+ #region 1.质检--暂未启用
+ // List qualityList = _reportQualityInspectionServices.JudgeIsQualified(BarCode);
+ // if (qualityList != null)
+ //{
+ // TempOffLineInfo.QualityResult = "失败";
+ // TempOffLineInfo.ProductSNCode = BarCode.Trim(); //产品SN条码*1
+ // TempOffLineInfo.ProductScanTime = System.DateTime.Now; // 扫码时间*2
+ // TempOffLineInfo.MsgInfo = "条码质检失败:";
+
+ // foreach(ReportQualityInsPection item in qualityList)
+ // {
+ // TempOffLineInfo.MsgInfo += item.QualityDefectName;
+ // }
+ // TempOffLineInfo.MsgAlarmFlag = true;
+ // //界面刷新
+ // // TempOffLineInfo.ProductRefreshFlag = true;
+ // RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
+ // return false;
+ //}
+ #endregion
- TempOffLineInfo.QualityResult = "成功";
-
- TempOffLineInfo.ProductSNCode = BarCode.Trim(); //产品SN条码*1
- TempOffLineInfo.ProductScanTime = System.DateTime.Now; // 扫码时间*2
-
- log.Info("条码验证开始:" + BarCode);
- //1.查询条码系统
- string result = _productOffLineServices.QueryChecked(BarCode);
+ TempOffLineInfo.QualityResult = "成功";
+
+ TempOffLineInfo.ProductSNCode = BarCode.Trim(); //产品SN条码*1
+ TempOffLineInfo.ProductScanTime = System.DateTime.Now; // 扫码时间*2
+
+ log.Info("条码系统查询开始:" + BarCode);
+
+ //1.查询条码系统
+ string result = _productOffLineServices.QueryChecked(BarCode);
+
//string result = "Y@1104@16160030000000910780@000010034895@@ @000000@000000009000003987@BCD-160C,家电下乡@@BCD-160C@test皓月白-家电下乡@161601300@160@1-00版@家电下乡产品@默认@2010-09-01";
- string[] FArrayList = new string[20];
- if (result != null)
- {
- //用"@"号分隔
- FArrayList = result.Split('@');
- }
- else
- {
- FArrayList[0] = "N";
- FArrayList[1] = "条码系统查询接口调用失败,请检查网络重新扫描";
- }
-
- if (FArrayList[0].ToUpper() == "Y") //查询数据成功
- {
- log.Info(BarCode + "成功返回验证信息:" + result);
-
- #region 实体赋值
- TempOffLineInfo.MsgInfo = "获取信息成功" + BarCode + " 返回值:" + FArrayList[0].ToUpper(); // 提示信息*7
- TempOffLineInfo.ProductFactoryCode = FArrayList[1];
- TempOffLineInfo.ProductSNCode = FArrayList[2];
- TempOffLineInfo.ProductOrderNo = DBToString(FArrayList[3]).Replace("0000", ""); // 订单编号*4
- TempOffLineInfo.ProductSaleNo = DBToString(FArrayList[4]);
- TempOffLineInfo.ProductSaleLineNo = DBToString(FArrayList[5]);
- TempOffLineInfo.ProductCheckInfo = DBToString(FArrayList[6]); //验证组合
- TempOffLineInfo.ProductCode = DBToString(FArrayList[7]).Replace("00000000", "");
- TempOffLineInfo.ProductName = DBToString(FArrayList[8]); //产品描述
- TempOffLineInfo.ProductType = FArrayList[9];
- TempOffLineInfo.ProductModel = FArrayList[10]; //产品型号*3
- 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];
+ string[] FArrayList = new string[20];
+ if (result != null)
+ {
+ //用"@"号分隔
+ FArrayList = result.Split('@');
+ }
+ else
+ {
+ FArrayList[0] = "N";
+ FArrayList[1] = "条码系统查询接口调用失败,请检查网络重新扫描";
+ }
+
+ if (FArrayList[0].ToUpper() == "Y") //查询数据成功
+ {
+ log.Info(BarCode + "成功返回验证信息:" + result);
+
+ #region 实体赋值
+ TempOffLineInfo.MsgInfo = "获取信息成功" + BarCode + " 返回值:" + FArrayList[0].ToUpper(); // 提示信息*7
+ TempOffLineInfo.ProductFactoryCode = FArrayList[1];
+ TempOffLineInfo.ProductSNCode = FArrayList[2];
+ TempOffLineInfo.ProductOrderNo = DBToString(FArrayList[3]).Replace("0000", ""); // 订单编号*4
+ TempOffLineInfo.ProductSaleNo = DBToString(FArrayList[4]);
+ TempOffLineInfo.ProductSaleLineNo = DBToString(FArrayList[5]);
+ TempOffLineInfo.ProductCheckInfo = DBToString(FArrayList[6]); //验证组合
+ TempOffLineInfo.ProductCode = DBToString(FArrayList[7]).Replace("00000000", "");
+ TempOffLineInfo.ProductName = DBToString(FArrayList[8]); //产品描述
+ TempOffLineInfo.ProductType = FArrayList[9];
+ TempOffLineInfo.ProductModel = FArrayList[10]; //产品型号*3
+ 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
- //界面刷新
- // TempOffLineInfo.ProductRefreshFlag = true;
- RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
- // 多码系统校验,暂不启用
- // bool flag = TestBarCode(TempOffLineInfo);
- // if (!flag)
- // {
- // return false;
- // }
- log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证通过!");
- //2.上传条码系统
- bool resultUp = uploadSnSysytem(TempOffLineInfo);
- return resultUp;
-
- }
-
- else
- {
- log.Info(BarCode + "失败返回验证信息:" + FArrayList[1]);
-
- #region 实体赋值
- 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 = "";
+
+ #region 成品条码与69码校验
+ BaseMaterialInfo materialInfo = _baseMaterialInfoServices.FirstAsync(x => x.ProductCode == code69).Result;
+ if(materialInfo == null)
+ {
+ TempOffLineInfo.MsgInfo = "69码校验失败:" + code69+"未在mes数据库找到信息!";
+ TempOffLineInfo.MsgAlarmFlag = true;
+
+ RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
+ log.Info("69码校验失败:" + code69 + "未在mes数据库找到信息!");
+ return false;
+ }
+ if(!TempOffLineInfo.ProductName.Contains(materialInfo.ProductName))
+ {
+ TempOffLineInfo.MsgInfo = "69码校验失败,69码名称:" + materialInfo.ProductName + ";成品码名称:"+ TempOffLineInfo.ProductName;
+ TempOffLineInfo.MsgAlarmFlag = true;
+
+ RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
+ log.Info("69码校验失败,69码名称:" + materialInfo.ProductName + ";成品码名称:" + TempOffLineInfo.ProductName);
+ return false;
+ }
#endregion
//界面刷新
// TempOffLineInfo.ProductRefreshFlag = true;
- RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
- return false;
- }
-
+ RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
+ // 多码系统校验,暂不启用
+ // bool flag = TestBarCode(TempOffLineInfo);
+ // if (!flag)
+ // {
+ // return false;
+ // }
+ log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证通过!");
+ //2.上传条码系统
+ bool resultUp = uploadSnSysytem(TempOffLineInfo);
+ return resultUp;
+
+ }
+
+ else
+ {
+ log.Info(BarCode + "失败返回验证信息:" + FArrayList[1]);
+
+ #region 实体赋值
+ 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
+ //界面刷新
+ // TempOffLineInfo.ProductRefreshFlag = true;
+ RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
+ return false;
+ }
+
}
- catch (Exception ex)
- {
- TempOffLineInfo.MsgInfo = "获取产品条码异常:" + ex.Message;
- TempOffLineInfo.MsgAlarmFlag = true;
+ catch (Exception ex)
+ {
+ TempOffLineInfo.MsgInfo = "获取产品条码异常:" + ex.Message;
+ TempOffLineInfo.MsgAlarmFlag = true;
//界面刷新
// TempOffLineInfo.ProductRefreshFlag = true;
RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
log.Info(BarCode + "条码验证异常:" + ex.Message.ToString());
- return false;
+ return false;
+ }
}
- }
- ///
- /// 条码系统保存接口
- ///
- ///
- ///
- public bool uploadSnSysytem(TempInfo TempOffLineInfo)
+ ///
+ /// 条码系统保存接口
+ ///
+ ///
+ ///
+ public bool uploadSnSysytem(TempInfo TempOffLineInfo)
{
try
{
@@ -630,12 +624,12 @@ namespace Aucma.Core.ProductOffLine.Business
// string strSave = "Y";
if (!string.IsNullOrEmpty(strSave))
{
- if (strSave == "Y" || strSave=="S")
+ if (strSave == "Y" || strSave == "S")
{
log.Info(TempOffLineInfo.ProductSNCode + "上传条码成功:" + strSave);
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",上传条码成功";
-
+
//界面刷新
// TempOffLineInfo.ProductRefreshFlag = true;
RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
@@ -702,15 +696,15 @@ namespace Aucma.Core.ProductOffLine.Business
// 查询本地数据库是否有数据
OffLineInfo offLineInfo = _offLineInfoServices.FirstAsync(x => x.ProductSNCode == TempOffLineInfo.ProductSNCode).Result;
- if (offLineInfo != null && offLineInfo.PlcResult==1)
+ if (offLineInfo != null && offLineInfo.PlcResult == 1)
{
-
- log.Info(TempOffLineInfo.ProductSNCode + "条码重复上传,plc应答字为1,未响应为2可以再次放行");
- TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + "条码重复,plc应答字为1可以放行";
-
- RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
- return true;
-
+
+ log.Info(TempOffLineInfo.ProductSNCode + "条码重复上传,plc应答字为1,未响应为2可以再次放行");
+ TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + "条码重复,plc应答字为1可以放行";
+
+ RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
+ return true;
+
}
else
{
@@ -718,18 +712,18 @@ namespace Aucma.Core.ProductOffLine.Business
TempOffLineInfo.MsgAlarmFlag = true;
TempOffLineInfo.MsgInfo = "条码重复,plc应答字2,禁止重复放行,上传时间:" + offLineInfo.ProductScanTime;
-
+
RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
return false;
}
}
catch (Exception ex)
{
-
+
log.Error("CodeRepeatProcess()异常" + ex.Message.ToString());
return false;
}
-
+
}
#region 条码重复历史处理方法
@@ -794,21 +788,21 @@ namespace Aucma.Core.ProductOffLine.Business
/// strDirection "A" ? 1 : 2;入库方向A,B
///
///
- private bool DownLoadPassFlag(int scannerNo,string strDirection)
- {
- // 入库方向A,B
- int direction = strDirection == "A" ? 1 : 2;
-
- bool result = false;
- try
+ private bool DownLoadPassFlag(int scannerNo, string strDirection)
{
- var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
- if (obj != null)
+ // 入库方向A,B
+ int direction = strDirection == "A" ? 1 : 2;
+
+ bool result = false;
+ try
{
-
- if(scannerNo == 1) // 扫码器1对应的货道地址,内侧
- {
- log.Info(TempOffLineInfo1.ProductSNCode + ":内侧下发plc放行信号,入库方向ZR1001,放行信号ZR1003分别写:"+ direction.ToString()+"/1" + ",等待反馈");
+ var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
+ if (obj != null)
+ {
+
+ if (scannerNo == 1) // 扫码器1对应的货道地址,内侧
+ {
+ log.Info(TempOffLineInfo1.ProductSNCode + ":内侧下发plc放行信号,入库方向ZR1001,放行信号ZR1003分别写:" + direction.ToString() + "/1" + ",等待反馈");
TempOffLineInfo1.MsgInfo = TempOffLineInfo1.MsgInfo + "下发放行,";
RefreshScanMateriaCodeEvent(TempOffLineInfo1);
//TempOffLineInfo1.ProductRefreshFlag = true;
@@ -816,9 +810,9 @@ namespace Aucma.Core.ProductOffLine.Business
obj.plc.WriteInt16("ZR1001", direction.ToString());
// 往plc写入放行信号
obj.plc.WriteInt16("ZR1003", "1");
- }
- else // 外侧
- {
+ }
+ else // 外侧
+ {
log.Info(TempOffLineInfo2.ProductSNCode + ":外侧下发plc放行信号,入库方向ZR1000,放行信号ZR1002分别写:" + direction.ToString() + "/1" + ",等待反馈");
TempOffLineInfo2.MsgInfo = TempOffLineInfo2.MsgInfo + "下发放行,";
RefreshScanMateriaCodeEvent(TempOffLineInfo2);
@@ -828,21 +822,21 @@ namespace Aucma.Core.ProductOffLine.Business
// 往plc写入放行信号
obj.plc.WriteInt16("ZR1002", "1");
-
- }
- DateTime targetTime = DateTime.Now.AddSeconds(18000); // 5h
- // 等待plc反馈信号
- while (true)
+
+ }
+ DateTime targetTime = DateTime.Now.AddSeconds(18000); // 5h
+ // 等待plc反馈信号
+ while (true)
+ {
+ if (DateTime.Now > targetTime) // plc超最大时限无反馈
{
- if(DateTime.Now > targetTime) // plc超最大时限无反馈
- {
- log.Info("等待plc放行反馈信号超时");
- result = false;
- break;
- }
+ log.Info("等待plc放行反馈信号超时");
+ result = false;
+ break;
+ }
if (scannerNo == 1)
{
-
+
// 读取plc反馈信号
if (obj.plc.ReadInt32("ZR1003") == 2)
{
@@ -861,7 +855,7 @@ namespace Aucma.Core.ProductOffLine.Business
else
{
-
+
// 读取plc反馈信号
if (obj.plc.ReadInt16("ZR1002") == 2)
{
@@ -877,182 +871,182 @@ namespace Aucma.Core.ProductOffLine.Business
break;
}
}
-
- Thread.Sleep(500);
- }
-
+
+ Thread.Sleep(500);
+ }
+
+ }
+ else
+ {
+ log.Info("获取plc连接对象信息为空");
+ }
}
- else
+ catch (Exception ex)
{
- log.Info("获取plc连接对象信息为空");
+ log.Error("下发plc放行信号方法SendPlcPass()出现异常,ex:" + ex);
}
+ return result;
}
- catch (Exception ex)
- {
- log.Error("下发plc放行信号方法SendPlcPass()出现异常,ex:" + ex);
- }
- return result;
- }
- ///
- /// 下发plc报警信号
- ///
- private void sendPlcError()
- {
- try
+ ///
+ /// 下发plc报警信号
+ ///
+ private void sendPlcError()
{
- var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
- if (obj != null)
+ try
{
- if (obj.plc.IsConnected)
+ var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
+ if (obj != null)
{
- // 下发报警信号
- obj.plc.WriteInt32("D104", 1);
+ if (obj.plc.IsConnected)
+ {
+ // 下发报警信号
+ obj.plc.WriteInt32("D104", 1);
+ }
+ else
+ {
+ log.Info("成品下线plc连接失败,请检查plc连接");
+ }
}
else
{
- log.Info("成品下线plc连接失败,请检查plc连接");
+ log.Info("获取plc连接对象信息为空");
}
}
- else
+ catch (Exception ex)
{
- log.Info("获取plc连接对象信息为空");
+ log.Error("下发plc放报警信号方法sendPlcError()出现异常,ex:" + ex);
}
}
- catch (Exception ex)
- {
- log.Error("下发plc放报警信号方法sendPlcError()出现异常,ex:" + ex);
- }
- }
- #endregion
-
+ #endregion
- #region 工具方法
- ///
- /// 转换成字符串
- ///
- ///
- ///
- public static string DBToString(object refData)
- {
- if (refData == null)
- return "";
- else
- return refData == DBNull.Value ? "" : refData.ToString();
- }
- ///
- /// 多码系统校验,暂未确定使用
- ///
- ///
- ///
- public bool TestBarCode(TempInfo TempOffLineInfo)
- {
- if (TempOffLineInfo.ProductCode.Replace("00000000", "") == "9002005518" || TempOffLineInfo.ProductCode.Replace("00000000", "") == "9002005517")
+ #region 工具方法
+ ///
+ /// 转换成字符串
+ ///
+ ///
+ ///
+ public static string DBToString(object refData)
{
- TempOffLineInfo.ProductRemark = "";
+ if (refData == null)
+ return "";
+ else
+ return refData == DBNull.Value ? "" : refData.ToString();
}
- if (TempOffLineInfo.ProductRemark != "")
+ ///
+ /// 多码系统校验,暂未确定使用
+ ///
+ ///
+ ///
+ public bool TestBarCode(TempInfo TempOffLineInfo)
{
- log.Info(TempOffLineInfo.ProductSNCode + ", 验证组合:" + TempOffLineInfo.ProductRemark);
+ if (TempOffLineInfo.ProductCode.Replace("00000000", "") == "9002005518" || TempOffLineInfo.ProductCode.Replace("00000000", "") == "9002005517")
+ {
+ TempOffLineInfo.ProductRemark = "";
+ }
- string strCheck = TempOffLineInfo.ProductRemark.Replace("wb", "");
+ if (TempOffLineInfo.ProductRemark != "")
+ {
+ log.Info(TempOffLineInfo.ProductSNCode + ", 验证组合:" + TempOffLineInfo.ProductRemark);
- 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");
+ string strCheck = TempOffLineInfo.ProductRemark.Replace("wb", "");
- int iCheck = 0;
+ 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");
- if (blnY == true)
- iCheck = iCheck + 1;
+ int iCheck = 0;
- if (blnZ == true)
- iCheck = iCheck + 1;
+ if (blnY == true)
+ iCheck = iCheck + 1;
- if (blnX == true)
- iCheck = iCheck + 1;
+ if (blnZ == true)
+ iCheck = iCheck + 1;
- if (blnG == true)
- iCheck = iCheck + 1;
+ if (blnX == true)
+ iCheck = iCheck + 1;
- //if (blnC == true)
- // iCheck = iCheck + 1;
+ if (blnG == true)
+ iCheck = 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 (blnC == true)
+ // iCheck = iCheck + 1;
+
+ //y一维码,公司条码 oneCode
+ //z资产号 serialNumber
+ //x芯片 rfid
+ //g模块信息 sim
+ //wb不需要验证
+ //c是摄像头码 number1
+ if (blnY == true && iCheck > 1)
{
- 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(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) == "")
+ if (blnY || blnZ || blnX || blnG) //|| blnC
{
- TempOffLineInfo.MsgInfo = "多码验证,公司条码验证失败";
- log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,公司条码验证失败");
- return false;
- }
+ 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(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;
- }
+ if (blnZ == true && DBToString(chkInfo.serialNumber) == "")
+ {
+ TempOffLineInfo.MsgInfo = "多码验证,资产号验证失败";
+ log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,资产号验证失败");
+ return false;
+ }
- if (blnX == true && DBToString(chkInfo.rfid) == "")
- {
- TempOffLineInfo.MsgInfo = "多码验证,芯片验证失败";
- log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,芯片验证失败");
- return false;
- }
+ if (blnX == true && DBToString(chkInfo.rfid) == "")
+ {
+ TempOffLineInfo.MsgInfo = "多码验证,芯片验证失败";
+ log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,芯片验证失败");
+ return false;
+ }
- if (blnG == true && DBToString(chkInfo.sim) == "")
- {
- TempOffLineInfo.MsgInfo = "多码验证,模块信息验证失败";
- log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,模块信息验证失败");
- return false;
- }
+ if (blnG == true && DBToString(chkInfo.sim) == "")
+ {
+ TempOffLineInfo.MsgInfo = "多码验证,模块信息验证失败";
+ log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证,模块信息验证失败");
+ return false;
+ }
- return true;
+ return true;
+ }
}
}
+ return true;
}
- return true;
- }
- ///
+ ///
/// 将 TempInfo转换为OffLineInfo对象
///
/// 类型A
/// 类型B
/// 类型为B的参数b
/// 拷贝b中相同属性的值的a
- public OffLineInfo MapperTwo(TempInfo b)
+ public OffLineInfo MapperTwo(TempInfo b)
{
OffLineInfo a = new OffLineInfo();
try
@@ -1082,9 +1076,9 @@ namespace Aucma.Core.ProductOffLine.Business
}
return a;
}
-
+
#endregion
-
-
+
+
}
}
\ No newline at end of file