-- 获取源文件信息 local handle = io.popen("cd") local script_dir if handle then script_dir = handle:read("*a"):gsub("[\r\n]+$", "") handle:close() end print(jit and jit.arch or "unknown") -- 设置脚本目录 --package.path = package.path .. ";./bin/;./jx/?.lua;./jx_base/?.lua;./mobox_base/?.lua;./wms/?.lua;./wms_base/?.lua;" -- 动态获取当前脚本目录(关键!) --local script_dir = debug.getinfo(1, "S").source:match("@?(.*/)") print("当前脚本所在的目录是: " .. script_dir) -- 重置 package.path(避免旧路径干扰) package.path = "" package.path = package.path .. ";" .. script_dir .. "/?.lua" -- 添加必要路径(使用正确的模板格式) package.path = package.path .. ";" .. script_dir .. "/lualibs/?.lua" ..--socket在这个目录,调接口要用到 ";" .. script_dir .. "/lualib/?.lua" .. -- openinfo 的 lua 模块 ";" .. script_dir .. "/mobox/public/?.lua" -- 添加 C 模块搜索路径(针对 Windows 的 .dll 文件) package.cpath = package.cpath .. ";" .. script_dir .. "/bin/clibs53/?.dll".. ";" .. script_dir .. "/bin/clibs53/socket/?.dll" -- 加载模块 wms = require ("OILua_WMS") mobox = require("OILua_JavelinExt") local wms_base = require("wms_base") -- 注意要去OILua_Debug.lua中修改MOBOX3的IP和端口 --[[ 还需要去OpenInfo下OIDataSAP| 服务目录下的 OlServerAuth.cfg 文件, 将其中的 disable 的值改为 1。,就是将调试时要使用的机器IP加至 配置文件的 trust ip 中,如:"trust ip":["192.168.1.101"] --]] -- 需要调试的脚本填写出处 require("WMS-0605-0001 1#Mobox-Main") -- 句柄填写处 local strLuaDEID = "{6E929CF1-A4B2-48DA-A155-888FD45F823E}" local nRet -- 启动事务 mobox.startTransaction( strLuaDEID ) -- 调试脚本的入口函数 nRet = Main ( strLuaDEID ) if ( nRet == 0 ) then mobox.commit(strLuaDEID) else mobox.abort(strLuaDEID) end print( "OK" )