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;
using ICSSoft.Common;

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/OtherOutDoc/Create")]
        [HttpPost]
        public HttpResponseMessage BrrowWDocCreate([FromBody]object JsonData)
        {
            log.Info("接口：api/BrrowDoc/Create");
            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.ConfirmRd09W(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("返回值：" + str);
                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");
                log.Debug("借用(生成其他出库)返回值：" + str);
                return result;
            }
        }
        #endregion
        #region 生成其他入库（无源头）
        /// <summary>
        /// (生成其他入库)
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OtherInDoc/Create")]
        [HttpPost]
        public HttpResponseMessage ReturnDocWCreate([FromBody]object JsonData)
        {
            log.Info("接口：api/ReturnDoc/Create");
            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.ConfirmRd08W(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("返回值：" + str);
                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");
                log.Debug("归还(生成其他入库)返回值：" + str);
                return result;
            }
        }
        #endregion
        #region 请购单
        /// <summary>
        /// 获取请购单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurchaseRequisition/Get")]
        [HttpPost]

        public HttpResponseMessage GetPurchaseRequisition([FromBody]object JsonData)
        {
            log.Info("接口：api/PurchaseRequisition/Get ");
            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("接口：api/PurchaseRequisition/Create ");
            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("接口：api/PurchaseRequisition/Approve");
            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("接口：api/PurchaseRequisition/Delete");
            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("接口：api/PurchaseOrder/Get");
            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("接口：api/PurchaseOrder/Create");
            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("接口：api/PurchaseOrder/Approve");
            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("接口：api/PurchaseOrder/Delete");
            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("接口：api/CreatePOArrive/Get");
            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("接口：api/CreatePOArrive/Create");
            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("接口：api/CreatePOArrive/Approve");
            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("接口：api/CreatePOArrive/Delete");
            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("接口：api/CreatePuArrivalVouch/Get");
            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("接口：api/CreatePuArrivalVouch/Create");
            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.Data = resultStr;
                            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/CreateWPuArrivalVouch/CreateNew")]
        [HttpPost]
        public HttpResponseMessage CreatePuArrivalVouchNEW([FromBody]object JsonData)
        {
            log.Info("接口：api/CreateWPuArrivalVouch/CreateNew");
            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<ICSOPUArrivalVouch> infos = new List<ICSOPUArrivalVouch>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOPUArrivalVouch>>(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.CreateWPUArrive(infos);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Data = resultStr;
                            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("接口：api/CreatePuArrivalVouch/Approve");
            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("接口：api/CreatePuArrivalVouch/Delete");
            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("接口：api/PurchaseReceiveDoc/Get");
            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("接口：api/PurchaseReceiveDoc/Create");
            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());
                        //if (ex.Message.IndexOf("处理条码") >= 0)
                        //   res.Success = true;
                        //else
                        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("接口：api/PurchaseReceiveDocPOArrive/Create");
            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("接口：api/PurchaseReceiveDoc/Approve");
            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("接口：api/PurchaseReceiveDoc/Delete");
            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("接口：api/PurchaseReturnBack/Get");
            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("接口：api/PurchaseReceiveDoctNegative/Get");
            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("接口：api/PurchaseReceiveDoctNegative/Create");
            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/CreatePurchaseReceivePO/Create")]
        [HttpPost]
        public HttpResponseMessage CreatePurchaseReceivePO([FromBody] object JsonData)
        {
            log.Info("接口：api/CreatePurchaseReceivePO/Create");
            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.CreatePurchaseReceiveDoctPO(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("接口：api/PurchaseReceiveDoctNegative/Approve");
            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("接口：api/PurchaseReceiveDoctNegative/Delete");
            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("接口：api/ManufactureOrder/Get");
            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("接口：api/ManufactureOrder/Create");
            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/MomOrder/Create")]
        [HttpPost]
        public HttpResponseMessage CreateMomOrder([FromBody]object JsonData)
        {
            log.Info("接口：api/MomOrder/Create");
            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.CreateMomOrder(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("接口：api/ManufactureOrder/Delete");
            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 生产订单备料表
        /// <summary>
        /// 更新生产订单备料表
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureOrderPick/Create")]
        [HttpPost]
        public HttpResponseMessage CreateManufactureOrderPick([FromBody]object JsonData)
        {
            log.Info("接口：api/ManufactureOrderPick/Create");
            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<ICSManufactureOrderPick> infos = new List<ICSManufactureOrderPick>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSManufactureOrderPick>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());

                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                            throw new Exception(res.Message);
                        }
                        ManufactureOrderPick action = new ManufactureOrderPick();
                        string resultStr = action.CreateManufactureOrderPick(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;
        }
        #endregion
        #region 领料申请单
        /// <summary>
        /// 创建入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOIssueApplyDoc/Get")]
        [HttpPost]
        public HttpResponseMessage GetMOIssueApplyDoc([FromBody]object JsonData)
        {
            log.Info("接口：api/MOIssueApplyDoc/Get");
            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("接口：api/MOIssueDoc/Get");
            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("接口：api/MOIssueDoc/Create");
            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/MOIssueDoc/CreateDX")]
        [HttpPost]
        public HttpResponseMessage CreateMOIssueDocDX([FromBody]object JsonData)
        {
            log.Info("接口：api/MOIssueDocDX/Create");
            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.CreateRd11DX(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("接口：api/MOIssueDocByPU/Create");
            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("接口：api/MOIssueDoc/Approve");
            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("接口：api/MOIssueDoc/Delete");
            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("接口：api/MOIssueDocNegative/Get");
            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("接口：api/MOIssueDocNegative/Create");
            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/MOIssueDocNegativeDX/Create")]
        [HttpPost]
        public HttpResponseMessage CreateMOIssueDocNegativesDX([FromBody] object JsonData)
        {
            log.Info("接口：api/MOIssueDocNegativeDX/Create");
            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.CreateRd11dx(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/MOIssueDocNegativeDXNEW/Create")]
        [HttpPost]
        public HttpResponseMessage MOIssueDocNegativeDXNEW([FromBody] object JsonData)
        {
            log.Info("接口：api/MOIssueDocNegativeDXNEW/Create");
            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.CreateRd11dxNEW(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/MOIssueDocNegativebl/Create")]
        [HttpPost]
        public HttpResponseMessage CreateMOIssueDocNegativesbl([FromBody]object JsonData)
        {
            log.Info("接口：api/MOIssueDocNegativebl/Create");
            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.CreateRd11bl(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/MOIssueDocNegativeblnew/Create")]
        [HttpPost]
        public HttpResponseMessage MOIssueDocNegativeblnew([FromBody] object JsonData)
        {
            log.Info("接口：api/MOIssueDocNegativeblnew/Create");
            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.CreateRd11blnew(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("接口：api/MOIssueDocNegative/Approve");
            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("接口：api/MOIssueDocNegative/Delete");
            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("接口：api/OutsourcingOrder/Get");
            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("接口：api/OutsourcingOrderPick/Get");
            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("接口：api/OutsourcingIssueDoc/Get");
            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("接口：api/OutsourcingIssueDoc/Create");
            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("接口：api/OutsourcingIssueDoc/Approve");
            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("接口：api/OutsourcingIssueDoc/Delete");
            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("接口：api/OutsourcingIssueDoNegative/Get");
            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("接口：api/OutsourcingIssueDoNegative/Create");
            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("接口：api/OutsourcingIssueDoNegative/Approve");
            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("接口：api/OutsourcingIssueDoNegative/Delete");
            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("接口：api/DeliveryNotice/Get");
            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("接口：api/DeliveryNotice/Create");
            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("接口：api/DeliveryNotice/Approve");
            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("接口：api/DeliveryNotice/Delete");
            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("接口：api/OutsourcingReceiveDoc/Get");
            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("接口：api/OutsourcingReceiveDocPOArrive/Create");
            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;
        }
        /// <summary>
        /// 创建委外采购入库单【订单】
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingReceiveDoc/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOutsourcingReceiveDocPO([FromBody]object JsonData)
        {
            log.Info("接口：api/OutsourcingReceiveDoc/Create");
            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/CreateOutsourcingReceiveDocPOT/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOutsourcingReceiveDocPOT([FromBody] object JsonData)
        {
            log.Info("接口：api/CreateOutsourcingReceiveDocPOT/Create");
            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.CreateOutsourcingReceiveDocByPOT(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/CreateOutsourcingReceiveDocPOTnew/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOutsourcingReceiveDocPOTnew([FromBody] object JsonData)
        {
            log.Info("接口：api/CreateOutsourcingReceiveDocPOTnew/Create");
            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.CreateOutsourcingReceiveDocByPOTnew(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("接口：api/OutsourcingReceiveDoc/Approve");
            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("接口：api/PurchaseReceiveDoc/Delete");
            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("接口：api/OutsourcingReturnBack/Get");
            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("接口：api/OutsourcingReceiveDocNegative/Get");
            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("接口：api/OutsourcingReceiveDocNegative/Create");
            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("接口：api/OutsourcingReceiveDocNegative/Approve");
            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("接口：api/OutsourcingReceiveDocNegative/Delete");
            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("接口：api/ManufactureReceiveDoc/Get");
            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("接口：api/ManufactureReceiveDoc/Create");
            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/CreateManufactureReceiveDocT/Create")]
        [HttpPost]
        public HttpResponseMessage CreateManufactureReceiveDocT([FromBody] object JsonData)
        {
            log.Info("接口：api/CreateManufactureReceiveDocT/Create");
            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.CreateManufactureReceiveDocT(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>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureLFReceiveDoc/Create")]
        [HttpPost]
        public HttpResponseMessage CreateManufactureLFReceiveDoc([FromBody]object JsonData)
        {
            log.Info("接口：api/ManufactureLFReceiveDoc/Create");
            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.CreateManufactureReceiveDoc1(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>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureReceiveDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveManufactureReceiveDoc([FromBody]object JsonData)
        {
            log.Info("接口：api/ManufactureReceiveDoc/Approve");
            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>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureReceiveDoc/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteManufactureReceiveDoc([FromBody]object JsonData)
        {
            log.Info("接口：api/ManufactureReceiveDoc/Delete");
            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>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDoc/Get")]
        [HttpPost]
        public HttpResponseMessage GetSalesShipmentDoc([FromBody]object JsonData)
        {
            log.Info("接口：api/SalesShipmentDoc/Get");
            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>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDoc/Create")]
        [HttpPost]
        public HttpResponseMessage CreateSalesShipmentDoc([FromBody]object JsonData)
        {
            log.Info("接口：api/SalesShipmentDoc/Create");
            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>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDocMF/Create")]
        [HttpPost]
        public HttpResponseMessage CreateSalesShipmentDocMF([FromBody] object JsonData)
        {
            log.Info("接口：api/SalesShipmentDocMF/Create");
            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.CreateSalesShipmentDocNEW(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>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipDoc/Create")]
        [HttpPost]
        public HttpResponseMessage CreateSalesShipDoc([FromBody]object JsonData)
        {
            log.Info("接口：api/SalesShipDoc/Create");
            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.CreateSalesShipDoc(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>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage ApproveSalesShipmentDoc([FromBody]object JsonData)
        {
            log.Info("接口：api/SalesShipmentDoc/Approve");
            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>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/SalesShipmentDoc/Delete")]
        [HttpPost]
        public HttpResponseMessage DeleteSalesShipmentDoc([FromBody]object JsonData)
        {
            log.Info("接口：api/SalesShipmentDoc/Delete");
            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("接口：api/SalesShipmentDocNegative/Get");
            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("接口：api/SalesShipmentDocNegative/Create,");
            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("接口：api/SalesShipmentDocNegative/Approve");
            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("接口：api/SalesShipmentDocNegative/Delete");
            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("接口：api/SalesOrder/Get");
            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("接口：api/SalesOrder/Create");
            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/SalesOrderNew/Create")]
        [HttpPost]
        public HttpResponseMessage CreateSalesOrderNew([FromBody] object JsonData)
        {
            log.Info("接口：api/SalesOrderNew/Create");
            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<ICSSalesOrdernew> infos = new List<ICSSalesOrdernew>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesOrdernew>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        SalesOrder action = new SalesOrder();
                        string resultStr = action.CerateSalesOrdernew(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("接口：api/SalesOrder/Approve");
            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("接口：api/SalesOrder/Delete");
            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("接口：api/SalesDeliveryNotice/Get");
            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("接口：api/SalesDeliveryNotice/Create");
            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("接口：api/SalesDeliveryNotice/Approve");
            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("接口：api/SalesDeliveryNotice/Delete");
            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("接口：api/SalesReturnBack/Get");
            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;
        }



        /// <summary>
        /// 创建销售退
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CreateSalesDeliveryNoticeout/Create")]
        [HttpPost]
        public HttpResponseMessage CreateSalesDeliveryNoticeout([FromBody] object JsonData)
        {
            log.Info("接口：api/CreateSalesDeliveryNoticeout/Create");
            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<ICSSalesDeliveryNoticeout> infos = new List<ICSSalesDeliveryNoticeout>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSSalesDeliveryNoticeout>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        SalesDeliveryNotice action = new SalesDeliveryNotice();
                        string resultStr = action.CerateSalesDeliveryNoticeout(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)
        {
            log.Info("接口：api/OneStepTransferDocIn/Approve");
            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();
                        string resultStr = action.ConfirmTrans(Bills);
                        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 = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                log.Debug("返回值：" + str);
                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");
                log.Debug("返回值：" + str);
                return result;
            }
        }




        /// 无源头生成调拨单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OneStepTransferDocIn/Create")]
        [HttpPost]
        public HttpResponseMessage TransferDocIn([FromBody]object JsonData)
        {
            log.Info("接口：api/OneStepTransferDocIn/Create");
            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<ICSTransfer> Bills = new List<ICSTransfer>();
                        try
                        {
                            Bills = JsonConvert.DeserializeObject<List<ICSTransfer>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        TransferDoc action = new TransferDoc();

                        string resultStr = action.ConfirmTransIN(Bills);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功！";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败！";
                            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("返回值：" + str);
                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");
                log.Debug("返回值：" + str);
                return result;
            }
        }


        /// 无源头生成调拨单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OneStepNoTransferDocIn/Create")]
        [HttpPost]
        public HttpResponseMessage TransferDocNOIn([FromBody]object JsonData)
        {
            log.Info("接口：api/OneStepNoTransferDocIn/Create");
            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<ICSTransfer> Bills = new List<ICSTransfer>();
                        try
                        {
                            Bills = JsonConvert.DeserializeObject<List<ICSTransfer>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        TransferDoc action = new TransferDoc();

                        string resultStr = action.NOConfirmTransIN(Bills);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功！";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败！";
                            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("返回值：" + str);
                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");
                log.Debug("返回值：" + str);
                return result;
            }
        }

        /// 来源头生成调拨单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OneStepTransferDoc/Create")]
        [HttpPost]
        public HttpResponseMessage TransferDocSIn([FromBody]object JsonData)
        {
            log.Info("接口：api/OneStepTransferDoc/Create");
            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<ICSTransfer> Bills = new List<ICSTransfer>();
                        try
                        {
                            Bills = JsonConvert.DeserializeObject<List<ICSTransfer>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        TransferDoc action = new TransferDoc();


                        string resultStr = action.ConfirmTrans(Bills);
                        if (!string.IsNullOrWhiteSpace(resultStr))
                        {
                            res.Success = true;
                            res.Message = "接口调用成功！";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = "接口调用失败！";
                            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("返回值：" + str);
                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");
                log.Debug("返回值：" + str);
                return result;
            }
        }
        #endregion
        #region 审核其他入库单(杂收)
        /// <summary>
        /// 其他入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OtherInDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage APIConfirmRdrecord08([FromBody]object JsonData)
        {
            log.Info("接口：api/OtherInDoc/Approve");
            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();
                        string resultStr = action.ConfirmRd08(Bills);
                        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 = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                log.Debug("返回值：" + str);
                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");
                log.Debug("返回值：" + str);
                return result;
            }
        }
        #endregion
        #region 审核其他出库单(杂发)
        /// <summary>
        /// 生成其他出库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OtherOutDoc/Create")]
        [HttpPost]
        public HttpResponseMessage OtherOutDocCreate([FromBody]object JsonData)
        {
            log.Info("接口：api/OtherOutDoc/Create");
            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<ICSOtherOutCreateDoc> infos = new List<ICSOtherOutCreateDoc>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSOtherOutCreateDoc>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        OtherOutDoc action = new OtherOutDoc();
                        string resultStr = action.CreateRd09(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("生成其他出库返回值：" + str);
                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");
                log.Debug("生成其他出库返回值：" + str);
                return result;
            }
        }
        /// <summary>
        /// 审核其他出库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OtherOutDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage APIConfirmRdrecord09([FromBody]object JsonData)
        {
            log.Info("接口：api/OtherOutDoc/Approve");
            HttpResponseMessage result = new HttpResponseMessage();
            Result res = new Result();
            string str = string.Empty;
            try
            {
                if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
                {

                    //DBHelper.WriteLogFile("api/OtherOutDoc/Approve  "+JsonData.ToString(), "Information");
                    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)
                        {
                            //DBHelper.WriteLogFile("api/OtherOutDoc/Approve  " + ex.ToString(), "Information");
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        OtherOutDoc action = new OtherOutDoc();
                        string resultStr = action.ConfirmRd09(Bills);
                        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 = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                log.Debug("返回值：" + str);
                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");
                log.Debug("返回值：" + str);
                return result;
            }
        }
        #endregion
        #region 拆卸单
        /// <summary>
        /// 审核拆卸单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/DisassemblyDoc/Approve")]
        [HttpPost]
        public HttpResponseMessage APIConfirmDismrecord01([FromBody]object JsonData)
        {
            log.Info("接口：api/DisassemblyDoc/Approve");
            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");
                log.Debug("返回值：" + str);
                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");
                log.Debug("返回值：" + str);
                return result;
            }
        }
        #endregion
        #region 审核其他入库单(两步调入)
        /// <summary>
        /// 其他入库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/TwoStepTransferDocIn/Approve")]
        [HttpPost]
        public HttpResponseMessage APIConfirmRdrecord08Two([FromBody]object JsonData)
        {
            log.Info("接口：api/TwoStepTransferDocIn/Approve");
            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();
                        string resultStr = action.ConfirmRd08(Bills);
                        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 = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                log.Debug("返回值：" + str);
                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");
                log.Debug("返回值：" + str);
                return result;
            }
        }
        #endregion
        #region 审核其他出库单(两步调出)
        /// <summary>
        /// 审核其他出库单
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/TwoStepTransferDocOut/Approve")]
        [HttpPost]
        public HttpResponseMessage APIConfirmRdrecord09Two([FromBody]object JsonData)
        {
            log.Info("接口：api/TwoStepTransferDocOut/Approve");
            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();
                        string resultStr = action.ConfirmRd09(Bills);
                        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 = "请传入参数";
                }
                str = JsonConvert.SerializeObject(res);
                result.Content = new StringContent(str.ToString(), Encoding.GetEncoding("UTF-8"), "application/json");
                log.Debug("返回值：" + str);
                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");
                log.Debug("返回值：" + str);
                return result;
            }
        }
        #endregion
        #region 委外材料出库(领料单)
        [Route("api/OOIssueDocByPU/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOOIssueDocBYPU([FromBody]object JsonData)
        {
            log.Info("接口：api/OOIssueDocByPU/Create");
            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("接口：api/OOIssueDoc/Approve");
            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");
                log.Debug("返回值：" + str);
                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");
                log.Debug("审核材料出库返回值：" + str);
                return result;
            }
        }


        [Route("api/OOIssueDocnew/Approve")]
        [HttpPost]
        public HttpResponseMessage MOIssueDocApprove1([FromBody] object JsonData)
        {
            log.Info("接口：api/OOIssueDocnew/Approve");
            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.ConfirmRd11new(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");
                log.Debug("返回值：" + str);
                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");
                log.Debug("审核材料出库返回值：" + str);
                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("接口：api/BrrowDoc/Create");
            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");
                log.Debug("返回值：" + str);
                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");
                log.Debug("借用(生成其他出库)返回值：" + str);
                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("接口：api/ReturnDoc/Create");
            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");
                log.Debug("返回值：" + str);
                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");
                log.Debug("归还(生成其他入库)返回值：" + str);
                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("接口：api/MorphologicalTransformationDoc/Create");
            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("返回值：" + str);
                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");
                log.Debug("形态转换单返回值：" + str);
                return result;
            }
        }
        #endregion
        #region 齐套检验接口
        /// <summary>
        /// 齐套检验接口
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/Complete/Approve")]
        [HttpPost]
        public HttpResponseMessage CompleteCreate([FromBody]object JsonData)
        {
            log.Info("接口：api/ReturnDoc/Approve");
            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<Complete> infos = new List<Complete>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<Complete>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ISComplete action = new ISComplete();
                        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");
                log.Debug("返回值：" + str);
                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");
                log.Debug("齐套检验返回值：" + str);
                return result;
            }
        }



        #endregion
        #region 补料功能

        /// <summary>
        /// 创建材料出库(生产补料)
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOReplenishment/Create")]
        [HttpPost]
        public HttpResponseMessage CreateMOReplenishment([FromBody]object JsonData)
        {
            log.Info("接口：api/MOReplenishment/Create");
            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.MOReplenishment(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/CurrentStock/Get")]
        [HttpPost]
        public HttpResponseMessage CurrentStockGet([FromBody]object JsonData)
        {
            log.Info("接口：api/CurrentStock/Get");
            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<Curr> infos = new List<Curr>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<Curr>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ISComplete action = new ISComplete();
                        string resultStr = action.CurrentStock(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("返回值：" + str);
                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");
                log.Debug("齐套检验返回值：" + str);
                return result;
            }
        }

        [Route("api/CurrentStockNEW/Get")]
        [HttpPost]
        public HttpResponseMessage CurrentStockamnewGet([FromBody]object JsonData)
        {
            log.Info("接口：api/CurrentStock/Get");
            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<Curr> infos = new List<Curr>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<Curr>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ISComplete action = new ISComplete();
                        string resultStr = action.CurrentStockNEW(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("返回值：" + str);
                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");
                log.Debug("齐套检验返回值：" + str);
                return result;
            }
        }

        #endregion
        #region 审核入库及倒冲
        /// <summary>
        /// 审核入库及倒冲
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/Rd1011/Approve")]
        [HttpPost]
        public HttpResponseMessage APIConfirmRdrecord1011([FromBody] object JsonData)
        {
            log.Info("接口：api/Rd1011/Approve");
            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<ICSRD1011> Bills = new List<ICSRD1011>();
                        try
                        {
                            Bills = JsonConvert.DeserializeObject<List<ICSRD1011>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        RD1011 action = new RD1011();
                        bool flag = action.ConfirmRD1011(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");
                log.Debug("返回值：" + str);
                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");
                log.Debug("返回值：" + str);
                return result;
            }
        }
        #endregion




        /// 删除对应条码信息
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ERPLot/DELETE")]
        [HttpPost]
        public HttpResponseMessage DELETELOT([FromBody] object JsonData)
        {
            log.Info("接口：api/ERPLot/DELETE");
            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<LOTNO>  infos = new List<LOTNO>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<LOTNO>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ISComplete action = new ISComplete();
                        retez resultStr = action.CONFLOTDELETE(infos);
                        if (resultStr.IsSuccess)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功！";
                            //res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr.Mess;
                            //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("返回值：" + str);
                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");
                log.Debug("齐套检验返回值：" + str);
                return result;
            }
        }

        /// 更新单据自定义字段值处理接口
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CDEFIND/UPDATE")]
        [HttpPost]
        public HttpResponseMessage CDEFIND([FromBody] object JsonData)
        {
            log.Info("接口：api/CDEFIND/UPDATE");
            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<UPDATECDEFIND> infos = new List<UPDATECDEFIND>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<UPDATECDEFIND>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ISComplete action = new ISComplete();
                        retez resultStr = action.CDEFINE(infos);
                        if (resultStr.IsSuccess)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功！";
                            //res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr.Mess;
                            //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("返回值：" + str);
                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");
                log.Debug("齐套检验返回值：" + str);
                return result;
            }
        }


        /// 新增采购发票
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/PurBillVouch/Create")]
        [HttpPost]
        public HttpResponseMessage PurBillVouchCreate([FromBody] object JsonData)
        {
            log.Info("接口：api/PurBillVouch/Create");
            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<PurBillVouch> infos = new List<PurBillVouch>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<PurBillVouch>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ISComplete action = new ISComplete();
                        retez resultStr = action.PurBillVouchCEREA(infos);
                        if (resultStr.IsSuccess)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功！";
                            //res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr.Mess;
                            //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("返回值：" + str);
                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");
                log.Debug("齐套检验返回值：" + str);
                return result;
            }
        }

        #region 奥美功能

        /// 连副产品分摊
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/ManufactureLFFTReceiveDoc/Create")]
        [HttpPost]
        public HttpResponseMessage CreateManufactureLFFTReceiveDoc([FromBody]object JsonData)
        {
            log.Info("接口：api/ManufactureLFReceiveDoc/Create");
            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<ICSManufactureReceiveDocam> infos = new List<ICSManufactureReceiveDocam>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSManufactureReceiveDocam>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ManufactureReceiveDoc action = new ManufactureReceiveDoc();
                        string resultStr = action.CreateManufactureReceiveDocFT(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>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        //[Route("api/FTNUMBER/Get")]
        //[HttpPost]
        //public HttpResponseMessage CurrentStockamGet([FromBody]object JsonData)
        //{
        //    log.Info("接口：api/FTNUMBER/Get");
        //    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<Curram> infos = new List<Curram>();
        //                try
        //                {
        //                    infos = JsonConvert.DeserializeObject<List<Curram>>(JsonData.ToString());
        //                }
        //                catch (Exception ex)
        //                {
        //                    log.Error("转换失败：" + ex.ToString());
        //                    res.Success = false;
        //                    res.Message = "JSON格式不正确！";
        //                }
        //                ISComplete action = new ISComplete();
        //                string resultStr = action.FTNUMBER(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("返回值：" + str);
        //        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");
        //        log.Debug("齐套检验返回值：" + str);
        //        return result;
        //    }
        //}


        /// 奥美期初现存量获取
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CurrentStockam/Get")]
        [HttpPost]
        public HttpResponseMessage CurrentStockamGet([FromBody]object JsonData)
        {
            log.Info("接口：api/CurrentStockam/Get");
            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<Curram> infos = new List<Curram>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<Curram>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ISComplete action = new ISComplete();
                        string resultStr = action.CurrentStockam(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("返回值：" + str);
                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");
                log.Debug("齐套检验返回值：" + str);
                return result;
            }
        }

        /// 奥美反写订单行预计开工，完工时间
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/MOHKWam/Update")]
        [HttpPost]
        public HttpResponseMessage MOHKWam([FromBody]object JsonData)
        {
            log.Info("接口：api/MOHKWam/Get");
            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<moh> infos = new List<moh>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<moh>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ISComplete action = new ISComplete();
                        string resultStr = action.mohkw(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("返回值：" + str);
                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");
                log.Debug("齐套检验返回值：" + str);
                return result;
            }
        }


        /// 奥美用判定
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/Completeam/Approve")]
        [HttpPost]
        public HttpResponseMessage CompleteamCreate([FromBody]object JsonData)
        {
            log.Info("接口：api/Completeam/Approve");
            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<Completeam> infos = new List<Completeam>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<Completeam>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ISComplete action = new ISComplete();
                        retez resultStr = action.Confirmam(infos);
                        if (resultStr.IsSuccess)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功！";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr.Mess;
                            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("返回值：" + str);
                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");
                log.Debug("齐套检验返回值：" + str);
                return result;
            }
        }


        /// 奥美用判定新档
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/Completeamnew/Approve")]
        [HttpPost]
        public HttpResponseMessage Completeamnew([FromBody]object JsonData)
        {
            log.Info("接口：api/Completeamnew/Approve");
            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<Completeam> infos = new List<Completeam>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<Completeam>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ISComplete action = new ISComplete();
                        retez resultStr = action.Confirmamnew(infos);
                        if (resultStr.IsSuccess)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功！";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr.Mess;
                            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("返回值：" + str);
                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");
                log.Debug("齐套检验返回值：" + str);
                return result;
            }
        }

        /// 奥美用判定新档05类
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/Completeamnew05/Approve")]
        [HttpPost]
        public HttpResponseMessage Completeamnew05([FromBody]object JsonData)
        {
            log.Info("接口：api/Completeamnew/Approve");
            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<Completeam> infos = new List<Completeam>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<Completeam>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        ISComplete action = new ISComplete();
                        retez resultStr = action.Confirmamnew05(infos);
                        if (resultStr.IsSuccess)
                        {
                            res.Success = true;
                            res.Message = "接口调用成功！";
                            res.Data = resultStr;
                        }
                        else
                        {
                            res.Success = false;
                            res.Message = resultStr.Mess;
                            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("返回值：" + str);
                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");
                log.Debug("齐套检验返回值：" + str);
                return result;
            }
        }

        /// 奥美用委外采购入
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingReceiveDocam/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOutsourcingReceiveDocPOam([FromBody]object JsonData)
        {
            log.Info("接口：api/OutsourcingReceiveDocam/Create");
            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.CreateOutsourcingReceiveDocByPOam(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>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/OutsourcingReceiveDoclfam/Create")]
        [HttpPost]
        public HttpResponseMessage CreateOutsourcingReceiveDocPOlfam([FromBody]object JsonData)
        {
            log.Info("接口：api/OutsourcingReceiveDoclfam/Create");
            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.CreateOutsourcingReceiveDocByPOArriveam(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/ManufactureReceiveDocDX/Create")]
        [HttpPost]
        public HttpResponseMessage CreateManufactureReceiveDocDX([FromBody] object JsonData)
        {
            log.Info("接口：api/ManufactureReceiveDocDX/Create");
            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;
        }


        #endregion


        #region 创建物料
        /// <summary>
        /// 期初现存量获取
        /// </summary>
        /// <param name="JsonData"></param>
        /// <returns></returns>
        [Route("api/CreateInventory/Create")]
        [HttpPost]
        public HttpResponseMessage CreateInventory([FromBody] object JsonData)
        {
            log.Info("接口：api/CreateInventory/Create");
            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<ICSInventory> infos = new List<ICSInventory>();
                        try
                        {
                            infos = JsonConvert.DeserializeObject<List<ICSInventory>>(JsonData.ToString());
                        }
                        catch (Exception ex)
                        {
                            log.Error("转换失败：" + ex.ToString());
                            res.Success = false;
                            res.Message = "JSON格式不正确！";
                        }
                        CreateInventory action = new CreateInventory();
                        string resultStr = action.CreateInv(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("返回值：" + str);
                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");
                log.Debug("创建物料返回值：" + str);
                return result;
            }
        }
        #endregion
    }
}
