Exemplo n.º 1
0
        public BizLogicMsg Delete_Ext(List <string> listID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (string strID in listID)
                            {
                                EntityObject_MCE_B_ASSETS_OUTSTOCK obj = new EntityObject_MCE_B_ASSETS_OUTSTOCK();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_OUTSTOCK.Get(obj);

                                if (obj != null)
                                {
                                    if (obj.STATE >= 2)
                                    {
                                        throw new Exception("已经提交的数据不能删除.");
                                    }

                                    HelperObject_MCE_B_ASSETS_OUTSTOCK.Delete(obj, transaction);
                                }
                            }

                            //平台自动生成代码

                            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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
                {
                    return(smgr.Service.Delete_Ext(listID));
                }
            }
        }
Exemplo n.º 2
0
        public BizLogicMsg CommitUpdate(EntityObject_MCE_B_ASSETS_OUTSTOCK updateBaseEntity, EntityObject_[] saveDetailEntities, EntityObject_[] updateDetailEntities, EntityObject_[] deleteDetailEntities)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            SystemLogic.Proxy.AuditEdit(updateBaseEntity);
                            HelperObject_MCE_B_ASSETS_OUTSTOCK.Update(updateBaseEntity, transaction);

                            //平台自动生成代码
                            foreach (EntityObject_ obj in saveDetailEntities)
                            {
                                obj. = updateBaseEntity.ID;
                                SystemLogic.Proxy.AuditAdd(obj);
                                HelperObject_.Save(obj, transaction);
                            }
                            foreach (EntityObject_ obj in updateDetailEntities)
                            {
                                SystemLogic.Proxy.AuditEdit(obj);
                                HelperObject_.Update(obj, transaction);
                            }
                            foreach (EntityObject_ obj in deleteDetailEntities)
                            {
                                HelperObject_.Delete(obj, transaction);
                            }
                            PostSave(updateBaseEntity, transaction);
                            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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
                {
                    return(smgr.Service.CommitUpdate(updateBaseEntity, saveDetailEntities, updateDetailEntities, deleteDetailEntities));
                }
            }
        }
        public EntityObject_MCE_B_ASSETS_OUTSTOCK_D Load(IDbTransaction transaction, string id, out EntityObject_COM_TYPE unit_id, out EntityObject_MDM_D_DEPT prd_id, out EntityObject_MCE_D_MCE_TYPE asset_type_id, out EntityObject_COM_TYPE economic_use_type_id, out EntityObject_MCE_B_ASSETS_OUTSTOCK base_id, out EntityObject_COM_TYPE country)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_OUTSTOCK_D obj = new EntityObject_MCE_B_ASSETS_OUTSTOCK_D();

                //平台自动生成代码
                unit_id              = new EntityObject_COM_TYPE();
                prd_id               = new EntityObject_MDM_D_DEPT();
                asset_type_id        = new EntityObject_MCE_D_MCE_TYPE();
                economic_use_type_id = new EntityObject_COM_TYPE();
                base_id              = new EntityObject_MCE_B_ASSETS_OUTSTOCK();
                country              = new EntityObject_COM_TYPE();


                obj.ID = id;
                obj    = HelperObject_MCE_B_ASSETS_OUTSTOCK_D.Get(obj, transaction);
                if (!string.IsNullOrEmpty(obj.UNIT_ID))
                {
                    unit_id.ID = obj.UNIT_ID;
                    unit_id    = HelperObject_COM_TYPE.Get(unit_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.PRD_ID))
                {
                    prd_id.ID = obj.PRD_ID;
                    prd_id    = HelperObject_MDM_D_DEPT.Get(prd_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.ASSET_TYPE_ID))
                {
                    asset_type_id.ID = obj.ASSET_TYPE_ID;
                    asset_type_id    = HelperObject_MCE_D_MCE_TYPE.Get(asset_type_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.ECONOMIC_USE_TYPE_ID))
                {
                    economic_use_type_id.ID = obj.ECONOMIC_USE_TYPE_ID;
                    economic_use_type_id    = HelperObject_COM_TYPE.Get(economic_use_type_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.BASE_ID))
                {
                    base_id.ID = obj.BASE_ID;
                    base_id    = HelperObject_MCE_B_ASSETS_OUTSTOCK.Get(base_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.COUNTRY))
                {
                    country.ID = obj.COUNTRY;
                    country    = HelperObject_COM_TYPE.Get(country, transaction);
                }
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
Exemplo n.º 4
0
        public EntityObject_MCE_B_ASSETS_OUTSTOCK Load(IDbTransaction transaction, string id, out EntityObject_COM_USER create_user_id, out EntityObject_COM_DEPART using_dept_id, out EntityObject_COM_USER user_id, out EntityObject_COM_USER using_user_id, out EntityObject_COM_DEPART dept_id, out EntityObject_MDM_D_STOCK stock_id)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_OUTSTOCK obj = new EntityObject_MCE_B_ASSETS_OUTSTOCK();

                //平台自动生成代码
                create_user_id = new EntityObject_COM_USER();
                using_dept_id  = new EntityObject_COM_DEPART();
                user_id        = new EntityObject_COM_USER();
                using_user_id  = new EntityObject_COM_USER();
                dept_id        = new EntityObject_COM_DEPART();
                stock_id       = new EntityObject_MDM_D_STOCK();


                obj.ID = id;
                obj    = HelperObject_MCE_B_ASSETS_OUTSTOCK.Get(obj, transaction);
                if (!string.IsNullOrEmpty(obj.CREATE_USER_ID))
                {
                    create_user_id.ID = obj.CREATE_USER_ID;
                    create_user_id    = HelperObject_COM_USER.Get(create_user_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.USING_DEPT_ID))
                {
                    using_dept_id.ID = obj.USING_DEPT_ID;
                    using_dept_id    = HelperObject_COM_DEPART.Get(using_dept_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.USER_ID))
                {
                    user_id.ID = obj.USER_ID;
                    user_id    = HelperObject_COM_USER.Get(user_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.USING_USER_ID))
                {
                    using_user_id.ID = obj.USING_USER_ID;
                    using_user_id    = HelperObject_COM_USER.Get(using_user_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.DEPT_ID))
                {
                    dept_id.ID = obj.DEPT_ID;
                    dept_id    = HelperObject_COM_DEPART.Get(dept_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.STOCK_ID))
                {
                    stock_id.ID = obj.STOCK_ID;
                    stock_id    = HelperObject_MDM_D_STOCK.Get(stock_id, transaction);
                }
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
Exemplo n.º 5
0
 public int DeleteByTrans2(CauseObject_MCE_B_ASSETS_OUTSTOCK cause, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         return(HelperObject_MCE_B_ASSETS_OUTSTOCK.Delete(cause, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Exemplo n.º 6
0
 public int UpdateByTrans(EntityObject_MCE_B_ASSETS_OUTSTOCK obj, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         SystemLogic.Proxy.AuditEdit(obj);
         return(HelperObject_MCE_B_ASSETS_OUTSTOCK.Update(obj, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Exemplo n.º 7
0
 public int SaveByTrans(EntityObject_MCE_B_ASSETS_OUTSTOCK obj, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         SystemLogic.Proxy.AuditAdd(obj);
         int amount = HelperObject_MCE_B_ASSETS_OUTSTOCK.Save(obj, transaction);
         //平台自动生成代码
         return(amount);
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Exemplo n.º 8
0
 public DisplayObject_MCE_B_ASSETS_OUTSTOCK[] List()
 {
     if (LocalMode)
     {
         //平台自动生成代码
         return(HelperObject_MCE_B_ASSETS_OUTSTOCK.List());
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
         {
             return(smgr.Service.List());
         }
     }
 }
Exemplo n.º 9
0
 public EntityObject_MCE_B_ASSETS_OUTSTOCK Get(EntityObject_MCE_B_ASSETS_OUTSTOCK obj)
 {
     if (LocalMode)
     {
         //平台自动生成代码
         return(HelperObject_MCE_B_ASSETS_OUTSTOCK.Get(obj));
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
         {
             return(smgr.Service.Get(obj));
         }
     }
 }
Exemplo n.º 10
0
        public DisplayObject_MCE_B_ASSETS_OUTSTOCK[] Query(CauseObject_MCE_B_ASSETS_OUTSTOCK cause, PagingParamter paging, OrderByParameter order)
        {
            if (LocalMode)
            {
                SystemLogic.Proxy.AuditQuery(cause);

                //平台自动生成代码
                return(HelperObject_MCE_B_ASSETS_OUTSTOCK.Query(cause, paging, order));
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
                {
                    return(smgr.Service.Query(cause, paging, order));
                }
            }
        }
Exemplo n.º 11
0
 public BizLogicMsg UndoAudit(EntityObject_MCE_B_ASSETS_OUTSTOCK obj)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     SystemLogic.Proxy.AuditUndoAudit(obj);
                     int amount = HelperObject_MCE_B_ASSETS_OUTSTOCK.Update(obj, transaction);
                     //平台自动生成代码
                     PostUndoAudit(obj, transaction);
                     //执行撤回操作
                     msg = SystemLogic.Proxy.BillUndoAudit(obj, transaction);
                     if (!msg.Succeed)
                     {
                         throw new Exception(msg.Message);
                     }
                     transaction.Commit();
                 }
                 catch (Exception expt)
                 {
                     SystemLogic.Proxy.AuditState(obj, Ipedf.Common.数据状态.已审核);
                     transaction.Rollback();
                     msg = new BizLogicMsg(false, expt.Message);
                     Error(expt);
                 }
                 finally
                 {
                     IDALProvider.IDAL.PushConnection(connection);
                 }
             }
         }
         return(msg);
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
         {
             return(smgr.Service.UndoAudit(obj));
         }
     }
 }
Exemplo n.º 12
0
        public BizLogicMsg BatchUpdate(EntityObject_MCE_B_ASSETS_OUTSTOCK[] objs)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (EntityObject_MCE_B_ASSETS_OUTSTOCK obj in objs)
                            {
                                SystemLogic.Proxy.AuditEdit(obj);
                            }
                            int amount = 0;

                            //平台自动生成代码
                            foreach (EntityObject_MCE_B_ASSETS_OUTSTOCK obj in objs)
                            {
                                amount += HelperObject_MCE_B_ASSETS_OUTSTOCK.Update(obj, transaction);
                            }
                            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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
                {
                    return(smgr.Service.BatchUpdate(objs));
                }
            }
        }
Exemplo n.º 13
0
 public BizLogicMsg CommitDelete(EntityObject_MCE_B_ASSETS_OUTSTOCK deleteBaseEntity)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     //平台自动生成代码
                     CauseObject_ p = new CauseObject_();
                     p. = deleteBaseEntity.ID;
                     HelperObject_.Delete(p, transaction);
                     HelperObject_MCE_B_ASSETS_OUTSTOCK.Delete(deleteBaseEntity, transaction);
                     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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
         {
             return(smgr.Service.CommitDelete(deleteBaseEntity));
         }
     }
 }
Exemplo n.º 14
0
 public BizLogicMsg Delete(CauseObject_MCE_B_ASSETS_OUTSTOCK cause)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     int amount = HelperObject_MCE_B_ASSETS_OUTSTOCK.Delete(cause, transaction);
                     //平台自动生成代码
                     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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
         {
             return(smgr.Service.Delete(cause));
         }
     }
 }
Exemplo n.º 15
0
        public BizLogicMsg Save_Ext(JsonMCE_OUTSTOCK jsonMCE_OUTSTOCK)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_OUTSTOCK entity = new EntityObject_MCE_B_ASSETS_OUTSTOCK();


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

                                entity = HelperObject_MCE_B_ASSETS_OUTSTOCK.Get(entity);

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


                            entity.CODE     = jsonMCE_OUTSTOCK.CODE;
                            entity.STOCK_ID = jsonMCE_OUTSTOCK.WAREHOUSE_ID;

                            if (!string.IsNullOrEmpty(jsonMCE_OUTSTOCK.CREATE_DATE))
                            {
                                entity.CREATE_DATE = DateTime.Parse(jsonMCE_OUTSTOCK.CREATE_DATE);
                            }
                            entity.USING_DEPT_ID = jsonMCE_OUTSTOCK.USING_DEPT_ID;
                            entity.USING_USER_ID = jsonMCE_OUTSTOCK.USING_USER_ID;

                            entity.COMMENTS = jsonMCE_OUTSTOCK.COMMENTS;

                            entity.STATE = 1;

                            if (string.IsNullOrEmpty(jsonMCE_OUTSTOCK.ID))
                            {
                                entity.CREATE_TIME    = DateTime.Now;
                                entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                int amount = HelperObject_MCE_B_ASSETS_OUTSTOCK.Save(entity, transaction);
                            }
                            else
                            {
                                int amount = HelperObject_MCE_B_ASSETS_OUTSTOCK.Update(entity, transaction);
                            }


                            if (jsonMCE_OUTSTOCK.DELETEIDS != null && jsonMCE_OUTSTOCK.DELETEIDS.Count > 0)
                            {
                                foreach (string strID in jsonMCE_OUTSTOCK.DELETEIDS)
                                {
                                    EntityObject_MCE_B_ASSETS_OUTSTOCK_D entity_D = new EntityObject_MCE_B_ASSETS_OUTSTOCK_D();

                                    if (!string.IsNullOrEmpty(strID))
                                    {
                                        entity_D.ID = strID;

                                        entity_D = HelperObject_MCE_B_ASSETS_OUTSTOCK_D.Get(entity_D);

                                        if (entity_D == null)
                                        {
                                            throw new Exception("获取数据出错.");
                                        }
                                        else
                                        {
                                            HelperObject_MCE_B_ASSETS_OUTSTOCK_D.Delete(entity_D, transaction);
                                        }
                                    }
                                }
                            }

                            if (jsonMCE_OUTSTOCK.children != null && jsonMCE_OUTSTOCK.children.Count > 0)
                            {
                                decimal decTotMoney = 0;
                                foreach (JsonMCE_OUTSTOCK_D item in jsonMCE_OUTSTOCK.children)
                                {
                                    EntityObject_MCE_B_ASSETS_OUTSTOCK_D entity_D = new EntityObject_MCE_B_ASSETS_OUTSTOCK_D();

                                    if (!string.IsNullOrEmpty(item.ID))
                                    {
                                        entity_D.ID = item.ID;

                                        entity_D = HelperObject_MCE_B_ASSETS_OUTSTOCK_D.Get(entity_D);

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

                                    entity_D.BASE_ID = entity.ID;

                                    entity_D.ASSET_TYPE_ID = item.ASSET_TYPE_ID;
                                    entity_D.ASSETS_ID     = item.ASSETS_ID;
                                    entity_D.ASSETS_NAME   = item.ASSETS_NAME;
                                    entity_D.ASSETS_CODE   = item.ASSETS_CODE;
                                    entity_D.SPEC          = item.SPEC;
                                    entity_D.PRD_ID        = item.PRD_ID;
                                    entity_D.PRICE         = item.PRICE;
                                    entity_D.AMOUNT        = item.AMOUNT;
                                    entity_D.UNIT_ID       = item.UNIT_ID;
                                    entity_D.COUNTRY       = item.COUNTRY;

                                    if (!string.IsNullOrEmpty(item.USE_DATE))
                                    {
                                        entity_D.USE_DATE = DateTime.Parse(item.USE_DATE);
                                    }

                                    entity_D.ECONOMIC_USE_TYPE_ID = item.ECONOMIC_USE_TYPE_ID;

                                    entity_D.REF_TAB_ID   = item.REF_TAB_ID;
                                    entity_D.REF_TAB_NAME = item.REF_TAB_NAME;

                                    entity_D.MONEY = item.AMOUNT * item.PRICE;
                                    decTotMoney    = decTotMoney + entity_D.MONEY;

                                    if (string.IsNullOrEmpty(item.ID))
                                    {
                                        HelperObject_MCE_B_ASSETS_OUTSTOCK_D.Save(entity_D, transaction);
                                    }
                                    else
                                    {
                                        HelperObject_MCE_B_ASSETS_OUTSTOCK_D.Update(entity_D, transaction);
                                    }
                                }
                                entity.TOTAL_MONEY = decTotMoney;

                                HelperObject_MCE_B_ASSETS_OUTSTOCK.Update(entity, 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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext(jsonMCE_OUTSTOCK));
                }
            }
        }
Exemplo n.º 16
0
        public BizLogicMsg Submit_Ext(List <string> listID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (string strID in listID)
                            {
                                EntityObject_MCE_B_ASSETS_OUTSTOCK obj = new EntityObject_MCE_B_ASSETS_OUTSTOCK();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_OUTSTOCK.Get(obj);

                                if (obj != null)
                                {
                                    if (obj.STATE == 2 || obj.STATE == 3 || obj.STATE == 4)
                                    {
                                        throw new Exception("已经提交的数据不能再提交.");
                                    }


                                    if (string.IsNullOrEmpty(obj.CODE))
                                    {
                                        throw new Exception("单号不能为空.");
                                    }

                                    if (string.IsNullOrEmpty(obj.USING_DEPT_ID))
                                    {
                                        throw new Exception("领用科室不能为空.");
                                    }

                                    if (string.IsNullOrEmpty(obj.USING_USER_ID))
                                    {
                                        throw new Exception("领用人不能为空.");
                                    }

                                    obj.STATE = 2;
                                    HelperObject_MCE_B_ASSETS_OUTSTOCK.Update(obj, transaction);
                                }
                            }

                            //平台自动生成代码

                            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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext(listID));
                }
            }
        }
Exemplo n.º 17
0
        public BizLogicMsg Audit_Ext(List <string> listID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (string strID in listID)
                            {
                                EntityObject_MCE_B_ASSETS_OUTSTOCK obj = new EntityObject_MCE_B_ASSETS_OUTSTOCK();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_OUTSTOCK.Get(obj);

                                if (obj != null)
                                {
                                    if (obj.STATE == 3 || obj.STATE == 4)
                                    {
                                        throw new Exception("已经审核的数据不能再审核.");
                                    }

                                    obj.STATE         = 3;
                                    obj.AUDIT_TIME    = DateTime.Now;
                                    obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                    HelperObject_MCE_B_ASSETS_OUTSTOCK.Update(obj, transaction);


                                    #region 资产卡片更新
                                    DisplayObject_MCE_B_ASSETS_OUTSTOCK_D[] disOutstock = BizLogicObject_MCE_B_ASSETS_OUTSTOCK_D.Proxy.Query(new CauseObject_MCE_B_ASSETS_OUTSTOCK_D()
                                    {
                                        BASE_ID = obj.ID
                                    });
                                    if (disOutstock.Length > 0)
                                    {
                                        for (int i = 0; i < disOutstock.Length; i++)
                                        {
                                            if (string.IsNullOrEmpty(disOutstock[i].REF_TAB_ID) || string.IsNullOrEmpty(disOutstock[i].REF_TAB_NAME))
                                            {
                                                continue;
                                            }

                                            if (disOutstock[i].REF_TAB_NAME == "MCE_B_ASSETS")
                                            {
                                                EntityObject_MCE_B_ASSETS entAssets = BizLogicObject_MCE_B_ASSETS.Proxy.Get(new EntityObject_MCE_B_ASSETS()
                                                {
                                                    ID = disOutstock[i].REF_TAB_ID
                                                });

                                                if (entAssets != null)
                                                {
                                                    entAssets.CUSTODY_DEPT_ID      = obj.USING_DEPT_ID;
                                                    entAssets.CUSTODY_USER_ID      = obj.USING_USER_ID;
                                                    entAssets.SUBJECTION_DEPT_ID   = obj.USING_DEPT_ID;
                                                    entAssets.USING_DEPT_ID        = obj.USING_DEPT_ID;
                                                    entAssets.USING_USER_ID        = obj.USING_USER_ID;
                                                    entAssets.CUSTODY_DEPT_ID      = obj.USING_DEPT_ID;
                                                    entAssets.ENABLE_DATE          = obj.CREATE_DATE;
                                                    entAssets.USE_STATE            = "00540001";                          //在用
                                                    entAssets.ASSETS_STATE         = "00530002";                          //资产状态(启用).
                                                    entAssets.CARD_TYPE_ID         = "00680002";
                                                    entAssets.ECONOMIC_USE_TYPE_ID = disOutstock[0].ECONOMIC_USE_TYPE_ID; //hsc 如果出库是多个设备  则会出错
                                                    BizLogicObject_MCE_B_ASSETS.Proxy.UpdateByTrans(entAssets, transaction);
                                                }
                                            }
                                            else
                                            {
                                                //因为这个方法取出的值只有ID跟状态.所以必须重新取值.
                                                DisplayObject_MCE_B_ASSETS[] disAssets = HelperObject_MCE_B_ASSETS.QueryIdState(disOutstock[i].REF_TAB_ID, disOutstock[i].REF_TAB_NAME);
                                                foreach (DisplayObject_MCE_B_ASSETS item in disAssets)
                                                {
                                                    EntityObject_MCE_B_ASSETS entAssets = BizLogicObject_MCE_B_ASSETS.Proxy.Get(new EntityObject_MCE_B_ASSETS()
                                                    {
                                                        ID = item.ID
                                                    });
                                                    if (entAssets != null)
                                                    {
                                                        entAssets.CUSTODY_DEPT_ID      = obj.USING_DEPT_ID;
                                                        entAssets.CUSTODY_USER_ID      = obj.USING_USER_ID;
                                                        entAssets.SUBJECTION_DEPT_ID   = obj.USING_DEPT_ID;
                                                        entAssets.USING_DEPT_ID        = obj.USING_DEPT_ID;
                                                        entAssets.USING_USER_ID        = obj.USING_USER_ID;
                                                        entAssets.CUSTODY_DEPT_ID      = obj.USING_DEPT_ID;
                                                        entAssets.ENABLE_DATE          = obj.CREATE_DATE;
                                                        entAssets.USE_STATE            = "00540001";                          //在用
                                                        entAssets.ASSETS_STATE         = "00530002";                          //资产状态(启用).
                                                        entAssets.CARD_TYPE_ID         = "00680002";
                                                        entAssets.ECONOMIC_USE_TYPE_ID = disOutstock[0].ECONOMIC_USE_TYPE_ID; //hsc 如果出库是多个设备  则会出错
                                                        BizLogicObject_MCE_B_ASSETS.Proxy.UpdateByTrans(entAssets, transaction);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    #endregion
                                }
                            }

                            //平台自动生成代码

                            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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext(listID));
                }
            }
        }