public string UpdateFixtureInfo(string data)
        {
            try
            {
                ChuckingApplianceInfoModel model = TDCommom.ObjectExtensions.FromJsonString <ChuckingApplianceInfoModel>(data);
                ApiModel apimodel;
                if (model.CAState <= 30)
                {
                    int i = caidb.UpdateFixtureInfo(model.CAId, model.CAState, model.CellNumber);
                    apimodel = new ApiModel()
                    {
                        ResultCode = i
                    };
                }
                else if (model.CAState > 30 && model.CAState <= 50)
                {
                    int i = caidb.UpdateFixtureInfo(model.CAId, model.CAState, model.CellNumber, model.HTDId, model.InStoveTime);
                    apimodel = new ApiModel()
                    {
                        ResultCode = i
                    };
                }
                else if (model.CAState == int.Parse(TDCommon.SysEnum.FixtureState.ProcessEnd.ToString("d")))//夹具单次流程结束 添加到历史表
                {
                    int i = caidb.UpdateFixtureInfo(model.CAId, model.CAState, model.CellNumber, model.HTDId, model.InStoveTime, model.OutStoveTime);
                    int t = -1;
                    if (i > 0)
                    {
                        t = caidb.FixtureHandle(model.CAId);
                    }
                    apimodel = new ApiModel()
                    {
                        ResultCode = t
                    };
                }
                else
                {
                    int i = caidb.UpdateFixtureInfo(model.CAId, model.CAState, model.CellNumber, model.HTDId, model.InStoveTime, model.OutStoveTime);
                    apimodel = new ApiModel()
                    {
                        ResultCode = i
                    };
                }

                string res = TDCommom.ObjectExtensions.ToJsonString(apimodel);
                TDCommom.Logs.Info(string.Format("修改夹具状态:接收数据:{0} \r\n 返回数据:{1} \r\n ", data, res));
                return(res);
            }
            catch (System.Exception ex)
            {
                TDCommom.Logs.Error(string.Format("修改夹具状态异常:接收数据:{0} \r\n 异常信息:{1} \r\n ", data, ex.Message));
                return(null);
            }
        }
        /// <summary>
        /// 根据ID查询夹具信息
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public string GetChuckInfoByid(string data)
        {
            string res = string.Empty;

            try
            {
                ApiModel apimodel = TDCommom.ObjectExtensions.FromJsonString <ApiModel>(data);
                ChuckingApplianceInfoModel list = caidb.GetChuckInfoByid(apimodel.id);
                if (list != null)
                {
                    res = TDCommom.ObjectExtensions.ToJsonString(list);
                }
                TDCommom.Logs.Info(string.Format("根据ID查询夹具信息:接收参数:{0} \r\n  返回数据:{1}\r\n", data, res));
                return(res);
            }
            catch (Exception ex)
            {
                TDCommom.Logs.Error(string.Format("根据ID查询夹具信息异常:接收参数:{0} \r\n  异常信息:{1}\r\n", data, ex.Message));
                return(res);
            }
        }
        public string UpdateState(string data)
        {
            string res = string.Empty;

            try
            {
                ChuckingApplianceInfoModel model = TDCommom.ObjectExtensions.FromJsonString <ChuckingApplianceInfoModel>(data);
                int      i        = caidb.UpdateState(model);
                ApiModel apimodel = new ApiModel()
                {
                    ResultCode = i
                };
                res = TDCommom.ObjectExtensions.ToJsonString(apimodel);
                TDCommom.Logs.Info(string.Format("修改夹具状态:接收数据:{0} \r\n 返回数据:{1} \r\n ", data, res));
                return(res);
            }
            catch (Exception ex)
            {
                TDCommom.Logs.Error(string.Format("修改夹具状态异常:接收数据:{0} \r\n 异常信息:{1} \r\n ", data, ex.Message));
                return(res);
            }
        }
        public string InsertFirstInfo(string data)
        {
            string res = string.Empty;

            try
            {
                ChuckingApplianceInfoModel model = TDCommom.ObjectExtensions.FromJsonString <ChuckingApplianceInfoModel>(data);
                int      i        = caidb.InsertFirstInfo(model.CABarCode, model.FixPosition);
                ApiModel apimodel = new ApiModel()
                {
                    ResultCode = i
                };
                res = TDCommom.ObjectExtensions.ToJsonString(apimodel);
                TDCommom.Logs.Info(string.Format("添加A实时夹具任务信息:接收数据:{0} \r\n 返回数据:{1} \r\n ", data, res));
                return(res);
            }
            catch (Exception ex)
            {
                TDCommom.Logs.Error(string.Format("添加A实时夹具任务信息异常:接收数据:{0} \r\n 异常信息:{1} \r\n ", data, ex.Message));
                return(res);
            }
        }