From e1ef8b7895ff3d5b0f36c7678fbe529a569fa4ac Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 30 十二月 2025 16:02:00 +0800
Subject: [PATCH] 海诚钉钉接口调整

---
 WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs |   70 +++++++++++++++++++++++------------
 1 files changed, 46 insertions(+), 24 deletions(-)

diff --git a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
index 9a3e451..0601117 100644
--- a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
@@ -800,40 +800,62 @@
         }
         [Route("Cg_POOrderBill/jindieCloud")]
         [HttpPost]
-        public bool jindieCloud(int HSupID,int MaterID)
+        public object jindieCloud(int HSupID,int MaterID)
         {
-            Int64 HInterID = 0;
-            string HBillNo = "";
-            string sErrMsg = "";
-            HInterID = DBUtility.ClsPub.CreateBillID_Prod("1102", ref sErrMsg);
-            HBillNo = DBUtility.ClsPub.CreateBillCode_Prod("1102", ref sErrMsg, true);
-            WebS.ClsCg_POOrderBillMain websLsmain = new WebS.ClsCg_POOrderBillMain();
+            try
+            {
+                oCN.BeginTran();
+                Int64 HInterID = 0;
+                string HBillNo = "";
+                string sErrMsg = "";
+                HInterID = DBUtility.ClsPub.CreateBillID_Prod("1102", ref sErrMsg);
+                HBillNo = DBUtility.ClsPub.CreateBillCode_Prod("1102", ref sErrMsg, true);
+                WebS.ClsCg_POOrderBillMain websLsmain = new WebS.ClsCg_POOrderBillMain();
             
-            websLsmain.HInterID = HInterID;
-            websLsmain.HDate = DateTime.Now;
-            websLsmain.HBillNo = HBillNo;
-            websLsmain.HSupID = HSupID;
-            websLsmain.HEmpID = MaterID;
-            websLsmain.HSTOCKORGID = 100038;
-            //websLsmain.HBillType = mainList[0].HBillType;
-            if (!oWebs.set_Bill_New(websLsmain, "1100", ref DBUtility.ClsPub.sErrInfo))
-            {
-                objJsonResult.code = "0";
+                websLsmain.HInterID = HInterID;
+                websLsmain.HDate = DateTime.Now;
+                websLsmain.HBillNo = HBillNo;
+                websLsmain.HSupID = HSupID;
+                websLsmain.HEmpID = MaterID;
+                websLsmain.HSTOCKORGID = 100038;
+                //websLsmain.HBillType = mainList[0].HBillType;
+                
+                objJsonResult = AddBillMould(HBillNo, MaterID, HSupID);
+                if (objJsonResult.code == "0")
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = objJsonResult.Message;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (!oWebs.set_Bill_New(websLsmain, "1100", ref DBUtility.ClsPub.sErrInfo))
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "杩斿洖閲戣澏鍗曟嵁澶辫触";  //鎴愬姛锛�
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
                 objJsonResult.count = 1;
-                objJsonResult.Message = "杩斿洖閲戣澏鍗曟嵁澶辫触";  //鎴愬姛锛�
+                objJsonResult.Message = "鎻愪氦鎴愬姛";  //鎴愬姛锛�
                 objJsonResult.data = null;
-                return false;
+                return objJsonResult;
             }
-            objJsonResult = AddBillMould(HBillNo, MaterID, HSupID);
-            if (objJsonResult.code == "0")
+            catch (Exception e)
             {
+                oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = objJsonResult.Message;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
                 objJsonResult.data = null;
-                return false;
+                return objJsonResult;
             }
-            return true;
+
         }
         public json AddBillMould(string HBillNo,int MaterID,int HSupID)
         {

--
Gitblit v1.9.1