public BizLogicMsg Save_Ext2(JsonMCE_METER json)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_METER entity = new EntityObject_MCE_B_ASSETS_METER();


                            if (!string.IsNullOrEmpty(json.ID))
                            {
                                entity.ID = json.ID;

                                entity = HelperObject_MCE_B_ASSETS_METER.Get(entity);

                                if (entity == null)
                                {
                                    throw new Exception("获取数据出错.");
                                }
                            }


                            entity.CODE = json.CODE;

                            entity.ASSETS_ID   = json.ASSETS_ID;
                            entity.ASSETS_CODE = json.ASSETS_CODE;
                            entity.SPEC        = json.SPEC;

                            entity.PRD_ID        = json.PRD_ID;
                            entity.UNIT_ID       = json.UNIT_ID;
                            entity.USING_DEPT_ID = json.USING_DEPT_ID;
                            entity.PRD_CODE      = json.PRD_CODE;

                            if (!string.IsNullOrEmpty(json.IDENTIFICATION_CYCLE))
                            {
                                entity.IDENTIFICATION_CYCLE = decimal.Parse(json.IDENTIFICATION_CYCLE);
                            }
                            entity.METER_TYPE   = json.METER_TYPE;
                            entity.HEAD_USER_ID = json.HEAD_USER_ID;

                            if (!string.IsNullOrEmpty(json.IDENTIFICATION_TYPE))
                            {
                                entity.IDENTIFICATION_TYPE = decimal.Parse(json.IDENTIFICATION_TYPE);
                            }
                            if (!string.IsNullOrEmpty(json.IS_FORCE_SENSE))
                            {
                                entity.IS_FORCE_SENSE = decimal.Parse(json.IS_FORCE_SENSE);
                            }
                            if (!string.IsNullOrEmpty(json.NEXT_IDENTIFICATION))
                            {
                                entity.NEXT_IDENTIFICATION = DateTime.Parse(json.NEXT_IDENTIFICATION);
                            }
                            if (!string.IsNullOrEmpty(json.EARLY_WARNING_DAYS))
                            {
                                entity.EARLY_WARNING_DAYS = decimal.Parse(json.EARLY_WARNING_DAYS);
                            }
                            entity.COMMENTS = json.COMMENTS;


                            if (string.IsNullOrEmpty(entity.ID))
                            {
                                entity.STATE          = 1;
                                entity.CREATE_TIME    = DateTime.Now;
                                entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                int amount = HelperObject_MCE_B_ASSETS_METER.Save(entity, transaction);
                            }
                            else
                            {
                                entity.MODIFY_TIME    = DateTime.Now;
                                entity.MODIFY_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;

                                int amount = HelperObject_MCE_B_ASSETS_METER.Update(entity, transaction);


                                CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE();
                                pCOM_FILE.REF_TAB_ID   = entity.ID;
                                pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_METER";
                                HelperObject_COM_FILE.Delete(pCOM_FILE, transaction);
                            }

                            //平台自动生成代码
                            msg.Message = entity.ID;
                            transaction.Commit();
                        }
                        catch (Exception expt)
                        {
                            transaction.Rollback();
                            msg = new BizLogicMsg(false, expt.Message);
                            Error(expt);
                        }
                        finally
                        {
                            IDALProvider.IDAL.PushConnection(connection);
                        }
                    }
                }
                return(msg);
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_METER> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext2(json));
                }
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            //允许跨域
            context.Response.AddHeader("Access-Control-Allow-Origin", "*");
            JSON_MSG jsonMsg = new JSON_MSG();

            try
            {
                context.Response.ContentType = "text/plain";
                HttpRequest request = context.Request;

                StringBuilder rsb       = new StringBuilder();
                int           bytelengg = (int)request.InputStream.Length;
                using (var reader = new StreamReader(request.InputStream, Encoding.UTF8))
                {
                    var read  = new Char[bytelengg];
                    var count = reader.Read(read, 0, bytelengg);
                    while (count > 0)
                    {
                        var str = new string(read, 0, count);
                        rsb.Append(str);
                        count = reader.Read(read, 0, bytelengg);
                    }
                    reader.Close();
                    reader.Dispose();
                    request.InputStream.Close();
                    request.InputStream.Dispose();
                }

                if (string.IsNullOrEmpty(rsb.ToString()))
                {
                    throw new Exception("参数错误.");
                }

                JsonMCE_METER entity = JsonConvert.DeserializeObject <JsonMCE_METER>(rsb.ToString());


                if (string.IsNullOrEmpty(entity.CODE))
                {
                    throw new Exception("参数错误,单号不能为空.");
                }


                if (string.IsNullOrEmpty(entity.ASSETS_ID))
                {
                    throw new Exception("参数错误,设备名称不能为空.");
                }

                if (string.IsNullOrEmpty(entity.HEAD_USER_ID))
                {
                    throw new Exception("参数错误,计量负责人不能为空.");
                }

                if (string.IsNullOrEmpty(entity.IDENTIFICATION_CYCLE))
                {
                    throw new Exception("参数错误,计量周期不能为空.");
                }

                if (string.IsNullOrEmpty(entity.NEXT_IDENTIFICATION))
                {
                    throw new Exception("参数错误,下次待检日期不能为空.");
                }


                if (string.IsNullOrEmpty(entity.METER_TYPE))
                {
                    throw new Exception("参数错误,计量分类不能为空.");
                }

                BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_METER.Proxy.Save_Ext2(entity);


                jsonMsg.Succeed = 1;
                jsonMsg.Message = msg.Message;
            }
            catch (Exception ex)
            {
                jsonMsg.Succeed = 0;
                jsonMsg.Message = ex.Message;
            }
            finally
            {
                context.Response.Write(JsonConvert.SerializeObject(jsonMsg));
                context.Response.End();
            }
        }