buli
2023-05-04 50b39c4b52bf5fd61ec46ada365c51e05a16d2ae
force-app/main/default/classes/ConInvoiceViewController.cls
@@ -473,6 +473,7 @@
    // 保存附件
    public PageReference saveAttachment() {
        Consumable_accessories_invoice__c attachmentdetails = new Consumable_accessories_invoice__c();
        System.debug('AttachmentRecoeds = ' + AttachmentRecoeds);
        for (InvoiceOrderInfo ass : AttachmentRecoeds) {
            if (!String.isBlank(ass.mailSelectOptsin)) {
                attachmentdetails.Id = ass.invoiceOrderId;
@@ -484,10 +485,12 @@
                upsert attachmentdetails;
            }
        }
        System.debug('attachmentdetails = ' + attachmentdetails);
        return UnabletoEdit();
    }
    // 保存按钮
    public PageReference save() {
        System.debug('enter ConInvoiceViewController.save success');
        List<String> chukudanID = new List<String>();
        if (coc.Name == '' || coc.Name == null) {
            coc.Name.addError('请录入发票号。');
@@ -736,6 +739,7 @@
                    delete invoiceLinkdetList;
                }*/
            } else if (String.isNotBlank(reopen) && reopen.equals('isreopen') && String.isNotBlank(invoiceId)) {
                System.debug('进入reopen');
                //CHAN-BSS5SQ    update by rentongxiao 2020-09-04   start
                //如果是 作废重开
                //1. 设置新发票信息
@@ -759,6 +763,7 @@
                    invoiceHead.Order_ForDealer__c = SecondDealer;
                }
                invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
                System.debug('invoiceHead = ' + invoiceHead);
                insert invoiceHead;
                List<String> updateChukudanId = new List<String>();
@@ -773,6 +778,7 @@
                    colc.Invoice_Code_link__c = invoiceHead.Id;
                    updateChukudanId.add(colc.Outboundorder_Code_link__c);
                }
                System.debug('tLinkList = ' + tLinkList);
                update tLinkList;
                //更新发票明细信息
                //获取出库单,设置关联关系
@@ -797,6 +803,7 @@
                    cocTemp.Consumable_order__c = invoiceHead.Id;
                    tempCocMap.put(cocTemp.Invoicedet1_OD_link__c + cocTemp.Asset_Model_No__c, cocTemp);
                }
                System.debug('tempCountList = ' + tempCountList);
                update tempCountList;
                List<Consumable_Orderdetails__c> updateFromList = [
                    SELECT
@@ -836,8 +843,10 @@
                Consumable_order__c tempcoc = new Consumable_order__c();
                tempcoc.Id = invoiceId;
                System.debug('tempcoc = ' + tempcoc);
                delete tempcoc;
                invoiceId = invoiceHead.Id;
                System.debug('updateFromList = ' + updateFromList);
                update updateFromList;
                //--------------------------------------------------------------------------
                for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
@@ -875,6 +884,7 @@
                            invoiceLinkList.add(invoiceLink);
                        }
                    }
                    System.debug('invoiceLinkList = ' + invoiceLinkList);
                    upsert invoiceLinkList;
                }
                //删除出库单链接表
@@ -892,6 +902,7 @@
                            invoiceLinkdetList.add(colctemp);
                        }
                    }
                    System.debug('invoiceLinkdetList = ' + invoiceLinkdetList);
                    delete invoiceLinkdetList;
                }
                //新建发票明细1
@@ -1268,6 +1279,7 @@
            FROM Consumable_Orderdetails__c
            WHERE Consumable_order__c = :value AND Invoicedet1_OD_link__c = :deleteMap.keySet()
        ];
        System.debug('detInvoicedet1List = ' + detInvoicedet1List);
        delete detInvoicedet1List;
    }
    //CHAN-BSS5SQ    update by rentongxiao 2020-09-08  end
@@ -1360,6 +1372,7 @@
        Savepoint sp = Database.setSavepoint();
        if (invoiceorderList1.size() > 0) {
            try {
                System.debug('invoiceorderList1 = ' + invoiceorderList1);
                insert invoiceorderList1;
            } catch (Exception ex) {
                Database.rollback(sp);