| | |
| | | // 保存附件 |
| | | 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; |
| | |
| | | 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('请录入发票号。'); |
| | |
| | | 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. 设置新发票信息 |
| | |
| | | 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>(); |
| | |
| | | colc.Invoice_Code_link__c = invoiceHead.Id; |
| | | updateChukudanId.add(colc.Outboundorder_Code_link__c); |
| | | } |
| | | System.debug('tLinkList = ' + tLinkList); |
| | | update tLinkList; |
| | | //更新发票明细信息 |
| | | //获取出库单,设置关联关系 |
| | |
| | | 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 |
| | |
| | | |
| | | 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) { |
| | |
| | | invoiceLinkList.add(invoiceLink); |
| | | } |
| | | } |
| | | System.debug('invoiceLinkList = ' + invoiceLinkList); |
| | | upsert invoiceLinkList; |
| | | } |
| | | //删除出库单链接表 |
| | |
| | | invoiceLinkdetList.add(colctemp); |
| | | } |
| | | } |
| | | System.debug('invoiceLinkdetList = ' + invoiceLinkdetList); |
| | | delete invoiceLinkdetList; |
| | | } |
| | | //新建发票明细1 |
| | |
| | | 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 |
| | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | if (invoiceorderList1.size() > 0) { |
| | | try { |
| | | System.debug('invoiceorderList1 = ' + invoiceorderList1); |
| | | insert invoiceorderList1; |
| | | } catch (Exception ex) { |
| | | Database.rollback(sp); |