1
Jianw
9 天以前 70f29da38121b9a467841253e3268feb5df02902
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
m3 = require("oi_base_mobox")
lua = require("oi_base_func")
json = require("json")
mobox = require("OILua_JavelinExt")
wms_base = require("wms_base")
wms_cntr = require("wms_container")
 
local ams_plc = {
    _version = "0.1.1"
}
 
-- 读出线体任务号 转换为我们的任务号
function ams_plc.ReadPlcTaskNo(strLuaDEID, taskno1, taskno2)
    lua.Debug(strLuaDEID, debug.getinfo(1), "ReadPlcTaskNo:", "IN")
 
    local no1 = tostring(taskno1) -- 确保输入是字符串
    if #no1 < 4 then
        no1 = string.rep("0", 4 - #no1) .. no1
    end
 
    local no2 = tostring(taskno2) -- 确保输入是字符串
    if #no2 < 4 then
        no2 = string.rep("0", 4 - #no2) .. no2
    end
    local shortYear = os.date("%y")
    return "TA" .. shortYear .. no1 .. "-" .. no2
end
 
-- 将我们的任务号 转换为写入线体的任务号
function ams_plc.WritePlcTaskNo(strLuaDEID, taskno)
    -- 2. 截取倒数第五位到倒数第八位(共4个字符)
    local no1 = string.sub(taskno, -9, -6)
    -- 1. 截取最后四位
    local no2 = string.sub(taskno, -4)
 
    -- 转换为数字再转回字符串(自动去除前导零)
    local Numberno1 = tonumber(no1)
    -- 转换为数字再转回字符串(自动去除前导零)
    local Numberno2 = tonumber(no2)
 
    return Numberno1, Numberno2
end
 
-- 写连续数据到S7的通讯项
function ams_plc.WriteMultiS7PLCCommsData(strLuaDEID, devicecode, commcode, comm_value)
    local nRet, strRetInfo, canshu
 
    --  comm_value为数组 {1}、{1,2} 可以写DInt
    local canshu = {
        device_code = devicecode,
        comm_code = commcode,
        value = comm_value
    }
 
    local strKey = "OpenInfo"
    local strSecret = "OpenInfoSecret"
    local strHeader = ''
    -- 获取Header
    nRet, strHeader = mobox.genReqVerify(strKey, strSecret)
    strHeader = string.gsub(strHeader, "ReqTime", "\nReqTime")
    strHeader = string.gsub(strHeader, "ReqVerify", "\nReqVerify")
    -- lua.DebugEx(strLuaDEID, "strHeader:", strHeader)
    local strurl = "http://192.168.1.205:5121/api/devctrl/WriteMultiData"
    local strBody = lua.table2str(canshu)
    -- lua.DebugEx(strLuaDEID, "接口调用前参数:", strBody)
    nRet, strRetInfo = mobox.sendHttpRequest(strurl, strHeader, strBody)
    if (nRet ~= 0 or strRetInfo == '') then
        lua.Stop(strLuaDEID,
            "S7PLC 写入失败!  device_code = " .. devicecode .. " comm_code = " .. commcode .. "错误码:" .. nRet ..
                "  " .. strRetInfo)
        return
    end
    -- lua.DebugEx(strLuaDEID, "写PLC返回信息:", strRetInfo)
    local api_ret = json.decode(strRetInfo)
    if (api_ret.err_code ~= 0) then
        lua.Stop(strLuaDEID,
            "S7PLC 写入失败! device_code = " .. devicecode .. " comm_code = " .. commcode .. "错误码:" ..
                api_ret.err_code .. " --> " .. api_ret.err_msg)
    end
 
    return nRet
end
--- 从内存中获取设备信息
function ams_plc.ReadS7PLCCommsData(strLuaDEID, devicecode, commcode)
 
    local nRet, strRetInfo, api_ret
    -- 开始调用
    local canshu = {
        device_code = devicecode,
        comm_code = commcode
    }
 
    local strKey = "OpenInfo"
    local strSecret = "OpenInfoSecret"
    local strHeader = ''
    -- 获取Header
    nRet, strHeader = mobox.genReqVerify(strKey, strSecret)
    strHeader = string.gsub(strHeader, "ReqTime", "\nReqTime")
    strHeader = string.gsub(strHeader, "ReqVerify", "\nReqVerify")
    -- lua.DebugEx(strLuaDEID, "strHeader:", strHeader)
 
    local strBody = lua.table2str(canshu)
    local strurl = "http://192.168.1.205:5121/api/devctrl/GetCommData"
    -- lua.DebugEx(strLuaDEID, "接口调用前参数:", strBody)
 
    nRet, strRetInfo = mobox.sendHttpRequest(strurl, strHeader, strBody)
    -- lua.DebugEx(strLuaDEID, "接口调用后返回信息:", strRetInfo)
    if (nRet ~= 0 or strRetInfo == '') then
        lua.Stop(strLuaDEID,
            "调用OIDeviceCommS接口ReadData失败! device_code = " .. devicecode .. " comm_code = " .. commcode ..
                "错误码:" .. nRet .. "  " .. strRetInfo)
        return 1
    end
    local api_ret = json.decode(strRetInfo)
    if (api_ret.err_code ~= 0) then
        lua.Stop(strLuaDEID,
            "调用OIDeviceCommS接口ReadData失败!  device_code = " .. devicecode .. " comm_code = " .. commcode ..
                "错误码:" .. api_ret.err_code .. "  " .. api_ret.err_msg)
        return 1
    end
 
    local retinfo = api_ret.result
    return retinfo
end
 
-- 写数据到PLC
function ams_plc.WriteS7PLCCommsData(strLuaDEID, devicecode, commcode, comm_value)
    local nRet, strRetInfo, canshu
 
    -- comm_value为数组 {1}、{1,2} 可以写DInt
    local canshu = {
        device_code = devicecode,
        comm_code = commcode,
        value = comm_value
    }
 
    local strKey = "OpenInfo"
    local strSecret = "OpenInfoSecret"
    local strHeader = ''
    -- 获取Header
    nRet, strHeader = mobox.genReqVerify(strKey, strSecret)
    strHeader = string.gsub(strHeader, "ReqTime", "\nReqTime")
    strHeader = string.gsub(strHeader, "ReqVerify", "\nReqVerify")
    lua.Debug(strLuaDEID, debug.getinfo(1), "strHeader:", strHeader)
    local strurl = "http://192.168.1.205:5121/api/devctrl/writedata"
    local strBody = lua.table2str(canshu)
    lua.Debug(strLuaDEID, debug.getinfo(1), "接口调用前参数:", strBody)
    nRet, strRetInfo = mobox.sendHttpRequest(strurl, strHeader, strBody)
    if (nRet ~= 0 or strRetInfo == '') then
        lua.Error(strLuaDEID, debug.getinfo(1),
            "S7PLC 写入失败!  device_code = " .. devicecode .. " comm_code = " .. commcode .. "错误码:" .. nRet ..
                "  " .. strRetInfo)
    end
    -- lua.Debug(strLuaDEID, debug.getinfo(1), "写PLC返回信息:", strRetInfo)
    local api_ret = json.decode(strRetInfo)
    if (api_ret.err_code ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1),
            "S7PLC 写入失败! device_code = " .. devicecode .. " comm_code = " .. commcode .. "错误码:" ..
                api_ret.err_code .. " --> " .. api_ret.err_msg)
    end
    return 0
end
 
-- 根据任务号或托盘号返回当前任务信息
function ams_plc.ReturnTaskEnd(strLuaDEID, task_no, cntr_code)
 
    -- lua.Debug(strLuaDEID, debug.getinfo(1), "ReturnTaskEnd:", "IN")
 
    local nRet, task_info, end_loc
    if (task_no ~= "") then
        nRet, task_info = m3.GetDataObjByCondition(strLuaDEID, "Task", "S_CODE = '" .. task_no .. "'", "T_CREATE DESC")
        if (nRet ~= 0) then
            lua.Stop(strLuaDEID, " ReturnTaskEnd 获取属性失败! " .. task_info)
        end
        -- lua.DebugEx(strLuaDEID, "task_info:", task_info)
 
        -- end_loc = task_info.end_loc_code -- 当前任务终点
    end
 
    if (cntr_code ~= "") then
        nRet, task_info = m3.GetDataObjByCondition(strLuaDEID, "Task", "S_CNTR_CODE = '" .. cntr_code .. "'",
            "T_CREATE DESC")
        if (nRet ~= 0) then
            lua.Stop(strLuaDEID, " ReturnTaskEnd 获取属性失败! " .. task_info)
        end
        -- end_loc = task_info.end_loc_code -- 当前任务终点
    end
    -- lua.DebugEx(strLuaDEID, "ReturnTaskEnd end_loc:", end_loc)
 
    return task_info
end
 
-- 根据任务终点或托盘 返回是否有执行中的任务 yes/no
function ams_plc.IsTaskExec(strLuaDEID, end_loc, cntr_code)
    local nRet, task_info, isexist
    -- 获取任务信息
    if (end_loc ~= "") then
        local sqlCondition = "S_END_LOC = '" .. end_loc .. "' AND N_B_STATE = 2"
        nRet, isexist = mobox.existThisData(strLuaDEID, "Task", sqlCondition)
        if (nRet ~= 0) then
            lua.Error("IsTaskExec 获取【任务表】信息失败! " .. isexist)
        end
        -- lua.Debug(strLuaDEID, debug.getinfo(1), " IsTaskExec 获取【终点】" .. end_loc .. "信息成功!", isexist)
    end
 
    if (cntr_code ~= "") then
        local sqlCondition = "S_CNTR_CODE = '" .. cntr_code .. "' AND N_B_STATE = 2"
        nRet, isexist = mobox.existThisData(strLuaDEID, "Task", sqlCondition)
        if (nRet ~= 0) then
            lua.Error("IsTaskExec 获取【任务表】信息失败! " .. isexist)
        end
        -- lua.Debug(strLuaDEID, debug.getinfo(1), "IsTaskExec 获取【任务】" .. cntr_code .. "信息成功!", isexist)
    end
    return isexist
end
 
-- 更新输送线任务终点
function ams_plc.UpdateEndLoc(strLuaDEID, task_no, end_loc)
    -- lua.Debug(strLuaDEID, debug.getinfo(1), "UpdateEndLoc", "IN")
    local nRet, updateTask
    -- 更新容器表
    local strCondition = "S_CODE = '" .. task_no .. "' "
    nRet, updateTask = mobox.updateDataAttrByCondition(strLuaDEID, "Task", strCondition,
        "S_END_LOC = '" .. end_loc .. "'")
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), " UpdateEndLoc 修改【任务终点】信息失败! " .. updateTask)
    end
    lua.Debug(strLuaDEID, debug.getinfo(1), "UpdateEndLoc 修改【任务" .. task_no .. "终点】信息成功!",
        updateTask)
    return 0
end
 
-- 输入任务号,设置任务为完成状态
function ams_plc.SetTaskComplete(strLuaDEID, task_no)
    -- lua.Debug(strLuaDEID, debug.getinfo(1), " SetTaskComplete", "IN")
    local nRet, task_info, strRetInfo, updateTask
    local strCondition = "S_CODE = '" .. task_no .. "' "
    nRet, updateTask = mobox.updateDataAttrByCondition(strLuaDEID, "Task", strCondition,
        "S_B_STATE = '完成',N_B_STATE = 3")
    if (nRet ~= 0) then
        lua.stop(strLuaDEID, debug.getinfo(1), " SetTaskComplete 设置任务信息失败! " .. updateTask)
        return
    end
    lua.Debug(strLuaDEID, debug.getinfo(1), " SetTaskComplete 设置任务" .. task_no .. "为完成状态成功!",
        updateTask)
    return 0
end
 
-- 根据作业编码判断是否存在已创建的堆垛机任务 yes/no
function ams_plc.IsExistTask(strLuaDEID, op_code)
    -- lua.Debug(strLuaDEID, debug.getinfo(1), " IsExistTask", "IN")
    local nRet, isExist_Task
    local sqlCondition = "S_OP_CODE = '" .. op_code .. "' AND N_TYPE = 5 "
    nRet, isExist_Task = mobox.existThisData(strLuaDEID, "Task", sqlCondition)
    if (nRet ~= 0) then
        lua.stop(" GetTaskInfo 获取【任务表】信息失败! " .. isExist_Task)
        return
    end
    -- lua.DebugEx(strLuaDEID, " GetTaskInfo 获取【任务】" .. op_code .. "信息成功!", isExist_Task)
    return isExist_Task
end
 
-- 根据堆垛机任务起点 判断是否存在已创建的堆垛机任务 yes/no
function ams_plc.IsExistTaskByStartLoc(strLuaDEID, start_loc)
    -- lua.Debug(strLuaDEID, debug.getinfo(1), " IsExistTaskByStartLoc", "IN")
    local nRet, isExist_Task
    local sqlCondition = "S_START_LOC = '" .. start_loc .. "' AND N_TYPE = 5 AND N_B_STATE = 0 "
    nRet, isExist_Task = mobox.existThisData(strLuaDEID, "Task", sqlCondition)
    if (nRet ~= 0) then
        lua.stop(" GetTaskInfo 获取【任务表】信息失败! " .. isExist_Task)
        return
    end
    return isExist_Task
end
 
-- 判断有无正在执行的输送线入库任务 (入库接驳位时用,判断是否推双托) yes/no
function ams_plc.IsExistLineTask(strLuaDEID)
    -- lua.DebugEx(strLuaDEID, "IsExistLineTask 查询有无正在执行的输送线入库任务", "IN")
    local sqlCondition = "N_TYPE = 1 and N_SCHEDULE_TYPE = 4 and N_B_STATE = 2"
    local nRet, isExist_LineTask = mobox.existThisData(strLuaDEID, "Task", sqlCondition)
    if (nRet ~= 0) then
        lua.stop(strLuaDEID, "IsExistLineTask 获取【任务表】信息失败! " .. isExist_LineTask)
        return
    end
    -- lua.DebugEx(strLuaDEID, "IsExistLineTask 查询有无正在执行的输送线入库任务返回", isExist_LineTask)
    return isExist_LineTask
end
 
-- 根据任务号/ 托盘码获取当前任务信息 (入库接驳位时用)
function ams_plc.GetTaskInfobyTaskno(strLuaDEID, task_no, cntr_code)
    -- lua.DebugEx(strLuaDEID, "GetTaskInfobyTaskno!", "IN")
    local nRet, strRetInfo
    -- 根据任务号获取
    if (task_no ~= "") then
        nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "Task", "S_CODE = '" .. task_no .. "'", "T_CREATE DESC")
        if (nRet ~= 0) then
            lua.Stop(strLuaDEID, "GetTaskInfobyTaskno 获取任务" .. task_no .. "信息失败! " .. strRetInfo)
            return
        end
    end
 
    -- 根据托盘码获取输送线入库执行中的任务
    if (cntr_code ~= "") then
        nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "Task", "S_CNTR_CODE = '" .. cntr_code ..
            "' AND N_TYPE = 1 AND N_B_STATE = 2", "T_CREATE DESC")
        if (nRet ~= 0) then
            lua.Stop(strLuaDEID, "GetTaskInfobyTaskno 获取任务" .. task_no .. "信息失败! " .. strRetInfo)
            return
        end
    end
    -- lua.DebugEx(strLuaDEID, "GetTaskInfobyTaskno返回的任务信息:", strRetInfo)
    return strRetInfo
end
 
-- 托盘号查作业信息 (1072、1085、1099 入库称重点时用)
function ams_plc.QueryOpbyTray(strLuaDEID, cntr_code, op_code)
    local nRet, strRetInfo
    -- lua.DebugEx(strLuaDEID, "QueryOpbyTray", "IN")
    if (cntr_code ~= "") then
        local strCondition = "S_CNTR_CODE = '" .. cntr_code .. "'"
        nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "Operation", strCondition, "T_CREATE DESC")
        if (nRet ~= 0) then
            lua.Stop(strLuaDEID, "QueryOpbyTray 根据托盘" .. cntr_code .. "获取作业信息失败! " .. strRetInfo)
            return
        end
    end
 
    if (op_code ~= "") then
        local strCondition = "S_OP_CODE = '" .. op_code .. "'"
        nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "Task", strCondition, "T_CREATE DESC")
        if (nRet ~= 0) then
            lua.Stop(strLuaDEID,
                "QueryOpbyTray 根据作业" .. op_code .. "获取任务信息信息失败! " .. strRetInfo)
        end
    end
 
    return strRetInfo
end
 
-- 创建入库输送线任务 1072->1019
-- 入库作业启动创建任务 创建后,将作业、输送线任务改为执行中
function ams_plc.PutInCreateTask(strLuaDEID, op_info, start_loc)
    local nRet, updateOperation, updateTask
    -- 创建输送线任务
    -- 生成【任务】编码
    local strCode
    local strHeader = 'TA' .. os.date("%y%m%d") .. '-'
    nRet, strCode = mobox.getSerialNumber("任务", strHeader, 4)
    if (nRet ~= 0) then
        lua.Stop(strLuaDEID, '申请【任务】编码失败!' .. strCode)
        return
    end
 
    local task = m3.AllocObject(strLuaDEID, "Task")
    task.code = strCode
    task.op_code = op_info.code -- 作业编码
    task.op_name = op_info.op_def_name -- 作业名称
    task.factory = op_info.factory -- 工厂
    task.cntr_code = op_info.cntr_code -- 托盘
    task.start_lan = op_info.start_aisle -- 巷道
    -- 起点
    task.start_wh_code = op_info.start_wh_code
    task.start_area_code = op_info.start_area_code
    task.start_loc_code = start_loc -- 起点货位
 
    -- 终点
    task.end_wh_code = op_info.end_wh_code
    task.end_area_code = op_info.end_area_code
    task.end_loc_code = "1019" -- 终点
    task.bs_state = 2
    task.type = 1
    task.schedule_type = 4
 
    -- lua.Debug(strLuaDEID, debug.getinfo(1), 'WCS作业启动:', "生成作业数据" .. task)
    -- 创建任务
    nRet, task = m3.CreateDataObj(strLuaDEID, task)
    if (nRet ~= 0) then
        lua.Stop(strLuaDEID, "创建输送线任务失败!" .. task)
        return
    end
 
    -- 更新作业状态为 1 执行
    local strCondition = "S_CODE = '" .. op_info.code .. "' "
    nRet, updateOperation = mobox.updateDataAttrByCondition(strLuaDEID, "Operation", strCondition,
        "N_B_STATE = 1,S_B_STATE = '执行'")
    if (nRet ~= 0) then
        lua.Stop(strLuaDEID, " UpdateEndLoc 修改【任务终点】信息失败! " .. updateOperation)
        return
    end
    return strCode
end
 
-- 创建堆垛机入库任务 (ok)
function ams_plc.CreateTask(strLuaDEID, start_loc, task_info)
 
    lua.DebugEx(strLuaDEID, "创建堆垛机任务方法CreateTask", "IN")
    -- 申请一个堆垛机任务号
    -- 生成一个任务号
    local nRet, task_no
    local strCode
    local strHeader = 'TA' .. os.date("%y%m%d") .. '-'
    nRet, strCode = mobox.getSerialNumber("任务", strHeader, 4)
    if (nRet ~= 0) then
        lua.Stop(strLuaDEID, '申请【任务】编码失败!' .. strCode)
        return
    end
 
    local task = m3.AllocObject(strLuaDEID, "Task")
    task.code = strCode -- 任务号
    task.op_code = task_info.op_code -- 作业编码
    task.op_name = task_info.op_name -- 作业名称
    task.factory = task_info.factory -- 工厂
    task.cntr_code = task_info.cntr_code -- 托盘
 
    -- 起点
    task.start_wh_code = task_info.start_wh_code
    task.start_area_code = task_info.start_area_code
    task.start_loc_code = start_loc
    -- 终点
    task.end_wh_code = task_info.end_wh_code
    task.end_area_code = task_info.end_area_code
    task.end_loc_code = start_loc
 
    -- task.type = wms_base.WMS_nConst(strLuaDEID, "任务类型-堆垛机入库搬运") -- 任务类型
    -- task.schedule_type = wms_base.WMS_nConst(strLuaDEID, "调度类型-堆垛机") -- 设置调度类型
    task.type = 5
    task.schedule_type = 5
 
    -- 创建任务
    nRet, task = m3.CreateDataObj(strLuaDEID, task)
    if (nRet ~= 0) then
        lua.Stop(strLuaDEID, "创建堆垛机入库搬运任务失败!" .. task)
        return
    end
    lua.DebugEx(strLuaDEID, "创建【线体编号为" .. start_loc .. "的输送线任务】信息成功!", task)
    return strCode
end
 
-- 查作业信息 (1072、1085、1099 入库称重点时用)
function ams_plc.QueryOpbyopcode(strLuaDEID, op_code)
 
    local nRet, strRetInfo
    -- lua.DebugEx(strLuaDEID, "QueryOpbyTray", "IN")
    local strCondition = "S_CODE = '" .. op_code .. "'"
    nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "Operation", strCondition, "T_CREATE DESC")
    if (nRet ~= 0) then
        lua.Stop(strLuaDEID, "QueryOpbyTray 根据作业号" .. op_code .. "获取作业信息失败! " .. strRetInfo)
        return
    end
    return strRetInfo
end
 
-- 根据起点、状态获取任务信息 (获取wms堆垛机任务终点时用)
function ams_plc.Gettaskinfoforend(strLuaDEID, start_loc, status)
    local nRet, strRetInfo
    local strCondition = "S_START_LOC = '" .. start_loc .. "' AND N_B_STATE = " .. status
 
    -- lua.DebugEx(strLuaDEID, "Gettaskinfoforend strCondition", strCondition)
    nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "Task", strCondition, "T_CREATE DESC")
    if (nRet ~= 0) then
        lua.Stop(strLuaDEID, "Gettaskinfoforend 根据起点" .. start_loc .. "获取作业信息失败! " .. strRetInfo)
        return
    end
    -- lua.DebugEx(strLuaDEID, "Gettaskinfoforend 返回的信息", strCondition)
 
    return strRetInfo
end
 
 
-- 接驳口创建设备动作优化用 
function ams_plc.GetddjTaskInfo(strLuaDEID, op_code)
    local nRet, strRetInfo
    local strCondition = "S_OP_CODE = '" .. op_code .. "' AND N_TYPE = 5 AND N_B_STATE = 1 "  
 
    local nRet, isExistTask = mobox.existThisData(strLuaDEID, "Task", strCondition)
    if (nRet ~= 0) then
        lua.stop(strLuaDEID, "IsExistLineTask 获取【任务表】信息失败! " .. isExistTask)
        return
    end
    -- lua.DebugEx(strLuaDEID, "IsExistLineTask 查询有无正在执行的输送线入库任务返回", isExist_LineTask)
    return isExistTask
end
 
 
return ams_plc