schangxiang@126.com
2025-09-17 c0e20b1b0f1298cdc0af0037d60e74d51e364501
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
 
using iWareCC.BLL;
using iWareCC.Common.Helper;
using iWareCC.SrmService;
using iWareCC.StationService;
using iWareCommon.Utils;
using iWareModel;
using iWareModel.Entity;
using iWareModel.Entity.Device;
using iWareSql.DataAccess;
using iWareSql.DBModel;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using XiGang.Core.Model;
using XiGang.Core.Model.PostParamModels;
using XiGang.Core.Model.PostParamModels.Task;
 
namespace iWareCC.WCF
{
    // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的类名“CCWcfService”。
    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
    public class CCWcfService : ICCWcfService
    {
 
        /// <summary>
        /// 模式是否正在运行
        /// </summary>
        /// <returns></returns>
        public bool IsStartedModel()
        {
            return SystemValue.isStartedModel;
        }
 
        /// <summary>
        /// 补板工位允许进板
        /// </summary>
        /// <returns></returns>
        public FunRetEntity WriteStation_AllowIn()
        {
            try
            {
                using (StationServiceClient client = new StationServiceClient())
                {
                    var res = client.WriteStation_AllowIn((int)EDevice.Station, true, StationLocationEnum.BZ39.ToString());
                    if (!res.result)
                    {
                        return FunRetEntity.Fail(res.resMsg);
                    }
                }
 
                return FunRetEntity.Success("成功", "");
            }
            catch (Exception ex)
            {
                return FunRetEntity.Fail("异常:" + ex.Message);
            }
        }
 
 
        /// <summary>
        /// 验证模式
        /// </summary>
        /// <param name="flag"></param>
        /// <returns></returns>
        public FunRetEntity ValidateMode(int flag)
        {
            try
            {
                var rgvLocation = StationLocationEnum.BZ39.ToString();
                var obj = FormCC.stationView.R_StationForReadCommList.Where(x => x.StationCode == rgvLocation.ToString()).FirstOrDefault();
                if (flag == 1)
                {//要强制出库
                    if (obj.R_ForceOutboundMode == false)
                    {
                        return FunRetEntity.Fail("PLC不是强制出库模式");
                    }
                }
                else
                {
                    if (obj.R_OutboundMode == false)
                    {
                        return FunRetEntity.Fail("PLC不是出库模式");
                    }
                }
                return FunRetEntity.Success("成功", "");
            }
            catch (Exception ex)
            {
                return FunRetEntity.Fail("异常:" + ex.Message);
            }
        }
 
 
        /// <summary>
        /// 扫码记录清除
        /// </summary>
        /// <returns></returns>
        public FunRetEntity WriteStation_PartClear()
        {
            try
            {
                using (StationServiceClient client = new StationServiceClient())
                {
                    var res = client.PartClear((int)EDevice.Station, true, StationLocationEnum.首次扫码工位.ToString());
                    if (!res.result)
                    {
                        return FunRetEntity.Fail(res.resMsg);
                    }
                }
 
                return FunRetEntity.Success("成功", "");
            }
            catch (Exception ex)
            {
                return FunRetEntity.Fail("异常:" + ex.Message);
            }
        }
 
 
        /// <summary>
        /// 下线放行方向
        /// </summary>
        /// <param name="iscomplete"></param>
        /// <returns></returns>
        public FunRetEntity WriteQiTaoInfo(bool iscomplete)
        {
            try
            {
                using (StationServiceClient client = new StationServiceClient())
                {
                    var res = client.WriteQiTaoInfo((int)EDevice.Station, StationLocationEnum.BZ30.ToString(), iscomplete);
                    if (!res.result)
                    {
                        return FunRetEntity.Fail(res.resMsg);
                    }
                }
 
                return FunRetEntity.Success("成功", "");
            }
            catch (Exception ex)
            {
                return FunRetEntity.Fail("异常:" + ex.Message);
            }
        }
 
    }
}