From e3c02c03dd2de442bbced87236f60a13a1cd154e Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期四, 02 三月 2023 17:51:57 +0800
Subject: [PATCH] gzw 正式环境最新代码更新

---
 force-app/main/default/classes/LostReportEditController.cls |   51 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/force-app/main/default/classes/LostReportEditController.cls b/force-app/main/default/classes/LostReportEditController.cls
index 4057a62..8b15eec 100644
--- a/force-app/main/default/classes/LostReportEditController.cls
+++ b/force-app/main/default/classes/LostReportEditController.cls
@@ -1,4 +1,4 @@
-public with sharing class LostReportEditController {
+public without sharing class LostReportEditController {
 
     public String lrid {get; set;}
     public PageBean pBean {get; set;}
@@ -64,6 +64,10 @@
                                              Rental_Apply__r.RecordType.Name,//20210428 1653 you
                                              Status_F__c,
                                              TransferApplyOwner__c, //鐢宠浜�
+                                             YunYingBuZhang__c, // 杩愯惀閮ㄩ暱 20211224 ljh SFDC-C933NJ add
+                                             RA_BuchangApprovalManagerSales__c, // 閮ㄩ暱 20211224 ljh SFDC-C933NJ add
+                                             BuchangManager_approval_time__c, // 閮ㄩ暱瀹℃壒鏃堕棿 20211214 ljh SFDC-C933NJ add
+                                             YunYingBuZhang_approval_time__c, // 杩愯惀閮ㄩ暱瀹℃壒鏃堕棿 20211214 ljh SFDC-C933NJ add
                                              Internal_asset_location_F__c, //澶囧搧瀛樻斁鍦�
                                              TransferApply__r.Bollow_Date__c, //澶囧搧涓績鍑哄簱鏃�
                                              TransferApplyDeveloperName__c, //璋冩嫧绫诲瀷
@@ -82,13 +86,21 @@
         }
 
         pBean = new PageBean(lrList[0]);
-        
+        // 20211216 ljh SFDC-C933NJ add start
+        String bz = lrList[0].RA_BuchangApprovalManagerSales__c;
+        String yybz = lrList[0].YunYingBuZhang__c;
+        if((String.isNotBlank(bz) && bz.substring(0,15) == System.Label.PersonalId && lrList[0].BuchangManager_approval_time__c != null )
+            ||(String.isNotBlank(yybz) && yybz.substring(0,15) == System.Label.PersonalId && lrList[0].YunYingBuZhang_approval_time__c != null)){
+           pBean.isShowPunish = true; 
+        }
+        // 20211216 ljh SFDC-C933NJ add end
         Set<String> assetRecordTypeList = new Set<String>();
         List<LostReport_Detail__c> lrdList = [SELECT Id,
                                                      Asset__c,
                                                      Asset__r.Id,
                                                      Fixture_Model_No_F__c,
                                                      SerialNumber__c,
+                                                     IsPunishObj__c, // 20211213 ljh SFDC-C933NJ add
                                                      Asset_Value_F__c,
                                                      Asset_Value__c,
                                                      Asset_day_F__c,
@@ -96,6 +108,7 @@
                                                      Internal_Asset_number__c,
                                                      Asset__r.Asset_day__c,
                                                      Asset__r.Asset_Value__c,
+                                                     Asset__r.Account.AgentCode_Ext__c,// 20211227 ljh SFDC-C933NJ add
                                                      Asset__r.RecordTypeId
                                                 FROM LostReport_Detail__c
                                                WHERE LostReport__c = :lrid
@@ -125,7 +138,20 @@
           DESC_RW = lgLayout2Map.get(str);
           break;
         }
-
+        // 20211214 ljh SFDC-C933NJ add start
+        // 褰撳墠鐧诲綍浜虹瓑浜� 鍙よ姵鍒�
+        String uId = UserInfo.getUserId();
+        if(uId.substring(0,15) == System.Label.PersonalId
+            && (lrList[0].Status_F__c == '鑽夋涓�' || lrList[0].Status_F__c == '鐢宠涓�')
+            && lrdList[0].Asset__r.Account.AgentCode_Ext__c != System.Label.Account_Asset_FJZ){
+            DESC_RW.put('IsPunishObj__c','wm');  
+            // 淇濆瓨鎸夐挳鏄剧ず
+            pBean.bzCanEdit = true;
+            pBean.isShowPunish = true;
+        }else{
+            DESC_RW.put('IsPunishObj__c','r');
+        }
+        // 20211214 ljh SFDC-C933NJ add end
         for (String field : DESC_RWField) {
             if (!DESC_RW.containsKey(field)) {
                 DESC_RW.put(field, 'r');
@@ -159,15 +185,27 @@
                         || lr.Status__c == '宸叉壒鍑�') {
                     throw new ControllerUtil.myException('璇风‘璁ら仐澶辨姤鍛婄姸鎬侊紝宸茬粡鎻愪氦杩囩殑鐢宠锛屼笉鑳介噸澶嶆彁浜�');
                 }
-                 pBean.lr.Status__c = '濉啓瀹屾瘯';
+                pBean.lr.Status__c = '濉啓瀹屾瘯';
             }
+
             if (pBean.rowList != null && pBean.rowList.size() > 0) {
                 List<LostReport_Detail__c> lrdList = new List<LostReport_Detail__c>();
                 for (PageRowBean prb : pBean.rowList) {
+                    // 20211215 ljh  SFDC-C933NJ add start 
+                    if(pBean.bzCanEdit && String.isBlank(prb.lrd.IsPunishObj__c)){
+                        throw new ControllerUtil.myException('銆愭槸鍚︾綒鍒欏璞°�� 蹇呴』濉啓淇濆瓨鍚庢墠鑳藉鎵�');
+                    }
+                    // 20211215 ljh  SFDC-C933NJ add end
                     lrdList.add(prb.lrd);
                 }
+
                 if (lrdList.size() > 0) {
                     update lrdList; 
+                    // 20211215 ljh  SFDC-C933NJ add start
+                    if(pBean.bzCanEdit){
+                        pBean.lr.IsFinishPunishObj__c = true;
+                    }
+                    // 20211215 ljh  SFDC-C933NJ add start
                 }
             }
             if (String.isNotBlank(saveType) && saveType == '1') {
@@ -223,6 +261,8 @@
         // 20210430 1653 you end 
         public Boolean hasApprovedFlag {get; set;}
         public Boolean islock {get; set;}
+        public Boolean bzCanEdit {get; set;} // 20211215 ljh SFDC-C933NJ add 
+        public Boolean isShowPunish {get; set;} // 20211215 ljh SFDC-C933NJ add 
         //add by rentx 20210605 start
         public ProcessInfo beiPinWindowInfo {get; set;}
         public ProcessInfo managerapprovalInfo {get; set;}
@@ -259,6 +299,8 @@
 
             lr = lr1;
             islock = System.Approval.isLocked(lr1.Id);
+            bzCanEdit = false; // 20211215 ljh SFDC-C933NJ add 
+            isShowPunish = false;// 20211216 ljh SFDC-C933NJ add 
             lrCreateDate = lr.CreatedDate.format('yyyy/MM/dd');
             ra = lr.Rental_Apply__r;
             bollow_DateStr = '';
@@ -476,7 +518,6 @@
         public LostReport_Detail__c lrd {get; set;}
         public Asset ass {get; set;}
         public String asset_dayStr {get; set;}
-
         public PageRowBean() {
             lrd = new LostReport_Detail__c();
             ass = new Asset();

--
Gitblit v1.9.1