From 4bfab3d9173fcced07cea4afb71227b83b47c469 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 25 六月 2024 12:32:22 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs |  285 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 272 insertions(+), 13 deletions(-)

diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
index 5b453d2..6309077 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -1244,6 +1244,8 @@
                     }
                     //================================================================================== 
 
+                    //鏇存柊鍙婃椂搴撳瓨琛�   鍑忓皯璋冨叆搴撳瓨,澧炲姞璋冨嚭搴撳瓨
+                    ds = oCN.RunProcReturn("exec h_KF_UPDateICinventory_Move  '"+ oBill.omodel.HInterID + "','"+ oBill.omodel.HBillType+ "','1'", "h_KF_UPDateICinventory_Move");
 
                     //瀹℃牳鍗曟嵁
                     if (!oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_MoveStockBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
@@ -1296,6 +1298,8 @@
                     }
                     //===========================================================          
 
+                    //鏇存柊鍙婃椂搴撳瓨琛�   澧炲姞璋冨叆搴撳瓨,鍑忓皯璋冨嚭搴撳瓨
+                    ds = oCN.RunProcReturn("exec h_KF_UPDateICinventory_Move  '" + oBill.omodel.HInterID + "','" + oBill.omodel.HBillType + "','2'", "h_KF_UPDateICinventory_Move");
 
                     //鍙嶅鏍稿崟鎹�
                     if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_MoveStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
@@ -1856,7 +1860,7 @@
                 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
-                    objJsonResult.count = 1;
+                    objJsonResult.count = 0;
                     objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
                     objJsonResult.data = null;
                     return objJsonResult;
@@ -1865,7 +1869,7 @@
                 if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                 {
                     objJsonResult.code = "0";
-                    objJsonResult.count = 1;
+                    objJsonResult.count = 0;
                     objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                     objJsonResult.data = null;
                     return objJsonResult;
@@ -1890,11 +1894,11 @@
                 oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOutStockToPOStockIn_Delete " + HInterID);
 
 
-                //oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
-                //oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
+                oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
+                oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
 
-                string sql = "exec h_p_WMS_ICStockBillAndWMS_Delete " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','1205'";
-                oCn.RunProc(sql);
+                //string sql = "exec h_p_WMS_ICStockBillAndWMS_Delete " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','1205'";
+                //oCn.RunProc(sql);
 
                 //鍒犻櫎鍚庢帶鍒�==================================================================================      
                 string sql2 = "exec h_p_Kf_SellOutBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
@@ -1903,7 +1907,7 @@
                 {
                     s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
                     objJsonResult.code = "0";
-                    objJsonResult.count = 1;
+                    objJsonResult.count = 0;
                     objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
                     objJsonResult.data = null;
                     oCN.RollBack();
@@ -1913,7 +1917,7 @@
                 {
                     s = ds.Tables[0].Rows[0]["HRemark"].ToString();
                     objJsonResult.code = "0";
-                    objJsonResult.count = 1;
+                    objJsonResult.count = 0;
                     objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
                     objJsonResult.data = null;
                     oCN.RollBack();
@@ -3296,7 +3300,6 @@
                     }
                     //================================================================================== 
 
-               
                     //瀹℃牳鍗曟嵁
                     if (!oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
@@ -3347,7 +3350,6 @@
                         return objJsonResult;
                     }
                     //===========================================================          
-
 
                     //鍙嶅鏍稿崟鎹�
                     if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
@@ -4596,7 +4598,7 @@
                 {
 
                     //ds = oCN.RunProcReturn("select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark   from Sc_MouldRepairCheckBillSub", "Sc_MouldRepairCheckBillSub");
-                    ds = oCN.RunProcReturn("select  HRepairCheckID,楠屾敹椤圭洰浠g爜 HRepairCheckCode,楠屾敹椤圭洰 HRepairCheckName,楠屾敹鍐呭 HRepairCheckContent,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,澶囨敞 HRemark from h_v_Sc_MouldRepairCheckBillList_Edit", "h_v_Sc_MouldRepairCheckBillList_Edit");
+                    ds = oCN.RunProcReturn("select * from h_v_Sc_MouldRepairCheckBillList_Edit", "h_v_Sc_MouldRepairCheckBillList_Edit");
 
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
@@ -4607,7 +4609,7 @@
                 {
 
                     //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark  from Sc_MouldRepairCheckBillSub where 1 = 1 ";
-                    string sql1 = "select  HRepairCheckID,楠屾敹椤圭洰浠g爜 HRepairCheckCode,楠屾敹椤圭洰 HRepairCheckName,楠屾敹鍐呭 HRepairCheckContent,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,澶囨敞 HRemark from h_v_Sc_MouldRepairCheckBillList_Edit where 1 = 1 ";
+                    string sql1 = "select * from h_v_Sc_MouldRepairCheckBillList_Edit where 1 = 1 ";
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairCheckBillList_Edit");
 
@@ -5035,6 +5037,7 @@
 
                 DAL.ClsSc_MouldMaintainPlanBill oBill = new DAL.ClsSc_MouldMaintainPlanBill();
                 List<Model.ClsSc_MouldMaintainPlanBillMain> lsmain = new List<Model.ClsSc_MouldMaintainPlanBillMain>();
+
                 msg2 = msg2.Replace("\\", "");
                 msg2 = msg2.Replace("\n", "");  //\n
                 lsmain = oListModels.getObjectByJson_Gy_MouldMaintainPlanBillMain(msg2);
@@ -5044,6 +5047,8 @@
                     UserName = oItem.HMaker;  //鍒跺崟浜�
                     oItem.HBillType = "3818";
                     oItem.HBillSubType = "3818";
+                    oItem.HMainSourceInterID = oItem.HMouldMaintainRuleID;
+                    oItem.HMainSourceBillNo = oItem.HMouldMaintainRuleNo;
 
                     //oItem.HInterID =0;
                     //oItem.HBillNo = "";
@@ -5539,6 +5544,142 @@
                     oBill.DetailColl.Add(Sub);
 
                 }
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.omodel.HInterID == 0)
+                {
+                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    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 = "淇濆瓨鎴愬姛锛�";
+                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                    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
+
+        #region 妯″叿淇濆吇璁板綍琛� 淇濆瓨/缂栬緫PDA
+        /// <summary>
+        /// 淇濆瓨妯″叿缁翠慨鍗�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Sc_MouldMaintainBill/SaveGetMouldMaintainBillListPDA")]
+        [HttpPost]
+        public object SaveGetMouldMaintainBillListPDA([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+            string msg5 = sArray[2].ToString();
+
+            string UserName = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainBill_Edit", 1, false, msg5))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DAL.ClsSc_MouldMaintainBill oBill = new DAL.ClsSc_MouldMaintainBill();
+                List<Model.ClsSc_MouldMaintainBillMain> lsmain = new List<Model.ClsSc_MouldMaintainBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Sc_MouldMaintainBillMain(msg2);
+                foreach (Model.ClsSc_MouldMaintainBillMain oItem in lsmain)
+                {
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    DBUtility.ClsPub.CurUserName = UserName;
+                    oItem.HBillType = "3819";
+                    oItem.HBillSubType = "3819";
+
+                    //oItem.HInterID =0;
+                    //oItem.HBillNo = "";
+                    oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    //oItem.HMakeDate = "";
+                    //oItem.HYear = "";
+                    //oItem.HPeriod = "";
+                    //oItem.HRemark = "";
+                    //oItem.HCycleUnit = "";
+                    //oItem.HCheckCycle = "";
+                    //oItem.HBeginDate = "";
+                    //oItem.HEndDate = "";
+                    //oItem.HInnerBillNo = "";
+                    //oItem.HExplanation = "";
+
+                    //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
+                    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_MouldMaintainRuleBillSub_Item> ls = new List<Model.ClsSc_MouldMaintainRuleBillSub_Item>();
+                ls = oListModels.getObjectByJson_Sc_MouldMaintainRuleBillSub_Item(msg3);
+                int i = 0;
+                foreach (Model.ClsSc_MouldMaintainRuleBillSub_Item oItemSub in ls)
+                {
+
+                    i++;
+                    oItemSub.HEntryID = i;
+                    //oItemSub.HCloseMan = "";       //琛屽叧闂�
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+                    //oItemSub.HRemark = "";         //澶囨敞
+                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+                    //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
+                    //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+                    oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+                    oBill.DetailCol.Add(oItemSub);
+
+                }
+               
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
@@ -6599,6 +6740,124 @@
         }
         #endregion
 
+        #region 鍣ㄥ叿鐐规璁″垝鍗曞鏍�/鍙嶅鏍稿姛鑳�
+        [Route("Sc_MouldDotCheckPlanBill/CheckSc_MouldDotCheckPlanBill")]
+        [HttpGet]
+        public object CheckSc_MouldDotCheckPlanBill(string HInterID, int Type, string user)
+        {
+            DAL.ClsSc_MouldDotCheckPlanBill BillOld = new DAL.ClsSc_MouldDotCheckPlanBill();
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckPlanBill_Check", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 瀹℃牳  2  鍙嶅鏍�
+                if (Type == 1)
+                {
+                    if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鑷姩鐢熸垚鐐规璁″垝鍗�
+                    oCN.RunProc("exec h_p_Sc_MouldDotCheckPlan_Auto " + HInterID);
+                }
+                else
+                {
+                    if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region[鍣ㄥ叿鐐规璁″垝琛ㄧ紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁--淇濆吇璁″垝]
+        [Route("Sc_MouldDotCheckPlanBill/GetPlanList")]
+        [HttpGet]
+        public object GetPlanList_Check(string sqlWhere)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (sqlWhere == null || sqlWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Sc_MouldDotCheckPlanList", "h_v_Sc_MouldDotCheckPlanList");
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Sc_MouldDotCheckPlanList where 1 = 1 ";
+                    string sql = sql1 + sqlWhere;
+                    ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckPlanList");
+                    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;
+        }
+        #endregion
 
         #endregion
 
@@ -6618,7 +6877,7 @@
                     return objJsonResult;
                 }
                 //寰楀埌淇℃伅
-                ds = oCN.RunProcReturn("select top 1 * from Gy_MouldFileMain  where HNumber= '" + HBarCode + "'", "Gy_MouldFileMain");
+                ds = oCN.RunProcReturn("select top 1 * from Gy_MouldFileMain  where HBarCode= '" + HBarCode + "'", "Gy_MouldFileMain");
                 //鍐欏叆淇℃伅
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {

--
Gitblit v1.9.1