ke_junjie
2025-06-04 84620534eb627e95811b971a4b552b6a177829bf
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
 
using iWareCommon.Utils;
using iWareModel;
using iWareModel.Entity.Device;
using iWareSql.DataAccess;
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.Task;
 
namespace iWareCC.WCF
{
    // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的类名“CCWcfService”。
    public class CCWcfService : ICCWcfService
    {
        /// <summary>
        /// MES提供某个发动机的详细信息
        /// </summary>
        /// <param name="_barCode"></param>
        public string getEngineInfo(string mes_url, string XiGang_Mes_Url_getEngineInfo, string token, string _barCode)
        {
            return MyMesService.getEngineInfo(mes_url, XiGang_Mes_Url_getEngineInfo, token, _barCode);
        }
 
        /// <summary>
        /// 获取设备坐标
        /// </summary>
        /// <returns></returns>
        public DeviceCoordinat GetDeviceCoordinat()
        {
            DeviceCoordinat result = null;
            try
            {
                result = new DeviceCoordinat()
                {
 
                };
 
                //result.RgvCoordinate = FormCC.rgvView.R_RGV_Coordinate;
 
                result.Srm1Coordinat = FormCC.srmViewDict[(int)EDevice.堆垛机].R_PosXmm.ToString();
                result.Srm2Coordinat = FormCC.srmViewDict[(int)EDevice.二号堆垛机].R_PosXmm.ToString();
 
                return result;
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteErrorLog(LogType.CCWCFService, "GetDeviceCoordinat出现异常:" + ex.Message, ex);
                return result;
            }
        }
 
        /// <summary>
        /// 模式是否正在运行
        /// </summary>
        /// <returns></returns>
        public bool IsStartedModel()
        {
            return SystemValue.isStartedModel;
        }
 
        /// <summary>
        /// 生成最新的任务序列号
        /// </summary>
        /// <param name="edm"></param>
        /// <returns></returns>
        public int GenerateTaskSequence()
        {
            try
            {
                //using (DbModel edm = new DbModel())
                //{
                //    return MainTaskHandler.GenerateTaskSequence(edm);
                //}
                return 0;
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteErrorLog(LogType.CCWCFService, "GenerateTaskSequence出现异常:" + ex.Message, ex);
                return 0;
            }
        }
 
        /// <summary>
        /// 重新扫描输送线1015上的托盘号
        /// </summary>
        /// <returns></returns>
        public FunRetEntity Write1015ReScan(bool value)
        {
            try
            {
                using (RgvService.RgvServiceClient client = new RgvService.RgvServiceClient())
                {
                    iWareCC.RgvService.SdaResEntity result = client.Write1015ReScan((int)EDevice.RGV, value);
                    if (result.result)
                    {
                        return FunRetEntity.Success("成功", "");
                    }
                    else
                    {
                        return FunRetEntity.Fail(result.resMsg, "");
                    }
                }
            }
            catch (Exception ex)
            {
                return FunRetEntity.Fail("获取输送线1015上扫描的托盘号出现异常:" + ex.Message);
            }
        }
 
 
        ///// <summary>
        ///// 寻找空闲的立库空库位 (普通物料)
        ///// </summary>
        ///// <returns></returns>
        //public Base_Station FindBestEmptyPlaceForOrdinaryMaterial(string orderNo)
        //{
        //    try
        //    {
        //        using (DbModel edm = new DbModel())
        //        {
        //            var item = StationHandler.FindBestEmptyPlaceForOrdinaryMaterial(edm, orderNo, MaterialTypeEnum.一般物料);
        //            return item;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        return null;
        //    }
        //}
 
        /// <summary>
        /// 新增入库任务
        /// </summary>
        /// <param name="user"></param>
        /// <param name="material"></param>
        /// <param name="salver"></param>
        /// <returns></returns>
        public FunRetEntity AddInStoreTask(SysUser user, AddMainTaskPostParam param)
        {
            try
            {
                //return MainTaskHandler.AddInStoreTask(user, param);
                return null;
            }
            catch (Exception ex)
            {
                return FunRetEntity.Fail("出现异常:" + ex.Message);
            }
        }
 
        /// <summary>
        /// 输送线站台是否满足新入库任务生成
        /// </summary>
        /// <param station="101"></param>
        /// <returns></returns>
        public bool IsMeetRequirements(string station)
        {
            try
            {
                var stationStatus = FormCC.conveyerView.R_ConveyerForReadCommList.Where(x => x.StationCode == station).FirstOrDefault();
                if (stationStatus != null)
                {
                    bool temp = false;
                    //是否有入库请求
                    switch (station)
                    {
                        case "101":
                            temp = FormCC.conveyerView.R_Scan1_Success;
                            break;
                        //case "102":
                        //    temp = FormCC.conveyerView.R_Scan2_Success;
                        //    break;
                        //case "103":
                        //    temp = FormCC.conveyerView.R_Scan3_Success;
                        //    break;
                        //case "104":
                        //    temp = FormCC.conveyerView.R_Scan4_Success;
                        //    break;
                    }
                    if(temp)
                    {
                        return false;
                    }
                    return stationStatus.R_HasCargo;
                }
                return false;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
 
        ///// <summary>
        ///// 新增入库任务
        ///// </summary>
        ///// <param name="user"></param>
        ///// <param name="material"></param>
        ///// <param name="salver"></param>
        ///// <returns></returns>
        //public FunRetEntity AddInStoreTask(SysUser user, AddMainTaskPostParam param)
        //{
        //    try
        //    {
        //        return MainTaskHandler.AddInStoreTask(user, param);
        //    }
        //    catch (Exception ex)
        //    {
        //        return FunRetEntity.Fail("出现异常:" + ex.Message);
        //    }
        //}
 
 
        ///// <summary>
        ///// 新增手动出库任务
        ///// </summary>
        ///// <param name="user"></param>
        ///// <param name="material"></param>
        ///// <param name="salver"></param>
        ///// <returns></returns>
        //public FunRetEntity AddOutStoreTaskByHand(SysUser user, int stationId)
        //{
        //    try
        //    {
        //        return MainTaskHandler.AddOutStoreTaskByHand(user, stationId);
        //    }
        //    catch (Exception ex)
        //    {
        //        return FunRetEntity.Fail("出现异常:" + ex.Message);
        //    }
        //}
    }
}