Admin
2025-12-02 9e42f0dafa019f5ecf6b0ff425ecb966b002171e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WIDESEA_Core.Utilities;
using WIDESEA_Entity.DomainModels;
using WIDESEA_Services.Repositories;
using WIDESEA_WCS.WCSClient;
 
namespace WIDESEA_WCS.Jobs.QueryEQInfo
{
    public class EquipmentResetOperation
    {
        public static WebResponseContent EquipmentReset(SaveModel saveModel)
        {
            WebResponseContent webResponse = new WebResponseContent();
            PLCClient client = WCSService.Clients.Find(r => r.PLCName == "LineDevice");
            if (!client.IsConnected)
                return webResponse.Error("PLC未连接,写入失败。");
            string writeValue = saveModel.MainData["writeValue"].ToString();
            foreach (var item in saveModel.DelKeys)
            {
                Dt_PLCinfoDetail detail = Dt_PLCinfoDetailRepository.Instance.FindFirst(r=>r.plcdetail_id==Guid.Parse(item.ToString()));
                if (null != detail)
                    client.WriteValue(detail.plcdetail_name, detail.plcdetail_number, writeValue);
            }
            return webResponse.OK("复位成功");
        }
    }
}