1.调拨申请单 增加审核,反审核,关闭,反关闭,作废,反作废,修复编辑数据不能回显,无法编辑,保存失败功能
2.发货通知单 新增编辑 页面 初始化 主管 部门 业务员,修复多条数据 反写 销售订单 失败
3.销售订单列表 增加字段名,用于选单号 赋值表头信息
4.销售出库单 保存时增加 选着源单 发货通知单 后,查询源单是否存在
6个文件已修改
603 ■■■■ 已修改文件
DAL/销售管理/ClsXs_ReceivableBill.cs 98 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/Sc_MouldRepairInBillListController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/WebAPIController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/仓存管理/调拨盘点/Kf_MoveStockRequestBillController.cs 433 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/ÏúÊÛ¹ÜÀí/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();
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);
WebAPI/Controllers/WebAPIController.cs
@@ -11645,11 +11645,11 @@
                //有的单子源单分为红蓝单  0代表蓝单  1代表红单
                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)
                {       //不分红蓝单
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);
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";
WebAPI/Controllers/²Ö´æ¹ÜÀí/µ÷²¦Å̵ã/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
    }
}