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 WorkStation04 : StationBase { public void PalletNum(string stationCode, object value, DateTime triggerTime) { try { LogHelper.WriteLog(stationCode + "到位托盘号" + Convert.ToInt32(value)); PalletCode = Convert.ToByte(value); if (PalletCode != 0) { //托盘到达,更新条码验证规则 查询产品型号 //查询订单 var deploydata = Deploy_Data.Query().Where(p => p.tuopan_id == Convert.ToInt32(value) && 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(); } else { ProductCycleTime = ExecDateDiff(ArrivedTime, DateTime.Now); ArrivedTime = DateTime.Now; //托盘离开,清空界面 ViewClear(); View_OP40.Barcodes_OP30 = Barcodes_OP30; View_OP40.CycleTime = PalletCode_Op30; View_OP40.StationCode = ProductType_Op30; View_OP40.NokNum = ProductAccount_Op30; View_OP40.OrderNum = OrderNum_OP30; View_OP40.PlanNum = PlanCount_Op30; View_OP40.OkNum = Deploy_Data.Query().Where(p => p.plan_id == PresentOrder.plan_id && p.op40_time != null).Count(); SendMsg.SendMsgToStation(StationInfo.StationCode, "", new CommonView()); SendMsg.SendMsgToStation(StationInfo.StationCode, "Barcodes_OP30", View_OP40.Barcodes_OP30); SendMsg.SendMsgToStation(StationInfo.StationCode, "NokNum", View_OP40.NokNum);//显示上线数量 SendMsg.SendMsgToStation(StationInfo.StationCode, "OkNum", View_OP40.OkNum);//显示上线数量 SendMsg.SendMsgToStation(StationInfo.StationCode, "CycleTime", PalletCode_Op30); SendMsg.SendMsgToStation(StationInfo.StationCode, "StationCode", ProductType_Op30); SendMsg.SendMsgToStation(StationInfo.StationCode, "OrderNum", OrderNum_OP30); SendMsg.SendMsgToStation(StationInfo.StationCode, "PlanNum", PlanCount_Op30); } } catch (Exception ex) { LogHelper.WriteLog(LogHelper.GetMethodInfo(), ex); } } } }