| | |
| | | using Autofac.Core; |
| | | using HslCommunication; |
| | | using HslCommunication.Core; |
| | | using Microsoft.VisualBasic.FileIO; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using Quartz; |
| | | using SixLabors.ImageSharp.PixelFormats; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_BasicInfoService; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class PLCJob : JobBase, IJob |
| | | { |
| | | private readonly IBoxingService _boxingService; |
| | | private readonly IBoxingDetailService _boxingDetailService; |
| | | private readonly IFormulaService _formulaService; |
| | | private readonly IFormulaDetailService _formulaDetailService; |
| | | private readonly IProcessInfoService _processInfoService; |
| | | public PLCJob(IBoxingService boxingService, IBoxingDetailService boxingDetailService, IFormulaService formulaService, IFormulaDetailService formulaDetailService, IProcessInfoService processInfoService) |
| | | { |
| | | _boxingService = boxingService; |
| | | _boxingDetailService = boxingDetailService; |
| | | _formulaService = formulaService; |
| | | _formulaDetailService = formulaDetailService; |
| | | _processInfoService = processInfoService; |
| | | } |
| | | private readonly string set = "0x16,0x4D,0x0D,0x30,0x34,0x30,0x31,0x44,0x30,0x35,0x2E";//主æºåéè®¾ç½®æ«ææ¨¡å¼ä¸ºä¸»æºæ¨¡å¼çå½ä»¤,æ«æå¨è¿åæ¥æ¶å°çå½ä»¤å<ACK>ï¼0x06ï¼åï¼å°æ«ææ¨¡å¼æ´æ¹ä¸ºä¸»æºæ¨¡å¼ |
| | | private readonly string Text = "å¼å¯æ«ç ";//主æºåéè®¾ç½®æ«ææ¨¡å¼ä¸ºä¸»æºæ¨¡å¼çå½ä»¤,æ«æå¨è¿åæ¥æ¶å°çå½ä»¤å<ACK>ï¼0x06ï¼åï¼å°æ«ææ¨¡å¼æ´æ¹ä¸ºä¸»æºæ¨¡å¼ |
| | | private readonly string command = "0x16,0x54,0x0D";//åéå¼å§è§£ç å½ä»¤ï¼"0x16,0x55,0x0D"åéåæ¢è§£ç å½ä»¤ |
| | | SerialPortCommunicator portCommunicator1 = new SerialPortCommunicator("COM1", 9600, "ä¸çº¿æ«ç æª"); |
| | | static bool IsConnected1 = false; |
| | | SerialPortCommunicator portCommunicator2 = new SerialPortCommunicator("COM2", 9600, "ä¸çº¿æ«ç æª"); |
| | | static bool IsConnected2 = false; |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | |
| | | bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value); |
| | | if (flag && value != null) |
| | | { |
| | | if (value is OtherDevice) |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | | try |
| | | { |
| | | |
| | | var Heart = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolHeart); |
| | | var EMG = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolEMG); |
| | | var AutoExecuting = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolAutoExecuting); |
| | | var OnlineExecuting = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolOnlineExecuting); |
| | | var Error = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolError); |
| | | if (Heart && !EMG && AutoExecuting && OnlineExecuting && !Error) |
| | | { |
| | | #region ä¸çº¿æ«ç |
| | | var Location1ScanStart = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolLocation1ScanStart); |
| | | var Location1ScanDone = device.GetValue<W_PLCDBName, bool>(W_PLCDBName.wboolLocation1ScanDone); |
| | | if (Location1ScanStart && !Location1ScanDone)//æ§å¶æ«ç æªæ«ææçç ï¼æ ¹æ®æçç æ¥è¯¢ç»çæ°æ®ï¼å¤ææçç»å®æåæ¯å¦å·²ç»å®æææéé¶ä»¶ |
| | | { |
| | | #region MyRegion |
| | | #region 串å£è¿æ¥ |
| | | if (!IsConnected1) IsConnected1 = portCommunicator1.Connect(); |
| | | if (!IsConnected2) IsConnected2 = portCommunicator2.Connect(); |
| | | byte[] dataToSend1 = Encoding.ASCII.GetBytes(command);//转æåèæ°ç» |
| | | portCommunicator1.Write(dataToSend1); |
| | | string receiveData = portCommunicator2.ToString(Encoding.UTF8); |
| | | //if (receiveData == "0x16,0x54,0x0D") |
| | | //{ |
| | | // Console.WriteLine(receiveData); |
| | | byte[] dataToSend2 = Encoding.ASCII.GetBytes("PL106");//转æåèæ°ç» |
| | | portCommunicator2.Write(dataToSend2); |
| | | //} |
| | | string PalletCode = portCommunicator1.ToString(Encoding.UTF8); |
| | | if (PalletCode.IsNotEmptyOrNull()) |
| | | { |
| | | var boxing = _boxingService.Repository.QueryFirst(x => x.PalletCode == PalletCode); |
| | | } |
| | | IsConnected1 = !portCommunicator1.Disconnect(); |
| | | IsConnected2 = !portCommunicator2.Disconnect(); |
| | | #endregion |
| | | #endregion |
| | | |
| | | device.SetValue(W_PLCDBName.wboolLocation1ScanDone, true); |
| | | } |
| | | else if (!Location1ScanStart && Location1ScanDone) |
| | | { |
| | | device.SetValue(W_PLCDBName.wboolLocation1ScanDone, false); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region åè£
æ«ç |
| | | var Location2ScanStart = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolLocation2ScanStart); |
| | | if (Location2ScanStart)//æ§å¶æ«ç æªæ«ææçç ï¼æ ¹æ®æçç æ¥è¯¢æçç»å®æåå å·¥æéæ°æ®ï¼åå
¥PLC |
| | | { |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region æ£æµæ«ç |
| | | var Location3ScanStart = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolLocation3ScanStart); |
| | | #endregion |
| | | |
| | | #region ä¸çº¿æ«ç |
| | | var Location4ScanStart = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolLocation4ScanStart); |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | //var a = _boxingService.Repository.QueryFirst(x => x.PalletCode == "1232123"); |
| | | //WriteInfo(device.DeviceName, "infoLog"); |
| | | |
| | | //WriteDebug(device.DeviceName, "debugLog"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(device.DeviceName, "é误", ex); |
| | | } |
| | | } |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | using System.Text;
|
| | | using Quartz;
|
| | | using WIDESEAWCS_BasicInfoService;
|
| | | using WIDESEAWCS_Common.PLCEnum;
|
| | | using WIDESEAWCS_Communicator;
|
| | | using WIDESEAWCS_Core.BaseRepository;
|
| | | using WIDESEAWCS_Core.Helper;
|
| | | using WIDESEAWCS_IBasicInfoService;
|
| | | using WIDESEAWCS_Model.Models;
|
| | | using WIDESEAWCS_QuartzJob;
|
| | |
|
| | | namespace WIDESEAWCS_Tasks
|
| | | {
|
| | | [DisallowConcurrentExecution]
|
| | | public class PLCJob : JobBase, IJob
|
| | | {
|
| | | private readonly IBoxingService _boxingService;
|
| | | private readonly IBoxingDetailService _boxingDetailService;
|
| | | private readonly IFormulaService _formulaService;
|
| | | private readonly IFormulaDetailService _formulaDetailService;
|
| | | private readonly IProcessInfoService _processInfoService;
|
| | | private readonly IProcessInfoDetailService _processDetailInfoService;
|
| | | private readonly IUnitOfWorkManage _unitOfWorkManage;
|
| | | private readonly IScanStationService _scanStationService;
|
| | | //private readonly string PalletCode = "PL107";
|
| | |
|
| | | public PLCJob(IBoxingService boxingService,
|
| | | IBoxingDetailService boxingDetailService,
|
| | | IFormulaService formulaService,
|
| | | IFormulaDetailService formulaDetailService,
|
| | | IProcessInfoService processInfoService,
|
| | | IProcessInfoDetailService processDetailInfoService,
|
| | | IUnitOfWorkManage unitOfWorkManage,
|
| | | IScanStationService scanStationService
|
| | | )
|
| | | {
|
| | | _boxingService = boxingService;
|
| | | _boxingDetailService = boxingDetailService;
|
| | | _formulaService = formulaService;
|
| | | _formulaDetailService = formulaDetailService;
|
| | | _processInfoService = processInfoService;
|
| | | _processDetailInfoService = processDetailInfoService;
|
| | | _unitOfWorkManage = unitOfWorkManage;
|
| | | _scanStationService = scanStationService;
|
| | | }
|
| | | public Task Execute(IJobExecutionContext context)
|
| | | {
|
| | | |
| | | bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
|
| | | if (flag && value != null)
|
| | | {
|
| | | if (value is OtherDevice)
|
| | | {
|
| | | OtherDevice device = (OtherDevice)value;
|
| | | try
|
| | | {
|
| | |
|
| | | var Heart = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolHeart);
|
| | | var EMG = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolEMG);
|
| | | var AutoExecuting = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolAutoExecuting);
|
| | | var OnlineExecuting = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolOnlineExecuting);
|
| | | var Error = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolError);
|
| | |
|
| | | if (Heart && !EMG && AutoExecuting && OnlineExecuting && !Error)
|
| | | {
|
| | | #region ä¸çº¿æ«ç
|
| | | HandleOnlineScan(device);
|
| | | #endregion
|
| | |
|
| | | #region åè£
æ«ç
|
| | | HandlePressScan(device);
|
| | | #endregion
|
| | |
|
| | | #region æ£æµæ«ç
|
| | | HandleDetectScan(device);
|
| | | #endregion
|
| | |
|
| | | #region ä¸çº¿æ«ç
|
| | | HandleOfflineScan(device);
|
| | |
|
| | | #endregion
|
| | | }
|
| | |
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | WriteError(device.DeviceName, "é误", ex);
|
| | | }
|
| | | }
|
| | | }
|
| | | return Task.CompletedTask;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// ä¸çº¿æ«ç
|
| | | /// </summary>
|
| | | /// <param name="device"></param>
|
| | | private void HandleOnlineScan(OtherDevice device)
|
| | | {
|
| | | var Location1ScanStart = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolLocation1ScanStart);
|
| | | var Location1ScanDone = device.GetValue<W_PLCDBName, bool>(W_PLCDBName.wboolLocation1ScanDone);
|
| | | if (Location1ScanStart && !Location1ScanDone)//æ§å¶æ«ç æªæ«ææçç ï¼æ ¹æ®æçç æ¥è¯¢ç»çæ°æ®ï¼å¤ææçç»å®æåæ¯å¦å·²ç»å®æææéé¶ä»¶
|
| | | {
|
| | | var PalletCode = TcpClientExample.Start("192.168.2.120", 2001);
|
| | | try
|
| | | {
|
| | | if (!PalletCode.IsNotEmptyOrNull())
|
| | | {
|
| | | throw new InvalidOperationException("æç为空");
|
| | | }
|
| | | var boxing = _boxingService.Repository.QueryFirst(x => x.PalletCode == PalletCode);
|
| | | if (boxing == null)
|
| | | {
|
| | | throw new InvalidOperationException("æªæ·»å ç»çä¿¡æ¯");
|
| | | }
|
| | | List<Dt_BoxingDetail> dt_BoxingDetails = _boxingDetailService.Repository.QueryData(x => x.BoxingId == boxing.Id);
|
| | | Dt_Formula dt_Formula = _formulaService.Repository.QueryFirst(x => x.ProductCode == boxing.ProductCode);
|
| | | if (dt_Formula == null)
|
| | | {
|
| | | throw new InvalidOperationException("æ æåé
æ¹");
|
| | | }
|
| | | List<Dt_FormulaDetail> dt_FormulaDetails = _formulaDetailService.Repository.QueryData(x => x.FormulaId == dt_Formula.Id && x.IsScanned == 1);
|
| | | //æ¯è¾é¶ä»¶æ¯å¦é½å
¨
|
| | | if (!_boxingDetailService.IsComponentCodesEqual(dt_BoxingDetails, dt_FormulaDetails))
|
| | | {
|
| | | throw new InvalidOperationException("é¶ä»¶æé®é¢ï¼è¯·å¤ç");
|
| | | }
|
| | | device.SetValue(W_PLCDBName.wboolLocation1ScanDone, true);
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | WriteError(device.DeviceName, "ä¸çº¿æ«ç æµç¨æ§è¡å¼å¸¸", ex);
|
| | | }
|
| | | }
|
| | | else if (!Location1ScanStart && Location1ScanDone)
|
| | | {
|
| | | device.SetValue(W_PLCDBName.wboolLocation1ScanDone, false);
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// åè£
æ«ç
|
| | | /// </summary>
|
| | | /// <param name="device"></param>
|
| | | private void HandlePressScan(OtherDevice device)
|
| | | {
|
| | | var Location2ScanStart = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolLocation2ScanStart);
|
| | | var Location2ScanDone = device.GetValue<W_PLCDBName, bool>(W_PLCDBName.wboolLocation2ScanDone);
|
| | | if (Location2ScanStart && !Location2ScanDone)//æ§å¶æ«ç æªæ«ææçç ï¼æ ¹æ®æçç æ¥è¯¢æçç»å®æåå å·¥æéæ°æ®ï¼åå
¥PLC
|
| | | {
|
| | | var PalletCode = TcpClientExample.Start("192.168.2.121", 2001);
|
| | |
|
| | | try
|
| | | {
|
| | | if (!PalletCode.IsNotEmptyOrNull())
|
| | | {
|
| | | throw new InvalidOperationException("æç为空");
|
| | | }
|
| | | Dt_Boxing dt_Boxing = _boxingService.Repository.QueryFirst(x => x.PalletCode == PalletCode);
|
| | | Dt_Formula dt_Formula = _formulaService.Repository.QueryFirst(x => x.ProductCode == dt_Boxing.ProductCode);
|
| | | //åå
¥PLC
|
| | | device.SetValue(W_PLCDBName.wrealProductLength, dt_Formula.ProductLength);
|
| | | device.SetValue(W_PLCDBName.wrealProductWidth, dt_Formula.ProductWidth);
|
| | | device.SetValue(W_PLCDBName.wrealProductHeight, dt_Formula.ProductHeight);
|
| | | device.SetValue(W_PLCDBName.wrealScrewDownsetDistance, dt_Formula.ScrewDownsetDistance);
|
| | | device.SetValue(W_PLCDBName.wrealScrewTorqueOutput, dt_Formula.ScrewTorqueOutput);
|
| | | device.SetValue(W_PLCDBName.wDintAutoScrewOn, dt_Formula.DintAutoScrewOn);
|
| | | //åè£
æ«ç 宿
|
| | | device.SetValue(W_PLCDBName.wboolLocation2ScanDone, true);
|
| | | //æ¥æ¶æ°æ®
|
| | | decimal PressHeight = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectPressHeight);
|
| | | decimal ScrewTorque = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectScrewTorque);
|
| | | decimal ScrewAngle = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectScrewAngle);
|
| | | //æ·»å å°æ°æ®åº
|
| | | Dt_ProcessInfo dt_ProcessInfo = new Dt_ProcessInfo()
|
| | | {
|
| | | PalletCode = PalletCode,
|
| | | ProductCode = dt_Formula.ProductCode,
|
| | | ProductName = dt_Formula.ProductName,
|
| | | PressHeight = PressHeight,
|
| | | ScrewTorque = ScrewTorque,
|
| | | ScrewAngle = ScrewAngle
|
| | | };
|
| | | _processInfoService.Repository.AddData(dt_ProcessInfo);
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | WriteError(device.DeviceName, "åè£
æ«ç æµç¨æ§è¡å¼å¸¸", ex);
|
| | | }
|
| | | }
|
| | | else if (!Location2ScanStart && Location2ScanDone)
|
| | | {
|
| | | device.SetValue(W_PLCDBName.wboolLocation2ScanDone, false);
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// æ£æµæ«ç
|
| | | /// </summary>
|
| | | /// <param name="device"></param>
|
| | | private void HandleDetectScan(OtherDevice device)
|
| | | {
|
| | | var Location3ScanStart = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolLocation3ScanStart);
|
| | | var Location3ScanDone = device.GetValue<W_PLCDBName, bool>(W_PLCDBName.wboolLocation3ScanDone);
|
| | | if (Location3ScanStart && !Location3ScanDone)
|
| | | {
|
| | | var PalletCode = TcpClientExample.Start("192.168.2.122", 2001);
|
| | | try
|
| | | {
|
| | | if (!PalletCode.IsNotEmptyOrNull())
|
| | | {
|
| | | throw new InvalidOperationException("æç为空");
|
| | | }
|
| | | Dt_Boxing dt_Boxing = _boxingService.Repository.QueryFirst(x => x.PalletCode == PalletCode);
|
| | | Dt_Formula dt_Formula = _formulaService.Repository.QueryFirst(x => x.ProductCode == dt_Boxing.ProductCode);
|
| | | //åå
¥PLC
|
| | | device.SetValue(W_PLCDBName.wrealXDirectionDistance1, dt_Formula.XDirectionDistance1);
|
| | | device.SetValue(W_PLCDBName.wrealYDirectionHeight1, dt_Formula.YDirectionHeight1);
|
| | | device.SetValue(W_PLCDBName.wrealXDirectionDistance2, dt_Formula.XDirectionDistance2);
|
| | | device.SetValue(W_PLCDBName.wrealYDirectionHeight2, dt_Formula.YDirectionHeight2);
|
| | | device.SetValue(W_PLCDBName.wrealXDirectionDistance3, dt_Formula.XDirectionDistance3);
|
| | | device.SetValue(W_PLCDBName.wrealYDirectionHeight3, dt_Formula.YDirectionHeight3);
|
| | |
|
| | | //æ£æµæ«ç 宿
|
| | | device.SetValue(W_PLCDBName.wboolLocation3ScanDone, true);
|
| | |
|
| | | //æ¥æ¶æ°æ®
|
| | | decimal Height1 = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectHeight1);
|
| | | decimal Height2 = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectHeight2);
|
| | | decimal Height3 = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectHeight3);
|
| | |
|
| | | Dt_ProcessInfo dt_ProcessInfo = _processInfoService.Repository.QueryFirst(x => x.PalletCode == PalletCode);
|
| | | if (dt_ProcessInfo == null)
|
| | | {
|
| | | throw new InvalidOperationException("æåæªåè£
");
|
| | | }
|
| | | dt_ProcessInfo.Height1 = Height1;
|
| | | dt_ProcessInfo.Height2 = Height2;
|
| | | dt_ProcessInfo.Height3 = Height3;
|
| | | _processInfoService.Repository.UpdateData(dt_ProcessInfo);
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | WriteError(device.DeviceName, "æ£æµæ«ç æµç¨æ§è¡å¼å¸¸", ex);
|
| | | }
|
| | | }
|
| | | else if (!Location3ScanStart && Location3ScanDone)
|
| | | {
|
| | | device.SetValue(W_PLCDBName.wboolLocation3ScanDone, false);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// ä¸çº¿æ«ç
|
| | | /// </summary>
|
| | | /// <param name="device"></param>
|
| | | private void HandleOfflineScan(OtherDevice device)
|
| | | {
|
| | | var Location4ScanStart = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rboolLocation4ScanStart);
|
| | | var Location4ScanDone = device.GetValue<W_PLCDBName, bool>(W_PLCDBName.wboolLocation4ScanDone);
|
| | | if (Location4ScanStart && !Location4ScanDone)//æ§å¶æ«ç æªæ«ææçç ï¼æ ¹æ®æçç æ¥è¯¢ç»çæ°æ®ï¼å¤ææçç»å®æåæ¯å¦å·²ç»å®æææéé¶ä»¶
|
| | | {
|
| | | var PalletCode = TcpClientExample.Start("192.168.2.123", 2001);
|
| | | using (var uow = _unitOfWorkManage.CreateUnitOfWork())
|
| | | {
|
| | | try
|
| | | {
|
| | | if (!PalletCode.IsNotEmptyOrNull())
|
| | | {
|
| | | throw new InvalidOperationException("æç为空");
|
| | | }
|
| | | Dt_ProcessInfo dt_ProcessInfo = _processInfoService.Repository.QueryFirst(x => x.PalletCode == PalletCode);
|
| | | if (dt_ProcessInfo == null)
|
| | | {
|
| | | throw new InvalidOperationException("æåæªåè£
忣æµ");
|
| | | }
|
| | | Dt_Boxing dt_Boxing = _boxingService.Repository.QueryFirst(x => x.PalletCode == PalletCode);
|
| | | _boxingService.Repository.DeleteData(dt_Boxing);
|
| | | List<Dt_BoxingDetail> dt_BoxingDetails = _boxingDetailService.Repository.QueryData(x => x.BoxingId == dt_Boxing.Id);
|
| | | _boxingDetailService.Repository.DeleteData(dt_BoxingDetails);
|
| | |
|
| | | Dt_ProcessInfoDetail dt_ProcessInfoDetail = new Dt_ProcessInfoDetail()
|
| | | {
|
| | | PalletCode = PalletCode,
|
| | | ProductCode = dt_ProcessInfo.ProductCode,
|
| | | ProductName = dt_ProcessInfo.ProductName,
|
| | | Creater = "admin",
|
| | | CreateDate = DateTime.Now
|
| | | };
|
| | | _processDetailInfoService.Repository.AddData(dt_ProcessInfoDetail);
|
| | | _processInfoService.DeleteData(dt_ProcessInfo);
|
| | | uow.Commit();
|
| | | //ä¸çº¿æ«ç 宿
|
| | | device.SetValue(W_PLCDBName.wboolLocation4ScanDone, true);
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | WriteError(device.DeviceName, "ä¸çº¿æ«ç æµç¨æ§è¡å¼å¸¸", ex);
|
| | | }
|
| | | }
|
| | | }
|
| | | else if (!Location4ScanStart && Location4ScanDone)
|
| | | {
|
| | | device.SetValue(W_PLCDBName.wboolLocation2ScanDone, false);
|
| | | }
|
| | | }
|
| | | }
|
| | | } |