using ICSSoft.DataProject;
using ICSSoft.DataProject.ICSSoft.DataProject;
using ICSSoft.Entity;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Http;
using System.Web.Http.Description;

namespace ICSSoft.WebAPI.Controllers
{
    public class ValuesController : ApiController
    {
        private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        #region 请购单
        /// <summary>
        /// 获取请购单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseRequisition/Get")]
        [HttpPost]

        public HttpResponseMessage GetPurchaseRequisition([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseRequisition action = new PurchaseRequisition();
                        string resultStr = action.Get(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建请购单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseRequisition/Create")]
        [HttpPost]
        public HttpResponseMessage CreatePurchaseRequisition([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        PurchaseRequisition action = new PurchaseRequisition();
                        string resultStr = action.CreatePurchaseRequisition(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;

                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核请购单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseRequisition/Approve")]
        [HttpPost]
        public HttpResponseMessage ApprovePurchaseRequisition([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseRequisition action = new PurchaseRequisition();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            //res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除到货单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseRequisition/Delete")]
        [HttpPost]
        public HttpResponseMessage DeletePurchaseRequisition([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseRequisition> infos = new List<ICSPurchaseRequisition>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseRequisition>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseRequisition action = new PurchaseRequisition();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            //res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 采购订单
        /// <summary>
        /// 获取采购订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseOrder/Get")]
        [HttpPost]

        public HttpResponseMessage GetPurchaseOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseOrder action = new PurchaseOrder();
                        string resultStr = action.GET(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建采购订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseOrder/Create")]
        [HttpPost]
        public HttpResponseMessage CreatePurchaseOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        PurchaseOrder action = new PurchaseOrder();
                        string resultStr = action.CreateICSPurchaseOrder(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;

                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核采购订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseOrder/Approve")]
        [HttpPost]
        public HttpResponseMessage ApprovePurchaseOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseOrder action = new PurchaseOrder();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            //res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除采购订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseOrder/Delete")]
        [HttpPost]
        public HttpResponseMessage DeletePurchaseOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseOrder> infos = new List<ICSPurchaseOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseOrder action = new PurchaseOrder();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            //res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 到货单
        /// <summary>
        /// 获取到货单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CreatePOArrive/Get")]
        [HttpPost]

        public HttpResponseMessage Get([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPOArrive> infos = new List<ICSPOArrive>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        CreatePOArrive action = new CreatePOArrive();
                        string resultStr = action.Get(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建到货单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CreatePOArrive/Create")]
        [HttpPost]
        public HttpResponseMessage Create([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPOArrive> infos = new List<ICSPOArrive>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        CreatePOArrive action = new CreatePOArrive();
                        string resultStr = action.CreatePUArrive(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;

                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核到货单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CreatePOArrive/Approve")]
        [HttpPost]
        public HttpResponseMessage Approve([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPOArrive> infos = new List<ICSPOArrive>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        CreatePOArrive action = new CreatePOArrive();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            //res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除到货单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CreatePOArrive/Delete")]
        [HttpPost]
        public HttpResponseMessage Delete([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPOArrive> infos = new List<ICSPOArrive>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPOArrive>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        CreatePOArrive action = new CreatePOArrive();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            //res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 拒收单
        /// <summary>
        /// 获取拒收单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CreatePuArrivalVouch/Get")]
        [HttpPost]
        public HttpResponseMessage GetPuArrivalVouch([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        CreatePuArrivalVouch action = new CreatePuArrivalVouch();
                        string resultStr = action.Get(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建拒收单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CreatePuArrivalVouch/Create")]
        [HttpPost]
        public HttpResponseMessage CreatePuArrivalVouch([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        CreatePuArrivalVouch action = new CreatePuArrivalVouch();
                        string resultStr = action.CreatePUArrive(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核拒收单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CreatePuArrivalVouch/Approve")]
        [HttpPost]
        public HttpResponseMessage ApprovePuArrivalVouch([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        CreatePuArrivalVouch action = new CreatePuArrivalVouch();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除拒收单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CreatePuArrivalVouch/Delete")]
        [HttpPost]
        public HttpResponseMessage DeletePuArrivalVouch([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPUArrivalVouch> infos = new List<ICSPUArrivalVouch>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPUArrivalVouch>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        CreatePuArrivalVouch action = new CreatePuArrivalVouch();
                        string resultStr = action.Delete(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 采购入库单
        /// <summary>
        /// 获取采购入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseReceiveDoc/Get")]
        [HttpPost]
        public HttpResponseMessage GetRdRecord01([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseReceiveDoc action = new PurchaseReceiveDoc();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建采购入库单(源头单据采购订单)
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseReceiveDoc/Create")]
        [HttpPost]
        public HttpResponseMessage CreateRdRecord01([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        PurchaseReceiveDoc action = new PurchaseReceiveDoc();
                        string resultStr = action.CreateRdRecord01sByPO(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建采购入库单(源头单据到货单)
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseReceiveDocPOArrive/Create")]
        [HttpPost]
        public HttpResponseMessage CreateRdRecord01ByPOArrive([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        PurchaseReceiveDoc action = new PurchaseReceiveDoc();
                        string resultStr = action.CreateRdRecord01sByPOArrive(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核采购入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseReceiveDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveRdRecord01([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseReceiveDoc action = new PurchaseReceiveDoc();
                        string resultStr = action.Approve(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除采购入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseReceiveDoc/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteRdRecord01([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseReceiveDoc action = new PurchaseReceiveDoc();
                        string resultStr = action.Delete(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 采购退货单

        /// <summary>
        /// 创建物料检验单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseReturnBack/Get")]
        [HttpPost]
        public HttpResponseMessage GETPurchaseReturnBack([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReturnBack> infos = new List<ICSPurchaseReturnBack>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReturnBack>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseReturnBack action = new PurchaseReturnBack();
                        string resultStr = action.Get(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 采购红字入库单
        /// <summary>
        /// 获取采购红字入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseReceiveDoctNegative/Get")]
        [HttpPost]
        public HttpResponseMessage GetPurchaseReceiveDoctNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
                        string resultStr = action.Get(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建采购红字入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseReceiveDoctNegative/Create")]
        [HttpPost]
        public HttpResponseMessage CreatePurchaseReceiveDoctNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
                        string resultStr = action.CreatePurchaseReceiveDoctNegative(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核采购红字入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseReceiveDoctNegative/Approve")]
        [HttpPost]
        public HttpResponseMessage ApprovePurchaseReceiveDoctNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
                        bool resultStr = action.Approve(infos);
                        if (resultStr==true)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除采购红字入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseReceiveDoctNegative/Delete")]
        [HttpPost]
        public HttpResponseMessage DeletePurchaseReceiveDoctNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
                        string resultStr = action.Delete(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 生产订单
        /// <summary>
        /// 获取采购订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureOrder/Get")]
        [HttpPost]

        public HttpResponseMessage GetManufactureOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSManufactureOrder> infos = new List<ICSManufactureOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSManufactureOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        ManufactureOrder action = new ManufactureOrder();
                        string resultStr = action.GET(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建生产订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureOrder/Create")]
        [HttpPost]
        public HttpResponseMessage CreateManufactureOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSManufactureOrder> infos = new List<ICSManufactureOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSManufactureOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        ManufactureOrder action = new ManufactureOrder();
                        string resultStr = action.CreateManufactureOrder(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;

                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        /// <summary>
        /// 删除生产订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureOrder/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteManufactureOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSManufactureOrder> infos = new List<ICSManufactureOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSManufactureOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        ManufactureOrder action = new ManufactureOrder();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            //res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 生产订单备料表

        #endregion
        #region 领料申请单
        /// <summary>
        /// 创建入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOIssueApplyDoc/Get")]
        [HttpPost]
        public HttpResponseMessage GetMOIssueApplyDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSMaterialAppVouch> infos = new List<ICSMaterialAppVouch>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSMaterialAppVouch>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueApplyDoc action = new MOIssueApplyDoc();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 材料出库
        /// <summary>
        /// 获取材料出库
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOIssueDoc/Get")]
        [HttpPost]
        public HttpResponseMessage GetMOIssueDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueDoc action = new MOIssueDoc();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建材料出库(生产订单)
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOIssueDoc/Create")]
        [HttpPost]
        public HttpResponseMessage CreateMOIssueDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueDoc action = new MOIssueDoc();
                        string resultStr = action.CreateRd11(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建材料出库(领料申请)
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOIssueDocByPU/Create")]
        [HttpPost]
        public HttpResponseMessage CreateMOIssueDocBYPU([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueDoc action = new MOIssueDoc();
                        string resultStr = action.MaterialAppVouchs(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核材料出库(生产订单)
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOIssueDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveMOIssueDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueDoc action = new MOIssueDoc();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除材料出库(备料表)
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOIssueDoc/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteMOIssueDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueDoc action = new MOIssueDoc();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 生产退料单(红字材料出库)
        /// <summary>
        /// 获取生产退料单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOIssueDocNegative/Get")]
        [HttpPost]
        public HttpResponseMessage GetMOIssueDocNegatives([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueDocNegatives action = new MOIssueDocNegatives();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建生产退料单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOIssueDocNegative/Create")]
        [HttpPost]
        public HttpResponseMessage CreateMOIssueDocNegatives([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueDocNegatives action = new MOIssueDocNegatives();
                        string resultStr = action.CreateRd11(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        /// <summary>
        /// 审核生产退料单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOIssueDocNegative/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveMOIssueDocNegatives([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueDocNegatives action = new MOIssueDocNegatives();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除生产退料单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOIssueDocNegative/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteMOIssueDocNegatives([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSMOIssueDocNegative> infos = new List<ICSMOIssueDocNegative>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocNegative>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueDocNegatives action = new MOIssueDocNegatives();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 委外订单
        /// <summary>
        /// 获取委外订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingOrder/Get")]
        [HttpPost]
        public HttpResponseMessage GetOutsourcingOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingOrder> infos = new List<ICSOutsourcingOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingOrder action = new OutsourcingOrder();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 委外订单备料表
        /// <summary>
        /// 获取委外订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingOrderPick/Get")]
        [HttpPost]
        public HttpResponseMessage GetOutsourcingOrderPick([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingOrderPick> infos = new List<ICSOutsourcingOrderPick>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingOrderPick>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingOrderPick action = new OutsourcingOrderPick();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 委外发料
        /// <summary>
        /// 获取委外发料
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingIssueDoc/Get")]
        [HttpPost]
        public HttpResponseMessage GetOutsourcingIssueDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingIssueDoc action = new OutsourcingIssueDoc();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建委外发料单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingIssueDoc/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOutsourcingIssueDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingIssueDoc action = new OutsourcingIssueDoc();
                        string resultStr = action.CreateOutsourcingIssueDoc(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        /// <summary>
        /// 审核委外发料单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingIssueDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveOutsourcingIssueDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingIssueDoc action = new OutsourcingIssueDoc();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除委外发料单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingIssueDoc/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteOutsourcingIssueDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingIssueDoc action = new OutsourcingIssueDoc();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 委外退料
        /// <summary>
        /// 获取委外退料
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingIssueDoNegative/Get")]
        [HttpPost]
        public HttpResponseMessage GetOutsourcingIssueDoNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建委外退料
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingIssueDoNegative/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOutsourcingIssueDoNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
                        string resultStr = action.CreateOutsourcingIssueDoNegative(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核委外退料
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingIssueDoNegative/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveOutsourcingIssueDoNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
                        string resultStr = action.Approve(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除委外退料
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingIssueDoNegative/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteOutsourcingIssueDoNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingIssueDoc> infos = new List<ICSOutsourcingIssueDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingIssueDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingIssueDoNegative action = new OutsourcingIssueDoNegative();
                        string resultStr = action.Delete(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 委外到货单
        /// <summary>
        /// 获取委外到货单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/DeliveryNotice/Get")]
        [HttpPost]
        public HttpResponseMessage GetDeliveryNotice([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        DeliveryNotice action = new DeliveryNotice();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建委外到货单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/DeliveryNotice/Create")]
        [HttpPost]
        public HttpResponseMessage CreateDeliveryNotice([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        DeliveryNotice action = new DeliveryNotice();
                        string resultStr = action.CreatePUArrive(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核委外到货
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/DeliveryNotice/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveDeliveryNotice([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        DeliveryNotice action = new DeliveryNotice();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除委外到货单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/DeliveryNotice/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteDeliveryNotice([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSDeliveryNotice> infos = new List<ICSDeliveryNotice>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        DeliveryNotice action = new DeliveryNotice();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 委外采购入库单
        /// <summary>
        /// 获取委外采购入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingReceiveDoc/Get")]
        [HttpPost]
        public HttpResponseMessage GetOutsourcingReceiveDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建委外采购入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingReceiveDocPOArrive/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOutsourcingReceiveDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
                        string resultStr = action.CreateOutsourcingReceiveDocByPOArrive(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        [Route("api/OutsourcingReceiveDoc/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOutsourcingReceiveDocPO([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
                        string resultStr = action.CreateOutsourcingReceiveDocByPO(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核委外采购入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingReceiveDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveOutsourcingReceiveDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingReceiveDoc> infos = new List<ICSOutsourcingReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingReceiveDoc action = new OutsourcingReceiveDoc();
                        string resultStr = action.Approve(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除采购入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseReceiveDoc/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteOutsourcingReceiveDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseReceiveDoc action = new PurchaseReceiveDoc();
                        string resultStr = action.Delete(infos);
                        if (resultStr.Length > 0)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 委外采购退货单
        /// <summary>
        /// 获取委外采购退货单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingReturnBack/Get")]
        [HttpPost]
        public HttpResponseMessage GETOutsourcingReturnBack([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingReturnBack> infos = new List<ICSOutsourcingReturnBack>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReturnBack>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingReturnBack action = new OutsourcingReturnBack();
                        string resultStr = action.Get(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 委外采购入库红字
        /// <summary>
        /// 获取委外采购入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingReceiveDocNegative/Get")]
        [HttpPost]
        public HttpResponseMessage GetOutsourcingReceiveDocNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingReceiveDocNegative> infos = new List<ICSOutsourcingReceiveDocNegative>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDocNegative>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingReceiveDocNegative action = new OutsourcingReceiveDocNegative();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 创建委外采购入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingReceiveDocNegative/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOutsourcingReceiveDocNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingReceiveDocNegative> infos = new List<ICSOutsourcingReceiveDocNegative>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDocNegative>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                            throw new Exception(res.Message);
                        }
                        OutsourcingReceiveDocNegative action = new OutsourcingReceiveDocNegative();
                        string resultStr = action.CreateOutsourcingReceiveDocNegative(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核委外采购入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingReceiveDocNegative/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveOutsourcingReceiveDocNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSPurchaseReceiveDoc> infos = new List<ICSPurchaseReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSPurchaseReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        PurchaseReceiveDoctNegative action = new PurchaseReceiveDoctNegative();
                        bool resultStr = action.Approve(infos);
                        if (resultStr == true)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除采购入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingReceiveDocNegative/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteOutsourcingReceiveDocNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSOutsourcingReceiveDocNegative> infos = new List<ICSOutsourcingReceiveDocNegative>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOutsourcingReceiveDocNegative>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OutsourcingReceiveDocNegative action = new OutsourcingReceiveDocNegative();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrEmpty(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 成品入库单

        /// <summary>
        /// 获取成品入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureReceiveDoc/Get")]
        [HttpPost]
        public HttpResponseMessage GetManufactureReceiveDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        ManufactureReceiveDoc action = new ManufactureReceiveDoc();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        /// <summary>
        /// 创建成品入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureReceiveDoc/Create")]
        [HttpPost]
        public HttpResponseMessage CreateManufactureReceiveDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        ManufactureReceiveDoc action = new ManufactureReceiveDoc();
                        string resultStr = action.CreateManufactureReceiveDoc(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核委外退料单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureReceiveDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveManufactureReceiveDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        ManufactureReceiveDoc action = new ManufactureReceiveDoc();
                        bool resultStr = action.Approve(infos);
                        if (resultStr == false)
                        {
                            res.Success = false;
                            res.Message = "接口调用失败!";
                        }
                        else
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除委外退料单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureReceiveDoc/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteManufactureReceiveDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSManufactureReceiveDoc> infos = new List<ICSManufactureReceiveDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        ManufactureReceiveDoc action = new ManufactureReceiveDoc();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        #endregion
        #region 销售出库

        /// <summary>
        /// 获取销售出库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDoc/Get")]
        [HttpPost]
        public HttpResponseMessage GetSalesShipmentDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesShipmentDoc action = new SalesShipmentDoc();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        /// <summary>
        /// 创建销售出库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDoc/Create")]
        [HttpPost]
        public HttpResponseMessage CreateSalesShipmentDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesShipmentDoc action = new SalesShipmentDoc();
                        string resultStr = action.CreateSalesShipmentDoc(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核销售出库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveSalesShipmentDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesShipmentDoc action = new SalesShipmentDoc();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除销售出库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDoc/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteSalesShipmentDoc([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesShipmentDoc> infos = new List<ICSSalesShipmentDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesShipmentDoc action = new SalesShipmentDoc();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        #endregion
        #region 销售出库红字

        /// <summary>
        /// 获取销售出库单红字
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDocNegative/Get")]
        [HttpPost]
        public HttpResponseMessage GetSalesShipmentDocNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesShipmentDocNegative action = new SalesShipmentDocNegative();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        /// <summary>
        /// 创建销售出库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDocNegative/Create")]
        [HttpPost]
        public HttpResponseMessage CreateSalesShipmentDocNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesShipmentDocNegative action = new SalesShipmentDocNegative();
                        string resultStr = action.CreateSalesShipmentDocNegative(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核销售出库单红字
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDocNegative/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveSalesShipmentDocNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesShipmentDocNegative action = new SalesShipmentDocNegative();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除销售出库单红字
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDocNegative/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteSalesShipmentDocNegative([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesShipmentDocNegative> infos = new List<ICSSalesShipmentDocNegative>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesShipmentDocNegative>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesShipmentDocNegative action = new SalesShipmentDocNegative();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        #endregion
        #region 销售订单

        /// <summary>
        /// 获取销售订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesOrder/Get")]
        [HttpPost]
        public HttpResponseMessage GetSalesOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesOrder> infos = new List<ICSSalesOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesOrder action = new SalesOrder();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        /// <summary>
        /// 创建销售订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesOrder/Create")]
        [HttpPost]
        public HttpResponseMessage CreateSalesOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesOrder> infos = new List<ICSSalesOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesOrder action = new SalesOrder();
                        string resultStr = action.CerateSalesOrder(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核销售订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesOrder/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveSalesOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesOrder> infos = new List<ICSSalesOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesOrder action = new SalesOrder();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除销售订单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesOrder/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteSalesOrder([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesOrder> infos = new List<ICSSalesOrder>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesOrder>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesOrder action = new SalesOrder();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        #endregion
        #region 销售发货

        /// <summary>
        /// 获取销售发货
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesDeliveryNotice/Get")]
        [HttpPost]
        public HttpResponseMessage GetSalesDeliveryNotice([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesDeliveryNotice action = new SalesDeliveryNotice();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        /// <summary>
        /// 创建销售发货
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesDeliveryNotice/Create")]
        [HttpPost]
        public HttpResponseMessage CreateSalesDeliveryNotice([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesDeliveryNotice action = new SalesDeliveryNotice();
                        string resultStr = action.CerateSalesDeliveryNotice(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 审核销售发货
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesDeliveryNotice/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveSalesDeliveryNotice([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesDeliveryNotice action = new SalesDeliveryNotice();
                        string resultStr = action.Approve(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        /// <summary>
        /// 删除销售发货
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesDeliveryNotice/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteSalesDeliveryNotice([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesDeliveryNotice> infos = new List<ICSSalesDeliveryNotice>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNotice>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesDeliveryNotice action = new SalesDeliveryNotice();
                        string resultStr = action.Delete(infos);
                        if (string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }

        #endregion
        #region 销售退货
        /// <summary>
        /// 获取销售退货
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesReturnBack/Get")]
        [HttpPost]
        public HttpResponseMessage GetSalesReturnBack([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSSalesReturnBack> infos = new List<ICSSalesReturnBack>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesReturnBack>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        SalesReturnBack action = new SalesReturnBack();
                        string resultStr = action.Get(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 调拨
        /// <summary>
        /// 审核拆卸单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OneStepTransferDocIn/Approve")]
        [HttpPost]
        public HttpResponseMessage TransferDoc([FromBody]object JsonData)
        {
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    log.Info("\r\n  JSON数据:" + JsonData + "\r\n");
                    try
                    {
                        List<ICSTransferDoc> Bills = new List<ICSTransferDoc>();
                        try
                        {
                            Bills = JsonConvert.DeserializeObject<List<ICSTransferDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        TransferDoc action = new TransferDoc();
                        bool flag = action.ConfirmTrans(Bills);
                        if (flag == false)
                        {
                            res.Success = false;
                            res.Message = "接口调用失败!";
                        }
                        else
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
        }
        #endregion
        #region 审核其他入库单(杂收)
        /// <summary>
        /// 其他入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OtherInDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage APIConfirmRdrecord08([FromBody]object JsonData)
        {
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    log.Info("\r\n  JSON数据:" + JsonData + "\r\n");
                    try
                    {
                        List<ICSOtherInDoc> Bills = new List<ICSOtherInDoc>();
                        try
                        {
                            Bills = JsonConvert.DeserializeObject<List<ICSOtherInDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OtherInDoc action = new OtherInDoc();
                        bool flag = action.ConfirmRd08(Bills);
                        if (flag == false)
                        {
                            res.Success = false;
                            res.Message = "接口调用失败!";
                        }
                        else
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
        }
        #endregion
        #region 审核其他出库单(杂发)
        /// <summary>
        /// 审核其他出库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OtherOutDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage APIConfirmRdrecord09([FromBody]object JsonData)
        {
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    log.Info("\r\n  JSON数据:" + JsonData + "\r\n");
                    try
                    {
                        List<ICSOtherOutDoc> Bills = new List<ICSOtherOutDoc>();
                        try
                        {
                            Bills = JsonConvert.DeserializeObject<List<ICSOtherOutDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OtherOutDoc action = new OtherOutDoc();
                        bool flag = action.ConfirmRd09(Bills);
                        if (flag == false)
                        {
                            res.Success = false;
                            res.Message = "接口调用失败!";
                        }
                        else
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
        }
        #endregion
        #region 拆卸单
        /// <summary>
        /// 审核拆卸单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/DisassemblyDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage APIConfirmDismrecord01([FromBody]object JsonData)
        {
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    log.Info("\r\n  JSON数据:" + JsonData + "\r\n");
                    try
                    {
                        List<ICSDisassemblyDoc> Bills = new List<ICSDisassemblyDoc>();
                        try
                        {
                            Bills = JsonConvert.DeserializeObject<List<ICSDisassemblyDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        DisassemblyDoc action = new DisassemblyDoc();
                        bool flag = action.Dismrecord01(Bills);
                        if (flag == false)
                        {
                            res.Success = false;
                            res.Message = "接口调用失败!";
                        }
                        else
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
        }
        #endregion
        #region 审核其他入库单(两步调入)
        /// <summary>
        /// 其他入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/TwoStepTransferDocIn/Approve")]
        [HttpPost]
        public HttpResponseMessage APIConfirmRdrecord08Two([FromBody]object JsonData)
        {
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    log.Info("\r\n  JSON数据:" + JsonData + "\r\n");
                    try
                    {
                        List<ICSOtherInDoc> Bills = new List<ICSOtherInDoc>();
                        try
                        {
                            Bills = JsonConvert.DeserializeObject<List<ICSOtherInDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OtherInDoc action = new OtherInDoc();
                        bool flag = action.ConfirmRd08(Bills);
                        if (flag == false)
                        {
                            res.Success = false;
                            res.Message = "接口调用失败!";
                        }
                        else
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
        }
        #endregion
        #region 审核其他出库单(两步调出)
        /// <summary>
        /// 审核其他出库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/TwoStepTransferDocOut/Approve")]
        [HttpPost]
        public HttpResponseMessage APIConfirmRdrecord09Two([FromBody]object JsonData)
        {
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    log.Info("\r\n  JSON数据:" + JsonData + "\r\n");
                    try
                    {
                        List<ICSOtherOutDoc> Bills = new List<ICSOtherOutDoc>();
                        try
                        {
                            Bills = JsonConvert.DeserializeObject<List<ICSOtherOutDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        OtherOutDoc action = new OtherOutDoc();
                        bool flag = action.ConfirmRd09(Bills);
                        if (flag == false)
                        {
                            res.Success = false;
                            res.Message = "接口调用失败!";
                        }
                        else
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
        }
        #endregion
        #region 委外材料出库(领料单)
        [Route("api/OOIssueDocByPU/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOOIssueDocBYPU([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSRdrecord11> infos = new List<ICSRdrecord11>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSRdrecord11>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueDoc action = new MOIssueDoc();
                        string resultStr = action.MaterialAppVouchs(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
            }
            finally
            {
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
            }
            log.Debug("返回值:" + str);
            return result;
        }
        #endregion
        #region 开立材料出库
        /// <summary>
        /// 审核材料出库
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OOIssueDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage MOIssueDocApprove([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSMOIssueDocApprove> infos = new List<ICSMOIssueDocApprove>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSMOIssueDocApprove>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        MOIssueDocApprove action = new MOIssueDocApprove();
                        bool flag = action.ConfirmRd11(infos);
                        if (flag == false)
                        {
                            res.Success = false;
                            res.Message = "接口调用失败!";
                        }
                        else
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
        }
        #endregion
        #region 借用(生成其他出库)
        /// <summary>
        /// 借用
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/BrrowDoc/Create")]
        [HttpPost]
        public HttpResponseMessage BrrowDocCreate([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSBrrowDoc> infos = new List<ICSBrrowDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSBrrowDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        BrrowDoc action = new BrrowDoc();
                        string resultStr = action.ConfirmRd09(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
        }
        #endregion
        #region 归还(生成其他入库)
        /// <summary>
        /// 借用
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ReturnDoc/Create")]
        [HttpPost]
        public HttpResponseMessage ReturnDocCreate([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSReturnDoc> infos = new List<ICSReturnDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSReturnDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        ReturnDoc action = new ReturnDoc();
                        string resultStr = action.ConfirmRd08(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
        }
        #endregion
        #region 形态转换单
        /// <summary>
        /// 形态转换单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MorphologicalTransformationDoc/Create")]
        [HttpPost]
        public HttpResponseMessage MorphologicalTransformationDocCreate([FromBody]object JsonData)
        {
            log.Info("传入值:" + JsonData);
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {
                    try
                    {
                        List<ICSAssemVouch> infos = new List<ICSAssemVouch>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSAssemVouch>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败:" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确!";
                        }
                        CreateAssemVouch action = new CreateAssemVouch();
                        string resultStr = action.Create(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功!";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Data = resultStr;
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("调用后台失败:" + ex.ToString());
                        res.Success = false;
                        res.Message = ex.Message;
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                log.Debug("返回值:" + result);
                return result;
            }
            catch (Exception ex)
            {
                log.Error("参数检验失败:" + ex.ToString());
                res.Success = false;
                res.Message = ex.Message;
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
                return result;
            }
        }
        #endregion
    }
}