From 948f767cfb45f9d61ef093878773a1f060f5ec0e Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期日, 29 一月 2023 12:38:28 +0800
Subject: [PATCH] 工序流转卡拆卡功能

---
 WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs |  214 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 213 insertions(+), 1 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
index 95cceb9..832c040 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -373,7 +373,6 @@
         //}
         #endregion
 
-
         #region 宸ュ簭娴佽浆鍗″垪琛ㄦ樉绀哄櫒鍏锋竻鍗曚俊鎭�
         [Route("Sc_ProcessExchangeBillList/QJQD")]
         [HttpGet]
@@ -709,5 +708,218 @@
             }
         }
         #endregion
+
+        #region 鎷嗗垎 缂栬緫鑾峰彇娴佽浆鍗℃暟鎹�
+        /// <summary>
+        /// 缂栬緫鑾峰彇琛ㄥご淇℃伅
+        /// </summary>
+        /// <param name="HInterID">涓籌D</param>
+        /// <returns></returns>
+        [Route("Sc_ProcessExchangeBill/GetProcessExchangeBillMain_cf")]
+        [HttpGet]
+        public object GetProcessExchangeBillMain_cf(string HInterID)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillQuery  where hmainid= " + HInterID + " ", "h_v_Sc_ProcessExchangeBillQuery");
+
+                DataSet Ds  = oCN.RunProcReturn("select  top 1 HNo  from Sc_ProcessExchangeBillmain where HBillNo like '%" + ds.Tables[0].Rows[0]["鍗曟嵁鍙�"].ToString() + "-%'   order by LEN(HBillno) , HbillNo desc ", "Sc_ProcessExchangeBillmain");
+
+                char c = '1';
+                string sNo = "01";
+                int sCount = 0;
+
+                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+                {
+                }
+                else
+                {
+                    sCount = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HNo"]);
+                    if (sCount >= 1)
+                    {
+                        sNo = Convert.ToChar(sCount + (int)c).ToString();
+                        sNo = "00" + sNo;
+                        sNo = sNo.Substring(sNo.Length - 2, 2);
+                    }
+                }
+
+                string sBillNo = ds.Tables[0].Rows[0]["鍗曟嵁鍙�"].ToString();
+                sBillNo = sBillNo.Replace("WORKX", "");
+                sBillNo = sBillNo.Replace("WORK", "");
+                sBillNo = sBillNo.Replace("_", "-");
+                sBillNo = sBillNo + "-" + sNo;
+                ds.Tables[0].Rows[0]["鍗曟嵁鍙�"] = sBillNo;
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+                objJsonResult.data = null;
+            }
+            return objJsonResult;
+        }
+
+
+        /// <summary>
+        /// 鑾峰彇琛ㄤ綋鏁版嵁淇℃伅
+        /// </summary>
+        /// <param name="HInterID"></param>
+        /// <returns></returns>
+        [Route("Sc_ProcessExchangeBill/GetProcessExchangeBillSub_cf")]
+        [HttpGet]
+        public object GetProcessExchangeBillSub_cf(string HInterID)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                string sql = string.Format(@"select * from h_v_Sc_ProcessExchangeBillQuerySub");
+                ds = oCN.RunProcReturn(sql + " where hmainid=" + HInterID, "h_v_Sc_ProcessExchangeBillQuerySub");
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+                objJsonResult.data = null;
+            }
+            return objJsonResult;
+        }
+
+        /// <summary>
+        /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Sc_ProcessExchangeBill/AddBill_cf")]
+        [HttpPost]
+        public object AddBill_cf([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+            string msg4 = sArray[2].ToString();
+            string msg5 = sArray[3].ToString();
+
+            string UserName = "";
+            ListModels oListModels = new ListModels();
+
+            try
+            {
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_CF", 1, false, msg5))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳媶鍒嗘潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DAL.ClsSc_ProcessExchangeBill oBill = new DAL.ClsSc_ProcessExchangeBill();
+                List<Model.ClsSc_ProcessExchangeBillMain> lsmain = new List<Model.ClsSc_ProcessExchangeBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Sc_ProcessExchangeBillMain(msg2);
+                foreach (Model.ClsSc_ProcessExchangeBillMain oItem in lsmain)
+                {
+                    oItem.HMaker = msg5;  //鍒跺崟浜�
+                    oItem.HBillType = "3772";
+                    oBill.HBillSubType = "Split";
+                    oItem.HNo = DBUtility.ClsPub.isLong(oItem.HBillNo.Split('-')[1]);
+                    oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+                    oItem.HMaterID2 = oItem.HMaterID;
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
+
+                //琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                //msg2 = msg2.Replace("'", "鈥�");
+                List<Model.ClsSc_ProcessExchangeBillSub> ls = new List<Model.ClsSc_ProcessExchangeBillSub>();
+                ls = oListModels.getObjectByJson_Sc_ProcessExchangeBillSub(msg3);
+                int i = 0;
+                foreach (Model.ClsSc_ProcessExchangeBillSub oItemSub in ls)
+                {
+
+                    i++;
+                    if (oItemSub.HSplitQty > oItemSub.HLeftQty)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "绗�"+i+ "琛岋紝鎷嗗垎鏁伴噺涓嶈兘澶т簬鍙媶鍒嗘暟閲忥紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    oItemSub.HEntryID = i;
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oBill.DetailColl.Add(oItemSub);
+
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult = false;
+                if (msg4 == "1")
+                {
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                //else
+                //{
+                //    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                //}
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1