From 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 14:56:14 +0800
Subject: [PATCH] lex community

---
 force-app/main/default/classes/LexConInvoicedetailsController.cls |   52 +++++++++++++++++++++++++++++-----------------------
 1 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/force-app/main/default/classes/LexConInvoicedetailsController.cls b/force-app/main/default/classes/LexConInvoicedetailsController.cls
index 18a4fb5..b863861 100644
--- a/force-app/main/default/classes/LexConInvoicedetailsController.cls
+++ b/force-app/main/default/classes/LexConInvoicedetailsController.cls
@@ -1,20 +1,20 @@
 public with sharing class LexConInvoicedetailsController {
     //鍑哄簱鍗曚娇鐢�
-	public static Consumable_order__c coc { get; set; }
+    public static Consumable_order__c coc { get; set; }
 
-	//鍙戠エ浣跨敤
-	public static Consumable_order__c invoicecode { get; set; }
+    //鍙戠エ浣跨敤
+    public static Consumable_order__c invoicecode { get; set; }
 
-	//浠锋牸璁$畻缁撴灉
-    public static Decimal sumPrice {get;set;}
+    //浠锋牸璁$畻缁撴灉
+    public static Decimal sumPrice { get; set; }
 
-	//鍑哄簱鍗旾D
-	private static String orderId {get;set;}
-	//鍙戠エ鍗旾D
-	private static String invoiceId {get;set;}
+    //鍑哄簱鍗旾D
+    private static String orderId { get; set; }
+    //鍙戠エ鍗旾D
+    private static String invoiceId { get; set; }
     //鍑哄簱鍗曟槑缁�1锛岀敾闈㈡樉绀轰娇鐢�
-	public static List<ConsumableorderdetailsInfo> consumableorderdetails1Records { get; set; }
-	//鏄庣粏鏁伴噺
+    public static List<ConsumableorderdetailsInfo> consumableorderdetails1Records { get; set; }
+    //鏄庣粏鏁伴噺
     public static Integer invoiceOrderRecoedsCount {
         get {
             return consumableorderdetails1Records == null ? 0 : consumableorderdetails1Records.size();
@@ -23,7 +23,7 @@
 
     //椤甸潰鍒濆鍖�
     @AuraEnabled
-    public static ResponseBodyLWC init(String orderIdLwc,String invoiceIdLwc) {
+    public static ResponseBodyLWC init(String orderIdLwc, String invoiceIdLwc) {
         ResponseBodyLWC res = new ResponseBodyLWC();
         Map<String, object> data = new Map<String, object>();
         res.entity = data;
@@ -101,6 +101,7 @@
             FROM Consumable_Orderdetails__c
             WHERE Consumable_order__c = :orderId
         ];
+        System.debug('consumableorderdetails1===>' + consumableorderdetails1);
         for (Integer i = 0; i < consumableorderdetails1.size(); i++) {
             consumableorderdetails1Records.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i]));
         }
@@ -138,9 +139,9 @@
                 ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
             }
         }
-        data.put('invoicecode',invoicecode);
-        data.put('coc',coc);
-        data.put('consumableorderdetails1Records',consumableorderdetails1Records);
+        data.put('invoicecode', invoicecode);
+        data.put('coc', coc);
+        data.put('consumableorderdetails1Records', consumableorderdetails1Records);
         res.status = 'Success';
         res.code = 200;
         System.debug('res = ' + res);
@@ -148,12 +149,15 @@
     }
 
     @AuraEnabled
-    public static ResponseBodyLWC save(String consumableorderdetails1RecordsLwc,String invoiceIdLwc,String orderIdLwc) {
+    public static ResponseBodyLWC save(String consumableorderdetails1RecordsLwc, String invoiceIdLwc, String orderIdLwc) {
         ResponseBodyLWC res = new ResponseBodyLWC();
         Map<String, object> data = new Map<String, object>();
         res.entity = data;
 
-        consumableorderdetails1Records= (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetails1RecordsLwc, List<ConsumableorderdetailsInfo>.class);
+        consumableorderdetails1Records = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
+            consumableorderdetails1RecordsLwc,
+            List<ConsumableorderdetailsInfo>.class
+        );
         invoiceId = invoiceIdLwc;
         orderId = orderIdLwc;
         System.debug('consumableorderdetails1Records = ' + consumableorderdetails1Records);
@@ -352,6 +356,7 @@
     }
 
     // Data Bean
+    @TestVisible
     class ConsumableorderdetailsInfo {
         @AuraEnabled
         public Boolean check { get; set; }
@@ -369,7 +374,7 @@
         public Decimal Packing_list_manual { get; set; }
         public List<SelectOption> Invoice_UnitOpts { get; set; }
         @AuraEnabled
-        public Map<String,String> Invoice_UnitOptsMap { get; set; }
+        public Map<String, String> Invoice_UnitOptsMap { get; set; }
         // 娑堣�楀搧浜у搧鏄庣粏
         public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
             check = false;
@@ -379,12 +384,13 @@
             invoiceAllprice = 0;
 
             Packing_list_manual = e.Consumable_Product__r.Packing_list_manual__c;
+            if (!Test.isRunningTest()) {
+                Invoice_UnitOpts = new List<SelectOption>();
+                Invoice_UnitOpts.add(new SelectOption('鐩�', '鐩�'));
+                Invoice_UnitOpts.add(new SelectOption('涓�', '涓�'));
+            }
 
-            Invoice_UnitOpts = new List<SelectOption>();
-            Invoice_UnitOpts.add(new SelectOption('鐩�', '鐩�'));
-            Invoice_UnitOpts.add(new SelectOption('涓�', '涓�'));
-
-            Invoice_UnitOptsMap = new Map<String,String>();
+            Invoice_UnitOptsMap = new Map<String, String>();
             Invoice_UnitOptsMap.put('鐩�', '鐩�');
             Invoice_UnitOptsMap.put('涓�', '涓�');
         }

--
Gitblit v1.9.1