using Aborlen.Model;
|
|
using FrameWork.Log;
|
|
using Monitor.FrameWork;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using WorkStationBase;
|
|
|
|
namespace Aborlen.WorkStation
|
|
{
|
|
public partial class WorkStation02 : StationBase
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
/// 初始化界面
|
|
/// </summary>
|
|
public override void ViewInit()
|
|
{
|
|
try
|
|
{
|
|
|
|
|
|
//更新当日产量信息
|
|
OkAccount = ProductData_Outline.Query().Where(p => p.ProductState == 1 && Convert.ToDateTime(p.op20_time).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")).Count();
|
|
NokAccount = ProductData_Outline.Query().Where(p => p.ProductState == 2 && Convert.ToDateTime(p.op20_time).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")).Count();
|
|
//获取订单信息
|
|
View.ProductType = PresentOrder.part_name;
|
|
View.OkNum = OkAccount; // 当日实际产量
|
|
View.NokNum =NokAccount ;
|
|
View.CycleTime = ProductCycleTime;
|
|
//查询工步信息
|
|
|
|
List<WorkStepInfo> stepInfos = WorkStepInfo.Query().Where(p => p.StationCode == StationInfo.StationCode && p.PieceTypeCode == PieceTypeCode).ToList();
|
|
|
|
View.StepList.Clear();
|
|
foreach (var item in stepInfos)
|
|
{
|
|
WorkStepClass workStepClass = new WorkStepClass();
|
|
workStepClass.Id = item.SerialId;
|
|
workStepClass.StepId = item.PlcStepId;
|
|
workStepClass.StepContent = item.StepContent;
|
|
workStepClass.TechRequirement = item.TechRequirement;
|
|
workStepClass.PictureName = item.PictureName;
|
|
workStepClass.GifPosition_X = item.GifPosition_X;
|
|
workStepClass.GifPosition_Y = item.GifPosition_Y;
|
|
View.StepList.Add(workStepClass);
|
|
|
|
}
|
|
|
|
//查询条码信息
|
|
View.Barcodes.Clear();
|
|
|
|
|
|
BarCodeClass barCodeClass = new BarCodeClass();
|
|
barCodeClass.Id = 1;
|
|
barCodeClass.PartName = "电机条码";
|
|
barCodeClass.PartCodeRule = PresentOrder.motor_rule;
|
|
barCodeClass.PartCount = "1";
|
|
View.Barcodes.Add(barCodeClass);
|
|
barCodeClass = new BarCodeClass();
|
|
barCodeClass.Id = 2;
|
|
barCodeClass.PartName = "左滑轨条码";
|
|
barCodeClass.PartCodeRule = PresentOrder.left_rule;
|
|
barCodeClass.PartCount = "1";
|
|
View.Barcodes.Add(barCodeClass);
|
|
barCodeClass = new BarCodeClass();
|
|
barCodeClass.Id = 3;
|
|
barCodeClass.PartName = "右滑轨条码";
|
|
barCodeClass.PartCodeRule = PresentOrder.right_rule;
|
|
barCodeClass.PartCount = "1";
|
|
View.Barcodes.Add(barCodeClass);
|
|
|
|
|
|
//向前端发送界面
|
|
|
|
SendMsg.SendMsgToStation( StationInfo.StationCode,null, View);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteLog(LogHelper.GetMethodInfo(), ex);
|
|
}
|
|
|
|
}
|
|
|
|
public override void OdsStep(string stationCode, object value, DateTime triggerTime)
|
|
{
|
|
|
|
|
|
|
|
|
|
int stepNo = Convert.ToInt32(value);
|
|
if (stepNo == 0)
|
|
{
|
|
//初始化界面
|
|
|
|
|
|
ViewInit();
|
|
}
|
|
else
|
|
{
|
|
List<WorkStepInfo> workStepInfos = WorkStepInfo.Query().Where(p => p.PlcStepId == stepNo && p.StationCode == stationCode).ToList();
|
|
|
|
if (workStepInfos.Count > 0)
|
|
{
|
|
SendMsg.SendMsgToStation(stationCode, $"StepList.#{workStepInfos.First().SerialId - 1}.#selected", true);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|