|
|
- using Aborlen.Model;
- using FrameWork.Log;
- using SqlSugar;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using WorkStationBase;
-
- namespace Aborlen.WorkStation
- {
- public partial class WorkStation105 : StationBase
- {
- public void PalletNum(string stationCode, object value, DateTime triggerTime)
- {
-
- try
- {
- LogHelper.WriteLog(stationCode + "到位托盘号" + Convert.ToInt32(value));
- if (Convert.ToByte(value) != 0)
- {
-
- //托盘到达,更新条码验证规则 查询产品型号
- //查询订单
- var deploydata = Deploy_Data.Query().Where(p => p.tuopan_id == Convert.ToInt32(value) && p.process_state == 1).OrderBy(p => p.Id, SqlSugar.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);
-
- string sql = $"update Deploy_Data set ";
-
- //string _AllResult = "0";
-
- //foreach (var qualityTag in QualityOpcTagInfos)
- //{
-
- // int readTime = 200;
- // //此处托盘到位时,工件总装结果可能未更新(增加读取速度再测试)
- // while (_AllResult == "0")
- // {
- // _AllResult = Read(qualityTag.TagId, triggerTime).ToString();
- // if (readTime == 0) break;
- // Thread.Sleep(50);
- // readTime--;
- // }
-
- // sql = sql + $" {qualityTag.ColName}='{ Read(qualityTag.TagId, triggerTime).ToString() }' ,";
-
- //}
- //sql = sql.Remove(sql.Length - 1, 1);
- sql = sql + $"all_time='{DateTime.Now}' where tuopan_id='{Read(2180, triggerTime)}'and process_state=1 and plan_id='{PresentOrder.plan_id}'";
- SqlSugarAdo.ExecuteCommand(sql);
-
- //回写保存完成
- Write(1120, (byte)1);
-
- }
-
-
- }
- catch (Exception ex)
- {
- LogHelper.WriteLog(LogHelper.GetMethodInfo(), ex);
- }
-
-
-
- }
-
- }
- }
|