//private ORGModels _dbContext;

        //protected virtual ORGModels DbContext
        //{
        //    get
        //    {
        //        if (_dbContext == null)
        //            _dbContext = new ORGModels();

        //        return _dbContext;
        //    }
        //}

        public void SaveLocationAssigner(IMS_CB_KC kc, IMS_CB_RQ rq, IMS_WT_CWRW cwrw, IMS_VC_DJH djh)
        {
            IMS_CB_Container_Dal dalContainer = new IMS_CB_Container_Dal();
            IMS_WT_CWRW_Dal dalTask = new IMS_WT_CWRW_Dal();
            IMS_VC_DJH_Dal dalOrderData = new IMS_VC_DJH_Dal();
            IMS_CB_Inventory_Dal dalInventory = new IMS_CB_Inventory_Dal();

            if (dalInventory.Exists(string.Format(" RQBH == \"{0}\" ", rq.RQBH)))
                throw new JsMiracleException("容器编号已在库存中,请重新输入容器编号");

            using (var tran = new TransactionScope())
            {
                try
                {
                    dalContainer.SaveOrUpdate(rq);
                    dalInventory.SaveOrUpdate(kc);
                    dalTask.SaveOrUpdate(cwrw);
                    dalOrderData.SaveOrUpdate(djh);

                    tran.Complete();
                }
                catch (Exception ex)
                {
                    throw new Exception("组盘失败", ex);
                }
            }
        }
        public ActionResult SaveContainer(IMS_CB_RQ entity)
        {
            Func<ExtResult> saveFun = () =>
            {
                if (entity.ID == 0)
                {
                    var filter = string.Format(" RQBH = \"{0}\" ", entity.RQBH);

                    //if (dalContainer.Exists(f => f.RQBH.Equals(entity.RQBH, StringComparison.CurrentCultureIgnoreCase)))
                    if (dalContainer.Exists(filter))
                        throw new JsMiracleException("容器类型编号不得重覆");

                }
                else
                {
                    var filter = string.Format(" RQBH = \"{0}\"  && ID != {1} ", entity.RQBH, entity.ID);

                    //if (dalContainer.Exists(f => f.RQBH.Equals(entity.RQBH, StringComparison.CurrentCultureIgnoreCase)
                    //    && f.ID != entity.ID))
                    if (dalContainer.Exists(filter))
                        throw new JsMiracleException("容器类型编号不得重覆");
                }
                entity.ZCSJ = System.DateTime.Now;
                dalContainer.SaveOrUpdate(entity);
                var ret = new ExtResult();
                ret.success = true;
                return ret;
            };

            return base.Save(saveFun);
        }