From d63516d67a13061977c1c7851f069f8c5a438466 Mon Sep 17 00:00:00 2001
From: fy36 <1046342473@qq.com>
Date: 星期五, 30 五月 2025 16:56:03 +0800
Subject: [PATCH] 修复已知问题,保证有返回值

---
 lua_code/Lua/Count_Pan_Sync.lua |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/lua_code/Lua/Count_Pan_Sync.lua b/lua_code/Lua/Count_Pan_Sync.lua
index d1f0dad..2e8ef42 100644
--- a/lua_code/Lua/Count_Pan_Sync.lua
+++ b/lua_code/Lua/Count_Pan_Sync.lua
@@ -83,11 +83,12 @@
  鍏ュ彛鍑芥暟锛欳ount_Pan_Sync
  璇存槑锛氳В鏋�xml锛屾敮鎸佸涓�InventoryTasks_TB锛堜富琛級锛屾瘡涓富琛ㄤ笅鍙寘鍚涓槑缁嗭紙InventoryTasks_TB_ITEM锛� ]] --
--- 寮曞叆渚濊禆搴�+
 wms_base = require("wms_base")
 xml = require("oi_base_xml")
 mobox = require("OILua_JavelinExt")
 m3 = require("oi_base_mobox")
+
 -- 鍒涘缓缁熶竴杩斿洖缁撴灉
 function Create_result(flag, code, msg, error)
     return {
@@ -102,7 +103,7 @@
     -- 1. 鑾峰彇 xml 鏁版嵁鍖�     local nRet, soap_xml = mobox.getCurEditDataPacket(strLuaDEID)
     if nRet ~= 0 then
-        FinalRes = Create_result("failure", "201", "鏃犳硶鑾峰彇鏁版嵁鍖� " .. soap_xml)
+        FinalRes = Create_result("failure", "1", "鏃犳硶鑾峰彇鏁版嵁鍖� " .. soap_xml)
         lua.Stop(strLuaDEID, "鑾峰彇鏁版嵁鍖呭け璐�, FinalRes)
         return
     end
@@ -115,7 +116,7 @@
         return
     end
 
-    -- 3. 鎻愬彇涓昏〃鏁版嵁锛堝彲鑳藉涓�InventoryTasks_TB锛�+    --  鎻愬彇涓昏〃鏁版嵁锛堝彲鑳藉涓�InventoryTasks_TB锛�     local receipt_data = parsed_data.Envelope.Body.InventoryTasksReq.InventoryTasks_Input
     local input_params = receipt_data.InputParameters
 
@@ -126,7 +127,7 @@
         return
     end
 
-    -- 4. 鍒ゆ柇 InventoryTasks_TB 鏄崟涓璞¤繕鏄暟缁�+    --  鍒ゆ柇 InventoryTasks_TB 鏄崟涓璞¤繕鏄暟缁�     -- xml 瑙f瀽鍚庯紝濡傛灉鍙湁涓�釜 InventoryTasks_TB锛屽彲鑳借繑鍥�table锛涘涓垯鍙兘鏄暟缁�     local mainTables = input_params.InventoryTasks_TB
     if not mainTables then
@@ -139,7 +140,7 @@
         -- 濡傛灉 mainTables 涓嶆槸鏁扮粍锛堝崟涓富琛級锛屽垯鍖呰鎴愭暟缁�         mainTables = {mainTables}
     end
-    -- 6. 閬嶅巻鎵�湁涓昏〃鏁版嵁
+    -- 閬嶅巻鎵�湁涓昏〃鏁版嵁
     local result = Create_result()
     for i = 1, #mainTables do
         local mainData = mainTables[i]
@@ -168,7 +169,7 @@
         count_plan.b_state = 0;
         local RetWH_COE, CONST_WH = wms_base.Get_sConst2(strLuaDEID, "GK_Default_Warehouse")
         if (RetWH_COE ~= 0) then
-            FinalRes = Create_result("failure", "201", "鑾峰彇浠撳簱甯搁噺澶辫触", CONST_WH)
+            FinalRes = Create_result("failure", "1", "鑾峰彇浠撳簱甯搁噺澶辫触", CONST_WH)
             lua.Stop(strLuaDEID, "鑾峰彇浠撳簱甯搁噺澶辫触", CONST_WH)
         else
             count_plan.wh_code = CONST_WH; -- 浠撳簱
@@ -195,7 +196,6 @@
             if details[1] == nil then
                 details = {details}
             end
-
             -- 閬嶅巻涓昏〃鏁版嵁鍙婂叾鏄庣粏鏁版嵁
             for j = 1, #details do
                 local item = details[j]
@@ -215,17 +215,15 @@
                     result.code = "102"
                     result.message = "鍒涘缓鏄庣粏鏁版嵁澶辫触"
                     result.error = "琛屽彿[" .. count_plan_item.row_no .. "]鍒涘缓澶辫触: " .. ret_info
-                    FinalRes = Create_result("failure", "206", "鏄庣粏琛ㄦ暟鎹垱寤哄け璐� ", ret_info)
-                    lua.DebugEx(strLuaDEID, "鏄庣粏琛ㄦ暟鎹垱寤哄け璐� ", ret_info)
+                    FinalRes = Create_result("failure", "1", "鏄庣粏琛ㄦ暟鎹垱寤哄け璐�", ret_info)
                     lua.Stop(strLuaDEID, "鍒涘缓鏄庣粏琛ㄦ暟鎹け璐� .. count_plan.cp_no, ret_info)
-                else
+                else 
                     lua.DebugEx(strLuaDEID, "鏄庣粏鏁版嵁鍒涘缓鎴愬姛锛�, count_plan_item)
+                    FinalRes = Create_result("success", "0", "鎴愬姛", "123")
                 end
             end
         end
     end
-
-    -- 8. 杩斿洖鎴愬姛
     local xml_result = xml.json_to_xml(FinalRes, "response")
     mobox.returnValue(strLuaDEID, 0, xml_result, 0)
 end

--
Gitblit v1.9.1