예제 #1
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));
                }
            }
        }