using Aborlen.Model;
using FrameWork.Log;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkStationBase;
namespace Aborlen.WorkStation
{
public partial class WorkStation04 : StationBase
{
///
/// 扫描条码
///
///
///
///
public void BarCode(string stationCode, object value, DateTime triggerTime)
{
try
{
//读取产品型号 查询当前型号的最近订单
string barcode = value.ToString();
if (PresentOrder.ecu_enable==1)
{
//电动产品,扫描电机条码 查询分线表
if (barcode.Contains(PresentOrder.ecu_rule))
{
//已存在,更新上线时间
string sql = $" update Deploy_Data set ecu_pid ='{barcode}' where tuopan_id ='{Read(2180, triggerTime)}' and process_state=1 and plan_id='{PresentOrder.plan_id}'";
SqlSugarAdo.ExecuteCommand(sql);
//写入扫描完成
Write(1080, (byte)1);
//显示扫描条码
View_OP40.Barcodes.Where(p => p.PartCodeRule == PresentOrder.ecu_rule).First().PartCode = barcode;
//向前端发送更改
SendMsg.SendMsgToStation(StationInfo.StationCode, "Barcodes", View_OP40.Barcodes);
SendMsg.SendMsgToStation(StationInfo.StationCode, "AlarmMsg", "");
}
else
{
SendMsg.SendMsgToStation(StationInfo.StationCode, "AlarmMsg", "OP40扫描条码错误。");
}
}
}
catch (Exception ex)
{
LogHelper.WriteLog(LogHelper.GetMethodInfo(), ex);
}
}
}
}