| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
-
- using SHJX.Service.Common.Extend;
- using SHJX.Service.Common.ReadXML;
- using SHJX.Service.Model.Control;
- using SHJX.Service.ServerClient.Interface;
- using SHJX.Service.ServerClient.TempController;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using SHJX.Service.Common.Logging;
- using Microsoft.Extensions.Logging;
- namespace SHJX.Service.ServerClient.PortControl
- {
- public class SilverSulfatePipePort : SerialPortImp, PortControlImp
- {
- private static readonly ILogger logger = LogFactory.BuildLogger(typeof(SilverSulfatePipePort));
- /// <summary>
- /// 硫酸银管道
- /// </summary>
- /// <param name="log">日志</param>
- /// <param name="config">配置</param>
- public SilverSulfatePipePort( ReadConfigUtil config)
- : base( config) { }
- public object Read(PortArgs args)
- {
- throw new NotImplementedException();
- }
- public bool Write(PortArgs args)
- {
- var res = args.WriteWay switch
- {
- WriteWay.Start => tMotorStorage(args, "L"),
- WriteWay.Stop => tMotorStorage(args, "H"),
- _ => throw new ArgumentNullException(args.WriteWay.GetEnumDesc<WriteWay>())
- };
- Thread.Sleep(500);
- return res;
- }
- private bool tMotorStorage(PortArgs args, string op)
- {
- string res1 = "";
- while (res1 != "0009\r" && res1 != "0209\r")
- {
- var storageRes = JudgeXYZMove(4); //加液前T轴要静止
- if (storageRes.Equals("")) return false;
- res1 = storageRes;
- Thread.Sleep(300);
- }
- return MotorStorage(args.NodeId, Convert.ToInt32(args.Reserve), op);
- }
- }
- }
|