using Newtonsoft.Json; 
 | 
using Newtonsoft.Json.Linq; 
 | 
using Pub_Class; 
 | 
using System; 
 | 
using System.Collections; 
 | 
using System.Collections.Generic; 
 | 
using System.Data; 
 | 
using System.Data.SqlClient; 
 | 
using System.Web.Http; 
 | 
using WebAPI.Models; 
 | 
  
 | 
namespace WebAPI.Controllers 
 | 
{ 
 | 
  
 | 
    public class Xs_OutDoorCheckBillController : ApiController 
 | 
    { 
 | 
        public DBUtility.ClsPub.Enum_BillStatus BillStatus; 
 | 
        public const string ModName = "1427";                   //单据类型 
 | 
        public const string ModCaption = "出门确认单";          //单据名称 
 | 
        public const string ModRightName = "Xs_OutDoorCheckBill"; 
 | 
        public const string ModRightNameList = ModRightName + "List";       //列表 
 | 
        public const string ModRightNameEdit = ModRightName + "_Edit";      //编辑 
 | 
        public const string ModRightNameCheck = ModRightName + "_Check";    //审核 
 | 
        public const string ModRightNameClose = ModRightName + "_Close";    //关闭 
 | 
        public const string ModRightNameDelete = ModRightName + "_Delete";  //作废 
 | 
        public const string ModRightNameDrop = ModRightName + "_Drop";      //删除 
 | 
        public const string ModRightNameMoney = ModRightName + "_Money";    //金额 
 | 
        public const string ModRightNameQty = ModRightName + "_Qty";        //数量 
 | 
        public DataSet ds = new DataSet(); 
 | 
        private json objJsonResult = new json(); 
 | 
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); 
 | 
        public DAL.ClsXs_OutDoorCheckBill oBill = new DAL.ClsXs_OutDoorCheckBill(); 
 | 
  
 | 
  
 | 
        #region 出门确认单列表 
 | 
        /// <summary> 
 | 
        /// 获取出门确认单列表信息 
 | 
        /// </summary> 
 | 
        /// <returns></returns> 
 | 
        [Route("Xs_OutDoorCheckBillController/GetXs_OutDoorCheckBillList_Json")] 
 | 
        [HttpGet] 
 | 
        public object GetXs_OutDoorCheckBillList_Json(string sWhere, string HMaker) 
 | 
        { 
 | 
            try 
 | 
            { 
 | 
                //判断权限 
 | 
                if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, HMaker)) 
 | 
                { 
 | 
                    objJsonResult.code = "0"; 
 | 
                    objJsonResult.count = 0; 
 | 
                    objJsonResult.Message = "您没有该模块权限,请与管理员联系!"; 
 | 
                    objJsonResult.data = null; 
 | 
                    return objJsonResult; 
 | 
                } 
 | 
  
 | 
                //返回列表信息 
 | 
                ds = oCn.RunProcReturn("select * from h_v_Xs_OutDoorCheckBillList where " + sWhere + " order by hmainid desc", "h_v_Xs_OutDoorCheckBillList"); 
 | 
                List<object> columnNameList = new List<object>(); 
 | 
                //添加列名 
 | 
                foreach (DataColumn col in ds.Tables[0].Columns) 
 | 
                { 
 | 
                    Type dataType = col.DataType; 
 | 
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; 
 | 
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //获取到DataColumn列对象的列名 
 | 
                } 
 | 
                objJsonResult.code = "0"; 
 | 
                objJsonResult.count = 1; 
 | 
                objJsonResult.Message = "成功!"; 
 | 
                objJsonResult.data = ds.Tables[0]; 
 | 
                objJsonResult.list = columnNameList; 
 | 
                return objJsonResult; 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                objJsonResult.code = "0"; 
 | 
                objJsonResult.count = 0; 
 | 
                objJsonResult.Message = "查询列表信息失败!" + e.ToString(); 
 | 
                objJsonResult.data = null; 
 | 
                return objJsonResult; 
 | 
            } 
 | 
        } 
 | 
        #endregion 
 | 
  
 | 
        #region 出门确认单删除 
 | 
        /// <summary> 
 | 
        /// 删除出门确认单 
 | 
        /// </summary> 
 | 
        /// <returns></returns> 
 | 
        [Route("Xs_OutDoorCheckBillController/GetXs_OutDoorCheckBill_Delete_Json")] 
 | 
        [HttpGet] 
 | 
        public object GetXs_OutDoorCheckBill_Delete_Json(Int64 HInterID, string HMaker) 
 | 
        { 
 | 
            try 
 | 
            { 
 | 
                //判断权限 
 | 
                if (!DBUtility.ClsPub.Security_Log(ModRightNameDrop, 3, false, HMaker)) 
 | 
                { 
 | 
                    objJsonResult.code = "0"; 
 | 
                    objJsonResult.count = 0; 
 | 
                    objJsonResult.Message = "您没有该模块删除功能权限,请与管理员联系!"; 
 | 
                    objJsonResult.data = null; 
 | 
                    return objJsonResult; 
 | 
                } 
 | 
  
 | 
                //判断存在性 
 | 
                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) 
 | 
                { 
 | 
                    //删除前控制 
 | 
                    DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Xs_OutDoorCheckBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Xs_OutDoorCheckBill_BeforeDelCtrl"); 
 | 
                    if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) 
 | 
                    { 
 | 
                        objJsonResult.code = "0"; 
 | 
                        objJsonResult.count = 0; 
 | 
                        objJsonResult.Message = "删除前判断失败!"; 
 | 
                        objJsonResult.data = null; 
 | 
                        return objJsonResult; 
 | 
                    } 
 | 
                    else 
 | 
                    { 
 | 
                        if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                    } 
 | 
  
 | 
                    //进行 会计期间 结账 的判断和控制 
 | 
                    string s = ""; 
 | 
                    int sYear = 0; 
 | 
                    int sPeriod = 0; 
 | 
                    DateTime HDate = DateTime.Now; 
 | 
                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) 
 | 
                    { 
 | 
                        objJsonResult.Message = s; 
 | 
                        return objJsonResult; 
 | 
                    } 
 | 
  
 | 
                    //删除单据(包含删除后控制、写入日志) 
 | 
                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Xs_OutDoorCheckBill_AfterDelCtrl", HMaker, ref ClsPub.sExeReturnInfo)) 
 | 
                    { 
 | 
                        objJsonResult.code = "0"; 
 | 
                        objJsonResult.count = 0; 
 | 
                        objJsonResult.Message = "删除失败!原因:" + ClsPub.sExeReturnInfo; 
 | 
                        objJsonResult.data = null; 
 | 
                        return objJsonResult; 
 | 
                    } 
 | 
                    else 
 | 
                    { 
 | 
                        objJsonResult.code = "0"; 
 | 
                        objJsonResult.count = 1; 
 | 
                        objJsonResult.Message = "删除出门确认单成功!"; 
 | 
                        objJsonResult.data = null; 
 | 
                        return objJsonResult; 
 | 
                    } 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    objJsonResult.code = "0"; 
 | 
                    objJsonResult.count = 0; 
 | 
                    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 出门确认单审核/反审核 
 | 
        /// <summary> 
 | 
        /// 审核/反审核出门确认单 
 | 
        /// </summary> 
 | 
        /// <param name="HInterID">单据ID</param> 
 | 
        /// <param name="Type">审核(1),反审核(2)</param> 
 | 
        /// <param name="HMaker">审核人</param> 
 | 
        /// <returns></returns> 
 | 
        [Route("Xs_OutDoorCheckBillController/GetXs_OutDoorCheckBill_Check_Json")] 
 | 
        [HttpGet] 
 | 
        public object GetXs_OutDoorCheckBill_Check_Json(Int64 HInterID, int Type, string HMaker) 
 | 
        { 
 | 
            try 
 | 
            { 
 | 
                //判断权限 
 | 
                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker)) 
 | 
                { 
 | 
                    objJsonResult.code = "0"; 
 | 
                    objJsonResult.count = 0; 
 | 
                    objJsonResult.Message = "您没有该模块审核/反审核功能权限,请与管理员联系!"; 
 | 
                    objJsonResult.data = null; 
 | 
                    return objJsonResult; 
 | 
                } 
 | 
  
 | 
                //判断存在性 
 | 
                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) 
 | 
                { 
 | 
                    //Type 1 审核  2  反审核 
 | 
                    if (Type == 1) 
 | 
                    { 
 | 
                        if (oBill.omodel.HChecker.Trim() != "") 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "单据已审核,不能再次审核!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        if (oBill.omodel.HCloseMan.Trim() != "") 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "单据已关闭,不能再次审核!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        if (oBill.omodel.HDeleteMan.Trim() != "") 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "单据已作废,不能再次审核!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        //审核前控制 
 | 
                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Xs_OutDoorCheckBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Xs_OutDoorCheckBill_BeforeCheckCtrl"); 
 | 
                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "审核前判断失败!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        else 
 | 
                        { 
 | 
                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) 
 | 
                            { 
 | 
                                objJsonResult.code = "0"; 
 | 
                                objJsonResult.count = 0; 
 | 
                                objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); 
 | 
                                objJsonResult.data = null; 
 | 
                                return objJsonResult; 
 | 
                            } 
 | 
                        } 
 | 
  
 | 
                        //进行 会计期间 结账 的判断和控制 
 | 
                        string s = ""; 
 | 
                        int sYear = 0; 
 | 
                        int sPeriod = 0; 
 | 
                        DateTime HDate = DateTime.Now; 
 | 
                        if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) 
 | 
                        { 
 | 
                            objJsonResult.Message = s; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
  
 | 
                        //审核单据 
 | 
                        if (!oBill.CheckBill(HInterID, oBill.omodel.HBillNo, "h_p_Xs_OutDoorCheckBill_AfterCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo)) 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        else 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 1; 
 | 
                            objJsonResult.Message = "单据号:"+ oBill.omodel.HBillNo+ " 审核成功!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; ; 
 | 
                        } 
 | 
                    } 
 | 
                    else 
 | 
                    { 
 | 
                        if (oBill.omodel.HChecker.Trim() == "") 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "单据未审核,不需要反审核!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        //反审核前控制 
 | 
                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Xs_OutDoorCheckBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Xs_OutDoorCheckBill_BeforeUnCheckCtrl"); 
 | 
                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "反审核前判断失败!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        else 
 | 
                        { 
 | 
                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) 
 | 
                            { 
 | 
                                objJsonResult.code = "0"; 
 | 
                                objJsonResult.count = 0; 
 | 
                                objJsonResult.Message = "反审核失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); 
 | 
                                objJsonResult.data = null; 
 | 
                                return objJsonResult; 
 | 
                            } 
 | 
                        } 
 | 
  
 | 
                        //进行 会计期间 结账 的判断和控制 
 | 
                        string s = ""; 
 | 
                        int sYear = 0; 
 | 
                        int sPeriod = 0; 
 | 
                        DateTime HDate = DateTime.Now; 
 | 
                        if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) 
 | 
                        { 
 | 
                            objJsonResult.Message = s; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
  
 | 
                        //反审核单据 
 | 
                        if (!oBill.AbandonCheck(HInterID, oBill.omodel.HBillNo, "h_p_Xs_OutDoorCheckBill_AfterUnCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo)) 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        else 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 1; 
 | 
                            objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " 反审核成功!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; ; 
 | 
                        } 
 | 
                    } 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    objJsonResult.code = "0"; 
 | 
                    objJsonResult.count = 0; 
 | 
                    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 出门确认单关闭/反关闭 
 | 
        /// <summary> 
 | 
        /// 关闭/反关闭出门确认单 
 | 
        /// </summary> 
 | 
        /// <param name="HInterID">单据ID</param> 
 | 
        /// <param name="Type">关闭(1),反关闭(2)</param> 
 | 
        /// <param name="HMaker">关闭人</param> 
 | 
        /// <returns></returns> 
 | 
        [Route("Xs_OutDoorCheckBillController/GetXs_OutDoorCheckBill_Close_Json")] 
 | 
        [HttpGet] 
 | 
        public object GetXs_OutDoorCheckBill_Close_Json(Int64 HInterID, int Type, string HMaker) 
 | 
        { 
 | 
            try 
 | 
            { 
 | 
                //判断权限 
 | 
                if (!DBUtility.ClsPub.Security_Log(ModRightNameClose, 3, false, HMaker)) 
 | 
                { 
 | 
                    objJsonResult.code = "0"; 
 | 
                    objJsonResult.count = 0; 
 | 
                    objJsonResult.Message = "您没有该模块关闭/反关闭功能权限,请与管理员联系!"; 
 | 
                    objJsonResult.data = null; 
 | 
                    return objJsonResult; 
 | 
                } 
 | 
  
 | 
                //判断存在性 
 | 
                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) 
 | 
                { 
 | 
                    //Type 1 关闭  2  反关闭 
 | 
                    if (Type == 1) 
 | 
                    { 
 | 
                        if (oBill.omodel.HCloseMan.Trim() != "") 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "单据已关闭,不能再次关闭!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        //关闭单据 
 | 
                        if (!oBill.CloseBill(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        else 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 1; 
 | 
                            objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " 关闭成功!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; ; 
 | 
                        } 
 | 
                    } 
 | 
                    else 
 | 
                    { 
 | 
                        if (oBill.omodel.HCloseMan.Trim() == "") 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "单据未关闭,不需要反关闭!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        //反关闭单据 
 | 
                        if (!oBill.CancelClose(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        else 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 1; 
 | 
                            objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " 反关闭成功!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; ; 
 | 
                        } 
 | 
                    } 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    objJsonResult.code = "0"; 
 | 
                    objJsonResult.count = 0; 
 | 
                    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 出门确认单作废/反作废 
 | 
        /// <summary> 
 | 
        /// 作废/反作废出门确认单 
 | 
        /// </summary> 
 | 
        /// <param name="HInterID">单据ID</param> 
 | 
        /// <param name="Type">作废(1),反作废(2)</param> 
 | 
        /// <param name="HMaker">作废人</param> 
 | 
        /// <returns></returns> 
 | 
        [Route("Xs_OutDoorCheckBillController/GetXs_OutDoorCheckBill_Cancelltion_Json")] 
 | 
        [HttpGet] 
 | 
        public object GetXs_OutDoorCheckBill_Cancelltion_Json(Int64 HInterID, int Type, string HMaker) 
 | 
        { 
 | 
            try 
 | 
            { 
 | 
                //判断权限 
 | 
                if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 3, false, HMaker)) 
 | 
                { 
 | 
                    objJsonResult.code = "0"; 
 | 
                    objJsonResult.count = 0; 
 | 
                    objJsonResult.Message = "您没有该模块作废/反作废功能权限,请与管理员联系!"; 
 | 
                    objJsonResult.data = null; 
 | 
                    return objJsonResult; 
 | 
                } 
 | 
  
 | 
                //判断存在性 
 | 
                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) 
 | 
                { 
 | 
                    //Type 1 作废  2  反作废 
 | 
                    if (Type == 1) 
 | 
                    { 
 | 
                        if (oBill.omodel.HDeleteMan.Trim() != "") 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "单据已作废,不能再次作废!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        //作废单据 
 | 
                        if (!oBill.Cancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "作废失败!原因:" + ClsPub.sExeReturnInfo; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        else 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 1; 
 | 
                            objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " 作废成功!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; ; 
 | 
                        } 
 | 
                    } 
 | 
                    else 
 | 
                    { 
 | 
                        if (oBill.omodel.HDeleteMan.Trim() == "") 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "单据未作废,不需要反作废!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        //反作废单据 
 | 
                        if (!oBill.AbandonCancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 0; 
 | 
                            objJsonResult.Message = "反作废失败!原因:" + ClsPub.sExeReturnInfo; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; 
 | 
                        } 
 | 
                        else 
 | 
                        { 
 | 
                            objJsonResult.code = "0"; 
 | 
                            objJsonResult.count = 1; 
 | 
                            objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " 反作废成功!"; 
 | 
                            objJsonResult.data = null; 
 | 
                            return objJsonResult; ; 
 | 
                        } 
 | 
                    } 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    objJsonResult.code = "0"; 
 | 
                    objJsonResult.count = 0; 
 | 
                    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 出门确认单编辑 
 | 
        /// <summary> 
 | 
        /// 出门确认单编辑时,根据单据ID获取单据信息 
 | 
        /// </summary> 
 | 
        /// <returns></returns> 
 | 
        [Route("Xs_OutDoorCheckBillController/GetXs_OutDoorCheckBill_Json")] 
 | 
        [HttpGet] 
 | 
        public object GetXs_OutDoorCheckBill_Json(Int64 HInterID, string HMaker) 
 | 
        { 
 | 
            try 
 | 
            { 
 | 
                //判断权限 
 | 
                if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 3, false, HMaker)) 
 | 
                { 
 | 
                    objJsonResult.code = "0"; 
 | 
                    objJsonResult.count = 0; 
 | 
                    objJsonResult.Message = "您没有该模块编辑权限,请与管理员联系!"; 
 | 
                    objJsonResult.data = null; 
 | 
                    return objJsonResult; 
 | 
                } 
 | 
  
 | 
                //返回列表信息 
 | 
                ds = oCn.RunProcReturn("exec h_p_Xs_OutDoorCheckBill_EditInit " + HInterID, "h_p_Xs_OutDoorCheckBill_EditInit"); 
 | 
                if (ds == null || ds.Tables[0].Rows.Count == 0) 
 | 
                { 
 | 
                    objJsonResult.code = "0"; 
 | 
                    objJsonResult.count = 0; 
 | 
                    objJsonResult.Message = "未查询到该出门确认单,请刷新数据后重新选择!"; 
 | 
                    objJsonResult.data = null; 
 | 
                    return objJsonResult; 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    objJsonResult.code = "1"; 
 | 
                    objJsonResult.count = 1; 
 | 
                    objJsonResult.Message = "成功!"; 
 | 
                    objJsonResult.data = ds.Tables[0]; 
 | 
                    return objJsonResult; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                objJsonResult.code = "0"; 
 | 
                objJsonResult.count = 0; 
 | 
                objJsonResult.Message = "返回出门确认单信息失败!" + e.ToString(); 
 | 
                objJsonResult.data = null; 
 | 
                return objJsonResult; 
 | 
            } 
 | 
        } 
 | 
        #endregion 
 | 
  
 | 
  
 | 
        //---------------------------------------------------------------PDA模块调用 
 | 
        #region 出门确认单列表 
 | 
        /// <summary> 
 | 
        /// 获取出门确认单列表信息 
 | 
        /// </summary> 
 | 
        /// <returns></returns> 
 | 
        [Route("Xs_OutDoorCheckBillController/GetXs_OutDoorCheckBillList_PDA_Json")] 
 | 
        [HttpGet] 
 | 
        public object GetXs_OutDoorCheckBillList_PDA_Json(string sWhere) 
 | 
        { 
 | 
            try 
 | 
            { 
 | 
                //返回列表信息 
 | 
                ds = oCn.RunProcReturn("exec h_p_Xs_OutDoorCheckBillList_PDA '" + sWhere + "'", "h_p_Xs_OutDoorCheckBillList_PDA"); 
 | 
                List<object> columnNameList = new List<object>(); 
 | 
                //添加列名 
 | 
                foreach (DataColumn col in ds.Tables[0].Columns) 
 | 
                { 
 | 
                    Type dataType = col.DataType; 
 | 
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; 
 | 
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //获取到DataColumn列对象的列名 
 | 
                } 
 | 
                objJsonResult.code = "0"; 
 | 
                objJsonResult.count = 1; 
 | 
                objJsonResult.Message = "成功!"; 
 | 
                objJsonResult.data = ds.Tables[0]; 
 | 
                objJsonResult.list = columnNameList; 
 | 
                return objJsonResult; 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                objJsonResult.code = "0"; 
 | 
                objJsonResult.count = 0; 
 | 
                objJsonResult.Message = "查询列表信息失败!" + e.ToString(); 
 | 
                objJsonResult.data = null; 
 | 
                return objJsonResult; 
 | 
            } 
 | 
        } 
 | 
        #endregion 
 | 
  
 | 
    } 
 | 
} 
 |