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/LexRemoveBoxController.cls | 759 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 435 insertions(+), 324 deletions(-)
diff --git a/force-app/main/default/classes/LexRemoveBoxController.cls b/force-app/main/default/classes/LexRemoveBoxController.cls
index 8388cd6..6360f98 100644
--- a/force-app/main/default/classes/LexRemoveBoxController.cls
+++ b/force-app/main/default/classes/LexRemoveBoxController.cls
@@ -1,6 +1,6 @@
public without sharing class LexRemoveBoxController {
//缁忛攢鍟嗕骇鍝佸垎绫�
- public static String agencyProType {get;set;}
+ public static String agencyProType { get; set; }
public static String userPro_Typestr = null;
public static String barcode { get; set; }
/*****************鐢婚潰琛ㄧずBean******************/
@@ -9,11 +9,11 @@
public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; }
//鎷嗙洅鏄庣粏
public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
- public static boolean saveFLGbln {get;set;}
+ public static boolean saveFLGbln { get; set; }
//閿欒淇℃伅
- public static String alertMessage {set;get;}
+ public static String alertMessage { get; set; }
//鎷嗙洅鏄庣粏浠舵暟
- public static integer getinventorysize(){
+ public static integer getinventorysize() {
return ConsumableorderdetailsRecordsdummy.size();
}
public static Map<String, String> ExistIdMap = new Map<String, String>();
@@ -21,48 +21,47 @@
public static Map<String, String> AllMap = new Map<String, String>();
public static List<String> BarCodeListP = new List<String>();
//涓嶇鍚堢殑barcode鍜屽瀷鍙�
- public static list<String> notInlist = new list<String>();
- public static String baseUrl {get;private set;}
+ public static list<String> notInlist = new List<String>();
+ public static String baseUrl { get; private set; }
private static String accountid = null;
private static String accountName = null;
//public String[] proidList =new String[]{};
// 鐧诲綍鑰呭伐浣滃湴
private static String userWorkLocation;
- public LexRemoveBoxController(){
+ public LexRemoveBoxController() {
baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
consumableInventory = new List<ConsumableorderdetailsInfo>();
- saveFLGbln = FALSE;
+ saveFLGbln = false;
}
@AuraEnabled
public static ResponseBodyLWC init() {
ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String,object> data = new Map<String,object>();
+ Map<String, object> data = new Map<String, object>();
res.entity = data;
-
String userId = UserInfo.getUserId();
- List<user> Useracc = New List<user>();
- Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:userId];
+ List<user> Useracc = new List<user>();
+ Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
accountid = Useracc[0].accountid;
userWorkLocation = Useracc[0].Work_Location__c;
agencyProType = Useracc[0].UserPro_Type__c;
- if(String.isBlank(Useracc[0].UserPro_Type__c)){
+ if (String.isBlank(Useracc[0].UserPro_Type__c)) {
agencyProType = 'ET';
}
userPro_Typestr = '%' + agencyProType + '%';
- List<account> accountInfo = [SELECT Name FROM account WHERE id =:accountid];
+ List<account> accountInfo = [SELECT Name FROM account WHERE id = :accountid];
//String view_product = accountInfo[0].view_product__c;
accountName = accountInfo[0].Name;
//proidList = view_product.split(',');
- data.put('ConsumableorderdetailsRecordsdummy',JSON.serialize(ConsumableorderdetailsRecordsdummy));
- data.put('accountName',accountName);
- data.put('userWorkLocation',userWorkLocation);
- data.put('agencyProType',agencyProType);
+ data.put('ConsumableorderdetailsRecordsdummy', JSON.serialize(ConsumableorderdetailsRecordsdummy));
+ data.put('accountName', accountName);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('agencyProType', agencyProType);
res.status = 'Success';
res.code = 200;
System.debug('res = ' + res);
@@ -70,15 +69,15 @@
}
// 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
- public static List<String> ParseBarCode(String Code){
- String[] Cache = new String[]{};
+ public static List<String> ParseBarCode(String Code) {
+ String[] Cache = new List<String>{};
Cache = Code.split('\n');
- Set <String> Buff = new Set<String>();
- for(String A : Cache){
+ Set<String> Buff = new Set<String>();
+ for (String A : Cache) {
Buff.add(A);
}
List<String> outPut = new List<String>();
- for(String B :Buff){
+ for (String B : Buff) {
B = B.trim();
outPut.add(B);
}
@@ -87,10 +86,14 @@
//鑾峰彇鏄庣粏
@AuraEnabled
- public static ResponseBodyLWC searchConsumableorderdetails(String barcode,String accountName,String userWorkLocation,String agencyProType) {
-
+ public static ResponseBodyLWC searchConsumableorderdetails(
+ String barcode,
+ String accountName,
+ String userWorkLocation,
+ String agencyProType
+ ) {
ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String,object> data = new Map<String,object>();
+ Map<String, object> data = new Map<String, object>();
res.entity = data;
userPro_Typestr = '%' + agencyProType + '%';
barcode = barcode;
@@ -99,21 +102,19 @@
ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
-
-
- notInlist = new list<String>();
+ notInlist = new List<String>();
BarCodeListP = ParseBarCode(barcode);
Consumable_order_details2__c p = new Consumable_order_details2__c();
- List<Consumable_order_details2__c> Ins = New List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
saveFLGbln = false;
- alertMessage='';
-
+ alertMessage = '';
+
//鍒ゆ柇barcode鏄惁涓虹┖
- if(barcode == null || barcode ==''){
- return new ResponseBodyLWC('Error',500, '璇疯緭鍏arCode鍙�', '');
+ if (barcode == null || barcode == '') {
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏arCode鍙�', '');
// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��'));
// return;
}
@@ -125,417 +126,529 @@
// ConsumableorderdetailsRecordsdummy.clear();
// 浜у搧绫诲瀷涓嶅悓
- reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
- Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
- Deliver_date__c,Bar_Code__c,Product_Type__c,
- Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
- recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c
- FROM Consumable_order_details2__c
- WHERE Dealer_Arrive__c = true
- AND Bar_Code__c in :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = : userWorkLocation
- AND (not Product_Type__c like : userPro_Typestr)
- ORDER BY Name ];
- if(reSet1.size() > 0){
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Product_Type__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Arrive_Owner_Work_Location__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Bar_Code__c IN :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND (NOT Product_Type__c LIKE :userPro_Typestr)
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
for (Integer i = 0; i < reSet1.size(); i++) {
- if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
// 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
continue;
- }else{
- String str = '璇ュ晢鍝佺被鍨�'+ reSet1[i].Product_Type__c +'涓庣敤鎴风被鍨�'+ agencyProType +'涓嶇,涓嶈兘鎷嗙洅';
- ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
- ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ } else {
+ String str = '璇ュ晢鍝佺被鍨�' + reSet1[i].Product_Type__c + '涓庣敤鎴风被鍨�' + agencyProType + '涓嶇,涓嶈兘鎷嗙洅';
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
}
}
}
//鏈埌璐�
- reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
- Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
- Deliver_date__c,Bar_Code__c,
- Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
- recordtypeid,Consumable_order_minor__r.Arrive_Order__c
- FROM Consumable_order_details2__c
- WHERE Dealer_Arrive__c = FALSE
- AND Dealer_Shipment__c= FALSE
- AND Dealer_Saled__c = FALSE
- AND Dealer_Returned__c = false
- AND Lose_Flag__c = false
- AND Box_Piece__c = '鐩�'
- AND Bar_Code__c in :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name ]; //宸插彂璐э紝鏈埌璐�
- if(reSet1.size() > 0){
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = FALSE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Box_Piece__c = '鐩�'
+ AND Bar_Code__c IN :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name
+ ]; //宸插彂璐э紝鏈埌璐�
+ if (reSet1.size() > 0) {
for (Integer i = 0; i < reSet1.size(); i++) {
- if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
// 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
continue;
- }else{
+ } else {
String str = '璇ュ晢鍝佹湭鍒拌揣,涓嶈兘鎷嗙洅';
- ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
- ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
}
}
}
//宸茶鏍�=1
- reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
- Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
- Deliver_date__c,Bar_Code__c,
- Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
- recordtypeid,Consumable_order_minor__r.Arrive_Order__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 Box_Piece__c = '鐩�'
- AND ProductPacking_list_manual__c = 1
- AND Bar_Code__c in :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name ]; //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱锛屾病鎷嗙洅锛岃鏍�=1
- if(reSet1.size() > 0){
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__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 Box_Piece__c = '鐩�'
+ AND ProductPacking_list_manual__c = 1
+ AND Bar_Code__c IN :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name
+ ]; //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱锛屾病鎷嗙洅锛岃鏍�=1
+ if (reSet1.size() > 0) {
for (Integer i = 0; i < reSet1.size(); i++) {
- if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
// 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
continue;
- }else{
+ } else {
String str = '璇ュ晢鍝佽鏍间负1,涓嶈兘鎷嗙洅';
- ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
- ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
}
}
}
//宸插嚭璐�
- reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
- Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
- Deliver_date__c,Bar_Code__c,
- Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
- recordtypeid,Consumable_order_minor__r.Arrive_Order__c
- FROM Consumable_order_details2__c
- WHERE Dealer_Shipment__c = true
- AND Dealer_Arrive__c = true
- AND Dealer_Returned__c = false
- AND Lose_Flag__c = false
- AND Bar_Code__c in :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name ];
- if(reSet1.size() > 0){
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Shipment__c = TRUE
+ AND Dealer_Arrive__c = TRUE
+ AND Dealer_Returned__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c IN :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
for (Integer i = 0; i < reSet1.size(); i++) {
- if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
// 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
continue;
- }else{
+ } else {
String str = '璇ュ晢鍝佸凡鍑鸿揣';
- ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
- ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
}
}
}
//宸查攢鍞�
- reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
- Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
- Deliver_date__c,Bar_Code__c,
- Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
- recordtypeid,Consumable_order_minor__r.Arrive_Order__c
- FROM Consumable_order_details2__c
- WHERE Dealer_Saled__c = true
- AND Dealer_Returned__c = false
- AND Dealer_Arrive__c = true
- AND Bar_Code__c in :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name ];
- if(reSet1.size() > 0){
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Saled__c = TRUE
+ AND Dealer_Returned__c = FALSE
+ AND Dealer_Arrive__c = TRUE
+ AND Bar_Code__c IN :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
for (Integer i = 0; i < reSet1.size(); i++) {
- if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
// 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
continue;
- }else{
+ } else {
String str = '璇ュ晢鍝佸凡閿�鍞�';
- ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
- ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
}
}
}
//宸叉媶鐩�
- reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
- Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
- Deliver_date__c,Bar_Code__c,
- Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
- recordtypeid,Consumable_order_minor__r.Arrive_Order__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 Box_Piece__c = '涓�'
- AND ProductPacking_list_manual__c > 1
- AND Bar_Code__c in :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- ORDER BY Name ]; //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱锛屽凡鎷嗙洅
- if(reSet1.size() > 0){
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__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 Box_Piece__c = '涓�'
+ AND ProductPacking_list_manual__c > 1
+ AND Bar_Code__c IN :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name
+ ]; //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱锛屽凡鎷嗙洅
+ if (reSet1.size() > 0) {
for (Integer i = 0; i < reSet1.size(); i++) {
- if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
// 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
continue;
- }else{
+ } else {
String str = '璇ュ晢鍝佸凡鎷嗙洅';
- ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
- ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
}
}
}
// 宸茬粡鍙栨秷
- reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
- Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
- Deliver_date__c,Bar_Code__c,
- Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
- recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c
- FROM Consumable_order_details2__c
- WHERE Dealer_Arrive__c = true
- AND Cancellation_Flag__c = true
- AND Bar_Code__c in :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = : userWorkLocation
- ORDER BY Name ];
- if(reSet1.size() > 0){
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Arrive_Owner_Work_Location__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Cancellation_Flag__c = TRUE
+ AND Bar_Code__c IN :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
for (Integer i = 0; i < reSet1.size(); i++) {
- if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
// 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
continue;
- }else{
+ } else {
String str = '璇ュ晢鍝佸凡缁忓彇娑�,涓嶈兘鎷嗙洅';
- ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
- ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
}
}
}
// 宸ヤ綔鍦颁笉鍚�
- reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c,
- Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
- Deliver_date__c,Bar_Code__c,
- Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
- recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c
- FROM Consumable_order_details2__c
- WHERE Dealer_Arrive__c = true
- // gzw 鏃犳硶鎷嗙洅锛屽幓鎺夐攢鍞槑缁� 20210802
- AND Dealer_Shipment__c= false
- AND Dealer_Saled__c = false
- AND Dealer_Returned__c = false
- // gzw 鏃犳硶鎷嗙洅锛屽幓鎺夐攢鍞槑缁� 20210802
- AND Bar_Code__c in :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c != : userWorkLocation
- ORDER BY Name ];
- if(reSet1.size() > 0){
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ recordtypeid,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Arrive_Owner_Work_Location__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ // gzw 鏃犳硶鎷嗙洅锛屽幓鎺夐攢鍞槑缁� 20210802
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ // gzw 鏃犳硶鎷嗙洅锛屽幓鎺夐攢鍞槑缁� 20210802
+ AND Bar_Code__c IN :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c != :userWorkLocation
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
for (Integer i = 0; i < reSet1.size(); i++) {
- if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
// 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
continue;
- }else{
+ } else {
String str = '璇ュ晢鍝佸睘浜�' + reSet1[i].Arrive_Owner_Work_Location__c + ',涓嶈兘鎷嗙洅';
- ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
- ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+ ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
}
}
}
-
-
- reSet = [SELECT Id,
- Name,
- Intra_Trade_List_RMB__c,
- Asset_Model_No__c,
- Consumable_Product__c,
- Consumable_Product__r.Name,
- Consumable_Product__r.Name__c,
- Sterilization_limit__c,
- Deliver_date__c,
- Bar_Code__c,
- Arrive_date__c,
- Send_Date__c,
- Consumable_order_minor__r.Name,
- Consumable_order_minor__c,
- Dealer_Arrive__c,
- Guarantee_period_for_products__c,
- CFDA_Status__c,
- ProductPacking_list_manual__c,
- Report_Product_Approbation__c,
- Report_Product_Expiration__c,
- Agencyinfo_fromSAP__c,
- Frist_Storage_Agency__c,
- Dealer_Info_text__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 in :BarCodeListP
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c = : userWorkLocation
- AND Product_Type__c like : userPro_Typestr
- ];
- if(reSet.size()>0){
+ reSet = [
+ SELECT
+ Id,
+ Name,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Name__c,
+ Sterilization_limit__c,
+ Deliver_date__c,
+ Bar_Code__c,
+ Arrive_date__c,
+ Send_Date__c,
+ Consumable_order_minor__r.Name,
+ Consumable_order_minor__c,
+ Dealer_Arrive__c,
+ Guarantee_period_for_products__c,
+ CFDA_Status__c,
+ ProductPacking_list_manual__c,
+ Report_Product_Approbation__c,
+ Report_Product_Expiration__c,
+ Agencyinfo_fromSAP__c,
+ Frist_Storage_Agency__c,
+ Dealer_Info_text__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 IN :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Product_Type__c LIKE :userPro_Typestr
+ ];
+ if (reSet.size() > 0) {
for (Integer i = 0; i < reSet.size(); i++) {
- if(ErrorIdMap.containsKey(reSet[i].Bar_Code__c) ){
+ if (ErrorIdMap.containsKey(reSet[i].Bar_Code__c)) {
// 璺宠繃閿欒鐨勬秷鑰楀搧鏄庣粏
continue;
- }
- else if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) ){
+ } else if (ExistIdMap.containsKey(reSet[i].Bar_Code__c)) {
// 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
continue;
- }
- else{
+ } else {
ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
- ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+ ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
}
}
}
AllMap.putAll(ExistIdMap);
//寰楀埌涓嶅瓨鍦ㄧ殑BarCode
- for(Integer i = 0; i < BarCodeListP.size(); i++){
- if(ExistIdMap.containsKey(BarCodeListP[i])){
+ for (Integer i = 0; i < BarCodeListP.size(); i++) {
+ if (ExistIdMap.containsKey(BarCodeListP[i])) {
continue;
- }else if(ErrorIdMap.containsKey(BarCodeListP[i])){
+ } else if (ErrorIdMap.containsKey(BarCodeListP[i])) {
continue;
- }else{
+ } else {
notInlist.add(BarCodeListP[i]);
}
}
- if(notInlist.size()>0){
- // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '涓嶅瓨鍦ㄣ��'));
- return new ResponseBodyLWC('Error',500, 'BarCode'+ notInlist + '涓嶅瓨鍦�', '');
+ if (notInlist.size() > 0) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '涓嶅瓨鍦ㄣ��'));
+ return new ResponseBodyLWC('Error', 500, 'BarCode' + notInlist + '涓嶅瓨鍦�', '');
}
-
- data.put('ConsumableorderdetailsRecordsdummy',JSON.serialize(ConsumableorderdetailsRecordsdummy));
- data.put('ConsumableorderdetailsRecordserror',JSON.serialize(ConsumableorderdetailsRecordserror));
- data.put('dataSize',ConsumableorderdetailsRecordsdummy.size());
+ data.put('ConsumableorderdetailsRecordsdummy', JSON.serialize(ConsumableorderdetailsRecordsdummy));
+ data.put('ConsumableorderdetailsRecordserror', JSON.serialize(ConsumableorderdetailsRecordserror));
+ data.put('dataSize', ConsumableorderdetailsRecordsdummy.size());
res.status = 'Success';
res.code = 200;
System.debug('res = ' + res);
return res;
-
}
//鎷嗙洅纭
@AuraEnabled
- public static ResponseBodyLWC removeBoxConfirm(String saveConsumableorderdetailsRecordsdummy,String accountName,String userWorkLocation,String agencyProType) {
+ public static ResponseBodyLWC removeBoxConfirm(
+ String saveConsumableorderdetailsRecordsdummy,
+ String accountName,
+ String userWorkLocation,
+ String agencyProType
+ ) {
ResponseBodyLWC res = new ResponseBodyLWC();
- Map<String,object> data = new Map<String,object>();
+ Map<String, object> data = new Map<String, object>();
res.entity = data;
userPro_Typestr = '%' + agencyProType + '%';
accountName = accountName;
- userWorkLocation =userWorkLocation;
- List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>)JSON.deserialize(saveConsumableorderdetailsRecordsdummy,List<ConsumableorderdetailsInfo>.class);
-
+ userWorkLocation = userWorkLocation;
+ List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
+ saveConsumableorderdetailsRecordsdummy,
+ List<ConsumableorderdetailsInfo>.class
+ );
-
-
- List<Consumable_order_details2__c> ins = New List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> ins = new List<Consumable_order_details2__c>();
Savepoint sp = Database.setSavepoint();
- if(ConsumableorderdetailsRecordsdummy.size()<1){
- return new ResponseBodyLWC('Error',500, '涓嶅瓨鍦ㄦ媶鐩掓槑缁�', '');
+ if (ConsumableorderdetailsRecordsdummy.size() < 1) {
+ return new ResponseBodyLWC('Error', 500, '涓嶅瓨鍦ㄦ媶鐩掓槑缁�', '');
// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'涓嶅瓨鍦ㄦ媶鐩掓槑缁�'));
// return null;
}
List<String> BarCodeList = new List<String>();
- for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) {
+ for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) {
BarCodeList.add(tmp.esd.Bar_Code__c);
}
- try{
+ try {
//鍙栧緱鍦ㄥ簱淇℃伅
- List<Consumable_order_details2__c> orderDetails2 = [SELECT
- Id,
- Name,
- Bar_Code__c,
- TracingCode__c,
- Intra_Trade_List_RMB__c,
- Purchase_Unitprice_From__c,
- Guarantee_period_for_products__c,
- Used_account__c,
- Consumable_ZS_order__c,
- Cancellation_Date__c,
- Consumable_product__c,
- Consumable_order_minor__c,
- Direct_Arrive_Product__c,
- Arrive_date__c,
- Consumable_Arrived_order__c,
- Unitprice_To_agency__c,
- SerialLotNo__c,
- Sterilization_limit__c,
- Invoice_Date__c,
- Lose_reason__c,
- Asset_Model_No__c,
- Deliver_date__c,
- Inventory_date__c,
- Consumable_Inventory_order__c,
- Dealer_Arrive__c,
- ProductPacking_list_manual__c,
- Agencyinfo_fromSAP__c,
- Frist_Storage_Agency__c,
- Dealer_Info_text__c,
- //add by rentx 2020-10-13 start
- ContractNo_text__c
- /*,ContractNo__c*/
- //add by rentx 2020-10-13 end
- // tcm start
- ,Consumable_order_minor__r.ContractNo__c
- // tcm end
- 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
+ List<Consumable_order_details2__c> orderDetails2 = [
+ SELECT
+ Id,
+ Name,
+ Bar_Code__c,
+ TracingCode__c,
+ Intra_Trade_List_RMB__c,
+ Purchase_Unitprice_From__c,
+ Guarantee_period_for_products__c,
+ Used_account__c,
+ Consumable_ZS_order__c,
+ Cancellation_Date__c,
+ Consumable_product__c,
+ Consumable_order_minor__c,
+ Direct_Arrive_Product__c,
+ Arrive_date__c,
+ Consumable_Arrived_order__c,
+ Unitprice_To_agency__c,
+ SerialLotNo__c,
+ Sterilization_limit__c,
+ Invoice_Date__c,
+ Lose_reason__c,
+ Asset_Model_No__c,
+ Deliver_date__c,
+ Inventory_date__c,
+ Consumable_Inventory_order__c,
+ Dealer_Arrive__c,
+ ProductPacking_list_manual__c,
+ Agencyinfo_fromSAP__c,
+ Frist_Storage_Agency__c,
+ Dealer_Info_text__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c,
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ // tcm start
+ Consumable_order_minor__r.ContractNo__c
+ // tcm end
+ 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 Box_Piece__c = '鐩�'
AND ProductPacking_list_manual__c > 1
- AND Bar_Code__c in :BarCodeList
- AND Dealer_Info_text__c = :accountName
- AND Arrive_Owner_Work_Location__c =: userWorkLocation
- AND Product_Type__c like : userPro_Typestr
- ];
+ AND Bar_Code__c IN :BarCodeList
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Product_Type__c LIKE :userPro_Typestr
+ ];
List<Consumable_order_details2__c> orderDetails2del = new List<Consumable_order_details2__c>();
List<Consumable_order_details2__c> orderDetails2ins = new List<Consumable_order_details2__c>();
for (Consumable_order_details2__c detail2tmp : orderDetails2) {
- Decimal num = detail2tmp.ProductPacking_list_manual__c;
+ Decimal num = detail2tmp.ProductPacking_list_manual__c;
Consumable_order_details2__c delDetails2 = new Consumable_order_details2__c();
- delDetails2.Id = detail2tmp.Id;
+ delDetails2.Id = detail2tmp.Id;
//鍒犻櫎鎷嗙洅鍓嶅湪搴�
//delete delDetails2;
orderDetails2del.add(delDetails2);
- for(integer i=0; i < num; i++){
+ for (integer i = 0; i < num; i++) {
Consumable_order_details2__c insertDetails2 = new Consumable_order_details2__c();
insertDetails2 = detail2tmp.clone();
- insertDetails2.Id = null;
+ insertDetails2.Id = null;
//鍗曚綅锛堢洅/涓級
- insertDetails2.Box_Piece__c = '涓�';
+ insertDetails2.Box_Piece__c = '涓�';
//鎷嗙洅鐣彿
- insertDetails2.RemoveBox_No__c = i+1;
+ insertDetails2.RemoveBox_No__c = i + 1;
//鎷嗙洅鏃ユ湡
- insertDetails2.RemoveBox_date__c = Date.today();
+ insertDetails2.RemoveBox_date__c = Date.today();
//add by rentx 2020-10-13 start 鎷嗙洅/鍙栨秷鎷嗙洅鏃�,璁板綍SAP鍚堝悓鍙�
// insertDetails2.ContractNo_text__c= detail2tmp.ContractNo__c;
// tcm start
if (String.isBlank(detail2tmp.Consumable_order_minor__r.ContractNo__c)) {
- insertDetails2.ContractNo_text__c= detail2tmp.ContractNo_text__c;
- }else {
- insertDetails2.ContractNo_text__c= detail2tmp.Consumable_order_minor__r.ContractNo__c;
+ insertDetails2.ContractNo_text__c = detail2tmp.ContractNo_text__c;
+ } else {
+ insertDetails2.ContractNo_text__c = detail2tmp.Consumable_order_minor__r.ContractNo__c;
}
// tcm end
//鐧诲綍鎷嗙洅鍚庡湪搴�
@@ -544,31 +657,29 @@
}
}
- if (orderDetails2del.size()>0){
+ if (orderDetails2del.size() > 0) {
delete orderDetails2del;
}
- if(orderDetails2ins.size()>0){
+ if (orderDetails2ins.size() > 0) {
insert orderDetails2ins;
-
}
saveFLGbln = true;
alertMessage = '鎷嗙洅瀹屾垚';
- data.put('saveFLGbln',saveFLGbln);
+ data.put('saveFLGbln', saveFLGbln);
res.status = 'Success';
res.code = 200;
res.msg = alertMessage;
System.debug('res = ' + res);
return res;
// return null;
- }catch(Exception e){
+ } catch (Exception e) {
Database.rollback(sp);
ApexPages.addMessages(e);
return null;
}
}
-
class ConsumableorderdetailsInfo implements Comparable {
@AuraEnabled
@@ -585,18 +696,18 @@
public String oldConsumableCount { get; set; }
@AuraEnabled
public String ErrorReason { get; set; }
- public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) {
- esd = e;
- Prod = e.Consumable_Product__r;
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) {
+ esd = e;
+ Prod = e.Consumable_Product__r;
oldConsumableCount = e.name;
- ErrorReason = str;
+ ErrorReason = str;
}
public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
- esd = e;
- Prod = e.Consumable_Product__r;
+ esd = e;
+ Prod = e.Consumable_Product__r;
oldConsumableCount = e.name;
}
- /*
+ /*
public ConsumableorderdetailsInfo(Product2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) {
esd = new Consumable_order_details2__c();
ProductName = e.Name__c;
--
Gitblit v1.9.1