From 10b3f91902107815a16e5ff0528e3880ff100b60 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 30 四月 2024 17:34:23 +0800
Subject: [PATCH] 1.调拨申请单 增加审核,反审核,关闭,反关闭,作废,反作废,修复编辑数据不能回显,无法编辑,保存失败功能 2.发货通知单 新增编辑 页面 初始化 主管 部门 业务员,修复多条数据 反写 销售订单 失败 3.销售订单列表 增加字段名,用于选单号 赋值表头信息 4.销售出库单 保存时增加 选着源单 发货通知单 后,查询源单是否存在

---
 WebAPI/Controllers/仓存管理/调拨盘点/Kf_MoveStockRequestBillController.cs |  433 +++++++++++++++++++++++++++++++++++++++
 WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs            |   30 +-
 DAL/销售管理/ClsXs_ReceivableBill.cs                                  |   98 ++++----
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs          |    4 
 WebAPI/Controllers/WebAPIController.cs                            |    4 
 WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs            |   34 ++
 6 files changed, 528 insertions(+), 75 deletions(-)

diff --git "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_ReceivableBill.cs" "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_ReceivableBill.cs"
index 3691193..d087237 100644
--- "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_ReceivableBill.cs"
+++ "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_ReceivableBill.cs"
@@ -36,52 +36,52 @@
         #region 鍏宠仈鏁伴噺
 
         //鍒犻櫎鍏宠仈
-        //public override void DeleteRelation(ref string sReturn, Int64 lngBillKey)
-        //{
-        //    //閿�鍞鍗� 閿�鍞嚭搴撳崟 鍏宠仈鏁伴噺
-        //    try
-        //    {
-        //        if (DetailColl[0].HSourceBillType == "1401")                    //閿�鍞鍗�
-        //        {
-        //            oCn.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToPOStockIn_Del " + lngBillKey.ToString());
-        //        }
-        //        else if (DetailColl[0].HSourceBillType == "1205")                    //閿�鍞嚭搴撳崟
-        //        {
-        //            oCn.RunProc("exec h_p_Xs_UpDateRelation_ICStockoPOStockIn_Del " + lngBillKey.ToString());
-        //        }
-        //        else
-        //        {
-        //        }
-        //    }
-        //    catch (Exception e)
-        //    {
-        //        throw (e);
-        //    }
-        //}
-        ////鏂板鍏宠仈
-        //public override void AddNewRelation(ref string sReturn, Int64 lngBillKey)
-        //{
-        //    //閿�鍞鍗� 閿�鍞嚭搴撳崟 鍏宠仈鏁伴噺
-        //    try
-        //    {
-        //        if (DetailColl[0].HSourceBillType == "1401")                    //閿�鍞鍗�
-        //        {
-        //            oCn.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToPOStockIn_Add " + lngBillKey.ToString());
-        //        }
-        //        else if (DetailColl[0].HSourceBillType == "1205")                    //閿�鍞嚭搴撳崟
-        //        {
-        //            oCn.RunProc("exec h_p_Xs_UpDateRelation_ICStockToPOStockIn_Add " + lngBillKey.ToString());
-        //        }
-        //        else
-        //        {
+        public override void DeleteRelation(ref string sReturn, Int64 lngBillKey)
+        {
+            //閿�鍞鍗� 閿�鍞嚭搴撳崟 鍏宠仈鏁伴噺
+            try
+            {
+                if (DetailColl[0].HSourceBillType == "1401")                    //閿�鍞鍗�
+                {
+                    oCn.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToPOStockIn_Del " + lngBillKey.ToString());
+                }
+                else if (DetailColl[0].HSourceBillType == "1205")                    //閿�鍞嚭搴撳崟
+                {
+                    oCn.RunProc("exec h_p_Xs_UpDateRelation_ICStockoPOStockIn_Del " + lngBillKey.ToString());
+                }
+                else
+                {
+                }
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+        //鏂板鍏宠仈
+        public override void AddNewRelation(ref string sReturn, Int64 lngBillKey)
+        {
+            //閿�鍞鍗� 閿�鍞嚭搴撳崟 鍏宠仈鏁伴噺
+            try
+            {
+                if (DetailColl[0].HSourceBillType == "1401")                    //閿�鍞鍗�
+                {
+                    oCn.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToPOStockIn_Add " + lngBillKey.ToString());
+                }
+                else if (DetailColl[0].HSourceBillType == "1205")                    //閿�鍞嚭搴撳崟
+                {
+                    oCn.RunProc("exec h_p_Xs_UpDateRelation_ICStockToPOStockIn_Add " + lngBillKey.ToString());
+                }
+                else
+                {
 
-        //        }
-        //    }
-        //    catch (Exception e)
-        //    {
-        //        throw (e);
-        //    }
-        //}
+                }
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
 
         #endregion
 
@@ -169,8 +169,8 @@
                     oCn.RunProc(subSql);
                 }
 
-                ////鏇存柊璁㈠崟鍏宠仈鏁伴噺
-                //AddNewRelation(ref sReturn, omodel.HInterID);
+                //鏇存柊璁㈠崟鍏宠仈鏁伴噺
+                AddNewRelation(ref sReturn, omodel.HInterID);
 
                 sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
@@ -288,8 +288,8 @@
                     oCn.RunProc(subSql);
                 }
 
-                ////鏇存柊璁㈠崟鍏宠仈鏁伴噺
-                //AddNewRelation(ref sReturn, omodel.HInterID);
+                //鏇存柊璁㈠崟鍏宠仈鏁伴噺
+                AddNewRelation(ref sReturn, omodel.HInterID);
 
                 sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
index a73f3e8..79e44b1 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -1836,10 +1836,10 @@
 
                 oCN.BeginTran();
                 //閿�鍞嚭搴撳垹闄ゅ洖濉攢鍞鍗曞叧鑱旀暟閲�
-                //oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellOut_Delete " + HInterID);
+                oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellOut_Delete " + HInterID);
 
                 //閿�鍞嚭搴撳垹闄ゅ洖濉敹璐ч�氱煡鍗曞叧鑱旀暟閲�
-                //oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOutStockToPOStockIn_Del " + HInterID);
+                oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOutStockToPOStockIn_Del " + HInterID);
 
 
                 //oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 31c8db2..459fe5d 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -11645,11 +11645,11 @@
                 //鏈夌殑鍗曞瓙婧愬崟鍒嗕负绾㈣摑鍗�  0浠h〃钃濆崟  1浠h〃绾㈠崟
                 if (Num==0)
                 {           //婧愬崟涓鸿摑鍗�
-                    oDs = oCn.RunProcReturn("select * from  Xt_BillSourceSet where HName='" + HName + "' HRedBlueFlag ='"+ Num+"' ", "Xt_BillSourceSet");
+                    oDs = oCn.RunProcReturn("select * from  Xt_BillSourceSet where HName='" + HName + "'and  HRedBlueFlag ='"+ Num+"' ", "Xt_BillSourceSet");
                 }
                 else if (Num==1)
                 {          //婧愬崟涓虹孩鍗�
-                    oDs = oCn.RunProcReturn("select * from  Xt_BillSourceSet where HName='" + HName + "' HRedBlueFlag ='" + Num + "' ", "Xt_BillSourceSet");
+                    oDs = oCn.RunProcReturn("select * from  Xt_BillSourceSet where HName='" + HName + "' and  HRedBlueFlag ='" + Num + "' ", "Xt_BillSourceSet");
                 }
                 else if(Num==2)
                 {       //涓嶅垎绾㈣摑鍗�
diff --git a/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs b/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs
index 128b977..abc342f 100644
--- a/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs
@@ -363,24 +363,20 @@
 
                 oCN.BeginTran();
 
-                //ds = oCN.RunProcReturn("select * from h_v_Xs_ReceivableBillList_Query where hmainid=" + HInterID, "h_v_Xs_ReceivableBillList_Query");
-                //foreach (DataRow row in ds.Tables[0].Rows)
-                //{
-                //    // 鑾峰彇褰撳墠琛岀殑 HSourceBillType 鍊�  
-                //    string hSourceBillType = row["HSourceBillType"].ToString();
+                ds = oCN.RunProcReturn("select * from h_v_Xs_ReceivableBillList_Query where hmainid=" + HInterID, "h_v_Xs_ReceivableBillList_Query");
+                string hSourceBillType = ds.Tables[0].Rows[0]["HSourceBillType"].ToString();
+                if (hSourceBillType == "1401")
+                {
+                    //搴旀敹鍗� 鍒犻櫎鍥炲~ 閿�鍞鍗� 鍏宠仈鏁伴噺
+                    oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToPOStockIn_Del " + HInterID);
+                }
+                else if (hSourceBillType == "1205")
+                {
+                    //搴旀敹鍗� 鍒犻櫎鍥炲~ 閿�鍞嚭搴撳崟 鍏宠仈鏁伴噺
+                    oCN.RunProc("exec h_p_Xs_UpDateRelation_ICStockoPOStockIn_Del	 " + HInterID);
+                }
 
-                //    if (hSourceBillType == "1401")
-                //    {
-                //        //搴旀敹鍗� 鍒犻櫎鍥炲~ 閿�鍞鍗� 鍏宠仈鏁伴噺
-                //        oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToPOStockIn_Del " + HInterID);
-                //    }
-                //    else if (hSourceBillType == "1205")
-                //    {
-                //        //搴旀敹鍗� 鍒犻櫎鍥炲~ 閿�鍞嚭搴撳崟 鍏宠仈鏁伴噺
-                //        oCN.RunProc("exec h_p_Xs_UpDateRelation_ICStockoPOStockIn_Del	 " + HInterID);
-                //    }
-                //}
-                  
+
                 oCN.RunProc("delete from Xs_ReceivableBillMain where HInterID = " + HInterID);
                 oCN.RunProc("delete from Xs_ReceivableBillSub where HInterID= " + HInterID);
 
diff --git a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
index b9f0333..b64a9ce 100644
--- a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs
@@ -144,8 +144,8 @@
 
                 oCN.BeginTran();
                 var ds = oCN.RunProcReturn("select * from Xs_SeOutStockBillMain where HInterID=" + HInterID, "Xs_SeOutStockBillMain");
-                
-                var dss = oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain_Delete " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Xs_SeOutStockBillMain_Delete");
+                //鍒犻櫎鎾ら攢  鍙戣揣閫氱煡鍗� 鍙嶅啓 閿�鍞鍗�
+                oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain_Delete " + HInterID, "h_p_Xs_SeOutStockBillMain_Delete");
                 //鍒犻櫎鍓嶆帶鍒�
                 DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeDelCtrl  " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBill_BeforeDelCtrl");
                 if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
@@ -362,6 +362,27 @@
                 }
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                 { //淇敼
+
+                    DataSet dss;
+                    dss = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_SeOutStockBillList");
+                    //鍒ゆ柇鏄惁鍙紪杈�
+                    if (dss.Tables[0].Rows[0]["瀹℃牳浜�"].ToString() != "" && dss.Tables[0].Rows[0]["瀹℃牳浜�"] != null)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (dss.Tables[0].Rows[0]["鐘舵��"].ToString() != "鍒涘缓")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+
                     string sql = $@"update Xs_SeOutStockBillMain  set " +
                                 "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                  ",HCusID='" + HCusID + "', HCurID='" + HCurID + "', HWHID = '" + HWHID
@@ -369,15 +390,21 @@
                                  + "',HAddress='" + HAddress + "',HProjectID='"+ HProjectID + "' where HInterID=" + HInterID;
                     oCN.RunProc(sql);
 
+                    //鍒犻櫎 鎾ら攢鍙戣揣閫氱煡鍗� 鍙嶅啓 閿�鍞鍗�
+                    oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain_Delete " + HInterID, "h_p_Xs_SeOutStockBillMain_Delete");
+
                     //鍒犻櫎瀛愯〃
                     oCN.RunProc("delete from Xs_SeOutStockBillSub where HInterID='" + HInterID + "'");
                 }
                 //淇濆瓨瀛愯〃
                 objJsonResult = AddBillSub(msg3, HInterID, OperationType,user);
 
+               //鍙戣揣閫氱煡鐨� 鍙嶅啓 鏁伴噺鍒� 閿�鍞鍗� 鍏宠仈鏁伴噺
+                oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain " + HInterID, "h_p_Xs_SeOutStockBillMain");
+
 
                 //淇濆瓨鍚庢帶鍒�=========================================
-                 ds = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "',1 ", "h_p_Xs_SeOutStockBill_AfterSaveCtrl");
+                ds = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "',1 ", "h_p_Xs_SeOutStockBill_AfterSaveCtrl");
                 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -487,7 +514,6 @@
 
                 oCN.RunProc(sql);
 
-                ds = oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain " + oSub.HQty + ", '" + oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user + " '", "h_p_Xs_SeOutStockBillMain");
             }
 
             objJsonResult.code = "1";
diff --git "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\350\260\203\346\213\250\347\233\230\347\202\271/Kf_MoveStockRequestBillController.cs" "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\350\260\203\346\213\250\347\233\230\347\202\271/Kf_MoveStockRequestBillController.cs"
index 9ec37d6..c5a0407 100644
--- "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\350\260\203\346\213\250\347\233\230\347\202\271/Kf_MoveStockRequestBillController.cs"
+++ "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\350\260\203\346\213\250\347\233\230\347\202\271/Kf_MoveStockRequestBillController.cs"
@@ -15,6 +15,7 @@
     {
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
         private json objJsonResult = new json();
+        public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
         public DataSet ds = new DataSet();
         public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
 
@@ -170,7 +171,7 @@
 	                    ,HSTOCKINORGID,HSTOCKOUTORGID,HStockStyle
 	                    ,HOWNERTYPEHEADID,HTRANSTYPE,HOWNERTYPEINID,HBUSINESSTYPE)
                         values(" + HInterID + ",'" + HBillNo + "','" + HDate + "','" + 1243 + "','" +
-                    HBillSubType + "'," + HBillStatus + "," + DateTime.Now.Year + "," + DateTime.Now.Month + "," + HSupID +
+                    1243 + "'," + HBillStatus + "," + DateTime.Now.Year + "," + DateTime.Now.Month + "," + HSupID +
                     "," + HWHID + "," + HSCWHID + "," + HEmpID + "," + HMangerID + "," + HSecManagerID +
                     "," + HKeeperID + "," + HDeptID + ",'" + HMaker + "','" + HMakeDate + "','" + HChecker + "','" + HCheckDate + "','" +  HUpDater + "','" +
                     HUpDateDate + "','" + HDeleteMan + "','" + HDeleteDate + "','" + HCloseMan + "','" + HCloseDate + "','"
@@ -383,5 +384,435 @@
                 return objJsonResult;
             }
         }
+
+        #region 璋冩嫧鐢宠鍗� 瀹℃牳/鍙嶅鏍�
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Kf_MoveStockRequestBill/AuditKf_MoveStockRequestBill")]
+        [HttpGet]
+        public object AuditKf_MoveStockRequestBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockRequestBill_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;
+                BillOld.MvarItemKey = "Kf_MoveStockRequestBillMain";
+                oCn.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 瀹℃牳  2  鍙嶅鏍�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //瀹℃牳鍗曟嵁
+                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜鍙嶅鏍革紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍙嶅鏍革紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅鏍稿崟鎹�
+                        if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            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("Kf_MoveStockRequestBill/CloseKf_MoveStockRequestBill")]
+        [HttpGet]
+        public object CloseKf_MoveStockRequestBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockRequestBill_Close", 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;
+                BillOld.MvarItemKey = "Kf_MoveStockRequestBillMain";
+                oCn.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍏抽棴鍗曟嵁
+                        if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂�
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸啀鍙嶅叧闂�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅叧闂崟鎹�
+                        if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            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("Kf_MoveStockRequestBill/DropKf_MoveStockRequestBill")]
+        [HttpGet]
+        public object DropKf_MoveStockRequestBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockRequestBill_Delete", 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;
+                BillOld.MvarItemKey = "Kf_MoveStockRequestBillMain";
+                oCn.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 浣滃簾  2  鍙嶄綔搴�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶉渶瑕佸啀浣滃簾!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //浣滃簾鍗曟嵁
+                        if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶄綔搴�
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸啀鍙嶄綔搴�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶄綔搴熷崟鎹�
+                        if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            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
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1