public with sharing class CheckAllOlympusAssetController { public static Asset StaticAssetQuertResult; // 按钮区域 public String assertQueryCondition {get; private set;} public Boolean allBlueFlag {get; private set;} // 查看全部保有设备蓝色按钮Flag public Boolean consumableBlueFlag {get; private set;} // 查看在库的保有设备蓝色按钮Flag public Boolean lendingBlueFlag {get; private set;} // 查看出借中保有设备蓝色按钮Flag public Boolean repairingBlueFlag {get; private set;} // 查看修理中保有设备蓝色按钮Flag public Boolean scrappingBlueFlag {get; private set;} // 查看待报废保有设备蓝色按钮Flag public Boolean scrappedBlueFlag {get; private set;} //查看已报废保有设备蓝色按钮Flag public Boolean consumedBlueFlag {get; private set;} //查看已消耗的保有设备 public Boolean soonExpiredBlueFlag {get; private set;} //查看即将到期的保有设备 public Boolean expiredBlueFlag {get; private set;} //查看已过期的保有设备 public Boolean angecylookrole {get; private set;} //办事处查看权限 20210628 you 1650 // 检索区域 public static final String NONE = system.label.StartTrading_None; // 「なし」ラベル [Chinese:--无--] public String internalAssetLocation; // 后台使用的 public String internalAssetLocationLogin {get; set;} // login的备品存放地 public String internalAssetLocationSet {get; set;} // 备品存放地 Internal_asset_location__c public String beipinCunFangDi {get; set;} // 备品存放地 public SearchBean searchB {get; set;} // 检索用Bean // 备品存放地 检索条件设置区 public List internalAssetLocationOptionList { get { if (internalAssetLocationOptionList == null) { internalAssetLocationOptionList = getPlickList('Asset', 'Internal_asset_location__c'); } return internalAssetLocationOptionList; } set; } // 备品存放地 数据适用区 public List internalAssetDataLocationOptionList { get { if (internalAssetDataLocationOptionList == null) { internalAssetDataLocationOptionList = getPlickList('Asset', 'Internal_asset_location__c'); } return internalAssetDataLocationOptionList; } set; } public String assetStatus {get; set;} // 备品状态 Asset_Status__c 左侧快捷按钮 public String assetStatus1 {get; set;} // 备品状态 Asset_Status__c 右侧检索区的 public List assetStatusOptionList { get { // FIXME StartTrading_None を使う、--なし-- はNGでしょう List selectOptions = new List { new SelectOption(NONE, NONE) }; //无保有 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Wu_Bao_You.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Wu_Bao_You.ordinal()))); //无库存 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Mei_You_Ku_Cun.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Mei_You_Ku_Cun.ordinal()))); //可分配 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Ke_Yi_Fen_Pei.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Ke_Yi_Fen_Pei.ordinal()))); //暂定分配 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Zan_Ding_Fen_Pei.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Zan_Ding_Fen_Pei.ordinal()))); //已出库指示 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Chu_Ku_Zhi_Shi.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Chu_Ku_Zhi_Shi.ordinal()))); //已下架 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Xia_Jia.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Xia_Jia.ordinal()))); //出库前已检测 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Chu_Ku_Qian_Yi_Jian_Ce.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Chu_Ku_Qian_Yi_Jian_Ce.ordinal()))); //已出库 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Chu_Ku.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Chu_Ku.ordinal()))); //申请者已收货 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Shen_Qing_Zhe_Yi_Shou_Huo.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Shen_Qing_Zhe_Yi_Shou_Huo.ordinal()))); //申请者收货NG selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Shen_Qing_Zhe_Shou_Huo_NG.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Shen_Qing_Zhe_Shou_Huo_NG.ordinal()))); //医院已装机确认 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Yuan_Yi_Zhuang_Ji_Que_Ren.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Yuan_Yi_Zhuang_Ji_Que_Ren.ordinal()))); //已回寄 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Hui_Ji.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Hui_Ji.ordinal()))); //欠品中 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Qian_Pin_Zhong.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Qian_Pin_Zhong.ordinal()))); //已回收 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Hui_Shou.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Hui_Shou.ordinal()))); //回收后已CDS selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Hui_Shou_Hou_Yi_CDS.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Hui_Shou_Hou_Yi_CDS.ordinal()))); //待上架 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Dai_Shang_Jia.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Dai_Shang_Jia.ordinal()))); //待移至报废区 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Zhi_Bao_Fei_Qu.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Yi_Zhi_Bao_Fei_Qu.ordinal()))); //待废弃 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Dai_Fei_Qi.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Dai_Fei_Qi.ordinal()))); //废弃 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Fei_Qi.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Fei_Qi.ordinal()))); //修理草案中 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Xiu_Li_Cao_An_Zhong.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Xiu_Li_Cao_An_Zhong.ordinal()))); //修理中 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Xiu_Li_Zhong.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Xiu_Li_Zhong.ordinal()))); //冻结 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Dong_Jie.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Dong_Jie.ordinal()))); //丢失 selectOptions.add(new SelectOption(FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Diu_Shi.ordinal()), FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Diu_Shi.ordinal()))); return selectOptions; } } public List bodyOrAccessoryOptionList { get { List selectOptions = new List { new SelectOption(NONE, NONE) }; //主体 selectOptions.add(new SelectOption('主体', '主体')); //附属品 selectOptions.add(new SelectOption('附属品', '附属品')); return selectOptions; } } //public String limits {get; set;} public List limitOpts { get { //List limitOpts = new List { new SelectOption(NONE, NONE) }; List limitOpts = new List(); //limitOpts.add(new SelectOption('2','2')); limitOpts.add(new SelectOption('10','10')); limitOpts.add(new SelectOption('50','50')); limitOpts.add(new SelectOption('100','100')); limitOpts.add(new SelectOption('200','200')); return limitOpts; } } // 分公司号PlickList public List companyOfEquipmentOpts { get { if (companyOfEquipmentOpts == null) { companyOfEquipmentOpts = getPlickList('Asset', 'CompanyOfEquipment__c'); } return companyOfEquipmentOpts; } set; } // 产品分类PlickList public List product_categoryOpts { get { if (product_categoryOpts == null) { product_categoryOpts = getPlickList('Asset', 'Product_category__c'); } return product_categoryOpts; } set; } // 备品分类PlickList public List equipment_TypeOpts { get { if (equipment_TypeOpts == null) { equipment_TypeOpts = getPlickList('Asset', 'Equipment_Type__c'); } return equipment_TypeOpts; } set; } // 管理种类PlickList public List manage_typeOpts { get { if (manage_typeOpts == null) { manage_typeOpts = getPlickList('Asset', 'Manage_type__c'); } return manage_typeOpts; } set; } // 所在地区(本部)PlickList public List salesdepartmentOpts { get { if (salesdepartmentOpts == null) { salesdepartmentOpts = getPlickList('Asset', 'Salesdepartment__c'); } return salesdepartmentOpts; } set; } // 所在地区(省)PlickList public List salesProvinceOpts { get { if (salesProvinceOpts == null) { salesProvinceOpts = getPlickList('Asset', 'SalesProvince__c'); } return salesProvinceOpts; } set; } // 备品类别PlickList public List assetLoanerCategoryOpts { get { if(assetLoanerCategoryOpts == null){ assetLoanerCategoryOpts = new List(); assetLoanerCategoryOpts.add(new SelectOption('', NONE)); assetLoanerCategoryOpts.add(new SelectOption('备品', '备品')); assetLoanerCategoryOpts.add(new SelectOption('耗材', '耗材')); } return assetLoanerCategoryOpts; } set; } // 到期时间picklist public List daysToExpiredOpts { get { if(daysToExpiredOpts == null){ daysToExpiredOpts = new List(); daysToExpiredOpts.add(new SelectOption('', NONE)); daysToExpiredOpts.add(new SelectOption('7', '一周内到期')); daysToExpiredOpts.add(new SelectOption('14', '两周内到期')); } return daysToExpiredOpts; } set; } private String targetColumusStr; // SOQL中的检索列 // 项目set 字段标签 public List leftLabelList {get; private set;} public List rightLabelList {get; private set;} public List allLabelList {get; private set;} public Integer leftLabelSize { get { return leftLabelList.size(); } } // 项目set 字段名 public List> leftApiList {get; private set;} // 参照項目用 public List> rightApiList {get; private set;} // 参照項目用 public List allApiList {get; private set;} // 参照項目用 public Integer eachLineSize {get; set;} public List apiTypeIsReferenceList {get; set;} // 判断api是否为参照关系 public List columnLeftCssList {get; private set;} // css 用 public List columnRightCssList {get; private set;} // css 用 public Map columnLeftRWMap {get; private set;} // r,w,wm用 public Map columnRightRWMap {get; private set;} // r,w,wm用 private Map DESC_RW = null; public String setInternalAssetLocation {get; set;} // 设置备品存放地 public String setAssetType {get; set;} // 设置备品分类 public List canChangeFlagList {get; set;} // 是否可编辑 public String isSavingSuccess {get; set;} // 保存flag public Asset assetSetting {get; set;} // 设置用 public List allAssetDataList {get; set;} // 明细结果(不包括checkoutbox) public Integer getAllAssetDataListSize() { // 明细条数 return allAssetInfoList.size(); } public List allAssetInfoList {get; set;} // 明细结果(包括checkoutbox) public List assetExportCsvList {get; set;} // 明细结果(导出CSV) public List> exportCsvResultList {get; set;} public String changeFlg {get; set;} // 监视刷新画面前是否存在未保持的值 public Boolean searchFromBtn {get; private set;} // 是否来自快捷键进行检索 public Boolean searchFromSave {get; private set;} // 是否来自保存进行检索 public Boolean onlyReadFlag {get; set;} // 只读权限 public Boolean returnFirstPageFlag {get; private set;} // 返回首页 public Boolean beipincunfangdiEditableFlag {get; private set;} // 备品存放地权限 public Boolean beipinfenleiEditableFlag {get; private set;} // 备品分类权限 public Boolean equipmentSetManagmentCodeEditableFlag {get; private set;} // 备品管理编码权限 public Boolean internalAssetNumberEditableFlag {get; private set;} // 固定资产号权限 public Boolean serialNumberEditableFlag {get; private set;} // 机身号权限 public Boolean companyEquipmentEditableFlag {get; private set;} // 分公司号权限 public Boolean productCategoryEditableFlag {get; private set;} // 产品分类权限 public Boolean manageTypeEditableFlag {get; private set;} // 管理种类权限 public Boolean salesDepartmentEditableFlag {get; private set;} // 所在地区(本部) public Boolean salesProvinceEditableFlag {get; private set;} // 所在地区(省) public Boolean consumableGuaranteenEndEditableFlag {get; private set;} // 消耗品有效期至 public Boolean excess2000Flag {get; set;} // 判断超过2000 public Date consumableGuaranteenEndDate {get; set;} // 消耗品有效期至 (2B2无access权限时) // 排序用 public String sortKey {get; set;} public String preSortKey {get; set;} public Boolean sortOrderAsc {get; set;} public List sortOrderList {get; set;} public Integer totalSoqlRecordNum {get; set;} // 总数据数量 public Integer totalNum {get; set;} // 检索出的总数量 = 检索出的数量 + 打勾固定的数量 // 分页用 public String selRecordOption { get; set; } // 选择的每页记录数 public Integer selctRecordNum { get { return Integer.valueOf(selRecordOption); } } // 选择的每页记录数 public Integer currPage { get; set; } // 当前页 public Integer totalPage { get; set; } // 总页数 public Integer totalFixDataNum { get; set; } // 打勾固定数据数量 public Integer totalUnfixDataNum { get; set; } // 未打勾固定数据数量 public List loginUserList { get; set; } public String fromQuickBarFlag; // 是否来自导航区按钮检索 public static String assetRecordTypeId = System.Label.Asset_RecordType; public Asset getAsset() { // 临时使用 if (StaticAssetQuertResult == null) { StaticAssetQuertResult = new Asset(Id = [SELECT Id FROM Asset WHERE Asset_Owner__c = 'Olympus' AND RecordTypeId = :assetRecordTypeId // AND RecordTypeId = '01210000000kOPRAA2' // AND Equipment_Type__c != '检测用备品' 已QA 不需要增加条件 AND Delete_Flag__c = False LIMIT 1 ].Id); } System.debug('StaticAssetQuertResult.Id1===' + StaticAssetQuertResult.Id); return new Asset(Id = StaticAssetQuertResult.Id, RecordTypeId = assetRecordTypeId); } public String appliedSelectOption {get; set;} public String exportCsvName {get; set;} public Integer checkedAssetInfoNum {get; set;} public String checkFromQuickBarFlag; // 明细类 class AssetInfo { public Boolean isCheck {get; set;} // 是否选择 public Asset assetQuertResult {get; set;} // 借出备品set一览 public AssetInfo() { isCheck = false; if (StaticAssetQuertResult == null) { StaticAssetQuertResult = new Asset(Id = [SELECT Id FROM Asset WHERE Asset_Owner__c = 'Olympus' AND RecordTypeId = :assetRecordTypeId // AND RecordTypeId = '01210000000kOPRAA2' // AND Equipment_Type__c != '检测用备品' 已QA 不需要增加条件 AND Delete_Flag__c = False LIMIT 1 ].Id); } System.debug('StaticAssetQuertResult.Id2===' + StaticAssetQuertResult.Id); assetQuertResult = new Asset(Id = StaticAssetQuertResult.Id, RecordTypeId = assetRecordTypeId); } } // 导出CSV public String COMMA { get { return Parser.COMMA; } } public String CRLF { get { return Parser.CRLF; } } public CheckAllOlympusAssetController() { currPage = 1; selRecordOption = '10'; // 初始化时默认选择数量 totalNum = 0; // 备品的RecordTypeId = 01210000000kOPRAA2 DESC_RW = SoapApi.getEditLayoutItemRW('Asset', new String[]{System.Label.Asset_RecordType}).get(System.Label.Asset_RecordType); } public CheckAllOlympusAssetController(ApexPages.StandardController controller) { currPage = 1; selRecordOption = '10'; // 初始化时默认选择数量 totalNum = 0; DESC_RW = SoapApi.getEditLayoutItemRW('Asset', new String[]{System.Label.Asset_RecordType}).get(System.Label.Asset_RecordType); } // 画面初始化 public void init() { searchB = new SearchBean(); System.debug('Start init'); isSavingSuccess = 'true'; checkFromQuickBarFlag = 'false'; checkedAssetInfoNum = 0; bp3_Setting__c bp3config = bp3_Setting__c.getOrgDefaults(); fromQuickBarFlag = 'false'; exportCsvName = bp3config.Export_CSV_Filename__c + datetime.now().format('_YYYY-MM-dd_') + UserInfo.getUserName().split('@')[0] + '.csv'; // CustomSet的CSV文件名 日期 登录者Username System.debug('exportCsvName === ' + exportCsvName); System.debug('UserInfo.getUserId()===' + UserInfo.getUserName().split('@')[0]); appliedSelectOption = ''; changeFlg = '0'; searchFromBtn = false; onlyReadFlag = false; searchFromSave = false; initSearchButtonColor(); returnFirstPageFlag = true; excess2000Flag = false; assetSetting = getAsset(); System.debug('assetSetting.Equipment_Type__c ==' + assetSetting.Equipment_Type__c); allAssetDataList = new List(); allAssetInfoList = new List(); //setAssetFieldSetInfo(); totalFixDataNum = 0; totalUnfixDataNum =0; // 权限 beipincunfangdiEditableFlag = Schema.sObjectType.Asset.fields.getMap().get('Internal_asset_location__c').getDescribe().isUpdateable(); beipinfenleiEditableFlag = Schema.sObjectType.Asset.fields.getMap().get('Equipment_Type__c').getDescribe().isUpdateable(); // 备品管理编码权限 equipmentSetManagmentCodeEditableFlag = Schema.sObjectType.Asset.fields.getMap().get('EquipmentSet_Managment_Code__c').getDescribe().isUpdateable(); // 固定资产号权限 internalAssetNumberEditableFlag = Schema.sObjectType.Asset.fields.getMap().get('Internal_Asset_number__c').getDescribe().isUpdateable(); // 机身号权限 serialNumberEditableFlag = Schema.sObjectType.Asset.fields.getMap().get('SerialNumber').getDescribe().isUpdateable(); // 分公司号权限 companyEquipmentEditableFlag = Schema.sObjectType.Asset.fields.getMap().get('CompanyOfEquipment__c').getDescribe().isUpdateable(); // 产品分类权限 productCategoryEditableFlag = Schema.sObjectType.Asset.fields.getMap().get('Product_category__c').getDescribe().isUpdateable(); // 管理种类权限 manageTypeEditableFlag = Schema.sObjectType.Asset.fields.getMap().get('Manage_type__c').getDescribe().isUpdateable(); // 所在地区(本部) salesDepartmentEditableFlag = Schema.sObjectType.Asset.fields.getMap().get('Salesdepartment__c').getDescribe().isUpdateable(); // 所在地区(省) salesProvinceEditableFlag = Schema.sObjectType.Asset.fields.getMap().get('SalesProvince__c').getDescribe().isUpdateable(); // 消耗品有效期至 consumableGuaranteenEndEditableFlag = Schema.sObjectType.Asset.fields.getMap().get('Consumable_Guaranteen_end__c').getDescribe().isUpdateable(); System.debug('7777'); //loginUserList = new List(); loginUserList = [SELECT Id, Default_Referable_Apply_Equipment_Center__c FROM User WHERE Id = :Userinfo.getUserId()]; beipinCunFangDi = loginUserList[0].Default_Referable_Apply_Equipment_Center__c; // User.默认可参照备品中心 //办事处查看权限 20210628 you 1650 if (beipinCunFangDi=='广州 备品中心' || beipinCunFangDi=='北京 备品中心' || beipinCunFangDi=='上海 备品中心') { angecylookrole =true; } setAssetFieldSetInfo();//20210628 1650 you 挪个位置 if (UserInfo.getProfileId() == System.Label.ProfileId_SystemAdmin || System.Label.ProfileId_EquCenAdmin.contains(UserInfo.getProfileId())) { internalAssetLocationLogin = FixtureUtil.bieCunFangDiOpsMap.get('备品管理中心')[0].getValue(); // SelectOption('All', '--全部--') } else { List tempBieCunFangDiOpsList = FixtureUtil.bieCunFangDiOpsMap.get('备品管理中心'); internalAssetLocationLogin = beipinCunFangDi; // User.默认可参照备品中心 } //internalAssetLocation1 = internalAssetLocationLogin; System.debug('internalAssetLocationLogin1111===' + internalAssetLocationLogin); System.debug('beipinCunFangDi===' + beipinCunFangDi); checkAssetBtn(); } public void setAssetFieldSetInfo() { leftLabelList = new List(); rightLabelList = new List(); allLabelList = new List(); leftApiList = new List>(); rightApiList = new List>(); allApiList = new List(); columnLeftCssList = new List(); columnRightCssList = new List(); columnLeftRWMap = new Map(); columnRightRWMap = new Map(); List columnLeftFieldPathList = new List(); List columnRightFieldPathList = new List(); // 获得納入商品 項目セット Map assetFieldSetMap = Schema.getGlobalDescribe().get('Asset').getDescribe().fieldSets.getMap(); // 項目セット查看保有设备_左侧固定 Schema.FieldSet leftFieldSetSet = assetFieldSetMap.get('CheckAsset_LeftFix'); // 項目セット查看保有设备_右侧固定 Schema.FieldSet rightFieldSetSet; //20210628 you 1650 办事处不显示 货架号 system.debug('zheli'+angecylookrole); if(angecylookrole){ rightFieldSetSet = assetFieldSetMap.get('CheckAsset_Right'); } else{ rightFieldSetSet = assetFieldSetMap.get('CheckAsset_Right_Angecy'); } // 获得左侧固定項目セット中的所有项目 List leftFieldSetMemberList = leftFieldSetSet.getFields(); // 获得右侧項目セット中的所有项目 List rightFieldSetMemberList = rightFieldSetSet.getFields(); Boolean haveWrongField = false; for (FieldSetMember eachLeftFieldSetMember : leftFieldSetMemberList) { List splitLeftFieldPathList = eachLeftFieldSetMember.getFieldPath().split('\\.'); // List size > 1 对应关联表 if (splitLeftFieldPathList.size() > 1) { if ( haveWrongField == false) { ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.WARNING, '保有设备字段集CheckAsset_LeftFix只能选择保有设备的字段')); haveWrongField = true; } continue; } leftLabelList.add(eachLeftFieldSetMember.getLabel()); // 左侧項目セットLabel columnLeftFieldPathList.add(eachLeftFieldSetMember.getFieldPath()); // 左侧項目セットAPI leftApiList.add(splitLeftFieldPathList); // List>() 左侧項目セットAPI if (DESC_RW == null) { columnLeftRWMap.put(eachLeftFieldSetMember.getFieldPath(), 'r'); // 未设置,默认为只读 } else if (splitLeftFieldPathList.size() == 1) { String rw = DESC_RW.get(eachLeftFieldSetMember.getFieldPath()); if (rw != null) { columnLeftRWMap.put(eachLeftFieldSetMember.getFieldPath(), rw); // 可读可写 } else { columnLeftRWMap.put(eachLeftFieldSetMember.getFieldPath(), 'r'); // 只读 } } else { columnLeftRWMap.put(eachLeftFieldSetMember.getFieldPath(), 'r'); // 只读 } } for (String eachColumnLeftFieldPath : columnLeftFieldPathList) { // if (queryColumusSet.contains(eachcolumnLeftFieldPath) == false) { // queryColumus.add(eachcolumnLeftFieldPath); // queryColumusSet.add(eachcolumnLeftFieldPath); // } columnLeftCssList.add(eachcolumnLeftFieldPath.replace('.', '_')); // 与API相同 } // 項目セット查看保有设备_右侧可拖动 for (FieldSetMember eachRightFieldSetMember : rightFieldSetMemberList) { List splitRightFieldPathList = eachRightFieldSetMember.getFieldPath().split('\\.'); // 与上面的相同 if (splitRightFieldPathList.size() > 1) { if ( haveWrongField == false) { ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.WARNING, '保有设备字段集CheckAsset_Right只能选择保有设备的字段')); haveWrongField = true; } continue; } rightLabelList.add(eachRightFieldSetMember.getLabel()); // 左侧項目セットLabel columnRightFieldPathList.add(eachRightFieldSetMember.getFieldPath()); // 左侧項目セットAPI rightApiList.add(splitRightFieldPathList); // List>() 左侧項目セットAPI if (DESC_RW == null) { columnRightRWMap.put(eachRightFieldSetMember.getFieldPath(), 'r'); // 未设置,默认为只读 } else if (splitRightFieldPathList.size() == 1) { String rw = DESC_RW.get(eachRightFieldSetMember.getFieldPath()); if (rw != null) { columnRightRWMap.put(eachRightFieldSetMember.getFieldPath(), rw); // 可读可写 } else { columnRightRWMap.put(eachRightFieldSetMember.getFieldPath(), 'r'); // 只读 } } else { columnRightRWMap.put(eachRightFieldSetMember.getFieldPath(), 'r'); // 只读 } } for (String eachColumnRightFieldPath : columnRightFieldPathList) { columnRightCssList.add(eachcolumnRightFieldPath.replace('.', '_')); // 与API相同 } allLabelList.addAll(leftLabelList); allLabelList.addAll(rightLabelList); System.debug('allLabelList=====' + allLabelList); // 备品存放地, 所在地区(本部), 所在地区(省), 备品配套明细型号, 设备名, 固定资产编号(Key), 固定资产编号, 产品 + 机体编码, 产品分类(GI/SP), 备品分类, ... for (List eachApiList : leftApiList) { allApiList.add(eachApiList[0]); } for (List eachApiList : rightApiList) { allApiList.add(eachApiList[0]); } // CSV 每一行数量 不包括Id if (allApiList.contains('Id')) { allApiList.remove(0); } eachLineSize = allApiList.size(); System.debug('allApiList===' + allApiList); Map objectFields = Schema.getGlobalDescribe().get('Asset').getDescribe().fields.getMap(); for(String eachApi : allApiList) { Schema.DescribeFieldResult lfieldLabel = objectFields.get(eachApi).getDescribe(); Schema.DisplayType dType = lfieldLabel.getType(); if (String.ValueOf(dType) == 'REFERENCE') { apiTypeIsReferenceList.add(eachApi); } } Map queryAssetFieldMap = Asset.getSObjectType().getDescribe().fields.getMap(); canChangeFlagList = new List(); for (String eachApi : allApiList) { DescribeFieldResult queryAssetFieldResult = queryAssetFieldMap.get(eachApi).getDescribe(); if (!queryAssetFieldResult.isCalculated()) { canChangeFlagList.add(''); } else { canChangeFlagList.add('(不可修改)'); } } targetColumusStr = String.join(allApiList, ', '); if (targetColumusStr.contains('LastModifiedDate') == false) { targetColumusStr += ', LastModifiedDate'; } // 默认排序 this.sortKey = '0'; this.preSortKey = '0'; this.sortOrderAsc = true; this.sortOrderList = new List(); this.sortOrderList.add('↑'); for (Integer i = 0; i < allLabelList.size(); i++) { this.sortOrderList.add(' '); } } // 初始化按钮颜色 public void initSearchButtonColor() { angecylookrole =false; //20210628 you 1650 allBlueFlag = true; // 初始页面上全部保有设备按钮为蓝色 consumableBlueFlag = false; lendingBlueFlag = false; repairingBlueFlag = false; scrappingBlueFlag = false; scrappedBlueFlag = false; consumedBlueFlag = false; soonExpiredBlueFlag = false; expiredBlueFlag = false; } // 检索按钮 查看保有设备 public void checkAssetBtn() { // get方式传url参数 if (String.isBlank(assertQueryCondition)) { assertQueryCondition = ApexPages.currentPage().getParameters().get('searchType'); } System.debug('ApexPages.currentPage().getParameters().searchType===' + assertQueryCondition); // 来自按钮 String tempAssertQueryCondition = ApexPages.currentPage().getParameters().get('assertCondition'); System.debug('ApexPages.currentPage().getParameters()tempAssertQueryCondition===' + tempAssertQueryCondition); String fromQuickBarFlag = ApexPages.currentPage().getParameters().get('fromQuickBarFlag'); System.debug('ApexPages.currentPage().getParameters()fromQuickBarFlag===' + fromQuickBarFlag); checkFromQuickBarFlag = fromQuickBarFlag; if (String.isNotBlank(tempAssertQueryCondition)) { assertQueryCondition = tempAssertQueryCondition; } //initSearchButtonColor(); // 每次检索时初始化按钮颜色 //searchFromBtn = true; // 去掉打钩项 if (String.isNotBlank(assertQueryCondition) && assertQueryCondition != null) { System.debug('changecolor'); allBlueFlag = false; consumableBlueFlag = false; lendingBlueFlag = false; repairingBlueFlag = false; scrappingBlueFlag = false; scrappedBlueFlag = false; consumedBlueFlag = false; soonExpiredBlueFlag = false; expiredBlueFlag = false; if (assertQueryCondition == 'all') { // 备品检索条件assertQueryCondition为空视为 查看全部保佑设备 allBlueFlag = true; } else if (assertQueryCondition == 'consumable') { consumableBlueFlag = true; } else if (assertQueryCondition == 'lending') { lendingBlueFlag = true; } else if (assertQueryCondition == 'repairing') { repairingBlueFlag = true; } else if (assertQueryCondition == 'scrapping') { scrappingBlueFlag = true; } else if (assertQueryCondition == 'scrapped') { scrappedBlueFlag = true; } else if (assertQueryCondition == 'consumed') { consumedBlueFlag = true; } else if (assertQueryCondition == 'soonExpired') { soonExpiredBlueFlag = true; } else if (assertQueryCondition == 'expired') { expiredBlueFlag = true; } } System.debug('fromQuickBarFlag1===' + fromQuickBarFlag); searchBtn(); } // 适用 public List getAppliedSelectOptionList() { if (allApiList.contains('Id')) { allApiList.remove(0); } if (allLabelList.contains('Id')) { allLabelList.remove(0); } Map assetFieldSetMap = Schema.getGlobalDescribe().get('Asset').getDescribe().fieldSets.getMap(); Schema.FieldSet appliedFieldSetSet = assetFieldSetMap.get('CheckAsset_Apply'); List appliedFieldSetMemberList = appliedFieldSetSet.getFields(); List appliedLabelList = new List(); System.debug('appliedLabelList===' + appliedLabelList); System.debug('appliedFieldSetMemberList===' + appliedFieldSetMemberList); for (FieldSetMember eachAppliedFieldSetMember : appliedFieldSetMemberList) { System.debug('eachAppliedFieldSetMember===' + eachAppliedFieldSetMember); //String targetAppliedApi = allApiList.get(allLabelList.indexOf(eachAppliedFieldSetMember.getLabel())); String targetAppliedApi = ''; system.debug('zheli0'+allLabelList.indexOf(eachAppliedFieldSetMember.getLabel())); if(allLabelList.indexOf(eachAppliedFieldSetMember.getLabel())!=-1){ //不包含 targetAppliedApi =allApiList.get(allLabelList.indexOf(eachAppliedFieldSetMember.getLabel())); System.debug('targetAppliedApi===' + targetAppliedApi); if (Schema.sObjectType.Asset.fields.getMap().get(targetAppliedApi).getDescribe().isUpdateable()) { System.debug('targetAppliedApi111===' + targetAppliedApi); appliedLabelList.add(eachAppliedFieldSetMember.getLabel()); } } } List appliedSelectOptionList = new List {new SelectOption('', NONE)}; String targetAppliedApi; for (String eachAppliedLabel : appliedLabelList) { if (allLabelList.contains(eachAppliedLabel)) { targetAppliedApi = allApiList.get(allLabelList.indexOf(eachAppliedLabel)); } appliedSelectOptionList.add(new SelectOption(targetAppliedApi, eachAppliedLabel)); } return appliedSelectOptionList; } // 检索按钮 public void searchBtn() { System.debug('Enter searchBtn.'); System.debug('fromQuickBarFlag2 === ' + fromQuickBarFlag); System.debug('checkFromQuickBarFlag===' + checkFromQuickBarFlag); returnFirstPageFlag = true; getAllAssetData(); } // 取消按钮 先清空所有打钩项 public void clearAllCheckedBtn() { searchFromBtn = true; returnFirstPageFlag = false; // 取消时不回到首页 getAllAssetData(); } // 明细排序 public void sortTable() { searchFromBtn = false; // 点击排序时,不需要清空打勾 returnFirstPageFlag = true; // 排序时回到首页 // 排序 this.sortKey = ApexPages.currentPage().getParameters().get('sortKey'); System.debug('###########sortKey='+this.sortKey); System.debug('###########preSortKey='+this.preSortKey); if (this.sortKey == this.preSortKey) { // 方向が変わるのみ this.sortOrderAsc = !this.sortOrderAsc; this.sortOrderList[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc == true ? '↑' : '↓'); } else { if (preSortKey == '') { preSortKey = '0'; } this.sortOrderAsc = true; this.sortOrderList[Integer.valueOf(this.preSortKey)] = ' '; this.sortOrderList[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc == true ? '↑' : '↓'); } System.debug('###########sortOrderAsc='+this.sortOrderAsc); this.preSortKey = this.sortKey; // 获取排序后借出备品一览 getAllAssetData(); } // 获取保有设备 private void getAllAssetData() { internalAssetLocation = searchB.internal_asset_location; List oldAssetInfoList = new List(); List newAssetInfoList = new List(); List oldAssetDataIdList = new List(); List checkedSavingDataIdList = new List(); if (allAssetInfoList.size() > 0) { for (AssetInfo eachOldAssetInfo : allAssetInfoList) { if (eachOldAssetInfo.isCheck == true) { oldAssetInfoList.add(eachOldAssetInfo); oldAssetDataIdList.add(eachOldAssetInfo.assetQuertResult.Id); if (searchFromSave == true) { checkedSavingDataIdList.add(eachOldAssetInfo.assetQuertResult.Id); } } } } System.debug('oldAssetInfoList===' + oldAssetInfoList); checkedAssetInfoNum = oldAssetInfoList.size(); allAssetInfoList.clear(); totalFixDataNum = oldAssetInfoList.size(); // 打勾固定数据数量 if (searchFromBtn == true || searchFromSave == true) { // 来自导航快捷键,去掉打钩项 oldAssetDataIdList.clear(); oldAssetInfoList.clear(); searchFromBtn = false; //searchFromSave = false; totalFixDataNum = 0; } allAssetInfoList.addAll(oldAssetInfoList); String dateToday = String.valueOf(Date.today()); String soqlAsset = ''; soqlAsset += 'SELECT Id, ' + targetColumusStr + ' FROM Asset '; //soqlAsset += 'WHERE RecordTypeId = \'' + System.Label.Asset_RecordType + '\' '; // RecordType备品 soqlAsset += 'WHERE Asset_Owner__c = \'' + 'Olympus' + '\' '; soqlAsset += 'AND Delete_Flag__c = false '; // 逻辑删除 soqlAsset += 'AND AssetManageConfirm__c = true '; // 备品中心确认 if (oldAssetDataIdList.size() > 0) { soqlAsset += 'AND Id NOT IN :oldAssetDataIdList '; } if (String.isNotBlank(assertQueryCondition)) { // 导航区快捷键备品状态 if (assertQueryCondition == 'all') { // 备品检索条件assertQueryCondition为空视为 查看全部保佑设备 assetStatus = NONE; } else if (assertQueryCondition == 'consumable') { assetStatus = NONE; soqlAsset += 'AND You_Xiao_Ku_Cun__c > 0 '; // 有效库存 } else if (assertQueryCondition == 'lending') { // 查看出借中保有设备 assetStatus = NONE; soqlAsset += 'AND Out_of_wh__c > 0 '; // 借出分配数 } else if (assertQueryCondition == 'repairing') { // 修理中 assetStatus = NONE; soqlAsset += 'AND (Repairing_Count__c > 0 OR Draft_Repair_Count__c > 0) '; // 修理中件数 + 草案中修理件数 > 0 } else if (assertQueryCondition == 'scrapping') { // 待报废 assetStatus = NONE; soqlAsset += 'AND (Abandoned_RealThing__c > 0 OR Abandoned_Inventory__c > 0) '; // 待废弃数(实物) 或者 待废弃数(丢失/盘亏) } else if (assertQueryCondition == 'scrapped') { // 已报废 assetStatus = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Fei_Qi.ordinal()); } else if (assertQueryCondition == 'consumed') { // 已消耗 assetStatus = NONE; soqlAsset += 'AND Consumed_Count__c > 0 ';// 已消耗数大于0 } else if (assertQueryCondition == 'soonExpired') { // 即将到期 assetStatus = NONE; Datetime time1 = Datetime.now(); Datetime future = time1.addMonths(1); // 这次能用format的原因是左边是Date类型,右边是DateTime类型 // 如果左边和右边都是DateTime类型的话就不能这么用了,因为Salfesforce里面保存的是格林志时间 soqlAsset += 'AND (Consumable_Guaranteen_end__c > ' + time1.format('YYYY-MM-dd') + ' AND Consumable_Guaranteen_end__c <= ' + future.format('YYYY-MM-dd') + ') '; // 1个月内即将到期的 } else if (assertQueryCondition == 'expired') { // 已过期 assetStatus = NONE; soqlAsset += 'AND Expired_Count_F__c > 0 ';// 已过期数>0 } } String notScriptedAssetStatus1 = ''; System.debug('assetStatus111==' + assetStatus); System.debug('fromQuickBarFlag3==' + fromQuickBarFlag); System.debug('checkFromQuickBarFlag===' + checkFromQuickBarFlag); if(assetStatus != FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Fei_Qi.ordinal()) && checkFromQuickBarFlag == 'false') { assetStatus = searchB.fixture_Status; } else if (searchB.fixture_Status != NONE && checkFromQuickBarFlag == 'false') { // 如果查看废弃保有设备同时选择了其他备品状态 notScriptedAssetStatus1 = searchB.fixture_Status; } System.debug('assetStatus222==' + assetStatus); System.debug('notScriptedAssetStatus1==' + notScriptedAssetStatus1); fromQuickBarFlag = 'false'; if (checkFromQuickBarFlag == null || checkFromQuickBarFlag == 'true') { internalAssetLocation = ''; } if (UserInfo.getProfileId() != System.Label.ProfileId_SystemAdmin && !(System.Label.ProfileId_EquCenAdmin.contains(UserInfo.getProfileId()))) { // ProfileId 2B3_备品中心管理者 if (String.isBlank(internalAssetLocation)) { internalAssetLocation = loginUserList[0].Default_Referable_Apply_Equipment_Center__c; // User.默认可参照备品中心 searchB.internal_asset_location = loginUserList[0].Default_Referable_Apply_Equipment_Center__c; // User.默认可参照备品中心 } } if (String.isNotBlank(internalAssetLocation)) { //系统管理员 ,2B3_备品中心管理者, 2B3_备品中心管理者(照片) 可以进行更新 if (UserInfo.getProfileId() == System.Label.ProfileId_SystemAdmin || System.Label.ProfileId_EquCenAdmin.contains(UserInfo.getProfileId())) { onlyReadFlag = false; if (internalAssetLocation != '全部' && internalAssetLocation != 'All') { soqlAsset += 'AND Internal_asset_location__c = \'' + String.escapeSingleQuotes(internalAssetLocation) + '\' '; }// 20210628 you 1650 AgencyProfileId 办事处没有更改得权限 } else if (internalAssetLocation != loginUserList[0].Default_Referable_Apply_Equipment_Center__c || System.Label.AgencyProfileId.contains(UserInfo.getProfileId())){ onlyReadFlag = true; if (internalAssetLocation != '全部' && internalAssetLocation != 'All') { soqlAsset += 'AND Internal_asset_location__c = \'' + String.escapeSingleQuotes(internalAssetLocation) + '\' '; } } else { onlyReadFlag = false; if (internalAssetLocation != '全部' && internalAssetLocation != 'All') { soqlAsset += 'AND Internal_asset_location__c = \'' + String.escapeSingleQuotes(internalAssetLocation) + '\' '; } } // 备品存放地 } if (String.isNotBlank(searchB.fixture_Model_No) && checkFromQuickBarFlag == 'false') { soqlAsset += 'AND Fixture_Model_No_F__c LIKE \'%' + String.escapeSingleQuotes(searchB.fixture_Model_No.trim().replaceAll('%', '\\%')) + '%\' '; } // 备品配套明细型号 if (String.isNotBlank(searchB.wh_location) && checkFromQuickBarFlag == 'false') { soqlAsset += 'AND WH_Location__c = \'' + String.escapeSingleQuotes(searchB.wh_location.trim()) + '\' '; } // 货架号 if (assetStatus != NONE && assetStatus != null && assetStatus != '') { System.debug('assetStatus=======' + assetStatus); if (assetStatus == FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Xiu_Li_Zhong.ordinal())) { // 修理中 // 个体管理: 备品状态; 数量管理: 修理中件数 + 草案中修理件数 > 0 soqlAsset += 'AND (Fixture_Status__c = \'' + String.escapeSingleQuotes(assetStatus) + '\' '; soqlAsset += 'OR (Repairing_Count__c > 0 '; soqlAsset += 'OR Draft_Repair_Count__c > 0)) '; } else if (assetStatus == FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Dai_Fei_Qi.ordinal())) { // 待报废 // 个体管理: 备品状态; 数量管理: 待废弃数(实物) > 0 soqlAsset += 'AND (Fixture_Status__c = \'' + String.escapeSingleQuotes(assetStatus) + '\' '; soqlAsset += 'OR Abandoned_RealThing__c > 0) '; } else if (assetStatus == FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Fei_Qi.ordinal())) { // 已报废 // 备品状态 soqlAsset += 'AND Fixture_Status__c = \'' + String.escapeSingleQuotes(assetStatus) + '\' '; } else { assetStatus = assetStatus == '废弃' ? FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Fei_Qi.ordinal()) : assetStatus; soqlAsset += 'AND Fixture_Status__c = \'' + String.escapeSingleQuotes(assetStatus) + '\' '; } if (notScriptedAssetStatus1 != '') { soqlAsset += 'AND Fixture_Status__c = \'' + String.escapeSingleQuotes(notScriptedAssetStatus1) + '\' '; } } // 备品状态 if (String.isNotBlank(searchB.equipmentSet_Managment_Code) && checkFromQuickBarFlag == 'false') { soqlAsset += 'AND EquipmentSet_Managment_Code__c = \'' + String.escapeSingleQuotes(searchB.equipmentSet_Managment_Code.trim()) + '\' '; } // 备品管理编码 if (String.isNotBlank(searchB.internal_Asset_number) && checkFromQuickBarFlag == 'false') { soqlAsset += 'AND Internal_Asset_number__c = \'' + String.escapeSingleQuotes(searchB.internal_Asset_number.trim()) + '\' '; } // 固定资产编号 if (String.isNotBlank(searchB.serialNumber) && checkFromQuickBarFlag == 'false') { soqlAsset += 'AND SerialNumber = \'' + String.escapeSingleQuotes(searchB.serialNumber.trim()) + '\' '; } // 机身号 シリアル番号 if (String.isNotBlank(searchB.companyOfEquipment) && checkFromQuickBarFlag == 'false') { soqlAsset += 'AND CompanyOfEquipment__c = \'' + String.escapeSingleQuotes(searchB.companyOfEquipment) + '\' '; } // 财务所属分公司 if (searchB.bodyOrAccessory != NONE && searchB.bodyOrAccessory != null && searchB.bodyOrAccessory != '' && checkFromQuickBarFlag == 'false') { if (searchB.bodyOrAccessory == '主体') { soqlAsset += 'AND Loaner_accsessary__c = false '; } else { soqlAsset += 'AND Loaner_accsessary__c = true '; } } // 主体/附属品 if (String.isNotBlank(searchB.product_category) && checkFromQuickBarFlag == 'false') { soqlAsset += 'AND Product_category__c = \'' + String.escapeSingleQuotes(searchB.product_category.trim()) + '\' '; } // 产品分类 if (String.isNotBlank(searchB.equipment_Type) && checkFromQuickBarFlag == 'false') { soqlAsset += 'AND Equipment_Type__c = \'' + String.escapeSingleQuotes(searchB.equipment_Type.trim()) + '\' '; } // 备品分类 if (String.isNotBlank(searchB.manage_type) && checkFromQuickBarFlag == 'false') { soqlAsset += 'AND Manage_type__c = \'' + String.escapeSingleQuotes(searchB.manage_type.trim()) + '\' '; } // 管理种类 if (String.isNotBlank(searchB.salesdepartment) && checkFromQuickBarFlag == 'false') { soqlAsset += 'AND Salesdepartment__c = \'' + String.escapeSingleQuotes(searchB.salesdepartment.trim()) + '\' '; } // 所在地区 本部 Saless_Department__c if (String.isNotBlank(searchB.salesProvince) && checkFromQuickBarFlag == 'false') { soqlAsset += 'AND SalesProvince__c = \'' + String.escapeSingleQuotes(searchB.salesProvince.trim()) + '\' '; } // 所在地区 省 Sales_Province__c if (String.isNotBlank(searchB.asset_loaner_category) && checkFromQuickBarFlag == 'false') { if(searchB.asset_loaner_category == '耗材') { soqlAsset += 'AND Asset_loaner_category__c = \'耗材\''; } else { soqlAsset += 'AND Asset_loaner_category__c != \'耗材\''; } } // 备品类别 if (String.isNotBlank(searchB.daysToExpired) && checkFromQuickBarFlag == 'false') { Datetime time1 = Datetime.now(); Datetime future = time1.addDays(Integer.valueOf(searchB.daysToExpired)); // 这次能用format的原因是左边是Date类型,右边是DateTime类型 // 如果左边和右边都是DateTime类型的话就不能这么用了,因为Salfesforce里面保存的是格林志时间 soqlAsset += 'AND (Consumable_Guaranteen_end__c > ' + time1.format('YYYY-MM-dd') + ' AND Consumable_Guaranteen_end__c <= ' + future.format('YYYY-MM-dd') + ') '; } // 到期时间 if (searchB.consumable_Guaranteen_end != NULL && checkFromQuickBarFlag == 'false') { Date tempDate; tempDate = searchB.consumable_Guaranteen_end; // if (consumableGuaranteenEndEditableFlag) { // tempDate = searchB.consumable_Guaranteen_end; // } else { // tempDate = consumableGuaranteenEndDate; // } soqlAsset += 'AND Consumable_Guaranteen_end__c = :tempDate '; } // 消耗品有效期至 Consumable_Guaranteen_End__c // ---------------检索区--------------- if (!allApiList.contains('Id')) { allApiList.add(0, 'Id'); } // 判断2000条限制 System.debug('soql2000===' + soqlAsset.right(299) + ' LIMIT 2001 '); Integer allAssetDataCheckSize = Database.query(soqlAsset + ' LIMIT 2001 ').size(); excess2000Flag = false; if(allAssetDataCheckSize > 2000) { excess2000Flag = true; ApexPages.Message excess2000Msg = new ApexPages.Message(ApexPages.severity.WARNING, '检索数据已超过2000条,无法显示超过2000条的部分,请追加检索条件。'); ApexPages.addMessage(excess2000Msg); } soqlAsset += ' ORDER BY ' + this.allApiList[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first ' : 'desc nulls last '); totalSoqlRecordNum = allAssetDataCheckSize > 2000 ? 2000 : allAssetDataCheckSize; totalNum = oldAssetDataIdList.size() + totalSoqlRecordNum; // 总的显示数量 totalPage = (totalNum/selctRecordNum) + (Math.mod(totalNum, selctRecordNum) > 0 ? 1 : 0); // 总页数 if (returnFirstPageFlag) { currPage = 1; } System.debug('currPage===' + currPage); System.debug('totalPage===' + totalPage); if (selRecordOption != NONE) { // selRecordOption = String.valueOf(Integer.valueOf(selRecordOption) + checkedAssetInfoNum); if (currPage == 1) { soqlAsset += ' limit ' + selRecordOption; } else if (currPage >= totalPage) { currPage = totalPage; soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage - 1) * selctRecordNum - checkedAssetInfoNum); System.debug('Last page;'); } else { soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage - 1) * selctRecordNum - checkedAssetInfoNum); } } // 最终检索结果 allAssetDataList = Database.query(soqlAsset); if (allAssetDataList.size() > 0) { for (Asset eachAssetDataList : allAssetDataList) { AssetInfo resultAssertInfo = new AssetInfo(); resultAssertInfo.assetQuertResult = eachAssetDataList; resultAssertInfo.isCheck = false; newAssetInfoList.add(resultAssertInfo); } allAssetInfoList.addAll(newAssetInfoList); } System.debug('Asset soql====' + soqlAsset); totalUnfixDataNum = allAssetInfoList.size() - totalFixDataNum; if (searchFromSave == true) { List headAssetList = new List(); // 暂存打勾项, 优先显示 List headAssetInfoList = new List(); // 暂存打勾项, 优先显示 List trailAssetInfo = new List(); List tempAssetInfoList = new List(allAssetInfoList); allAssetInfoList.clear(); // 获取打勾固定项 headAssetList = Database.query('SELECT Id, ' + targetColumusStr + ' FROM Asset WHERE Id IN :checkedSavingDataIdList LIMIT 2000'); for (Asset eachheadAsset : headAssetList) { AssetInfo tempHeadAssetInfo = new AssetInfo(); tempHeadAssetInfo.isCheck = true; tempHeadAssetInfo.assetQuertResult = eachheadAsset; headAssetInfoList.add(tempHeadAssetInfo); } for (AssetInfo eachAssetInfo : tempAssetInfoList) { if (!checkedSavingDataIdList.contains(eachAssetInfo.assetQuertResult.Id)) { trailAssetInfo.add(eachAssetInfo); } } allAssetInfoList.addAll(headAssetInfoList); allAssetInfoList.addAll(trailAssetInfo); searchFromSave = false; } checkFromQuickBarFlag = 'false'; System.debug('allAssetInfoList===' + allAssetInfoList); System.debug('Test allAssetInfoListallAssetInfoList = ' + allAssetInfoList); } // csv export public PageReference csvExprot() { exportCsvResultList = new List>(); if (allApiList.contains('Id')) { allApiList.remove(0); } assetExportCsvList = new List(); for (AssetInfo eachAssetInfo : allAssetInfoList) { List exportCsvRowList = new List(); if (eachAssetInfo.isCheck) { exportCsvRowList.add(eachAssetInfo.assetQuertResult.Id); for (String eachApi : allApiList) { System.debug('----====----'); System.debug(eachApi); System.debug(eachAssetInfo.assetQuertResult.get(eachApi)); System.debug('++++:::::++++'); if (eachAssetInfo.assetQuertResult.get(eachApi) != null) { //exportCsvRowList.add(String.valueOf(eachAssetInfo.assetQuertResult.get(eachApi)).escapeCsv()); exportCsvRowList.add(String.valueOf(eachAssetInfo.assetQuertResult.get(eachApi))); } else { exportCsvRowList.add(''.escapeCsv()); } } exportCsvResultList.add(exportCsvRowList); System.debug('exportCsvRowList===' + exportCsvRowList); } } return Page.ExportAllOlympusAsset.setRedirect(false); } // 适用按钮 public void applyBtn() { String strMessage = null; } // 适用区域信息提示 public void showApplyMsg() { String applyMsg = ApexPages.currentPage().getParameters().get('applyMsg'); String applyMsgType = ApexPages.currentPage().getParameters().get('applyMsgType'); String applyErrorLabel = ApexPages.currentPage().getParameters().get('applyErrorLabel'); if(applyMsgType == 'Fail') { ApexPages.Message vfApplyMsg = new ApexPages.Message(ApexPages.severity.ERROR, applyMsg); ApexPages.addMessage(vfApplyMsg); System.debug('applyMsg===' + applyMsg); System.debug('applyMsgType===' + applyMsgType); System.debug('applyErrorLabel===' + applyErrorLabel); if(applyErrorLabel != null) { System.debug('applyErrorLabel===' + applyErrorLabel); } } else { ApexPages.Message vfApplyMsg = new ApexPages.Message(ApexPages.severity.INFO, applyMsg); ApexPages.addMessage(vfApplyMsg); } } // 保存按钮 当保存时先将修改flag置0,只更新打勾的,未打勾的将在下次保存时刷掉。 public PageReference saveBtn() { isSavingSuccess = 'true'; List saveAssetList = new List(); if (changeFlg == '1') { changeFlg = '0'; } Set assetId = new Set(); for (AssetInfo eachAssetInfoList : allAssetInfoList) { // 只更新打勾的 if (eachAssetInfoList.isCheck == true) { saveAssetList.add(eachAssetInfoList.assetQuertResult); assetId.add(eachAssetInfoList.assetQuertResult.Id); } } totalFixDataNum = saveAssetList.size(); // 打勾固定数据数量 totalUnfixDataNum = allAssetInfoList.size() - totalFixDataNum; // 未打勾固定数据数量 Boolean errorFlag = false; Boolean errorFlaglook = false; String errorMsg = '保存失败,导入CSV数据存在问题。'; //Map errorSavingMap = new Map (); if (saveAssetList.size() > 0) { Map assMap = new Map(); for (Asset ass : [Select Id, LastModifiedDate FROM Asset Where Id = :assetId for Update]) { assMap.put(ass.Id, ass); } System.debug('saveAssetList'); //Savepoint spAsset = Database.setSavepoint(); // Database.update(saveAssetList); // withsharing Map saveAssetFieldMap = Asset.getSObjectType().getDescribe().fields.getMap(); for (Asset eachSavingAsset : saveAssetList) { for (String eachApi : allApiList) { DescribeFieldResult saveAssetFieldResult = saveAssetFieldMap.get(eachApi).getDescribe(); if (!saveAssetFieldResult.isCalculated()) { if (saveAssetFieldResult.getType() == Schema.DisplayType.Picklist) { List ple = saveAssetFieldResult.getPicklistValues(); List pleList = new List(); for (Schema.PicklistEntry s : ple) { pleList.add(s.getValue()); } if (!pleList.contains(String.valueOf(eachSavingAsset.get(eachApi))) && String.valueOf(eachSavingAsset.get(eachApi)) != null) { errorFlag = true; isSavingSuccess = 'false'; String targetLabel = allLabelList.get(allApiList.indexOf(eachApi) - 1); // allApiList[0]为Id,allLabelList中不存在。 String errorMsgField = targetLabel + ' 中不存在 ' + String.valueOf(eachSavingAsset.get(eachApi)) + '。 '; System.debug('targetLabel===' + targetLabel); System.debug('eachApi===' + eachApi); if (eachApi == 'Internal_asset_location__c') { // 备品存放地 eachSavingAsset.Internal_asset_location__c.addError(errorMsgField); } else if (eachApi == 'Salesdepartment__c') { // 所在地区(本部) eachSavingAsset.Salesdepartment__c.addError(errorMsgField); } else if (eachApi == 'SalesProvince__c') { // 所在地区(省) eachSavingAsset.SalesProvince__c.addError(errorMsgField); } else if (eachApi == 'CompanyOfEquipment__c') { // 备品所属公司 eachSavingAsset.CompanyOfEquipment__c.addError(errorMsgField); } else if (eachApi == 'Product_category__c') { // 产品分类(GI/SP) eachSavingAsset.Product_category__c.addError(errorMsgField); } else if (eachApi == 'Equipment_Type__c') { // 备品分类 eachSavingAsset.Equipment_Type__c.addError(errorMsgField); } else if (eachApi == 'Manage_type__c') { // 管理种类 eachSavingAsset.Manage_type__c.addError(errorMsgField); } else if (eachApi == 'Asset_loaner_category__c') { // 备品类别 eachSavingAsset.Asset_loaner_category__c.addError(errorMsgField); } } } } } if (assMap.containsKey(eachSavingAsset.Id) && assMap.get(eachSavingAsset.Id).LastModifiedDate != eachSavingAsset.LastModifiedDate) { ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, '保有设备:' + eachSavingAsset.Fixture_Model_No_F__c + ' ' + eachSavingAsset.SerialNumber + '有被更新过,请刷新画面重试'); ApexPages.addMessage(errorMessage); errorFlaglook = true; } System.debug('errorFlag===' + errorFlag); } if (errorFlaglook) { isSavingSuccess = 'false'; return null; } if (errorFlag) { System.debug('errorFlagerrorFlag' + errorFlag); isSavingSuccess = 'false'; System.debug('errorMsg' + errorMsg); ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, errorMsg); ApexPages.addMessage(errorMessage); errorFlag = false; return null; } //if(!errorSavingMap.isEmpty()) { // String errorMsg; // errorMsg += '导入CSV数据存在问题,'; // for (String eachErrorApiKey : errorSavingMap.keySet()) { // System.debug('eachErrorApiKey' + eachErrorApiKey); // String eachErrorValue = String.valueOf(errorSavingMap.get(eachErrorApiKey)); // System.debug('eachErrorValue' + eachErrorValue); // errorMsg += eachErrorApiKey + '中不存在' + eachErrorValue; // } // System.debug(errorMsg); //} //ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, '导入过程出现错误,请检查CSV文件格式。'); //ApexPages.addMessage(errorMessage); try { System.debug('saveAssetList====----===' + saveAssetList); Database.SaveResult[] saveResultList = FixtureUtil.withoutUpdate(saveAssetList, true); // withoutsharing //Database.SaveResult[] saveResultList = Database.update(saveAssetList, true); getAllAssetData(); } catch (Exception e) { //Database.rollback(spAsset); System.debug('eeee' + e); } } searchFromSave = true; return null; } // 保存完了信息提示 public void setSaveSuccessMsg() { ApexPages.Message savingSuccessfullyMessage = new ApexPages.Message(ApexPages.severity.INFO, '保存成功。'); ApexPages.addMessage(savingSuccessfullyMessage); } public Date stringToDate(String dateStr) { // Fri Jan 18 00:00:00 GMT 2019 //System.debug('dateStr=====' + dateStr); return Date.valueOf(dateStr); //String monthStr = dateStr.substring(4,7); //Integer dayStr = Integer.ValueOf(dateStr.substring(8,10)); //Integer yearStr = Integer.ValueOf(dateStr.substring(24,28)); //Integer strMonth; //switch on monthStr { // when 'Jan' { // strMonth = 01; // } when 'Feb' { // strMonth = 02; // } when 'Mar' { // strMonth = 03; // } when 'Apr' { // strMonth = 04; // } when 'May' { // strMonth = 05; // } when 'Jun' { // strMonth = 06; // } when 'Jul' { // strMonth = 07; // } when 'Aug' { // strMonth = 08; // } when 'Sep' { // strMonth = 09; // } when 'OCt' { // strMonth = 10; // } when 'Nov' { // strMonth = 11; // } when 'Dec' { // strMonth = 12; // } //} //return date.newinstance(yearStr, strMonth, dayStr); } public void importCSVFile() { System.debug('*************importCSVFile*************'); allAssetInfoList.clear(); // 清空检索结果 allAssetDataList.clear(); // 清空检索结果 用于统计数量 String csvData = ApexPages.currentPage().getParameters().get('csvData'); System.debug('------' + csvData + '------'); System.debug('111111'); List> tempCsvBody = CSVReader.readIETFRFC4180CSVFile(Blob.valueof(csvData)); // 全部CSV数据 System.debug('222222'); List importApiList = tempCsvBody[0]; // CSV读入的标题行 ID + Label List importLabelList = tempCsvBody[1]; // CSV读入的标题行 ID + Label Map importAssetMap = new Map(); // 导入CSV生成的AssetList // 检查CSV列是否一一对应 List allLabelList = new List(); // 默认的 ID + Label if (!allLabelList.contains('Id')) { allLabelList.add('Id'); } allLabelList.addAll(leftLabelList); allLabelList.addAll(rightLabelList); for (Integer i = 0; i < importLabelList.size(); i++) { if (importLabelList[i].contains('不可修改')) { importLabelList[i] = importLabelList[i].remove('(不可修改)'); } } System.debug('333333'); // 检索CSV中的ID检索Asset获得List try { if (allApiList.contains('Id')) { allApiList.remove(0); } if (importApiList.contains('Id(不可修改)')) { importApiList.remove(0); } List notIncludeApiList = new List(); for (String eachApi : allApiList) { if ((!importApiList.contains(eachApi)) && (!importApiList.contains(eachApi+'(不可修改)'))) { notIncludeApiList.add(eachApi); } } Map queryAssetFieldMap = Asset.getSObjectType().getDescribe().fields.getMap(); for (Integer i = 2; i < tempCsvBody.size(); i++) { Asset tempAsset = getAsset(); System.debug('--------==========----------'); System.debug('internalAssetLocationLogin===' + internalAssetLocationLogin); System.debug('1234' + tempCsvBody[i][1]); if (UserInfo.getProfileId() == System.Label.ProfileId_SystemAdmin || System.Label.ProfileId_EquCenAdmin.contains(UserInfo.getProfileId())) { internalAssetLocationLogin = FixtureUtil.bieCunFangDiOpsMap.get('备品管理中心')[0].getValue(); // SelectOption('All', '--全部--') } else { List tempBieCunFangDiOpsList = FixtureUtil.bieCunFangDiOpsMap.get('备品管理中心'); internalAssetLocationLogin = beipinCunFangDi; } if(internalAssetLocationLogin != 'All' && tempCsvBody[i][1] != internalAssetLocationLogin) { continue; } for (Integer j = 0; j < importApiList.size(); j++) { if (importApiList[j].contains('(不可修改)')) { importApiList[j] = importApiList[j].remove('(不可修改)'); } DescribeFieldResult queryAssetFieldResult = queryAssetFieldMap.get(importApiList[j]).getDescribe(); if (!queryAssetFieldResult.isCalculated()) { if (queryAssetFieldResult.getType() == Schema.DisplayType.Date) { if (tempCsvBody[i][j+1] != '') { tempAsset.put(importApiList[j], stringToDate(tempCsvBody[i][j+1])); } } else if (queryAssetFieldResult.getType() == Schema.DisplayType.Boolean) { if (tempCsvBody[i][j+1] != '') { tempAsset.put(importApiList[j], Boolean.valueOf(tempCsvBody[i][j+1])); } } else if (queryAssetFieldResult.getType() == Schema.DisplayType.Double) { if (tempCsvBody[i][j+1] != '') { tempAsset.put(importApiList[j], Decimal.valueOf(tempCsvBody[i][j+1])); } } else { tempAsset.put(importApiList[j], tempCsvBody[i][j+1]); } } } importAssetMap.put(tempCsvBody[i][0], tempAsset); } System.debug('importAssetMap===---===' + importAssetMap); if (!importAssetMap.isEmpty()) { Set importAssetId = importAssetMap.keySet(); String soqlAsset = ''; soqlAsset += 'SELECT Id, ' + targetColumusStr + ' FROM Asset '; //soqlAsset += 'WHERE RecordTypeId = \'' + System.Label.Asset_RecordType + '\' '; soqlAsset += 'WHERE Asset_Owner__c = \'' + 'Olympus' + '\' '; soqlAsset += 'AND Id IN :importAssetId LIMIT 2000 '; //System.debug('soqlAsset====' + soqlAsset); // 导入csv时,获取相应的数据库中的数据与导入的CSV数据比较,只更新存在差异的文件。 allAssetDataList = Database.query(soqlAsset); // importAssetMap => allAssetDataList Id for (Asset eachOldAsset : allAssetDataList) { Asset updatingAsset = importAssetMap.get((Id)(eachOldAsset.get('Id'))); for (String eachAllApi : importApiList) { DescribeFieldResult queryAssetFieldResult = queryAssetFieldMap.get(eachAllApi).getDescribe(); if (queryAssetFieldResult.isCalculated()) { continue; } System.debug('test1'); if ((eachOldAsset.get(eachAllApi) != updatingAsset.get(eachAllApi)) && (!notIncludeApiList.contains(eachAllApi))) { eachOldAsset.put(eachAllApi, updatingAsset.get(eachAllApi)); } System.debug('test2'); } System.debug('eachOldAsset-======' + eachOldAsset); AssetInfo updatingAssetInfo = new AssetInfo(); updatingAssetInfo.isCheck = true; updatingAssetInfo.assetQuertResult = eachOldAsset; allAssetInfoList.add(updatingAssetInfo); System.debug('allAssetInfoList===---' + allAssetInfoList); } } System.debug('test3'); totalFixDataNum = allAssetInfoList.size(); totalUnfixDataNum = allAssetInfoList.size() - totalFixDataNum; totalSoqlRecordNum = 0; Integer importAssetMapSize = importAssetMap.size(); if (importAssetMapSize == 0) { ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.WARNING, '未导入任何数据,请检查CSV文件')); } else { String importSuccessfulMsg = '导入CSV文件完成,成功导入' + importAssetMapSize + '条数据。'; ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.INFO, importSuccessfulMsg); ApexPages.addMessage(errorMessage); } } catch (Exception e) { System.debug('1234 ' + e); ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, '导入过程出现错误,导入文件中可能存在Fieldset中不存在的列名,请检查CSV文件。'); ApexPages.addMessage(errorMessage); } } // 翻页到首页 public Integer soqlNos(){ getAllAssetData(); return totalNum; } public void firstPage() { currPage = 1; totalNum = soqlNos(); totalPage = (totalNum/selctRecordNum) + (Math.mod(totalNum, selctRecordNum) > 0 ? 1 : 0); } // 向前翻页 public void previousPage() { returnFirstPageFlag = false; currPage --; totalNum = soqlNos(); totalPage = (totalNum/selctRecordNum) + (Math.mod(totalNum, selctRecordNum) > 0 ? 1 : 0); } // 向后翻页 public void nextPage() { returnFirstPageFlag = false; if (totalNum == 0) { currPage = 1; } else { currPage ++; } totalNum = soqlNos(); System.debug('totalNum ==' + totalNum); totalPage = (totalNum/selctRecordNum) + (Math.mod(totalNum, selctRecordNum) > 0 ? 1 : 0); System.debug('totalPage ==' + totalPage); System.debug('currPage ==' + currPage); } // 翻页到尾页 public void endPage() { System.debug('currPage11===' + currPage); System.debug('totalPage11===' + totalPage); returnFirstPageFlag = false; totalNum = soqlNos(); // 获取总页数 totalPage = (totalNum/selctRecordNum) + (Math.mod(totalNum, selctRecordNum) > 0 ? 1 : 0); if (totalNum == 0){ currPage = 1; } else { currPage = totalPage; // 将当前页数置为总页数 } totalNum = soqlNos(); System.debug('currPage1===' + currPage); System.debug('totalPage1===' + totalPage); } // 每页显示记录数变更 public void recordNumChange() { currPage = 1; totalPage = (totalNum/selctRecordNum) + (Math.mod(totalNum, selctRecordNum) > 0 ? 1 : 0); } // 清空检索条件 public void clearAllSearchConditionWhenCancel() { // 备品存放地 //if (UserInfo.getProfileId() != System.Label.ProfileId_SystemAdmin) { // if (String.isBlank(internalAssetLocation)) { // internalAssetLocation = beipinCunFangDi; // } //} // 对于备品管理者,2B3_备品中心管理者、2B3_备品中心管理者(照片) 默认显示北京、上海、广州备品中心的库存,可以检索 //if (UserInfo.getProfileId() == System.Label.ProfileId_SystemAdmin || System.Label.ProfileId_EquCenAdmin.contains(UserInfo.getProfileId())) { // internalAssetLocation1 = FixtureUtil.bieCunFangDiOpsMap.get('备品管理中心')[0].getValue(); // SelectOption('All', '--全部--') //} else { // List tempBieCunFangDiOpsList = FixtureUtil.bieCunFangDiOpsMap.get('备品管理中心'); // internalAssetLocation1 = beipinCunFangDi; //} searchB.internal_asset_location = internalAssetLocationLogin; searchB.fixture_Model_No = ''; // 备品配套明细型号 searchB.wh_location = ''; // 货架号 searchB.fixture_Status = ''; // 备品状态 searchB.equipmentSet_Managment_Code = ''; // 备品管理编码 searchB.internal_Asset_number = ''; // 固定资产号 searchB.serialNumber = ''; // 机身号 searchB.companyOfEquipment = ''; // 分公司号 searchB.bodyOrAccessory = ''; // 主体/附属品 searchB.product_category = ''; // 产品分类 searchB.equipment_Type = ''; // 备品分类 searchB.manage_type = ''; // 管理种类 searchB.salesdepartment = ''; // 所在地区(本部) searchB.salesProvince = ''; // 所在地区(省) searchB.consumable_Guaranteen_endStr = ''; // 消耗品有效期至 searchB.asset_loaner_category = ''; // 备品类别 searchB.daysToExpired = ''; // 到期时间 System.debug('Before searching.'); searchBtn(); } public List getPlickList(String objApi, String fieldApi) { Schema.DescribeFieldResult fieldResult = Schema.getGlobalDescribe().get(objApi).getDescribe().fields.getMap().get(fieldApi).getDescribe(); List pickListValuesList= new List(); List ple = fieldResult.getPicklistValues(); pickListValuesList.add(new SelectOption('', NONE)); for( Schema.PicklistEntry pickListVal : ple){ pickListValuesList.add(new SelectOption(pickListVal.getValue(), pickListVal.getLabel())); } return pickListValuesList; } // 画面检索Bean public Class SearchBean { // 为了节省viewstate所以不使用Sobject // public Asset assetQuery {get; set;} // 查询用 public String internal_asset_location {get; set;} // 备品存放地 public String fixture_Model_No {get; set;} // 备品配套明细型号 Fixture_Model_No__c public String wh_location {get; set;} // 货架号 WH_location__c public String fixture_Status {get; set;} // 备品状态 public String equipmentSet_Managment_Code {get; set;} // 备品管理编码 public String internal_Asset_number {get; set;} // 固定资产号 public String serialNumber {get; set;} // 机身号 public String companyOfEquipment {get; set;} // 分公司号 public String bodyOrAccessory {get; set;} // 主体/附属品 public String product_category {get; set;} // 产品分类 public String equipment_Type {get; set;} // 备品分类 public String manage_type {get; set;} // 管理种类 public String salesdepartment {get; set;} // 所在地区(本部) public String salesProvince {get; set;} // 所在地区(省) public String asset_loaner_category {get; set;} // 备品类别 public String daysToExpired {get;set;} // 到期时间 public Date consumable_Guaranteen_end {get; set;} // 消耗品有效期至 public String consumable_Guaranteen_endStr { get; set{ consumable_Guaranteen_endStr = value; if (String.isNotBlank(consumable_Guaranteen_endStr)) { consumable_Guaranteen_end = Date.valueOf(consumable_Guaranteen_endStr.replace('/', '-')); } else { consumable_Guaranteen_end = null; } } } // 消耗品有效期至 } }