高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
public  class ProductScoreHistoryService{
 
  
      //通用类
      public class SearchDataBean {
        public String Id;
 
        public String BiddingProjectNameBidc;
   
      }
 
      public static string getYear(){
         Date dateNow = Date.today();
         Integer year = dateNow.year();
        Integer month = dateNow.month();
        if (month < 4) {
            year -= 1;
        }
        Integer tempiYear = year+1;
        string currentPeriod = String.valueOf('FY'+tempiYear);
        return currentPeriod;
      }
      @AuraEnabled
      public  static string GetNotCompleteData(String HospitalId){
        // GZW 取科室对应的医院Parent.Parent start
        String hosid = [select Parent.Parentid FROM Account WHERE Id = : HospitalId].Parent.Parentid;
        QueryWrapper query = new QueryWrapper(Product_Score_Table_History__c.SObjectType);
        query.eq('OCSM_Period__c',getYear());
        // query.eq('Hospital__c', HospitalId);
        query.eq('Hospital__c', hosid);
        // GZW 取科室对应的医院Parent.Parent end
        query.eq('recordtype.developername','TargetPDCA');
        List<Product_Score_Table_History__c> arrays = DataBasePlus.listPlus(query);
        String TempStr = Json.serialize(arrays);
        return TempStr;
 
      }
 
 
      @AuraEnabled
      public  static string SaveData(String JsonData){
        System.debug('JsonData+++ ' + JsonData);
         try{
          List<Product_Score_Table_History__c> ProductList = (List<Product_Score_Table_History__c>)JSON.deserialize(JsonData,List<Product_Score_Table_History__c>.class);
          // GZW update 禁止循环中做DML操作 start
          Database.update(ProductList,false);
          // for(Product_Score_Table_History__c itms:ProductList){
          //   Database.update(itms,false);
          // }
          // GZW update 禁止循环中做DML操作 end
        }
        catch(Exception ex)
        {
          return ex.getMessage();
        }
        return '成功';
      }
      ///  撤销
      @AuraEnabled
      public  static string RevokeData(String Id){
         try{
            QueryWrapper query = new QueryWrapper(Product_Score_Table_History__c.SObjectType);
            query.eq('Id',Id);
            List<Product_Score_Table_History__c> arrays = DataBasePlus.listPlus(query);
            Product_Score_Table_History__c TempData = arrays[0];
            TempData.Result__c = null;
            TempData.Revoke__c = true;
            TempData.Agency_Linkage__c = false;
            Database.update(TempData,false);
          }catch(Exception ex)
          {
            return '失败';
          }
          return '成功';
      }
      
 
      @AuraEnabled
      public  static string GetDoContentC(){
        String JsonData = CommonUtils.GetSelectedValues( Product_Score_Table_History__c.Do_Content__c.getDescribe());
        return JsonData;
      }
 
      @AuraEnabled
      public  static string GetCheckPurchaseC(){
        String JsonData = CommonUtils.GetSelectedValues( Product_Score_Table_History__c.Check_Purchase__c.getDescribe());
        return JsonData;
      }
 
      @AuraEnabled
      public  static string GetActionContentC(){
        String JsonData = CommonUtils.GetSelectedValues( Product_Score_Table_History__c.Action_Content__c.getDescribe());
        return JsonData;
      }
 
 
 
 
}