|
|
@ -9,6 +9,7 @@ using SlnMesnac.Model.enums;
|
|
|
|
using SlnMesnac.Plc;
|
|
|
|
using SlnMesnac.Plc;
|
|
|
|
using SlnMesnac.Repository.service;
|
|
|
|
using SlnMesnac.Repository.service;
|
|
|
|
using SlnMesnac.Rfid;
|
|
|
|
using SlnMesnac.Rfid;
|
|
|
|
|
|
|
|
using SlnMesnac.TouchSocket;
|
|
|
|
using SqlSugar;
|
|
|
|
using SqlSugar;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
@ -50,7 +51,7 @@ namespace SlnMesnac.Business
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public class ProdCompletionBusiness : BaseBusiness
|
|
|
|
public class ProdCompletionBusiness : BaseBusiness
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
private FJ500Comm.FJ500SP fj500s = new FJ500Comm.FJ500SP();
|
|
|
|
private readonly IMesProductPlanService _mesProductPlanService;
|
|
|
|
private readonly IMesProductPlanService _mesProductPlanService;
|
|
|
|
private readonly IMesProductOrderService _mesProductOrderService;
|
|
|
|
private readonly IMesProductOrderService _mesProductOrderService;
|
|
|
|
private readonly IMesPrdBarCodeService _barCodeTaskService;
|
|
|
|
private readonly IMesPrdBarCodeService _barCodeTaskService;
|
|
|
@ -63,6 +64,7 @@ namespace SlnMesnac.Business
|
|
|
|
|
|
|
|
|
|
|
|
public ProdCompletionBusiness(ISqlSugarClient _sqlSugarClient, ILogger<BaseBusiness> logger, AppConfig appConfig, List<PlcAbsractFactory> plcFactories, List<RfidAbsractFactory> rfidFactories, IMesProductPlanService mesProductPlanService, IMesPrdBarCodeService barCodeTaskService, IServiceProvider serviceProvider) : base(logger, appConfig, plcFactories, rfidFactories, serviceProvider)
|
|
|
|
public ProdCompletionBusiness(ISqlSugarClient _sqlSugarClient, ILogger<BaseBusiness> logger, AppConfig appConfig, List<PlcAbsractFactory> plcFactories, List<RfidAbsractFactory> rfidFactories, IMesProductPlanService mesProductPlanService, IMesPrdBarCodeService barCodeTaskService, IServiceProvider serviceProvider) : base(logger, appConfig, plcFactories, rfidFactories, serviceProvider)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
UdpServer.ReceivedPMCodeEvent += PmCodeHandler;
|
|
|
|
sqlSugarClient = _sqlSugarClient;
|
|
|
|
sqlSugarClient = _sqlSugarClient;
|
|
|
|
_mesProductPlanService = mesProductPlanService;
|
|
|
|
_mesProductPlanService = mesProductPlanService;
|
|
|
|
_barCodeTaskService = barCodeTaskService;
|
|
|
|
_barCodeTaskService = barCodeTaskService;
|
|
|
@ -102,6 +104,45 @@ namespace SlnMesnac.Business
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 喷码机返回信息解析处理
|
|
|
|
|
|
|
|
/// 1.传输完成及喷码完成
|
|
|
|
|
|
|
|
/// 2.喷码机状态检查
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="str"></param>
|
|
|
|
|
|
|
|
private void PmCodeHandler(string str)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//设备状态30s一次
|
|
|
|
|
|
|
|
if (str.Substring(0, 4) == "0A0C")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//推送最新需要打印条码,防止无可打印条码
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = fj500s.GetState(str);
|
|
|
|
|
|
|
|
if (result == "0E")
|
|
|
|
|
|
|
|
{ // 喷码机设备故障,todo 推送报警
|
|
|
|
|
|
|
|
_logger.LogError("喷码机设备故障,待推送报警");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else // 传输完成及喷码完成结果
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var result = fj500s.GetAck(str);
|
|
|
|
|
|
|
|
if(result == "00")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 发送数据成功
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(result =="0E")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 发送数据失败,重新发送,超过10次失败推送报警
|
|
|
|
|
|
|
|
}else if(result == "0F")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//打印完成,更新当前打印条码信息,并推送下一条信息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// É豸²ú³öÂß¼´¦Àí
|
|
|
|
/// É豸²ú³öÂß¼´¦Àí
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|