From 07390e2fcb4adf27c928335bf27ae7939c5a80ad Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 23 五月 2023 11:28:12 +0800
Subject: [PATCH] bakcup20230523
---
force-app/main/default/classes/LexConsumableController.cls | 342 ++++++--------------------------------------------------
1 files changed, 40 insertions(+), 302 deletions(-)
diff --git a/force-app/main/default/classes/LexConsumableController.cls b/force-app/main/default/classes/LexConsumableController.cls
index 7758fd7..cf82fc8 100644
--- a/force-app/main/default/classes/LexConsumableController.cls
+++ b/force-app/main/default/classes/LexConsumableController.cls
@@ -184,6 +184,7 @@
@AuraEnabled
public static Results init(String type, String esetId, String keywordStr) {
Results results = new Results();
+ results.isNoteStay = LexUtility.getIsNoteStay();
errorMsgList = new List<String>();
warningMsgList = new List<String>();
baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
@@ -440,9 +441,12 @@
AND Consumable_order__r.Dealer_Info__c = :accountid
];
for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) {
- orderzaikuId.add(cdc1.Consumable_Product__c);
+ if(cdc1.Consumable_Product__c != null){
+ orderzaikuId.add(cdc1.Consumable_Product__c);
+ }
}
soql = makeSoqlorderdet();
+ System.debug('soql:'+soql);
size = orderzaikuId.size();
initStandardController();
product2Selected = Database.query(soql);
@@ -522,8 +526,7 @@
// attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
// }
// }
-
- List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate FROM ContentVersion WHERE FirstPublishLocationId = :ESetId];
+ List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :ESetId];
if (cvInfo.size() > 0) {
for (Integer i = 0; i < cvInfo.size(); i++) {
attachmentRecoeds.add(new ConsumableorderdetailsInfo(cvInfo[i]));
@@ -540,8 +543,10 @@
List<String> upper = new List<String>();
if (String.isNotBlank(ESetid)) {
for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) {
- if (bss.esd.Consumable_count__c + bss.allnumber > bss.upperlimit) {
- upper.add(bss.esd.Consumable_Product__r.Name__c);
+ if(bss.esd.Consumable_count__c != null && bss.allnumber != null && bss.upperlimit != null){
+ if (bss.esd.Consumable_count__c + bss.allnumber > bss.upperlimit) {
+ upper.add(bss.esd.Consumable_Product__r.Name__c);
+ }
}
}
}
@@ -591,6 +596,7 @@
// category5OptionList.add(new SelectOption('', '-鏃�-'));
category5Option.add(new CusOption('-鏃�-',''));
//return msg
+ consumableorderdetailsRecordsview = consumableorderdetailsRecords;
getConsumableShowTableFieldValue();
results.result = 'Success';
results.coc = coc;
@@ -837,300 +843,6 @@
}
}
- //搴撳瓨鎺掑簭
- public static void SortStore() {
- if (sortKey == preSortKey) {
- // 鏂瑰悜銇屽銈忋倠銇伩
- sortOrderAsc = !sortOrderAsc;
- sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
- } else {
- sortOrderAsc = true;
- sortOrder[Integer.valueOf(preSortKey)] = ' ';
- sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
- }
- preSortKey = sortKey;
- List<ConsumableorderdetailsInfo> selectedSort = new List<ConsumableorderdetailsInfo>();
- List<ConsumableorderdetailsInfo> noselectedSort = new List<ConsumableorderdetailsInfo>();
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
- ass.sortBy = sortOrderAsc;
- if (ass.check == true) {
- selectedSort.add(ass);
- } else {
- noselectedSort.add(ass);
- }
- }
- consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
- if (selectedSort.size() > 0) {
- if (searchDone != 'searchDone') {
- selectedSort.sort();
- }
- consumableorderdetailsRecordsview.addAll(selectedSort);
- }
- if (noselectedSort.size() > 0) {
- noselectedSort.sort();
- consumableorderdetailsRecordsview.addAll(noselectedSort);
- }
- }
-
- //闄愬埗鎬ф帓搴�
- public static void SortLimited() {
- List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
- Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
- List<Consumable_order_details2__c> countDel = [
- SELECT
- Id,
- Bar_Code__c,
- Name,
- Inventory_date__c,
- Consumable_Product__c,
- Consumable_Product__r.Asset_Model_No__c,
- Recordtypeid,
- Box_Piece__c,
- hospitalSpecialOffer__c,
- promotionorder__c
- FROM Consumable_order_details2__c
- WHERE
- Dealer_Arrive__c = TRUE
- AND Dealer_Shipment__c = FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = FALSE
- AND Lose_Flag__c = FALSE
- AND Bar_Code__c != NULL
- AND Arrive_Owner_Work_Location__c = :userWorkLocation
- //AND Consumable_order_minor__r.Dealer_Info__c = :accountid
- AND Dealer_Info_text__c = :accountName
- ];
- if (sortKey == preSortKey) {
- // 鏂瑰悜銇屽銈忋倠銇伩
- sortOrderAsc = !sortOrderAsc;
- sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
- } else {
- sortOrderAsc = true;
- sortOrder[Integer.valueOf(preSortKey)] = ' ';
- sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
- }
- preSortKey = sortKey;
- // 鎵�鏈変骇鍝佸彇寰�
- if (
- (EsetId == null || ESetId == '') || (EsetId != null && ESetId != '' && statusEdit == 'Redirect' && searchDone == 'searchDone')
- ) {
- String strProd = null;
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
- if (strProd == null || strProd.length() == 0) {
- strProd = '\'' + String.valueOf(ass.prod.Id) + '\'';
- } else {
- strProd += ',\'' + String.valueOf(ass.prod.Id) + '\'';
- }
- }
- String soqll = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
- //update by rentx 2020-12-31 start
- if (agencyProType == 'ET') {
- soqll += ' AND Pro2_Dealer_Object__c = true';
- }
- if (agencyProType == 'ENG') {
- soqll += ' AND Pro2_Dealer_ENG__c = true';
- }
- soqll += ' AND Intra_Trade_List_RMB__c > 0 ';
- //update by rentx 2020-12-31 end
- soqll += ' AND Id IN (' + strProd + ')';
- soqll +=
- ' order by ' +
- columus_no[Integer.valueOf(sortKey)] +
- ' ' +
- (sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last');
- List<Product2__c> queryList = Database.query(soqll);
- // 閬告姙娓堛伩銇槑缁嗐倰鍙栧緱
- Map<String, String> selectedIdMap = new Map<String, String>();
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
- if (ass.check == true) {
- selectedIdMap.put(ass.Prod.id, ass.Prod.id);
- reSet.add(ass);
- }
- }
- for (Integer i = 0; i < queryList.size(); i++) {
- if (selectedIdMap.containsKey(queryList[i].Id)) {
- // 璺宠繃宸茬粡閫夋嫨鐨勬秷鑰楀搧鏄庣粏
- continue;
- } else {
- // 鏈�夋嫨鐨勬秷鑰楀搧鏄庣粏
- MidMap.put(queryList[i].Id, new ConsumableorderdetailsInfo(queryList[i]));
- }
- }
- consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
- consumableorderdetailsRecordsview = reSet;
- for (Integer i = 0; i < countDel.size(); i++) {
- if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
- if (countDel[i].hospitalSpecialOffer__c == true) {
- //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
- if (countDel[i].promotionorder__c == true) {
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
- if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- }
- }
- //鎶妋ap閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
- for (ConsumableorderdetailsInfo bss : MidMap.values()) {
- if (selectedIdMap.containsKey(bss.Prod.Id)) {
- continue;
- } else {
- if (DealerProductMap.containsKey(bss.Prod.Id)) {
- bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
- bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
- bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
- }
- bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
- bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
- bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
-
- consumableorderdetailsRecordsview.add(bss);
- }
- }
- } else if (searchDone != 'searchDone') {
- String strProd = null;
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
- if (strProd == null || strProd.length() == 0) {
- strProd = '\'' + String.valueOf(ass.prod.Id) + '\'';
- } else {
- strProd += ',\'' + String.valueOf(ass.prod.Id) + '\'';
- }
- }
- String SqlOrder = 'SELECT Id, Name, Consumable_order__c, Consumable_Product__r.Name__c,';
- SqlOrder += ' Consumable_Product__c,Consumable_Product__r.Name,';
- SqlOrder += 'Consumable_Count__c,Consumable_Product__r.Intra_Trade_List_RMB__c,';
- SqlOrder += 'Consumable_Product__r.Asset_Model_No__c,Sum_of_money__c, ';
- SqlOrder += 'Consumable_Product__r.SFDA_Status__c,Consumable_Product__r.Product2__r.Packing_list_manual__c,Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,';
- SqlOrder += 'Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,Consumable_Product__r.Category3__c,Consumable_Product__r.Category4__c,Consumable_Product__r.Category5__c ';
- SqlOrder +=
- 'FROM Consumable_orderdetails__c WHERE recordtypeid != \'' +
- System.Label.RT_ConOrderDetail1_Sale +
- '\' AND Consumable_order__c = \'' +
- ESetId +
- '\'';
- SqlOrder += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
- SqlOrder += ' AND Consumable_Product__c IN (' + strProd + ')';
- SqlOrder +=
- ' order by ' +
- columus[Integer.valueOf(sortKey)] +
- ' ' +
- (sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last');
- List<Consumable_Orderdetails__c> queryList = Database.query(SqlOrder);
- // 閬告姙娓堛伩銇槑缁嗐倰鍙栧緱
- Map<String, String> selectedIdMap = new Map<String, String>();
- for (Integer i = 0; i < queryList.size(); i++) {
- // 鏈�夋嫨鐨勬秷鑰楀搧鏄庣粏
- MidMap.put(queryList[i].Consumable_Product__c, new ConsumableorderdetailsInfo(queryList[i]));
- }
- for (Integer i = 0; i < countDel.size(); i++) {
- if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
- if (countDel[i].hospitalSpecialOffer__c == true) {
- //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
- if (countDel[i].promotionorder__c == true) {
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
- if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
- if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
- ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
- if (countDel[i].Box_Piece__c == '鐩�') {
- Jstage.allnumber = Jstage.allnumber + 1;
- } else {
- Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
- }
- MidMap.put(countDel[i].Consumable_Product__c, Jstage);
- }
- }
- }
- }
- consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
- //鎶妋ap閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
- for (ConsumableorderdetailsInfo bss : MidMap.values()) {
- if (DealerProductMap.containsKey(bss.Prod.Id)) {
- bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
- bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
- bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
- }
- bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
- bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
- bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
- consumableorderdetailsRecordsview.add(bss);
- }
- }
- productLimtAndDateView();
- }
-
- //搴撳瓨涓婁笅闄�
- public static void productLimtAndDateView() {
- String nowName = null, nowRightAsstModelNo = null;
- Map<String, String> productLimt = new Map<String, String>();
- for (Integer i = 0; i < proLimitAndDate.size(); i++) {
- nowName = proLimitAndDate[i];
- if (nowName.indexOf('|') >= 0) {
- nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
- nowName = nowName.subString(nowName.indexOf('|') + 1);
- }
- productLimt.put(nowRightAsstModelNo, nowName);
- }
- for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
- if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) {
- ass.lowerlimit = decimal.valueOf(
- productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|'))
- );
- ass.upperlimit = decimal.valueOf(
- productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1)
- );
- }
- }
- }
-
//搴撳瓨涓婁笅闄�
public static void productLimtAndDate() {
String nowName = null, nowRightAsstModelNo = null;
@@ -1196,7 +908,8 @@
String dealerProductIdStr,
String methodTypeStr,
String consumableorderdetailsRecordsviewStr,
- Boolean editAbleStr
+ Boolean editAbleStr,
+ List<String> proLimitAndDateList
){
Results results = new Results();
errorMsgList = new List<String>();
@@ -1215,6 +928,7 @@
specialCampaign = specialCampaignStr;
methodType = methodTypeStr;
editAble = editAbleStr;
+ proLimitAndDate = proLimitAndDateList;
dealerProductId = (List<String>)JSON.deserialize(dealerProductIdStr, List<String>.class);
consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class);
size = Integer.valueOf(System.Label.orderdetLimitsize);
@@ -1335,11 +1049,11 @@
// makeMessage();
results.errorMsgList = errorMsgList;
results.warningMsgList = warningMsgList;
- if(consumableorderdetailsRecordsview.size() > 0){
+ if(consumableorderdetailsRecords.size() > 0){
getConsumableShowTableFieldValue();
results.result = 'Success';
results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
- results.errorMsg = '鎼滅储鍒�' + consumableorderdetailsRecordsview.size() + '浠朵骇鍝�';
+ results.errorMsg = '鎼滅储鍒�' + consumableorderdetailsRecords.size() + '浠朵骇鍝�';
}else {
getConsumableShowTableFieldValue();
results.result = 'Fail';
@@ -1707,6 +1421,8 @@
}
}
String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
+ System.debug('sqlTail:'+sqlTail);
+ System.debug('orderzaikuId:'+orderzaikuId);
if (orderzaikuId.size() > 0) {
soql += ' AND Id in' + sqlTail;
}
@@ -1764,6 +1480,9 @@
cv.VersionData = EncodingUtil.base64Decode(base64Data);
cv.IsMajorVersion = true;
insert cv;
+ Consumable_order__c c = [SELECT Id FROM Consumable_order__c WHERE Id =:pId];
+ c.Consumable_pdf_insert_day__c = Date.today();
+ update c;
results.result = 'Success';
} catch (Exception e) {
results.result = 'Fail';
@@ -2261,6 +1980,23 @@
return results;
}
+ //鍒犻櫎闄勪欢
+ @AuraEnabled
+ public static Results deleteAtt(String contentVersionId){
+ Results results = new Results();
+ try {
+ ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId];
+ String contentDocumentId = conVersion.ContentDocumentId;
+ ContentDocument conDocument = [SELECT Id FROM ContentDocument where Id = :contentDocumentId];
+ delete conDocument;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
public static void getConsumableShowTableFieldValue(){
for(ConsumableorderdetailsInfo con :consumableorderdetailsRecordsview){
if(con.Prod != null){
@@ -2470,6 +2206,8 @@
public String methodType;
@AuraEnabled
public List<String> proLimitAndDate;
+ @AuraEnabled
+ public Boolean isNoteStay;
}
public class CusOption {
--
Gitblit v1.9.1