|
|
|
@ -101,16 +101,16 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public async void test()
|
|
|
|
|
public void test()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// string result = await _productOffLineServices.QueryChecked("1531000AP0098DCU0481");
|
|
|
|
|
// Console.WriteLine(result);
|
|
|
|
|
|
|
|
|
|
// string tt = "Y@1104@16160030000000910780@000010034895@@ @000000@000000009000004899@BCD-160C,家电下乡@@BCD-160C@皓月白-家电下乡@161601300@160@1-00版@家电下乡产品@默认@2010-09-01";
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(5000);
|
|
|
|
|
Thread.Sleep(6000);
|
|
|
|
|
MaterialBarScan("32160030000000910780", "192.168.1.19");
|
|
|
|
|
// Thread.Sleep(1000);
|
|
|
|
|
// MaterialBarScanEvent("33160030000000910780", "192.168.1.20");
|
|
|
|
@ -140,9 +140,30 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
}
|
|
|
|
|
// 2.更新mes数据库
|
|
|
|
|
BackResult = updateMesData(TempOffLineInfo1);
|
|
|
|
|
log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo1.ProductOrderNo, TempOffLineInfo1.OrderQty));
|
|
|
|
|
// 3.plc放行
|
|
|
|
|
if (BackResult)
|
|
|
|
|
{
|
|
|
|
|
bool plcResult =SendAndWaitSignal(ScannerNo, materialType);
|
|
|
|
|
if (plcResult)
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo1.MsgInfo = TempOffLineInfo1.MsgInfo + "plc放行成功";
|
|
|
|
|
TempOffLineInfo1.MsgAlarmFlag = true;
|
|
|
|
|
//界面刷新
|
|
|
|
|
TempOffLineInfo1.ProductRefreshFlag = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo1.MsgInfo = TempOffLineInfo1.MsgInfo + "plc放行异常";
|
|
|
|
|
TempOffLineInfo1.MsgAlarmFlag = true;
|
|
|
|
|
//界面刷新
|
|
|
|
|
TempOffLineInfo1.ProductRefreshFlag = true;
|
|
|
|
|
}
|
|
|
|
|
log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo1.ProductOrderNo, TempOffLineInfo1.OrderQty));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
// 扫码器2
|
|
|
|
|
else if (ScannerNo == 2)
|
|
|
|
|
{
|
|
|
|
|
BackResult = HandleMaterialBarCode(code.Trim(), TempOffLineInfo2); //扫码器2
|
|
|
|
|
materialType = TempOffLineInfo2.ProductCode;
|
|
|
|
@ -152,26 +173,47 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
}
|
|
|
|
|
// 2.更新mes数据库
|
|
|
|
|
BackResult = updateMesData(TempOffLineInfo2);
|
|
|
|
|
log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo2.ProductOrderNo, TempOffLineInfo2.OrderQty));
|
|
|
|
|
}
|
|
|
|
|
if (BackResult == true)
|
|
|
|
|
{
|
|
|
|
|
// 先查询分垛方向A或者B
|
|
|
|
|
string direction = getDirectioneEvent?.Invoke(materialType);
|
|
|
|
|
if (direction == "")
|
|
|
|
|
// 3.plc放行
|
|
|
|
|
if (BackResult)
|
|
|
|
|
{
|
|
|
|
|
//未设置方向处理
|
|
|
|
|
}
|
|
|
|
|
bool plcResult = DownLoadPassFlag(ScannerNo, direction); //下发plc放行信号,分垛AB库
|
|
|
|
|
if (plcResult == false)
|
|
|
|
|
{
|
|
|
|
|
sendPlcError();
|
|
|
|
|
bool plcResult = SendAndWaitSignal(ScannerNo, materialType);
|
|
|
|
|
if (plcResult)
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo2.MsgInfo = TempOffLineInfo2.MsgInfo + "plc放行成功";
|
|
|
|
|
TempOffLineInfo2.MsgAlarmFlag = true;
|
|
|
|
|
//界面刷新
|
|
|
|
|
TempOffLineInfo2.ProductRefreshFlag = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TempOffLineInfo2.MsgInfo = TempOffLineInfo2.MsgInfo + "plc放行异常";
|
|
|
|
|
TempOffLineInfo2.MsgAlarmFlag = true;
|
|
|
|
|
//界面刷新
|
|
|
|
|
TempOffLineInfo2.ProductRefreshFlag = true;
|
|
|
|
|
}
|
|
|
|
|
log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo2.ProductOrderNo, TempOffLineInfo2.OrderQty));
|
|
|
|
|
}
|
|
|
|
|
log.Info("plc放行反馈成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下发plc放行并等待反馈信号
|
|
|
|
|
/// </summary>
|
|
|
|
|
private bool SendAndWaitSignal(int ScannerNo, string materialType)
|
|
|
|
|
{
|
|
|
|
|
bool plcResult = false;
|
|
|
|
|
// 先查询分垛方向A或者B
|
|
|
|
|
string direction = getDirectioneEvent?.Invoke(materialType);
|
|
|
|
|
if (direction == "")
|
|
|
|
|
{
|
|
|
|
|
//未设置方向处理,默认去A
|
|
|
|
|
direction = "A";
|
|
|
|
|
}
|
|
|
|
|
plcResult = DownLoadPassFlag(ScannerNo, direction); //下发plc放行信号,分垛AB库
|
|
|
|
|
return plcResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 条码验证成功后,更新mes数据库 成品下线表,订单表等等
|
|
|
|
|
/// </summary>
|
|
|
|
@ -242,7 +284,7 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
TempOffLineInfo.QualityResult = "成功";
|
|
|
|
|
Thread.Sleep(10000);
|
|
|
|
|
|
|
|
|
|
TempOffLineInfo.ProductSNCode = BarCode.Trim(); //产品SN条码*1
|
|
|
|
|
TempOffLineInfo.ProductScanTime = System.DateTime.Now; // 扫码时间*2
|
|
|
|
|
|
|
|
|
@ -454,7 +496,7 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
// 往plc写入放行信号
|
|
|
|
|
obj.plc.WriteInt32("D202", 1);
|
|
|
|
|
}
|
|
|
|
|
DateTime targetTime = DateTime.Now.AddSeconds(60);
|
|
|
|
|
DateTime targetTime = DateTime.Now.AddSeconds(5);
|
|
|
|
|
// 等待plc反馈信号
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|