From 00e147ec892cb1e89d0698787a8c60da1014cdb7 Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期一, 26 六月 2023 17:42:22 +0800
Subject: [PATCH] Community升级
---
force-app/main/default/classes/LexSaleAndDeliveryController.cls | 151 +++++++++++++++++++++++++++++++++++--------------
1 files changed, 107 insertions(+), 44 deletions(-)
diff --git a/force-app/main/default/classes/LexSaleAndDeliveryController.cls b/force-app/main/default/classes/LexSaleAndDeliveryController.cls
index 4891a47..adbd428 100644
--- a/force-app/main/default/classes/LexSaleAndDeliveryController.cls
+++ b/force-app/main/default/classes/LexSaleAndDeliveryController.cls
@@ -1,7 +1,7 @@
public with sharing class LexSaleAndDeliveryController {
// 鏄剧ず鏁版嵁鏉℃暟闄愬埗
private static Integer Select_Limit = 100;
-
+
//鍒濆鍖�
@AuraEnabled
public static ResponseBodyLWC init() {
@@ -17,31 +17,37 @@
String userWorkLocation = '';
ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String,object> data = new Map<String,object>();
+ Map<String, object> data = new Map<String, object>();
res.entity = data;
userinfoId = UserInfo.getUserId();
- List<user> Useracc = New List<user>();
- Useracc = [SELECT
- accountid, Work_Location__c,UserPro_Type__c
- FROM user
- WHERE id =:userinfoId];
+ List<user> Useracc = new List<user>();
+ Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userinfoId];
accountid = Useracc[0].accountid;
agencyProType = Useracc[0].UserPro_Type__c;
- if(String.isBlank(Useracc[0].UserPro_Type__c)){
+ if (String.isBlank(Useracc[0].UserPro_Type__c)) {
agencyProType = 'ET';
}
userWorkLocation = Useracc[0].Work_Location__c;
- data.put('userinfoId',userinfoId);
- data.put('accountid',accountid);
- data.put('agencyProType',agencyProType);
- data.put('userWorkLocation',userWorkLocation);
- System.debug('userinfoId = ' + userinfoId + ' accountid = ' + accountid + ' agencyProType = ' + agencyProType + ' userWorkLocation = ' + userWorkLocation);
+ data.put('userinfoId', userinfoId);
+ data.put('accountid', accountid);
+ data.put('agencyProType', agencyProType);
+ data.put('userWorkLocation', userWorkLocation);
+ System.debug(
+ 'userinfoId = ' +
+ userinfoId +
+ ' accountid = ' +
+ accountid +
+ ' agencyProType = ' +
+ agencyProType +
+ ' userWorkLocation = ' +
+ userWorkLocation
+ );
//榛樿妫�绱㈡樉绀烘湭瀹屾垚鐨勬寚绀哄崟
List<Consumable_order__c> raesList = new List<Consumable_order__c>();
String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c';
soql += ' WHERE Order_type__c = \'' + '浼犵エ' + '\' ';
- soql += ' and Order_ProType__c =\'' + agencyProType +'\' ';
- soql += 'and SummonsStatus_c__c != \'' + '宸插畬鎴�' + '\' and Dealer_Info__c =\'' + accountid +'\' ';
+ soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
+ soql += 'and SummonsStatus_c__c != \'' + '宸插畬鎴�' + '\' and Dealer_Info__c =\'' + accountid + '\' ';
soql += 'and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
soql += 'order by SummonsStatus_c__c';
System.debug('soql = ' + soql);
@@ -53,16 +59,24 @@
res.msg = '';
return res;
} catch (Exception e) {
- return new ResponseBodyLWC('Error',500, e.getMessage(), '');
+ return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
}
}
// 宸插嚭搴撴湭寮�绁ㄧ殑鍑哄簱鍗�
@AuraEnabled
- public static ResponseBodyLWC searchOrderInstatus(String orderDate,String deliverDate,String accountid,String agencyProType,String userWorkLocation,String category1,String category2) {
+ public static ResponseBodyLWC searchOrderInstatus(
+ String orderDate,
+ String deliverDate,
+ String accountid,
+ String agencyProType,
+ String userWorkLocation,
+ String category1,
+ String category2
+ ) {
try {
ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String,object> data = new Map<String,object>();
+ Map<String, object> data = new Map<String, object>();
res.entity = data;
Date cate2 = String.isEmpty(orderDate) ? null : Date.valueOf(orderDate.replace('/', '-'));
@@ -71,8 +85,8 @@
List<Consumable_order__c> raesList = new List<Consumable_order__c>();
String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c';
soql += ' WHERE Order_type__c = \'' + '浼犵エ' + '\' ';
- soql += ' and Dealer_Info__c =\'' + accountid +'\' ';
- soql += ' and Order_ProType__c =\'' + agencyProType +'\' ';
+ soql += ' and Dealer_Info__c =\'' + accountid + '\' ';
+ soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
if (!String.isBlank(category1)) {
soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' ';
@@ -80,10 +94,10 @@
if (!String.isBlank(category2)) {
soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' ';
}
- if(cate2 != null){
+ if (cate2 != null) {
soql += ' and Outbound_Date__c >= :cate2 ';
}
- if(cate3 != null){
+ if (cate3 != null) {
soql += ' and Outbound_Date__c <= :cate3 ';
}
soql += 'and SummonsForDirction__c != \'' + '浜掔浉璋冭揣' + '\' ';
@@ -93,34 +107,44 @@
System.debug('soql = ' + soql);
raesList = Database.query(soql);
data.put('raesList', raesList);
- if(raesList.size()>0){
+ if (raesList.size() > 0) {
res.msg = '鍏辨湁' + raesList.size() + '涓嚭搴撳崟';
- }else{
+ } else {
res.msg = '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟銆�';
}
res.status = 'Success';
res.code = 200;
return res;
} catch (Exception e) {
- return new ResponseBodyLWC('Error',500, e.getMessage(), '');
+ return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
}
}
//杩樻病鍑哄簱鐨勫嚭搴撳崟
@AuraEnabled
- public static ResponseBodyLWC searchConsumableorderdetails(String orderDate,String deliverDate,String accountid,String agencyProType,String userWorkLocation,String category1,String category2) {
+ public static ResponseBodyLWC searchConsumableorderdetails(
+ String orderDate,
+ String deliverDate,
+ String accountid,
+ String agencyProType,
+ String userWorkLocation,
+ String category1,
+ String category2
+ ) {
try {
ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String,object> data = new Map<String,object>();
+ Map<String, object> data = new Map<String, object>();
res.entity = data;
Date cate2 = String.isEmpty(orderDate) ? null : Date.valueOf(orderDate.replace('/', '-'));
Date cate3 = String.isEmpty(deliverDate) ? null : Date.valueOf(deliverDate.replace('/', '-'));
+ System.debug('cate2 = ' + cate2);
+ System.debug('cate3 = ' + cate3);
// 鑾峰緱璁㈠崟涓�瑙�
List<Consumable_order__c> raesList = new List<Consumable_order__c>();
String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c';
soql += ' WHERE Order_type__c = \'' + '浼犵エ' + '\' ';
- soql += ' and Dealer_Info__c =\'' + accountid +'\' ';
- soql += ' and Order_ProType__c =\'' + agencyProType +'\' ';
+ soql += ' and Dealer_Info__c =\'' + accountid + '\' ';
+ soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
if (!String.isBlank(category1)) {
soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' ';
@@ -128,44 +152,52 @@
if (!String.isBlank(category2)) {
soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' ';
}
- if(cate2 != null){
+ if (cate2 != null) {
soql += ' and Order_date__c >= :cate2 ';
}
- if(cate3 != null){
+ if (cate3 != null) {
soql += ' and Order_date__c <= :cate3 ';
}
soql += 'and SummonsStatus_c__c != \'' + '宸插畬鎴�' + '\' ';
- soql += 'order by SummonsStatus_c__c limit '+ Select_Limit;
+ soql += 'order by SummonsStatus_c__c limit ' + Select_Limit;
System.debug('soql+++++' + soql);
raesList = Database.query(soql);
data.put('raesList', raesList);
- if(raesList.size()>0){
+ if (raesList.size() > 0) {
res.msg = '鍏辨湁' + raesList.size() + '涓嚭搴撳崟';
- }else{
+ } else {
res.msg = '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟銆�';
}
res.status = 'Success';
res.code = 200;
return res;
} catch (Exception e) {
- return new ResponseBodyLWC('Error',500, e.getMessage(), '');
+ return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
}
}
// 宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�
@AuraEnabled
- public static ResponseBodyLWC searchConsumableorFinish(String orderDate,String deliverDate,String accountid,String agencyProType,String userWorkLocation,String category1,String category2) {
+ public static ResponseBodyLWC searchConsumableorFinish(
+ String orderDate,
+ String deliverDate,
+ String accountid,
+ String agencyProType,
+ String userWorkLocation,
+ String category1,
+ String category2
+ ) {
try {
ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String,object> data = new Map<String,object>();
+ Map<String, object> data = new Map<String, object>();
res.entity = data;
Date cate2 = String.isEmpty(orderDate) ? null : Date.valueOf(orderDate.replace('/', '-'));
Date cate3 = String.isEmpty(deliverDate) ? null : Date.valueOf(deliverDate.replace('/', '-'));
List<Consumable_order__c> raesList = new List<Consumable_order__c>();
String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c';
soql += ' WHERE Order_type__c = \'' + '浼犵エ' + '\' ';
- soql += ' and Dealer_Info__c =\'' + accountid +'\' ';
- soql += ' and Order_ProType__c =\'' + agencyProType +'\' ';
+ soql += ' and Dealer_Info__c =\'' + accountid + '\' ';
+ soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
if (!String.isBlank(category1)) {
soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' ';
@@ -173,10 +205,10 @@
if (!String.isBlank(category2)) {
soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' ';
}
- if(cate2 != null){
+ if (cate2 != null) {
soql += ' and Outbound_Date__c >= :cate2 ';
}
- if(cate3 != null){
+ if (cate3 != null) {
soql += ' and Outbound_Date__c <= :cate3 ';
}
soql += 'and SummonsStatus_c__c = \'' + '宸插畬鎴�' + '\' ';
@@ -184,16 +216,47 @@
soql += 'order by CreatedDate desc limit ' + Select_Limit;
raesList = Database.query(soql);
data.put('raesList', raesList);
- if(raesList.size()>0){
+ if (raesList.size() > 0) {
res.msg = '鍏辨湁' + raesList.size() + '涓嚭搴撳崟';
- }else{
+ } else {
res.msg = '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟銆�';
}
res.status = 'Success';
res.code = 200;
return res;
} catch (Exception e) {
- return new ResponseBodyLWC('Error',500, e.getMessage(), '');
+ return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
+ }
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC cleanUp(String accountid, String agencyProType, String userWorkLocation) {
+ try {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ // 鑾峰緱鏄剧ず鏁版嵁
+ List<Consumable_order__c> raesList = new List<Consumable_order__c>();
+ String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c';
+ soql += ' WHERE Order_type__c = \'' + '浼犵エ' + '\' ';
+ soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
+ soql += 'and SummonsStatus_c__c != \'' + '宸插畬鎴�' + '\' and Dealer_Info__c =\'' + accountid + '\' ';
+ soql += 'and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ soql += 'order by SummonsStatus_c__c';
+ System.debug('soql = ' + soql);
+ raesList = Database.query(soql);
+ data.put('raesList', raesList);
+ if (raesList.size() > 0) {
+ res.msg = '鍏辨湁' + raesList.size() + '涓嚭搴撳崟';
+ } else {
+ res.msg = '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟銆�';
+ }
+ res.status = 'Success';
+ res.code = 200;
+ return res;
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
}
}
}
\ No newline at end of file
--
Gitblit v1.9.1