using Aborlen.Model;
|
|
using FrameWork.Log;
|
|
using Monitor.FrameWork;
|
|
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 WorkStation06 : StationBase
|
|
{
|
|
public void PalletNum(string stationCode, object value, DateTime triggerTime)
|
|
{
|
|
|
|
try
|
|
{
|
|
LogHelper.WriteLog(stationCode + "到位托盘号" + Convert.ToInt32(value));
|
|
PalletCode = Convert.ToInt32(value);
|
|
if (PalletCode != 0)
|
|
{
|
|
PalletNum_Record = PalletCode;
|
|
|
|
//托盘到达,更新条码验证规则 查询产品型号
|
|
//查询订单
|
|
var deploydata = Deploy_Data.Query().Where(p => p.tuopan_id == PalletCode && p.process_state == 1).OrderBy(p=>p.Id,OrderByType.Desc);
|
|
if (deploydata.Count() > 0)
|
|
{
|
|
PresentOrder = ProductOrder.Query().Where(p => p.plan_id == deploydata.First().plan_id).First();
|
|
|
|
}
|
|
else
|
|
{
|
|
PresentOrder = ProductOrder.Query().OrderBy(p => p.id, OrderByType.Desc).First();
|
|
}
|
|
|
|
ProductTypeCode = Convert.ToInt32(PresentOrder.product_id);
|
|
|
|
//初始化界面
|
|
ViewInit();
|
|
|
|
if (PresentOrder.xs_enable == 1)
|
|
{
|
|
|
|
BarCodeClass barCodeClass = new BarCodeClass();
|
|
barCodeClass.Id = 1;
|
|
barCodeClass.PartName = "线束条码";
|
|
barCodeClass.PartCodeRule = PresentOrder.xs_rule;
|
|
barCodeClass.PartCount = "1";
|
|
View.Barcodes.Add(barCodeClass);
|
|
SendMsg.SendMsgToStation(stationCode, "Barcodes", View.Barcodes);
|
|
}
|
|
|
|
//更新OP60 TIME
|
|
string sql = $"update Deploy_Data set op60_time='{DateTime.Now}' where tuopan_id='{PalletCode}'and process_state=1 and plan_id='{PresentOrder.plan_id}'";
|
|
SqlSugarAdo.ExecuteCommand(sql);
|
|
//更新产量
|
|
View.NokNum = Deploy_Data.Query().Where(p => p.plan_id == PresentOrder.plan_id && p.op60_time != null).Count(); //当前工站数量
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
if (PalletNum_Record != 0&& Barcode_Record!=null) {
|
|
|
|
string sql_bar = $" update Deploy_Data set xs_pid ='{Barcode_Record}' where tuopan_id ='{PalletNum_Record}' and process_state=1 and plan_id='{PresentOrder.plan_id}'";
|
|
|
|
SqlSugarAdo.ExecuteCommand(sql_bar);
|
|
}
|
|
Barcode_Record = null;
|
|
|
|
|
|
ProductCycleTime = ExecDateDiff(ArrivedTime, DateTime.Now);
|
|
|
|
ArrivedTime = DateTime.Now;
|
|
|
|
//托盘离开,清空界面
|
|
ViewClear();
|
|
SendMsg.SendMsgToStation(StationInfo.StationCode, "", new CommonView());
|
|
SendMsg.SendMsgToStation(StationInfo.StationCode, "NokNum", View.NokNum);
|
|
SendMsg.SendMsgToStation(StationInfo.StationCode, "OkNum", View.OkNum);
|
|
SendMsg.SendMsgToStation(StationInfo.StationCode, "AlarmMsg", "");
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteLog(LogHelper.GetMethodInfo(), ex);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
}
|