From df927841dd7d05669c69ea81e785d92d040e1b77 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 02 二月 2026 14:26:51 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs |  226 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 155 insertions(+), 71 deletions(-)

diff --git a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
index 8c0dd1e..313ea3f 100644
--- a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
@@ -771,16 +771,16 @@
                     return objJsonResult;
                 }
                 oCN.Commit();
-                #region 鐢熸垚閲戣澏鍗曟嵁锛堝厛淇濆瓨鍒癿es鏈湴锛岄�氳繃鏈湴璋冪敤鐢熸垚閲戣澏鍗曟嵁锛�
-                if (!jindieCloud(msg1))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "杩斿洖閲戣澏鍗曟嵁澶辫触";  //鎴愬姛锛�
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                #endregion
+                //#region 鐢熸垚閲戣澏鍗曟嵁锛堝厛淇濆瓨鍒癿es鏈湴锛岄�氳繃鏈湴璋冪敤鐢熸垚閲戣澏鍗曟嵁锛�
+                //if (!jindieCloud(msg1))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 1;
+                //    objJsonResult.Message = "杩斿洖閲戣澏鍗曟嵁澶辫触";  //鎴愬姛锛�
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                //#endregion
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鍗曟嵁淇濆瓨鎴愬姛锛�";
@@ -798,78 +798,99 @@
                 return objJsonResult;
             }
         }
-        public bool jindieCloud(string msg1)
+        [Route("Cg_POOrderBill/jindieCloud")]
+        [HttpPost]
+        public object jindieCloud(int HSupID,int MaterID)
         {
-            WebS.ClsCg_POOrderBillMain websLsmain = new WebS.ClsCg_POOrderBillMain();
-            //WebS.ClsCg_POInStockBillMain websLsmain = new WebS.ClsKf_OtherOutBillMain();
-            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
-            string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁
-            string msg3 = sArray[1].ToString(); //瀛愯〃鏁版嵁
-            int OperationType = int.Parse(sArray[2].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼
-            string user = sArray[3].ToString();
-            string msg_allVal = sArray[4].ToString(); //涓昏〃+瀛愯〃鎵�鏈夋暟鎹�
-            msg2 = "[" + msg2.ToString() + "]";
-            List<ClsCg_POOrderBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillMain>>(msg2);
-            websLsmain.HInterID = mainList[0].HInterID;
-            websLsmain.HDate = mainList[0].HDate;
-            websLsmain.HBillNo = mainList[0].HBillNo;
-            websLsmain.HSupID = mainList[0].HSupID;
-            websLsmain.HEmpID = mainList[0].HEmpID;
-            websLsmain.HSTOCKORGID = mainList[0].HUSEORGID;
-            websLsmain.HBillType = mainList[0].HBillType;
-            if (!oWebs.set_Bill_New(websLsmain, "1100", ref DBUtility.ClsPub.sErrInfo))
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "杩斿洖閲戣澏鍗曟嵁澶辫触";  //鎴愬姛锛�
-                objJsonResult.data = null;
-                return false;
-            }
-            objJsonResult = AddBillMould(msg1);
-            if (objJsonResult.code == "0")
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = objJsonResult.Message;
-                objJsonResult.data = null;
-                return false;
-            }
-            return true;
-        }
-        public json AddBillMould(string msg1)
-        {
-            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
-            string msg2 = sArray[0].ToString();
-            string msg3 = sArray[1].ToString();
             try
             {
-                msg2 = "[" + msg2.ToString() + "]";
-                List<Gy_Mould> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_Mould>>(msg2);
-                List<Gy_Mould> mainList1 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_Mould>>(msg3);
+                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;
+                
+                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.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+        }
+        public json AddBillMould(string HBillNo,int MaterID,int HSupID)
+        {
+            //string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            //string msg2 = sArray[0].ToString();
+            //string msg3 = sArray[1].ToString();
+            try
+            {
+                //msg2 = "[" + msg2.ToString() + "]";
+                //List<Gy_Mould> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_Mould>>(msg2);
+                //List<Gy_Mould> mainList1 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_Mould>>(msg3);
                 string BillType = "3899";
                 //寰楀埌mainid
                 long HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
-                string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
-                DateTime HDate = mainList[0].HDate;//鏃ユ湡
+                //string HBillNo = HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
+                DateTime HDate = DateTime.Now;//鏃ユ湡
                 int HYear = DBUtility.ClsPub.isInt(DateTime.Now.Year);
                 double HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                 string HMouldNo = HInterID+"xxx";
                 string HBarCode = HBillNo+"xxx";
-                string HName = mainList[0].HName??"娴嬭瘯妯″叿";
-                string HModel = mainList[0].HModel?? "娴嬭瘯";
-                string HModel2 = mainList[0].HModel2 ?? "娴嬭瘯";
-                string HDiameter = mainList[0].HDiameter ?? "娴嬭瘯";
-                string HSubjoin = mainList[0].HSubjoin ?? "娴嬭瘯";
-                string HSubjoin2 = mainList[0].HSubjoin2 ?? "娴嬭瘯";
-                string HPICNo = mainList[0].HPICNo ?? "娴嬭瘯";
-                string HWorkMaterModel = mainList[0].HWorkMaterModel ?? "娴嬭瘯";
-                long HMaterID = mainList1[0].HMaterID;
+                string HName = "娴嬭瘯妯″叿";
+                string HModel =  "娴嬭瘯";
+                string HModel2 = "娴嬭瘯";
+                string HDiameter = "娴嬭瘯";
+                string HSubjoin = "娴嬭瘯";
+                string HSubjoin2 =  "娴嬭瘯";
+                string HPICNo = "娴嬭瘯";
+                string HWorkMaterModel =  "娴嬭瘯";
+                long HMaterID = MaterID;
                 long HMouleTypeID = 1;
-                long HUnitID = mainList1[0].HUnitID;
+                long HUnitID = 1;
                 DateTime HOutComDate = DateTime.Now;
-                string HOutComNo = mainList[0].HOutComNo ?? "娴嬭瘯";
+                string HOutComNo = "娴嬭瘯";
                 long HDeptID = 0;
-                long HSupID = mainList[0].HSupID;
+                //long HSupID = HSupID;
                 string HMouldStatus = "0";
                 long HWHID = 0;
                 long HRoutingID = 0;
@@ -900,8 +921,8 @@
                 int HNowWHID = 0;
                 int HNowSPID = 0;
                 string HMouldUseStatus = "test";
-                int HCREATEORGID = mainList[0].HCREATEORGID;
-                int HUSEORGID = mainList[0].HUSEORGID;
+                int HCREATEORGID = 100038;
+                int HUSEORGID = 100038;
                 bool HTransPackFlag = false;     //鍛ㄨ浆瀹瑰櫒鏍囪
                 bool HSendPackFlag = false;       //鍙戣揣瀹瑰櫒鏍囪
                 int HMouldLength =0;          //闀�
@@ -3575,7 +3596,70 @@
         }
         #endregion
 
+        #region 閲囪喘璁㈠崟缂栬緫鍥炴樉
+        [Route("Cg_POOrderBill/QueryListEdit")]
+        [HttpGet]
+        public object QueryListEdit(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Cg_POOrderBillList", 3, false, user))
+                {
+                    objJsonResult.code = CodeConstant.FAIL;
+                    objJsonResult.count = CountConstant.FAIL;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //if (!DBUtility.ClsPub.Security_Log("Sc_EmployeeSignInNoteBillMain_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
 
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Cg_POOrderBillEdit order by 鍗曟嵁鍙� desc", "锘縣_v_Cg_POOrderBillEdit");
+                }
+                else
+                {
+                    string sql1 = "select * from  h_v_Cg_POOrderBillEdit  where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "锘縣_v_Cg_POOrderBillEdit");
+                }
+
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
 
     }
 

--
Gitblit v1.9.1