From 3962c2bb0435484b60a3e408e4738d792e249a53 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 05 六月 2023 11:09:55 +0800
Subject: [PATCH] LEX CommunityNewCmp
---
force-app/main/default/lwc/lexConsumable/lexConsumable.js-meta.xml | 9
force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.html | 3
force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.js-meta.xml | 5
force-app/main/default/classes/LexArriveGoodsMainController.cls-meta.xml | 5
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html | 17
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js | 410
force-app/main/default/classes/lexSearchAgencyHospitalController.cls-meta.xml | 5
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js-meta.xml | 9
force-app/main/default/lwc/lexTopPage/lexTopPage.js | 667 +
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js | 84
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js-meta.xml | 8
force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.html | 8
force-app/main/default/lwc/boxorpieceType/boxorpieceType.js-meta.xml | 5
force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.html | 16
force-app/main/default/classes/LexProductLimitEditController.cls-meta.xml | 5
force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.html | 10
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html | 102
force-app/main/default/classes/LexConInvoiceList.cls | 156
force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js | 25
force-app/main/default/classes/LexConsumableAccountSOQL.cls-meta.xml | 5
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js-meta.xml | 9
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.css | 31
force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.html | 12
force-app/main/default/lwc/lwcDatatableUtility/templates/customUnit.html | 8
force-app/main/default/lwc/commonToast/commonToast.js-meta.xml | 5
force-app/main/default/lwc/paginator/paginator.html | 42
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js-meta.xml | 9
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js | 24
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html | 143
force-app/main/default/triggers/ContentVersionTrigger.trigger-meta.xml | 5
force-app/main/default/classes/LexOutboundorderImportController.cls | 919 +
force-app/main/default/lwc/lexCustomLightningDatatable/customWeeklyReport.html | 8
force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js | 29
force-app/main/default/classes/LexCancelRemoveBoxController.cls-meta.xml | 5
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js | 242
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js | 273
force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js | 29
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js | 757 +
force-app/main/default/classes/LexUtility.cls | 14
force-app/main/default/lwc/lexLookup/lexLookup.html | 139
force-app/main/default/classes/LexSearchContractController.cls | 69
force-app/main/default/lwc/myCustomTypeDatatable/customNumber.html | 6
force-app/main/default/classes/LexInventoryController.cls-meta.xml | 5
force-app/main/default/classes/LexArriveGoodsMainController.cls | 208
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js-meta.xml | 9
force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html | 3
force-app/main/default/lwc/paginator/paginator.js | 32
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js | 24
force-app/main/default/lwc/customUnitComp/customUnitComp.css | 1
force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js | 41
force-app/main/default/lwc/lexInventory/lexInventory.js | 760 +
force-app/main/default/classes/LexArriveGsDetailsController.cls-meta.xml | 5
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html | 262
force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js-meta.xml | 5
force-app/main/default/lwc/lexSaleAndDelivery/templates/boxorpieceType.html | 4
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js | 31
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js-meta.xml | 5
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js-meta.xml | 9
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js | 244
force-app/main/default/triggers/ContentDocumentLink.trigger-meta.xml | 5
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js | 168
force-app/main/default/lwc/lexTopPage/lexTopPage.css | 1
force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js-meta.xml | 5
force-app/main/default/classes/LexInventoryListController.cls | 103
force-app/main/default/classes/LexSearchHospitalController.cls-meta.xml | 5
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js-meta.xml | 5
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js-meta.xml | 9
force-app/main/default/triggers/ContentDocumentTrigger.trigger-meta.xml | 5
force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html | 3
force-app/main/default/classes/LexConsumableOrderManageController.cls-meta.xml | 5
force-app/main/default/classes/LexConsumableOrderManageController.cls | 332
force-app/main/default/classes/LexSaleOrderController.cls | 1310 ++
force-app/main/default/lwc/lexCustomLightningDatatable/customAgencyOppInput.html | 3
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js-meta.xml | 9
force-app/main/default/classes/LexConsumableGoodsInfo.cls-meta.xml | 5
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.css | 23
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.html | 189
force-app/main/default/classes/LexConsumableAccountInfoController.cls | 49
force-app/main/default/lwc/boxorpieceType/boxorpieceType.js | 21
force-app/main/default/lwc/lexCustomLightningDatatable/customTableInput.html | 3
force-app/main/default/lwc/lexCssUtility/lexCssUtility.css | 116
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js-meta.xml | 5
force-app/main/default/classes/LexInventoryListController.cls-meta.xml | 5
force-app/main/default/lwc/navigateToRecord/navigateToRecord.html | 3
force-app/main/default/classes/LexConInvoiceList.cls-meta.xml | 5
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.css | 45
force-app/main/default/classes/LexSaleOrderController.cls-meta.xml | 5
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.html | 80
force-app/main/default/classes/LexInventoryController.cls | 1283 ++
force-app/main/default/lwc/boxorpieceType/boxorpieceType.html | 10
force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js | 64
force-app/main/default/classes/LexConsumableController.cls | 2264 +++
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.html | 90
force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.html | 3
force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js | 33
force-app/main/default/lwc/customOutputGood/customOutputGood.js-meta.xml | 5
force-app/main/default/lwc/lwcDatatableUtility/templates/customShippingUnitPrice.html | 11
force-app/main/default/lwc/lexInventory/lexInventory.html | 186
force-app/main/default/lwc/myCustomTypeDatatable/customUnit.html | 8
force-app/main/default/classes/LexOutboundorderImportController.cls-meta.xml | 5
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js-meta.xml | 9
force-app/main/default/classes/LexConsumableAccountSOQL.cls | 27
force-app/main/default/classes/LexRemoveBoxController.cls | 625
force-app/main/default/classes/LexTopPageController.cls-meta.xml | 5
force-app/main/default/lwc/customLightningDatatable/templates/boxorpieceType.html | 4
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js | 44
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js | 70
force-app/main/default/classes/LexConsumableAccountController.cls-meta.xml | 5
force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.js | 9
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css | 34
force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html | 9
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.css | 1
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html | 855 +
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js | 718 +
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js-meta.xml | 9
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js | 28
force-app/main/default/labels/CustomLabels.labels-meta.xml | 31
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css | 1
force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js | 22
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js-meta.xml | 5
force-app/main/default/classes/LexSearchContractController.cls-meta.xml | 5
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.html | 8
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js | 417
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js | 656 +
force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js-meta.xml | 5
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.html | 135
force-app/main/default/triggers/ContentDocumentTrigger.trigger | 64
force-app/main/default/lwc/commonToast/commonToast.html | 22
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.css | 1
force-app/main/default/lwc/lexCustomLightningDatatable/customInventoryColor.html | 3
force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.html | 10
force-app/main/default/classes/LexConInvoicedetailsController.cls | 392
force-app/main/default/lwc/customOutputGood/customOutputGood.js | 42
force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentAmount.html | 7
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.html | 67
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js | 299
force-app/main/default/lwc/lexCustomLightningDatatable/customUnit.html | 12
force-app/main/default/lwc/lexNewOrder/lexNewOrder.js | 25
force-app/main/default/classes/LexDealerInquiryModifyStateController.cls-meta.xml | 5
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.html | 3
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.html | 5
force-app/main/default/lwc/navigateToRecord/navigateToRecord.js-meta.xml | 5
force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.html | 1
force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.js | 11
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.css | 24
force-app/main/default/lwc/lexCustomLightningDatatable/customShippingUnitPrice.html | 8
force-app/main/default/classes/LexConInvoicedetailsController.cls-meta.xml | 5
force-app/main/default/lwc/customOutputGood/customOutputGood.html | 24
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js-meta.xml | 9
force-app/main/default/lwc/lexInventory/lexInventory.js-meta.xml | 9
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.css | 28
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.html | 9
force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js | 11
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js-meta.xml | 9
force-app/main/default/classes/LexUtility.cls-meta.xml | 5
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.css | 1
force-app/main/default/classes/LexArriveGsDetailsController.cls | 171
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.css | 1
force-app/main/default/lwc/myCustomTypeDatatable/customShippingUnitPrice.html | 11
force-app/main/default/classes/LexTopPageController.cls | 744 +
force-app/main/default/lwc/lexLookup/LexLookup.css | 30
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.html | 8
force-app/main/default/classes/LookupSearchResult.cls | 26
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html | 384
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.css | 1
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.css | 1
force-app/main/default/classes/LexUpAccountProLimit.cls-meta.xml | 5
force-app/main/default/classes/LexProductLimitEditController.cls | 61
force-app/main/default/lwc/commonToast/commonToast.js | 44
force-app/main/default/classes/LexConInvoiceViewController.cls | 1629 ++
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.html | 199
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js-meta.xml | 9
force-app/main/default/classes/LexSearchHospitalController.cls | 52
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.css | 1
force-app/main/default/lwc/lexCustomLightningDatatable/customTableCellIcon.html | 3
force-app/main/default/classes/LexOverdueStockController.cls-meta.xml | 5
force-app/main/default/lwc/lexLookup/lexLookup.js-meta.xml | 5
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.html | 82
force-app/main/default/classes/LexDealerInquiryModifyStateController.cls | 866 +
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomDiffReason.html | 5
force-app/main/default/classes/LexConsumableAccountInfoController.cls-meta.xml | 5
force-app/main/default/classes/LexConsumableGoodsInfo.cls | 642 +
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js-meta.xml | 9
force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js-meta.xml | 5
force-app/main/default/lwc/lexNewOrder/lexNewOrder.js-meta.xml | 9
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.css | 1
force-app/main/default/lwc/navigateToRecord/navigateToRecord.js | 20
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.css | 17
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.css | 30
force-app/main/default/classes/LexInventoryViewController.cls | 1114 +
force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.html | 2
force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js-meta.xml | 5
force-app/main/default/classes/LexLicenceReminderController.cls-meta.xml | 5
force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.html | 9
force-app/main/default/classes/LexRemoveBoxController.cls-meta.xml | 5
force-app/main/default/classes/LexSummonsCreatController.cls | 2990 ++++
force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.html | 5
force-app/main/default/lwc/customUnitComp/customUnitComp.js-meta.xml | 5
force-app/main/default/lwc/customUnitComp/customUnitComp.html | 22
force-app/main/default/classes/LexOverdueStockController.cls | 380
force-app/main/default/lwc/lexConsumable/lexConsumable.css | 23
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js | 2490 +++
force-app/main/default/lwc/lexNewOrder/lexNewOrder.html | 7
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js | 1764 ++
force-app/main/default/lwc/lexTopPage/lexTopPage.js-meta.xml | 9
force-app/main/default/classes/LexConsumableAccountController.cls | 422
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.html | 109
force-app/main/default/lwc/lwcDatatableUtility/templates/customShipmentNumber.html | 11
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.css | 43
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html | 129
force-app/main/default/lwc/lexTopPage/lexTopPage.html | 214
force-app/main/default/classes/LexConInvoiceViewController.cls-meta.xml | 5
force-app/main/default/classes/LexConsumableController.cls-meta.xml | 5
force-app/main/default/classes/lexSearchAgencyHospitalController.cls | 58
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.css | 1
force-app/main/default/lwc/lexCssUtility/lexCssUtility.js-meta.xml | 5
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js-meta.xml | 9
force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js | 31
force-app/main/default/lwc/customUnitComp/customUnitComp.js | 27
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js-meta.xml | 9
force-app/main/default/classes/LexUpAccountProLimit.cls | 143
force-app/main/default/triggers/ContentVersionTrigger.trigger | 48
force-app/main/default/classes/LexSaleAndDeliveryController.cls-meta.xml | 5
force-app/main/default/lwc/myCustomTypeDatatable/customName.html | 6
force-app/main/default/classes/LexSaleAndDeliveryController.cls | 262
force-app/main/default/lwc/datatableWithCustomTypes/navigateToRecordTemplate.html | 8
force-app/main/default/lwc/lexLookup/lexLookup.js | 493
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js-meta.xml | 5
force-app/main/default/classes/LexCancelRemoveBoxController.cls | 646 +
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js | 270
force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js-meta.xml | 5
force-app/main/default/classes/LexLicenceReminderController.cls | 53
force-app/main/default/lwc/paginator/paginator.css | 12
force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.js-meta.xml | 5
force-app/main/default/classes/LexSummonsCreatController.cls-meta.xml | 5
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js | 193
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js-meta.xml | 9
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html | 131
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js | 221
force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js-meta.xml | 5
force-app/main/default/lwc/lexCustomLightningDatatable/customAttachmentType.html | 10
force-app/main/default/lwc/myCustomTypeDatatable/customShipmentNumber.html | 11
force-app/main/default/classes/LexInventoryViewController.cls-meta.xml | 5
force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js-meta.xml | 9
force-app/main/default/permissionsets/Community_LEX_PS.permissionset-meta.xml | 159
force-app/main/default/classes/LookupSearchResult.cls-meta.xml | 2
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js | 103
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js-meta.xml | 5
force-app/main/default/lwc/paginator/paginator.js-meta.xml | 5
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html | 91
force-app/main/default/lwc/lexConsumable/lexConsumable.js | 1388 ++
force-app/main/default/lwc/lexInventory/lexInventory.css | 18
force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js-meta.xml | 5
force-app/main/default/lwc/lexConsumable/lexConsumable.html | 483
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html | 1048 +
force-app/main/default/triggers/ContentDocumentLink.trigger | 68
force-app/main/default/lwc/lexCustomLightningDatatable/customOutboundCount.html | 7
257 files changed, 38,243 insertions(+), 10 deletions(-)
diff --git a/force-app/main/default/classes/LexArriveGoodsMainController.cls b/force-app/main/default/classes/LexArriveGoodsMainController.cls
new file mode 100644
index 0000000..489086c
--- /dev/null
+++ b/force-app/main/default/classes/LexArriveGoodsMainController.cls
@@ -0,0 +1,208 @@
+public without sharing class LexArriveGoodsMainController {
+ /*****************妞滅储鐢�******************/
+ //缁忛攢鍟嗕骇鍝佸垎绫�
+ public static String agencyProType {get;set;}
+ // public static Consumable_order__c coc { get; set; }
+ public static String category1 { get; set; }
+ private static String cate1ForSort = null;
+ private static Date cate2ForSort = Date.today();
+ private static Date cate2 = Date.today();
+ private static String[] columus = new String[]{ 'Product2__c.Name'};
+ // 浜у搧 ID
+ private static String ESetId = '';
+ private static String accountid = null;
+ // 璁㈠崟 瀛楁鏍囩
+ public static List<String> title { get; private set; }
+ // 璁㈠崟 瀛楁鍚�
+ public static List<String> column;
+ public static List<List<String>> columns { get; private set; }
+ // 鐢婚潰鏄剧ず鏁版嵁
+ public static List<Consumable_order__c> raesList { get; private set; }
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+ // 20200904 ljh 姹囨�讳娇鐢� start
+ public static Integer Total_num {get; set;}
+ public static Integer OrderNumber_arrived {get; set;}
+ public static Integer Delivery_detail_count {get; set;}
+ public static Integer OrderNumber_notarrive {get; set;}
+ public static Integer More_than_seven_days {get; set;}
+
+ @AuraEnabled
+ public static Results init(){
+ Results results = new Results();
+ results.isNoteStay = LexUtility.getIsNoteStay();
+ try {
+ List<String> idList = new List<String>();
+ idList.add('a2K10000002zHyDEAU');
+ idList.add('a2K10000002zIJEEA2');
+ idList.add('a2K10000002zK9rEAE');
+ idList.add('a2K10000004AKGBEA4');
+ idList.add('a2K10000004ALqeEAG');
+ idList.add('a2K10000004AMmrEAG');
+ idList.add('a2K10000004ANvDEAW');
+ idList.add('a2K10000004AOVxEAO');
+ idList.add('a2K10000004AOJZEA4');
+ idList.add('a2K10000004AOLuEAO');
+ idList.add('a2K10000004AOLfEAO');
+ // coc = new Consumable_order__c();
+ String userId = UserInfo.getUserId();
+ 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)){
+ agencyProType = 'ET';
+ }
+ // 鑾峰緱璁㈠崟涓�瑙�
+ Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap();
+ Schema.FieldSet fs = fsMap.get('arrive_view');
+ // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
+ List<FieldSetMember> fsmList = fs.getFields();
+ // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
+ title = new List<String>();
+ column = new List<String>();
+ columns = new List<List<String>>();
+ for (FieldSetMember fsm : fsmList) {
+ title.add(fsm.getLabel());
+ column.add(fsm.getFieldPath());
+ columns.add(fsm.getFieldPath().split('\\.'));
+ }
+ // 鑾峰緱鏄剧ず鏁版嵁
+ raesList = new List<Consumable_order__c>();
+ String soql = 'select Id';
+ for (String s : column) {
+ soql += ',' + s;
+ }
+ soql += ' from Consumable_order__c where Order_type__c = \''+'璁㈠崟'+'\' and recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\' and Order_ProType__c =\'' + agencyProType +'\' and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' and showFalseNotshowTrue__c = false order by Deliver_date__c'; //
+ // soql = 'select id,name,ContractNo__c,Total_num__c,OrderNumber_arrived__c,Delivery_detail_count__c,OrderNumber_notarrive__c,More_than_seven_days__c,Shipment_date__c,First_Delivery__c from Consumable_order__c where id in :idList';
+ raesList = Database.query(soql);
+ //20200904 ljh add start
+ Total_num = 0;
+ OrderNumber_arrived = 0;
+ Delivery_detail_count = 0;
+ OrderNumber_notarrive = 0;
+ More_than_seven_days = 0;
+ System.debug('-----1------'+raesList);
+ for(Consumable_order__c conorder :raesList){
+ if(conorder.Total_num__c != null){
+ Total_num += (Integer)conorder.Total_num__c;
+ }
+ if(conorder.OrderNumber_arrived__c != null){
+ OrderNumber_arrived += (Integer)conorder.OrderNumber_arrived__c;
+ }
+ if(conorder.Delivery_detail_count__c != null){
+ Delivery_detail_count += (Integer)conorder.Delivery_detail_count__c;
+ }
+ if(conorder.OrderNumber_notarrive__c != null){
+ OrderNumber_notarrive += (Integer)conorder.OrderNumber_notarrive__c;
+ }
+ if(conorder.More_than_seven_days__c != null){
+ More_than_seven_days += (Integer)conorder.More_than_seven_days__c;
+ }
+ }
+ results.agencyProType = agencyProType;
+ results.accountId = accountid;
+ results.title = title;
+ results.raesList = raesList;
+ results.userWorkLocation = userWorkLocation;
+ results.totalNum = Total_num;
+ results.orderNumberArrived = OrderNumber_arrived;
+ results.deliveryDetailCount = Delivery_detail_count;
+ results.orderNumberNotarrive = OrderNumber_notarrive;
+ results.moreThanSevenDays = More_than_seven_days;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ @AuraEnabled
+ public static Results searchConsumableorderdetails(String category1Str, Date cate2Str, String accountidStr, String userWorkLocationStr, String agencyProTypeStr){
+ Results results = new Results();
+ category1 = category1Str;
+ cate2 = cate2Str;
+ accountid = accountidStr;
+ userWorkLocation = userWorkLocationStr;
+ agencyProType = agencyProTypeStr;
+ try {
+ // cate2 = coc.Shipment_date__c;
+ // 鑾峰緱璁㈠崟涓�瑙�
+ Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap();
+ Schema.FieldSet fs = fsMap.get('arrive_view');
+ // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
+ List<FieldSetMember> fsmList = fs.getFields();
+ // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
+ title = new List<String>();
+ column = new List<String>();
+ columns = new List<List<String>>();
+ for (FieldSetMember fsm : fsmList) {
+ title.add(fsm.getLabel());
+ column.add(fsm.getFieldPath());
+ columns.add(fsm.getFieldPath().split('\\.'));
+ }
+ // 鑾峰緱鏄剧ず鏁版嵁
+ raesList = new List<Consumable_order__c>();
+ String soql = 'select Id';
+ for (String s : column) {
+ soql += ',' + s;
+ }
+ soql += ' from Consumable_order__c where Order_type__c = \''+'璁㈠崟'+'\' and recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\' and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) ';
+ soql += 'and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ soql += 'and showFalseNotshowTrue__c = false';
+ if (!String.isBlank(category1)) {
+ soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' ';
+ }
+ if(cate2 != null){
+ soql += ' and Shipment_date__c = :cate2 ';
+ }
+ soql += ' and Order_ProType__c =\'' + agencyProType +'\'';
+ soql += ' order by Deliver_date__c';
+ system.debug('====soql:' + soql);
+ raesList = Database.query(soql);
+ results.raesList = raesList;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public String agencyProType;
+ @AuraEnabled
+ public String category1;
+ @AuraEnabled
+ public Date cate2;
+ @AuraEnabled
+ public String eSetId;
+ @AuraEnabled
+ public String accountId;
+ @AuraEnabled
+ public List<String> title;
+ @AuraEnabled
+ public List<Consumable_order__c> raesList;
+ @AuraEnabled
+ public String userWorkLocation;
+ @AuraEnabled
+ public Integer totalNum;
+ @AuraEnabled
+ public Integer orderNumberArrived;
+ @AuraEnabled
+ public Integer deliveryDetailCount;
+ @AuraEnabled
+ public Integer orderNumberNotarrive;
+ @AuraEnabled
+ public Integer moreThanSevenDays;
+ @AuraEnabled
+ public Boolean isNoteStay;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexArriveGoodsMainController.cls-meta.xml b/force-app/main/default/classes/LexArriveGoodsMainController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexArriveGoodsMainController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexArriveGsDetailsController.cls b/force-app/main/default/classes/LexArriveGsDetailsController.cls
new file mode 100644
index 0000000..05b90bc
--- /dev/null
+++ b/force-app/main/default/classes/LexArriveGsDetailsController.cls
@@ -0,0 +1,171 @@
+public without sharing class LexArriveGsDetailsController {
+ public static Consumable_order__c coc { get; set; }
+ private static String accountid = null;
+ private static Decimal orderallcount = 0;
+ public static Boolean arrivetoorder { get; set; }
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; }
+ public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; }
+ private static String eSetId = '';
+ private static Integer consumableorderdetailsCount = null;
+
+ //鍒濆鍖�
+ @AuraEnabled
+ public static Results init(String eSetIdStr) {
+ Results results = new Results();
+ results.isNoteStay = LexUtility.getIsNoteStay();
+ eSetId = eSetIdStr;
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+ try {
+ //鍙栫粡閿�鍟嗕俊鎭�
+ String userId = UserInfo.getUserId();
+ List<user> useracc = New List<user>();
+ useracc = [select accountid from user where id =:userId];
+ accountid = useracc[0].accountid;
+ List<Consumable_order__c> rs = New List<Consumable_order__c>();
+ if(eSetId == NULL || eSetId == '') {
+
+ }else {
+ rs = [SELECT id,name,Order_reason__c,Arrive_Order__c,Arrive_Order__r.Total_num__c,Arrive_Order__r.IsShipment__c,Arrive_Order__r.Name,
+ recordtypeid,Order_status__c,Deliver_date__c,Arrive_total_amount__c
+ FROM Consumable_order__c
+ WHERE id =:eSetId];
+ coc = new Consumable_order__c();
+ if(rs.size()>0){
+ coc = rs[0];
+ orderallcount = coc.Arrive_Order__r.Total_num__c;
+ }
+ if(coc.Arrive_Order__c == null){
+ arrivetoorder = true;
+ }
+ List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = [SELECT Id,Dealer_Arrive__c,Bar_Code__c, RecordTypeid, Name,Consumable_Product__r.Name__c,
+ Consumable_Product__c,Consumable_Product__r.Name,Dealer_Saled__c,
+ Sterilization_limit__c,Deliver_date__c,
+ Intra_Trade_List_RMB__c,Asset_Model_No__c,Arrive_Date__c,Send_Date__c,
+ Consumable_Product__r.SFDA_Status__c,
+ Consumable_Product__r.Product2__r.Packing_list_manual__c,
+ Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
+ Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
+ FROM Consumable_order_details2__c
+ WHERE Consumable_Arrived_order__c = :eSetId
+ ORDER BY Name ];
+ for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
+ consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
+ }
+ }
+ for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){
+ bss.packing_list = bss.Prod.Product2__r.Packing_list_manual__c;
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ //update by rentx 20210622 start CHAN-C3K4ZQ
+ bss.expiration_DateStr = bss.Prod.Product2__r.SFDA_Expiration_Date__c == null ? '' : bss.Prod.Product2__r.SFDA_Expiration_Date__c.format();
+ bss.Sterilization_limitStr = bss.esd.Sterilization_limit__c == null ? '' : bss.esd.Sterilization_limit__c.format();
+ //update by rentx 20210622 end CHAN-C3K4ZQ
+ }
+ consumableorderdetailsCount = consumableorderdetailsRecords.size();
+ //add by rentx 20210622 CHAN-C3K4ZQ
+ // makeRecordsView(consumableorderdetailsRecords);
+ //add by rentx 20210622 CHAN-
+ for(ConsumableorderdetailsInfo con : consumableorderdetailsRecords){
+ con.prodName = con.esd.Consumable_Product__r.Name__c;
+ }
+ results.coc = coc;
+ results.accountid = accountid;
+ results.orderallcount = orderallcount;
+ results.arrivetoorder = arrivetoorder;
+ results.consumableorderdetailsRecords = consumableorderdetailsRecords;
+ results.consumableorderdetailsCount = consumableorderdetailsCount;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鍑哄簱
+ @AuraEnabled
+ public static Results proSale(String cocStr, Decimal orderallcountParm, Integer consumableorderdetailsCountParm) {
+ Results results = new Results();
+ try {
+ orderallcount = orderallcountParm;
+ consumableorderdetailsCount = consumableorderdetailsCountParm;
+ coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class);
+ List<Consumable_order_details2__c> orderdetails = new List<Consumable_order_details2__c>();
+ //鍙戣揣鏄庣粏2
+ orderdetails = [SELECT Id
+ FROM Consumable_order_details2__c
+ WHERE Consumable_order_minor__c =:coc.Arrive_Order__c
+ AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Dealer_Arrive__c = true ];
+ if(orderallcount!= consumableorderdetailsCount){
+ results.result = 'Fail';
+ results.errorMsg = '璁㈠崟涓嶅畬鍏ㄥ埌璐э紝鏃犳硶鍑哄簱';
+ return results;
+ }
+ if(coc.Arrive_Order__r.IsShipment__c == true){
+ results.result = 'Fail';
+ results.errorMsg = '璁㈠崟宸茬粡鍑哄簱';
+ return results;
+ }
+ results.url = '/lexsummonscreat?arriveorder=' + eSetId +'&KeyWords=Redirect';
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public Consumable_order__c coc;
+ @AuraEnabled
+ public String accountid;
+ @AuraEnabled
+ public Decimal orderallcount;
+ @AuraEnabled
+ public Boolean arrivetoorder;
+ @AuraEnabled
+ public List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
+ @AuraEnabled
+ public Integer consumableorderdetailsCount;
+ @AuraEnabled
+ public String url;
+ @AuraEnabled
+ public Boolean isNoteStay;
+ }
+
+ public class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Consumable_order_details2__c esd;
+ @AuraEnabled
+ public Product2__c Prod;
+ @AuraEnabled
+ public Decimal packing_list;
+ @AuraEnabled
+ public Date expiration_Date;
+ @AuraEnabled
+ public String approbation_No;
+ @AuraEnabled
+ public String expiration_DateStr;
+ @AuraEnabled
+ public String Sterilization_limitStr;
+ @AuraEnabled
+ public String prodName;
+
+
+ // 宸插瓨鍦ㄦ秷鑰楀搧鏄庣粏鐢�
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ esd = e;
+ Prod = e.Consumable_Product__r;
+ }
+ // 鎺掑簭Consumable_order__c
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexArriveGsDetailsController.cls-meta.xml b/force-app/main/default/classes/LexArriveGsDetailsController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexArriveGsDetailsController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexCancelRemoveBoxController.cls b/force-app/main/default/classes/LexCancelRemoveBoxController.cls
new file mode 100644
index 0000000..7bd832f
--- /dev/null
+++ b/force-app/main/default/classes/LexCancelRemoveBoxController.cls
@@ -0,0 +1,646 @@
+public with sharing class LexCancelRemoveBoxController {
+ //缁忛攢鍟嗕骇鍝佸垎绫�
+ public static String agencyProType {get;set;}
+ public static String userPro_Typestr = null;
+ public static String barcode { get; set; }
+ /*****************鐢婚潰琛ㄧずBean******************/
+ public static List<ConsumableorderdetailsInfo> consumableInventory { get; set; }
+ //閿欒鏄庣粏
+ public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; }
+ //鎷嗙洅鏄庣粏
+ public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
+ public static boolean saveFLGbln {get;set;}
+ //閿欒淇℃伅
+ public static String alertMessage {set;get;}
+ //鎷嗙洅鏄庣粏浠舵暟
+ public static Integer getinventorysize(){
+ return ConsumableorderdetailsRecordsdummy.size();
+ }
+ public static Map<String, String> ExistIdMap = new Map<String, String>();
+ public static Map<String, String> ErrorIdMap = new Map<String, String>();
+ 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;}
+ private static String accountid = null;
+ private static String accountName = null;
+ //public String[] proidList =new String[]{};
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+
+ public LexCancelRemoveBoxController(){
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
+ consumableInventory = new List<ConsumableorderdetailsInfo>();
+ saveFLGbln = FALSE;
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC init() {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ 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];
+ accountid = Useracc[0].accountid;
+ userWorkLocation = Useracc[0].Work_Location__c;
+ agencyProType = 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];
+ //String view_product = accountInfo[0].view_product__c;
+ accountName = accountInfo[0].Name;
+ //proidList = view_product.split(',');
+ data.put('accountName',accountName);
+ data.put('userWorkLocation',userWorkLocation);
+ data.put('agencyProType',agencyProType);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+
+ }
+
+ // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
+ public static List<String> ParseBarCode(String Code){
+ String[] Cache = new String[]{};
+ Cache = Code.split('\n');
+ Set <String> Buff = new Set<String>();
+ for(String A : Cache){
+ Buff.add(A);
+ }
+ List<String> outPut = new List<String>();
+ for(String B :Buff){
+ B = B.trim();
+ outPut.add(B);
+ }
+ return outPut;
+ }
+
+ //鑾峰彇鏄庣粏
+ @AuraEnabled
+ public static ResponseBodyLWC searchConsumableorderdetails(String barcode,String accountName,String userWorkLocation,String agencyProType) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String,object> data = new Map<String,object>();
+ res.entity = data;
+ userPro_Typestr = '%' + agencyProType + '%';
+ barcode = barcode;
+ accountName = accountName;
+ userWorkLocation = userWorkLocation;
+
+ ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
+
+
+
+ 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> reSet = new List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
+ saveFLGbln = FALSE;
+ alertMessage='';
+
+ //鍒ゆ柇barcode鏄惁涓虹┖
+ if(barcode == null || barcode ==''){
+ return new ResponseBodyLWC('Error',500, '璇疯緭鍏arCode鍙�', '');
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��'));
+ // return;
+ }
+
+ // ExistIdMap.clear();
+ // ErrorIdMap.clear();
+ // notInlist.clear();
+ // ConsumableorderdetailsRecordserror.clear();
+ // 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,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ 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)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ 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);
+ }
+ }
+ }
+
+ //娌℃湁鎷嗙洅
+ 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,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 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 :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)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佹病鏈夋媶鐩�';
+ 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,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ 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)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佽繕鏈埌璐�';
+ 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,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ 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 Box_Piece__c = '涓�'
+ AND RemoveBox_date__c != null
+ 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)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸瓨鍦ㄥ嚭璐у饱鍘�';
+ 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,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Saled__c = true
+ AND Dealer_Arrive__c = true
+ AND Dealer_Returned__c = false
+ AND Lose_Flag__c = false
+ AND Box_Piece__c = '涓�'
+ AND RemoveBox_date__c != null
+ 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)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸瓨鍦ㄩ攢鍞饱鍘�';
+ 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,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Returned__c = true
+ AND Return_date__c != null
+ AND Box_Piece__c = '涓�'
+ AND RemoveBox_date__c != null
+ 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)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸瓨鍦ㄨ繑鍝佸饱鍘�';
+ 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,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ FROM Consumable_order_details2__c
+ WHERE Inventory_date__c != null
+ AND Box_Piece__c = '涓�'
+ AND RemoveBox_date__c != null
+ 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)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸瓨鍦ㄧ洏鐐瑰饱鍘�';
+ 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,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 end
+ 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
+ ORDER BY Name ];
+ if(reSet1.size() > 0){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }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);
+ }
+ }
+ }
+
+ 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,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 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 RemoveBox_date__c != null
+ 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) ){
+ // 璺宠繃閿欒鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }
+ else if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) ){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }
+ else{
+ ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
+ 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])){
+ continue;
+ }else if(ErrorIdMap.containsKey(BarCodeListP[i])){
+ continue;
+ }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 + '涓嶅瓨鍦ㄣ��', '');
+ }
+ 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 cancelRemoveBoxConfirm(String saveConsumableorderdetailsRecordsdummy,String accountName,String userWorkLocation,String agencyProType) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ 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);
+
+
+ List<Consumable_order_details2__c> ins = New List<Consumable_order_details2__c>();
+
+ Savepoint sp = Database.setSavepoint();
+ if(ConsumableorderdetailsRecordsdummy.size()<1){
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'涓嶅瓨鍦ㄥ彇娑堟媶鐩掓槑缁�'));
+ return new ResponseBodyLWC('Error',500, '涓嶅瓨鍦ㄥ彇娑堟媶鐩掓槑缁�', '');
+ // return null;
+ }
+
+ List<String> BarCodeList = new List<String>();
+ for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) {
+ BarCodeList.add(tmp.esd.Bar_Code__c);
+ }
+
+ try{
+ //鍙栧緱閫氱暘澶т簬001鐨勫湪搴撴槑缁�
+ List<Consumable_order_details2__c> orderDetails2del = [SELECT
+ Id,
+ Box_Piece__c,
+ RemoveBox_date__c,
+ RemoveBox_No__c,
+ Bar_Code__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rentx 2020-10-13 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 RemoveBox_date__c != null
+ AND RemoveBox_No__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
+ ];
+
+ List<Consumable_order_details2__c> orderlistdel = new List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> orderlistupd= new List<Consumable_order_details2__c>();
+
+ for (Consumable_order_details2__c detail2tmp : orderDetails2del) {
+ Consumable_order_details2__c delDetails2 = new Consumable_order_details2__c();
+ delDetails2.Id = detail2tmp.Id;
+
+ //鍒犻櫎閫氱暘澶т簬001鐨勬槑缁�2
+ //delete delDetails2;
+ orderlistdel.add(delDetails2);
+ }
+
+ //鍙栧緱閫氱暘001鐨勫湪搴撴槑缁�
+ List<Consumable_order_details2__c> orderDetails2 = [SELECT
+ Id,
+ Box_Piece__c,
+ RemoveBox_date__c,
+ RemoveBox_No__c,
+ Bar_Code__c,
+ //add by rentx 2020-10-13 start
+ ContractNo_text__c
+ /*,ContractNo__c*/
+ //add by rebtx 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 RemoveBox_date__c !=null
+ AND RemoveBox_No__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
+ ];
+
+ for (Consumable_order_details2__c detail2tmp : orderDetails2) {
+ Consumable_order_details2__c updDetails2 = new Consumable_order_details2__c();
+ updDetails2.Id = detail2tmp.Id;
+ updDetails2.Box_Piece__c = '鐩�';
+ updDetails2.RemoveBox_date__c = null;
+ updDetails2.RemoveBox_No__c = null;
+
+ // tcm start
+ if (String.isBlank(detail2tmp.Consumable_order_minor__r.ContractNo__c)) {
+ updDetails2.ContractNo_text__c= detail2tmp.ContractNo_text__c;
+ }else {
+ updDetails2.ContractNo_text__c= detail2tmp.Consumable_order_minor__r.ContractNo__c;
+ }
+ // updDetails2.ContractNo_text__c = detail2tmp.ContractNo__c;
+ // tcm end
+
+ //閫氱暘001銇儑銉笺偪銇鐞嗗崢浣嶃倰鐩掋伀鎴汇仐銆侀�氱暘銈掋偗銉偄
+ //update updDetails2;
+ orderlistupd.add(updDetails2);
+ }
+
+ if(orderlistdel.size()>0){
+ delete orderlistdel;
+ }
+
+ if(orderlistupd.size()>0){
+ update orderlistupd;
+ }
+ saveFLGbln = true;
+ alertMessage = '鍙栨秷鎷嗙洅瀹屾垚';
+ data.put('saveFLGbln',saveFLGbln);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = alertMessage;
+ System.debug('res = ' + res);
+ return res;
+ // return null;
+ }catch(Exception e){
+ Database.rollback(sp);
+ ApexPages.addMessages(e);
+ return null;
+ }
+ }
+
+
+ class ConsumableorderdetailsInfo implements Comparable {
+ public Consumable_order_details2__c esd { get; set; }
+ public Product2__c Prod { get; set; }
+ //public String ProductName { get; set; }
+ //public Boolean canSELECT { get; set; }
+ //public String barCodeNo { get; set; }
+ //public Date sterilizationlimitDate { get; set; }
+ //public String serialNoorLotNo { get; set; }
+ //public String tracingCodeNo { get; set; }
+ public String oldConsumableCount { get; set; }
+ public String ErrorReason { get; set; }
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) {
+ esd = e;
+ Prod = e.Consumable_Product__r;
+ oldConsumableCount = e.name;
+ ErrorReason = str;
+ }
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ 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;
+ Prod = e;
+ barCodeNo = barCode;
+ sterilizationlimitDate = sterilizationlimit;
+ serialNoorLotNo = serialNoorLot;
+ tracingCodeNo = tracingCode;
+ }
+
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) {
+ //esd = new Consumable_order_details2__c();
+ Prod = e.Consumable_Product__r;
+ //ProductName = productName;
+ barCodeNo = barCode;
+ sterilizationlimitDate = sterilizationlimit;
+ serialNoorLotNo = serialNoorLot;
+ tracingCodeNo = tracingCode;
+ }
+*/
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexCancelRemoveBoxController.cls-meta.xml b/force-app/main/default/classes/LexCancelRemoveBoxController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexCancelRemoveBoxController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexConInvoiceList.cls b/force-app/main/default/classes/LexConInvoiceList.cls
new file mode 100644
index 0000000..3f488ef
--- /dev/null
+++ b/force-app/main/default/classes/LexConInvoiceList.cls
@@ -0,0 +1,156 @@
+public with sharing class LexConInvoiceList {
+ public static Consumable_order__c coc { get; set; }
+ public static String agencyProType { get; set; }
+ public static String category1 { get; set; }
+ public static String category2 { get; set; }
+ //鍙戠エ寮�濮嬨�佺粨鏉熸棩鏈�
+ private static Date cate1 { get; set; }
+ private static Date cate2 { get; set; }
+ // 鐧诲綍鐢ㄦ埛 ID
+ private static String userinfoId { get; set; }
+ private static String invoiceStatus { get; set; }
+ //缁忛攢鍟唅d
+ private static String accountid { get; set; }
+ // 鐢婚潰鏄剧ず鏁版嵁
+ public static List<Consumable_order__c> raesList { get; private set; }
+ //鎺掑簭浣跨敤
+ private static String[] orderby = new List<String>{ 'Invoice_Date__c', 'Name', 'ShipmentAccount__c' };
+ public static String sortKey { get; set; }
+ public static String preSortKey { get; private set; }
+ public static Boolean sortOrderAsc { get; private set; }
+ public static String[] sortOrder { get; private set; }
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation { get; set; }
+ public static Map<String, String> statusMap { get; set; }
+
+ @AuraEnabled
+ public static ResponseBodyLWC init() {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ statusMap = new Map<String, String>();
+ raesList = new List<Consumable_order__c>();
+ coc = new Consumable_order__c();
+ cate1 = coc.Order_date__c;
+ cate2 = coc.Deliver_date__c;
+ userinfoId = UserInfo.getUserId();
+ List<user> Useracc = new List<user>();
+ Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userinfoId];
+ accountid = Useracc[0].accountid;
+ userWorkLocation = Useracc[0].Work_Location__c;
+ agencyProType = Useracc[0].UserPro_Type__c;
+ if (String.isBlank(Useracc[0].UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ invoiceStatus = coc.Invoice_status__c;
+ String soql = makeSoql(category1, category2, invoiceStatus);
+ raesList = Database.query(soql);
+
+ statusMap = getPicklistValues('Consumable_order__c', 'Invoice_status__c');
+
+ data.put('userinfoId', userinfoId);
+ data.put('accountid', accountid);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('agencyProType', agencyProType);
+ data.put('raesList', raesList);
+ data.put('statusMap', statusMap);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // 鍙戠エ鍗曟绱�
+ @AuraEnabled
+ public static ResponseBodyLWC invoiceCodeSearch(
+ Date orderDateLwc,
+ Date deliverDateLwc,
+ String invoiceStatusLwc,
+ String category1Lwc,
+ String category2Lwc,
+ String accountidLwc,
+ String userWorkLocationLwc,
+ String agencyProTypeLwc
+ ) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ cate1 = orderDateLwc;
+ cate2 = deliverDateLwc;
+ invoiceStatus = invoiceStatusLwc;
+ category1 = category1Lwc;
+ category2 = category2Lwc;
+ accountid = accountidLwc;
+ userWorkLocation = userWorkLocationLwc;
+ agencyProType = agencyProTypeLwc;
+ // 鑾峰緱鍙戠エ涓�瑙�
+ raesList = new List<Consumable_order__c>();
+ String soql = makeSoql(category1, category2, invoiceStatus);
+ raesList = Database.query(soql);
+ // if(raesList.size()>0){
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '鍏辨绱㈠埌' + raesList.size() + '涓彂绁�'));
+ // }else{
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '娌℃湁鎼滅储鍒扮浉鍏冲彂绁ㄣ��'));
+ // }
+ data.put('raesList', raesList);
+ data.put('raesListSize', raesList.size());
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // 鍋氭垚妫�绱QL鏂�
+ private static String makeSoql(String invoiceCode, String accountName, String invoiceStatus) {
+ String soql = 'SELECT Id, Name,Invoice_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Invoice_status__c, ';
+ soql += ' InvoicedPro_total_amount__c,InvoiceNotPro_total_amount__c,Invoice_total_amount__c,Invoice_attachment__c,Invoicedet_attachment__c FROM Consumable_order__c ';
+ soql += ' WHERE Dealer_Info__c = \'' + accountid + '\'';
+ soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
+ soql += ' AND recordtypeid = \'' + System.Label.RT_ConOrder_Invoice + '\'';
+ if (cate1 != null) {
+ soql += ' AND Invoice_Date__c >= :cate1 ';
+ }
+ if (cate2 != null) {
+ soql += ' AND Invoice_Date__c <= :cate2 ';
+ }
+ if (!String.isBlank(invoiceCode)) {
+ soql += ' AND Name like \'%' + String.escapeSingleQuotes(invoiceCode.replaceAll('%', '\\%')) + '%\' ';
+ }
+ if (!String.isBlank(accountName)) {
+ soql += ' AND ShipmentAccount__c like \'%' + String.escapeSingleQuotes(accountName.replaceAll('%', '\\%')) + '%\' ';
+ }
+ if (!String.isBlank(invoiceStatus)) {
+ soql += ' AND Invoice_status__c =\'' + invoiceStatus + '\' ';
+ }
+ System.debug('soql+++++' + soql);
+ return soql;
+ }
+
+ /*
+ 閫氳繃sObjectName鍜屾寚瀹氬瓧娈佃幏鍙朠ickList鐨剉alue鍊�
+ */
+ public static Map<String, String> getPicklistValues(String sObjectName, String sFieldName) {
+ Map<String, String> picValues = new Map<String, String>();
+ picValues.put('-鏃�-', '');
+ Map<String, Schema.SObjectType> sObjectDescribeMap = Schema.getGlobalDescribe();
+ if (sObjectDescribeMap.containsKey(sObjectName)) {
+ Map<String, Schema.SobjectField> sObjectFieldsMap = sObjectDescribeMap.get(sObjectName).getDescribe().fields.getMap();
+ if (sObjectFieldsMap.containsKey(sFieldName)) {
+ Schema.DescribeFieldResult sObjectFieldDescribe = sObjectFieldsMap.get(sFieldName).getDescribe();
+ List<Schema.PicklistEntry> lPickEntryList = sObjectFieldDescribe.getPicklistValues();
+ //tPicklistEntry.isDefaultValue()
+ for (Schema.PicklistEntry tPicklistEntry : lPickEntryList) {
+ picValues.put(tPicklistEntry.getLabel(), tPicklistEntry.getValue());
+ }
+ } else {
+ //TODO 涓嶅瓨鍦ㄦ瀛楁鐨勬墽琛�
+ }
+ } else {
+ // TODO 涓嶅瓨鍦ㄦsObject鐨勬墽琛�
+ }
+ return picValues;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConInvoiceList.cls-meta.xml b/force-app/main/default/classes/LexConInvoiceList.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexConInvoiceList.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexConInvoiceViewController.cls b/force-app/main/default/classes/LexConInvoiceViewController.cls
new file mode 100644
index 0000000..0173b6c
--- /dev/null
+++ b/force-app/main/default/classes/LexConInvoiceViewController.cls
@@ -0,0 +1,1629 @@
+public without sharing class LexConInvoiceViewController {
+ public static String agencyProType { get; set; }
+ public static Consumable_order__c coc { get; set; }
+ public static Consumable_order__c outbound { get; set; }
+ public static String invoiceId { get; set; }
+ public static String orderRemind { get; set; }
+ public static String deliveryId { get; set; }
+ public static String reopen { get; set; }
+ public static Decimal sumPrice { get; set; }
+ public static Boolean isChange { get; set; }
+ public static String accountid { get; set; }
+ public static String userId { get; set; }
+ public static String errorMsg { get; set; }
+
+ public static Boolean getdone() {
+ return (invoiceOrderdetail1Recoeds.size() > 0);
+ }
+
+ public static Boolean getExistOutbound() {
+ return (coc.Outbound_order__c != null);
+ }
+
+ public static String getInvoiceName() {
+ return (coc.Name);
+ }
+ public static List<Consumable_Orderdetails__c> conoList { get; set; }
+
+ public static String shipmentAccount {
+ get {
+ return (coc.ShipmentAccount__c);
+ }
+ }
+ public static String statusEdit = '';
+ public static Boolean editAble { get; set; }
+ public static List<InvoiceOrderInfo> invoiceOrderRecoeds { get; set; }
+ public static List<InvoiceOrderInfo> invoiceOrderdetail1Recoeds { get; set; }
+ public static List<InvoiceOrderInfo> invoiceOrderRecoedschange { get; set; }
+ public static List<InvoiceOrderInfo> attachmentRecoeds { get; set; }
+ public static List<Consumable_order__c> invoiceOrderList { get; set; }
+ public static List<Consumable_order__c> invoiceOrderSelectedList { get; set; }
+ public static Map<String, Decimal> ordermx1defaultMap { get; set; }
+ public static Map<String, Decimal> outorderMoneytMap { get; set; }
+ public static Map<String, Consumable_Orderdetails__c> outordercountMap { get; set; }
+ public static List<String> outOrderStringList { get; set; }
+ public static List<SelectOption> provinceOpts { get; set; }
+ public static Map<String, String> provinceOptsMap { get; set; }
+ public static String SecondDealer { get; set; }
+ public static String HospitalInfo { get; set; }
+ public static String HospitalName { get; set; }
+
+ public static Integer invoiceOrderRecoedsCount {
+ get {
+ return invoiceOrderRecoeds == null ? 0 : invoiceOrderRecoeds.size();
+ }
+ }
+
+ public static list<Dealer_elationship__c> Dealerelationship { get; set; }
+ public static String[] orderby = new List<String>{ 'Outbound_Date__c', 'Name', 'ShipmentAccount__c' };
+ public static String sortKey { get; set; }
+ public static String preSortKey { get; set; }
+ public static Boolean sortOrderAsc { get; set; }
+ public static String[] sortOrder { get; set; }
+ public static String userWorkLocation { get; set; }
+
+ //椤甸潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init(String invoiceId, String statusEdit, String deliveryId) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ provinceOpts = new List<SelectOption>();
+ provinceOptsMap = new Map<String, String>();
+ invoiceOrderRecoeds = new List<InvoiceOrderInfo>();
+ attachmentRecoeds = new List<InvoiceOrderInfo>();
+ invoiceOrderdetail1Recoeds = new List<InvoiceOrderInfo>();
+ invoiceOrderRecoedschange = new List<InvoiceOrderInfo>();
+ orderRemind = '';
+ isChange = false;
+ conoList = new List<Consumable_Orderdetails__c>();
+ outorderMoneytMap = new Map<String, Decimal>();
+ outOrderStringList = new List<String>();
+ outordercountMap = new Map<String, Consumable_Orderdetails__c>();
+
+ sumPrice = 0;
+ // this.sortKey = '1';
+ // this.preSortKey = '1';
+ // this.sortOrderAsc = false;
+ // this.sortOrder = new List<String>(2);
+ // this.sortOrder = new List<String>{ ' ', ' ', ' ', ' ' };
+
+ invoiceId = invoiceId;
+ statusEdit = statusEdit;
+ deliveryId = deliveryId;
+
+ if (invoiceId != null && invoiceId != '' && (statusEdit == '' || statusEdit == null)) {
+ editAble = false;
+ } else if ((invoiceId == null || invoiceId == '') && (statusEdit == '' || statusEdit == null)) {
+ editAble = true;
+ } else if (invoiceId != null && invoiceId != '' && statusEdit != '' && statusEdit != null) {
+ editAble = true;
+ }
+ userId = UserInfo.getUserId();
+ 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)) {
+ agencyProType = 'ET';
+ }
+ coc = new Consumable_order__c();
+
+ Dealerelationship = [
+ SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
+ FROM Dealer_elationship__c
+ WHERE Dealer_principal__c = :accountid
+ ];
+ List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
+ AgencyHospitalLink = [
+ SELECT Id, Name, Hospital__c, Hospital__r.Id, Hospital__r.Name, Agency__c
+ FROM Agency_Hospital_Link__c
+ WHERE Agency__c = :accountId
+ ];
+ // 鏂拌
+ if (invoiceId == null || invoiceId == '') {
+ if (deliveryId == null || deliveryId == '') {
+ String msoql = makeSoql();
+ invoiceOrderList = Database.query(msoql);
+ for (Integer i = 0; i < invoiceOrderList.size(); i++) {
+ invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i]));
+ }
+ } else {
+ if (statusEdit == '' || statusEdit == null) {
+ EditAble = false;
+ } else if (statusEdit != '' && statusEdit != null) {
+ EditAble = true;
+ }
+ coc = [
+ SELECT
+ Id,
+ Name,
+ Invoice_status__c,
+ Invoice_Date__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__c,
+ Order_ForHospital__r.Name,
+ Order_date__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ SummonsForDirction__c,
+ Order_ForCustomerText__c,
+ Invoice_Note__c,
+ Invoice_attachment__c,
+ Invoicedet_attachment__c,
+ Outbound_order__c
+ FROM Consumable_order__c
+ WHERE Id = :deliveryId
+ ];
+ coc.Name = '';
+ if (coc.Order_ForDealer__c != null) {
+ SecondDealer = coc.Order_ForDealer__c;
+ }
+
+ if (coc.Order_ForHospital__c != null) {
+ HospitalInfo = coc.Order_ForHospital__c;
+ HospitalName = coc.Order_ForHospital__r.Name;
+ }
+
+ //鍙戠エ鍏宠仈鍑哄簱鍗曞彇寰楋紙鍑哄簱鍗曪級
+ invoiceOrderSelectedList = [
+ SELECT
+ Id,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__r.Name,
+ Order_ForDealerText__c,
+ Name,
+ Outbound_Date__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ SummonsForDirction__c,
+ Shipment_total_amount__c,
+ RrturnPro_total_amount__c,
+ Total_Invoiced_Procount__c,
+ InvoiceNotPro_total_amount__c,
+ InvoiceNotPro_money__c,
+ Invoice_total_amount__c,
+ Billed_Status__c
+ FROM Consumable_order__c
+ WHERE Id = :deliveryId
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) {
+ invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
+ }
+ }
+ } else {
+ coc = [
+ SELECT
+ Id,
+ Name,
+ Invoice_status__c,
+ Invoice_Date__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__c,
+ Order_ForHospital__r.Name,
+ Order_date__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ SummonsForDirction__c,
+ Order_ForCustomerText__c,
+ Invoice_Note__c,
+ Invoice_attachment__c,
+ Invoicedet_attachment__c,
+ Outbound_order__c
+ FROM Consumable_order__c
+ WHERE Id = :invoiceId AND Order_type__c = '鍙戠エ'
+ ];
+ if (coc.Order_ForDealer__c != null) {
+ SecondDealer = coc.Order_ForDealer__c;
+ }
+ if (coc.Order_ForHospital__c != null) {
+ HospitalInfo = coc.Order_ForHospital__c;
+ HospitalName = coc.Order_ForHospital__r.Name;
+ }
+ //鍒伴摼鎺ヨ〃涓煡鎵惧叧鑱斿嚭搴撳崟
+ List<Consumable_order_LinkTable__c> outOrderList = [
+ SELECT Outboundorder_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Invoice_Code_link__c = :invoiceId
+ ];
+ for (Integer i = 0; i < outOrderList.size(); i++) {
+ outOrderStringList.add(outOrderList[i].Outboundorder_Code_link__c);
+ }
+ //鍙栧緱鍑哄簱鍗曚俊鎭�
+ invoiceOrderSelectedList = [
+ SELECT
+ Id,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__r.Name,
+ Order_ForDealerText__c,
+ Name,
+ Outbound_Date__c,
+ ShipmentAccount__c,
+ Shipment_total_amount__c,
+ RrturnPro_total_amount__c,
+ Total_Invoiced_Procount__c,
+ InvoiceNotPro_total_amount__c,
+ InvoiceNotPro_money__c,
+ Invoice_total_amount__c,
+ Billed_Status__c
+ FROM Consumable_order__c
+ WHERE Id IN :outOrderStringList AND Order_Owner_WorkLocal__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) {
+ outorderMoneytMap.put(invoiceOrderSelectedList[i].id, 0);
+ invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
+ }
+ if (String.isNotBlank(deliveryId)) {
+ //鍙戠エ鍏宠仈鍑哄簱鍗曞彇寰楋紙鍑哄簱鍗曪級
+ isChange = true;
+ invoiceOrderSelectedList = [
+ SELECT
+ Id,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__r.Name,
+ Order_ForDealerText__c,
+ Name,
+ Outbound_Date__c,
+ ShipmentAccount__c,
+ Shipment_total_amount__c,
+ RrturnPro_total_amount__c,
+ Total_Invoiced_Procount__c,
+ InvoiceNotPro_total_amount__c,
+ InvoiceNotPro_money__c,
+ Invoice_total_amount__c,
+ Billed_Status__c
+ FROM Consumable_order__c
+ WHERE Id = :deliveryId AND Order_Owner_WorkLocal__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) {
+ if (!outorderMoneytMap.containsKey(invoiceOrderSelectedList[i].Id)) {
+ invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
+ invoiceOrderRecoedschange.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
+ }
+ }
+ }
+ //鍙戠エ鏄庣粏涓�瑙�
+ List<Consumable_Orderdetails__c> countDel = [
+ SELECT
+ Id,
+ Consumable_ZS_order__c,
+ Name,
+ Consumable_order__c,
+ Invoicedet1_OD_link__c,
+ Invoicedet1_OD_link__r.Name,
+ Consumable_order__r.Name,
+ Product_OutDate__c,
+ Asset_Model_No__c,
+ Invoice_Unitprice__c,
+ Delivery_List_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ InvoicedProCost_RMB__c,
+ Box_Piece__c,
+ Invoice_Unit__c,
+ ProductPacking_list_manual__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId
+ ORDER BY Invoicedet1_OD_link__c
+ ];
+ if (countDel.size() > 0) {
+ for (Integer i = 0; i < countDel.size(); i++) {
+ outordercountMap.put(countDel[i].Invoicedet1_OD_link__c + countDel[i].Asset_Model_No__c, countDel[i]);
+ if (outorderMoneytMap.containsKey(countDel[i].Invoicedet1_OD_link__c)) {
+ outorderMoneytMap.put(
+ countDel[i].Invoicedet1_OD_link__c,
+ outorderMoneytMap.get(countDel[i].Invoicedet1_OD_link__c) + countDel[i].InvoicedProCost_RMB__c
+ );
+ }
+ invoiceOrderdetail1Recoeds.add(new InvoiceOrderInfo(countDel[i]));
+ }
+ }
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ if (outorderMoneytMap.containsKey(ass.esd.id)) {
+ ass.needInvoiceCount = outorderMoneytMap.get(ass.esd.id);
+ }
+ ass.check = true;
+ }
+ }
+
+ if (SecondDealer == null || SecondDealer == '') {
+ provinceOpts.add(new SelectOption('', '-鏃�-'));
+ provinceOptsMap.put('', '-鏃�-');
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ provinceOpts.add(
+ new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
+ );
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
+ }
+ } else {
+ provinceOpts.add(new SelectOption('', '-鏃�-'));
+ provinceOptsMap.put('', '-鏃�-');
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ if (Dealerelationship[i].Dealer_subordinate__r.Name == SecondDealer) {
+ provinceOpts.add(new SelectOption(Dealerelationship[i].Dealer_subordinate__c, SecondDealer));
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, SecondDealer);
+ }
+ }
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ if (Dealerelationship[i].Dealer_subordinate__r.Name != SecondDealer) {
+ provinceOpts.add(
+ new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
+ );
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
+ }
+ }
+ }
+
+ Map<String, String> consumableaccessoriesMap = new Map<String, String>();
+ Map<String, String> invorceOrderIdMap = new Map<String, String>();
+ List<Consumable_accessories_invoice__c> consumableaccessories = [
+ SELECT Id, Name, Attachment_ID__c, Accessories_type__c
+ FROM Consumable_accessories_invoice__c
+ WHERE Invoice_code__c = :invoiceId
+ ];
+ System.debug('consumableaccessories = ' + consumableaccessories);
+ if (consumableaccessories.size() > 0) {
+ for (Integer i = 0; i < consumableaccessories.size(); i++) {
+ consumableaccessoriesMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Accessories_type__c);
+ invorceOrderIdMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Id);
+ }
+ }
+
+ //List<Attachment> attachmentinfo = [SELECT Id, Name, OwnerId,Owner.Name, CreatedDate FROM Attachment WHERE parentid = :invoiceId];
+ // if (attachmentinfo.size() > 0) {
+ // for (Integer i = 0; i < attachmentinfo.size(); i++) {
+ // attachmentRecoeds.add(new InvoiceOrderInfo(attachmentinfo[i]));
+ // }
+ // }
+ List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :invoiceId];
+ if (cvInfo.size() > 0) {
+ for (Integer i = 0; i < cvInfo.size(); i++) {
+ attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i]));
+ }
+ }
+ System.debug('attachmentRecoeds = ' + attachmentRecoeds);
+ System.debug('consumableaccessoriesMap = ' + consumableaccessoriesMap);
+ for (InvoiceOrderInfo ass : attachmentRecoeds) {
+ if (consumableaccessoriesMap.containsKey(ass.cvInfo.Id)) {
+ ass.mailSelectOptsin = consumableaccessoriesMap.get(ass.cvInfo.Id);
+ ass.invoiceOrderId = invorceOrderIdMap.get(ass.cvInfo.Id);
+ }
+ }
+ data.put('EditAble', EditAble);
+ data.put('isChange', isChange);
+ data.put('coc', coc);
+ data.put('ExistOutbound', getExistOutbound());
+ data.put('invoiceOrderRecoeds', invoiceOrderRecoeds);
+ data.put('provinceOptsMap', provinceOptsMap);
+ data.put('HospitalName', HospitalName);
+ data.put('HospitalInfo', HospitalInfo);
+ data.put('agencyProType', agencyProType);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('done', getdone());
+ data.put('invoiceOrderdetail1Recoeds', invoiceOrderdetail1Recoeds);
+ data.put('accountid', accountid);
+ data.put('invoiceOrderRecoedschange',invoiceOrderRecoedschange);
+ data.put('attachmentRecoeds',attachmentRecoeds);
+ data.put('outOrderStringList',outOrderStringList);
+ data.put('outordercountMap',outordercountMap);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+
+ //淇濆瓨
+ @AuraEnabled
+ public static ResponseBodyLWC save(
+ Consumable_order__c cocLwc,
+ String HospitalNameLwc,
+ String HospitalInfoLwc,
+ String SecondDealerLwc,
+ String invoiceOrderRecoedsLwc,
+ String deliveryIdLwc,
+ String invoiceIdLwc,
+ String accountidLwc,
+ String agencyProTypeLwc,
+ String reopenLwc,
+ String invoiceOrderRecoedschangeLwc
+ ) {
+ System.debug('enter LexConInvoiceViewController.save success');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ coc = cocLwc;
+ HospitalName = HospitalNameLwc;
+ HospitalInfo = HospitalInfoLwc;
+ System.debug('HospitalInfo = ' + HospitalInfo);
+ SecondDealer = SecondDealerLwc;
+ errorMsg = '';
+ deliveryId = deliveryIdLwc;
+ invoiceOrderRecoeds = (List<InvoiceOrderInfo>)JSON.deserialize(invoiceOrderRecoedsLwc, List<InvoiceOrderInfo>.class);
+ invoiceId = invoiceIdLwc;
+ accountid = accountidLwc;
+ agencyProType = agencyProTypeLwc;
+ reopen = reopenLwc;
+ invoiceOrderRecoedschange = (List<InvoiceOrderInfo>)JSON.deserialize(invoiceOrderRecoedschangeLwc, List<InvoiceOrderInfo>.class);
+
+ List<String> chukudanID = new List<String>();
+ if (coc.Name == '' || coc.Name == null) {
+ // coc.Name.addError('璇峰綍鍏ュ彂绁ㄥ彿');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇峰綍鍏ュ彂绁ㄥ彿', '');
+ }
+ if (coc.Invoice_Date__c == null) {
+ // coc.Invoice_Date__c.addError('璇峰綍鍏ュ彂绁ㄦ棩鏈�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇峰綍鍏ュ彂绁ㄦ棩鏈�', '');
+ }
+ if (String.isBlank(HospitalInfo) && String.isBlank(SecondDealer)) {
+ // coc.addError('蹇呴』杈撳叆瀹㈡埛鍚嶆垨鑰呬簩绾х粡閿�鍟�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '蹇呴』杈撳叆瀹㈡埛鍚嶆垨鑰呬簩绾х粡閿�鍟�', '');
+ }
+ if (HospitalInfo != null && HospitalInfo != '' && String.isNotEmpty(SecondDealer)) {
+ //coc.addError('璇疯緭鍏ュ鎴峰悕銆佷簩绾х粡閿�鍟嗗彧鍙緭鍏ヤ竴涓�');
+ errorMsg += '璇疯緭鍏ュ鎴峰悕銆佷簩绾х粡閿�鍟嗗彧鍙緭鍏ヤ竴涓�';
+ }
+ if (HospitalInfo != null && HospitalInfo != '') {
+ if (coc.Order_ForCustomerText__c == null) {
+ // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
+ }
+ } else {
+ if (coc.Order_ForCustomerText__c != null) {
+ // coc.Order_ForCustomerText__c.addError('涓嶉渶瑕佽緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佽緭鍏ョ瀹�', '');
+ }
+ }
+ String shipmentAccountString = '';
+ if (HospitalInfo != null) {
+ shipmentAccountString = HospitalInfo;
+ } else if (String.isNotEmpty(SecondDealer)) {
+ shipmentAccountString = SecondDealer;
+ } else {
+ shipmentAccountString = coc.Order_ForDealerText__c == null ? '' : coc.Order_ForDealerText__c;
+ }
+
+ Integer x = 0;
+ List<String> invoiceOrderAccountList = new List<String>();
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ if (String.isBlank(deliveryId)) {
+ if (ass.check == true) {
+ x++;
+ System.debug(shipmentAccountString);
+ if (HospitalInfo != null && HospitalInfo != '') {
+ if (ass.esd.Order_ForHospital__c != shipmentAccountString) {
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ if (String.isNotEmpty(SecondDealer)) {
+ if (
+ ass.esd.Order_ForDealer__c != shipmentAccountString &&
+ ass.esd.Order_ForDealerText__c != shipmentAccountString
+ ) {
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ if (coc.Order_ForDealerText__c != null && (HospitalInfo == null || HospitalInfo == '')) {
+ if (
+ (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') &&
+ ass.esd.ShipmentAccount__c != shipmentAccountString
+ ) {
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ }
+ } else {
+ if (HospitalInfo != null && HospitalInfo != '') {
+
+ System.debug('++++++++++++' + ass.esd.Order_ForHospital__c + ' ' + shipmentAccountString);
+ if (ass.esd.Order_ForHospital__c != shipmentAccountString) {
+ System.debug('HospitalInfo != null ass.esd.Order_ForHospital__c != shipmentAccountString');
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ //if (String.isNotEmpty(SecondDealer)) {
+ if (String.isNotEmpty(SecondDealer)) {
+ if (ass.esd.Order_ForDealer__c != shipmentAccountString) {
+ System.debug('String.isNotEmpty(SecondDealer) ass.esd.Order_ForHospital__c != shipmentAccountString');
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ if (coc.Order_ForDealerText__c != null && (HospitalInfo == null || HospitalInfo == '')) {
+ if (
+ (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') &&
+ ass.esd.ShipmentAccount__c != shipmentAccountString
+ ) {
+ System.debug('HospitalInfo == null && ass.esd.Order_ForDealerText__c != null ass.esd.ShipmentAccount__c != shipmentAccountString');
+ invoiceOrderAccountList.add(ass.esd.Name);
+ }
+ }
+ }
+ }
+ // invoiceOrderAccountList.add('12345');
+ if (invoiceOrderAccountList.size() > 0) {
+ orderRemind = invoiceOrderAccountList + '鍑哄簱鍗曞鎴峰悕涓庡彂绁ㄥ鎴峰悕涓嶄竴鑷达紒';
+ // coc.addError(invoiceOrderAccountList + '鍑哄簱鍗曞鎴峰悕涓庡彂绁ㄥ鎴峰悕涓嶄竴鑷达紒');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, invoiceOrderAccountList + '鍑哄簱鍗曞鎴峰悕涓庡彂绁ㄥ鎴峰悕涓嶄竴鑷达紒', '');
+ } else {
+ orderRemind = '';
+ }
+ if (String.isBlank(deliveryId)) {
+ if (x < 1) {
+ // coc.addError('璇烽�夋嫨闇�瑕佸紑鍙戠エ鐨勫嚭搴撳崟锛�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇烽�夋嫨闇�瑕佸紑鍙戠エ鐨勫嚭搴撳崟锛�', '');
+ }
+ }
+ Consumable_order__c invoiceHead = new Consumable_order__c();
+ List<String> outOrderIdList = new List<String>();
+ List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>();
+ Map<String, String> insertDetMap = new Map<String, String>();
+ Map<String, String> deleteDetMap = new Map<String, String>();
+ //鏂板缓鍙戠エ鏃�
+ Savepoint sp = Database.setSavepoint();
+ try {
+ if (String.isBlank(invoiceId)) {
+ invoiceHead.Name = coc.Name;
+ if (coc.Invoice_status__c == null || String.isBlank(coc.Invoice_status__c))
+ coc.Invoice_status__c = '鑽夋涓�';
+ invoiceHead.Order_type__c = '鍙戠エ';
+ invoiceHead.Invoice_Date__c = coc.Invoice_Date__c;
+ invoiceHead.Dealer_Info__c = accountid;
+ invoiceHead.Invoice_Note__c = coc.Invoice_Note__c;
+ invoiceHead.Invoice_status__c = '鑽夋涓�';
+ invoiceHead.Order_ProType__c = agencyProType;
+ invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ //if (deliveryId != null) {
+ if (String.isNotBlank(deliveryId)) {
+ invoiceHead.Outbound_order__c = deliveryId;
+ }
+ invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ // if (SecondDealer == null) {
+ if (String.isBlank(SecondDealer)) {
+ if (HospitalInfo != null && HospitalInfo != '') {
+ invoiceHead.Order_ForHospital__c = HospitalInfo;
+ }
+ } else {
+ invoiceHead.Order_ForDealer__c = SecondDealer;
+ }
+ invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+
+ insert invoiceHead;
+
+ invoiceId = invoiceHead.Id;
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ cocinfo = [
+ SELECT
+ Id,
+ Name,
+ Invoice_status__c,
+ Invoice_Date__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__c,
+ Order_date__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ SummonsForDirction__c,
+ Order_ForCustomerText__c,
+ Invoice_Note__c,
+ Invoice_attachment__c,
+ Invoicedet_attachment__c,
+ Outbound_order__c
+ FROM Consumable_order__c
+ WHERE Id = :invoiceId
+ ];
+ if (cocinfo.size() > 0) {
+ invoiceHead = cocinfo[0];
+ }
+ if (!String.isBlank(deliveryId)) {
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ chukudanID.add(ass.esd.Id);
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ }
+ } else {
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ if (!String.isBlank(deliveryId)) {
+ chukudanID.add(ass.esd.Id);
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ } else {
+ if (ass.check == true) {
+ chukudanID.add(ass.esd.Id);
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ } else {
+ //deleteDetMap.put(ass.esd.Id,invoiceHead.Id);
+ }
+ }
+ }
+ }
+ //鏂板缓鍙戠エ鏄庣粏1
+ if (chukudanID.size() > 0) {
+ newinvoicedetails1(chukudanID);
+ }
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'deleteDetMap +++++' + deleteDetMap.size()));
+ //return null;
+ if (insertDetMap.size() > 0) {
+ for (String field : insertDetMap.keySet()) {
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c = :field AND Invoice_Code_link__c = :insertDetMap.get(field)
+ ];
+ if (existLinkinfo.size() < 1) {
+ Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c();
+ invoiceLink.Name = field + insertDetMap.get(field);
+ invoiceLink.Outboundorder_Code_link__c = field;
+ invoiceLink.Invoice_Code_link__c = insertDetMap.get(field);
+ invoiceLinkList.add(invoiceLink);
+ }
+ }
+ upsert invoiceLinkList;
+ }
+ } else if (String.isNotBlank(reopen) && reopen.equals('isreopen') && String.isNotBlank(invoiceId)) {
+ System.debug('杩涘叆reopen');
+ invoiceHead.Name = coc.Name;
+ invoiceHead.Order_type__c = '鍙戠エ';
+ invoiceHead.Invoice_Date__c = coc.Invoice_Date__c;
+ invoiceHead.Dealer_Info__c = accountid;
+ invoiceHead.Invoice_Note__c = coc.Invoice_Note__c;
+ invoiceHead.Invoice_status__c = '鑽夋涓�';
+ invoiceHead.Order_ProType__c = agencyProType;
+ invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ //if (deliveryId != null) {
+ if (String.isNotBlank(deliveryId)) {
+ invoiceHead.Outbound_order__c = deliveryId;
+ }
+ invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+ //if (SecondDealer == null) {
+ if (String.isBlank(SecondDealer)) {
+ if (HospitalInfo != null && HospitalInfo != '') {
+ invoiceHead.Order_ForHospital__c = HospitalInfo;
+ }
+ } else {
+ invoiceHead.Order_ForDealer__c = SecondDealer;
+ }
+ invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+ insert invoiceHead;
+ System.debug('invoiceHead = ' + invoiceHead);
+
+ List<String> updateChukudanId = new List<String>();
+ //鑾峰彇鍘熷彂绁ㄧ浉鍏宠仈鐨勯摼鎺ヨ〃淇℃伅
+ List<Consumable_order_LinkTable__c> tLinkList = [
+ SELECT Outboundorder_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Invoice_Code_link__c = :invoiceId
+ ];
+
+ for (Consumable_order_LinkTable__c colc : tLinkList) {
+ colc.Invoice_Code_link__c = invoiceHead.Id;
+ updateChukudanId.add(colc.Outboundorder_Code_link__c);
+ }
+ System.debug('tLinkList = ' + tLinkList);
+ update tLinkList;
+ //鏇存柊鍙戠エ鏄庣粏淇℃伅
+ //鑾峰彇鍑哄簱鍗�,璁剧疆鍏宠仈鍏崇郴
+ //鑾峰彇鍑哄簱鍗曟槑缁嗕俊鎭�,鍥犱负鍑哄簱鍗曚俊鎭拰鍑哄簱鍗曟槑缁嗕俊鎭槸鍏宠仈鐨�,鎵�鏈夊彧闇�瑕佸洖婊氬嚭搴撳崟鏄庣粏淇℃伅鍗冲彲
+
+ Map<String, Consumable_Orderdetails__c> tempCocMap = new Map<String, Consumable_Orderdetails__c>();
+ List<Consumable_Orderdetails__c> tempCountList = [
+ SELECT
+ Id,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ InvoicedProCost_RMB__c,
+ Invoicedet1_OD_link__c,
+ InvoicedProduct_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_BoxCount__c,
+ Invoice_Unit__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId
+ ];
+ for (Consumable_Orderdetails__c cocTemp : tempCountList) {
+ 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
+ Id,
+ Consumable_order__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoice_Unitprice__c,
+ Box_Piece__c,
+ Invoice_Unit__c,
+ Consumable_order__r.Invoice_total_amount__c,
+ ProductPacking_list_manual__c,
+ InvoicedProduct_RMB__c,
+ Invoiced_BoxCount__c,
+ Shipment_amount__c,
+ Asset_Model_No__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c IN :updateChukudanId
+ ];
+ for (Consumable_Orderdetails__c corderc : updateFromList) {
+ String tempStr = corderc.Consumable_order__c + corderc.Asset_Model_No__c;
+ if (tempCocMap.get(tempStr) != null) {
+ //璁剧疆宸插彂绁ㄩ噾棰� 鍑哄簱鍗曠殑宸插彂绁ㄩ噾棰� - 鍙戠エ鐨勫彂绁ㄩ噾棰�
+ corderc.InvoicedProCost_RMB__c = corderc.InvoicedProCost_RMB__c - tempCocMap.get(tempStr).InvoicedProduct_RMB__c;
+ //璁剧疆宸插彂绁ㄦ暟閲� 鍑哄簱鍗曠殑宸插彂绁ㄦ暟閲� - 鍙戠エ鐨勫彂绁ㄦ暟閲�(鐩�)
+ corderc.Invoiced_Procount__c = corderc.Invoiced_Procount__c - tempCocMap.get(tempStr).Invoiced_BoxCount__c;
+ //璁剧疆鍙戠エ鍗曚环
+ if (corderc.Box_Piece__c == '鐩�' && corderc.Invoice_Unit__c == '涓�') {
+ corderc.Invoice_Unitprice__c = corderc.Delivery_List_RMB__c / corderc.ProductPacking_list_manual__c;
+ } else {
+ corderc.Invoice_Unitprice__c = corderc.Delivery_List_RMB__c;
+ }
+ }
+ }
+
+ 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) {
+ if (ass.check == true) {
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ } else {
+ outOrderIdList.add(ass.esd.Id);
+ deleteDetMap.put(ass.esd.Id, invoiceHead.Id);
+ }
+ }
+ if (outOrderIdList.size() > 0) {
+ getdefaultMapinfo(outOrderIdList);
+ }
+ //琚�変腑鐨勫嚭搴撳崟闆嗗悎
+ if (insertDetMap.size() > 0) {
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id, Invoice_Code_link__c, Outboundorder_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c IN :insertDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id
+ ];
+ //瀛樺湪娌℃湁涓庡彂绁ㄥ缓绔嬪叧鑱斿叧绯荤殑鍑哄簱鍗�
+ List<String> templist2 = new List<String>();
+ for (Consumable_order_LinkTable__c colc : existLinkinfo) {
+ templist2.add(colc.Outboundorder_Code_link__c);
+ }
+ //鑾峰彇璇ュ嚭搴撳崟
+ for (String field : insertDetMap.keySet()) {
+ if (!templist2.contains(field)) {
+ //璇ュ嚭搴撳崟涓嶅瓨鍦ㄤ笌閾炬帴琛ㄤ腑,鏂板缓閾炬帴
+ chukudanID.add(field);
+ Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c();
+ invoiceLink.Name = field + insertDetMap.get(field);
+ invoiceLink.Outboundorder_Code_link__c = field;
+ invoiceLink.Invoice_Code_link__c = insertDetMap.get(field);
+ invoiceLinkList.add(invoiceLink);
+ }
+ }
+ System.debug('invoiceLinkList = ' + invoiceLinkList);
+ upsert invoiceLinkList;
+ }
+ //鍒犻櫎鍑哄簱鍗曢摼鎺ヨ〃
+ if (deleteDetMap.size() > 0) {
+ List<Consumable_order_LinkTable__c> invoiceLinkdetList = new List<Consumable_order_LinkTable__c>();
+ deleteOutboundorder(deleteDetMap, invoiceHead.Id);
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id, Outboundorder_Code_link__c, Invoice_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c IN :deleteDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id
+ ];
+ for (Consumable_order_LinkTable__c colctemp : existLinkinfo) {
+ if (deleteDetMap.get(colctemp.Outboundorder_Code_link__c) == colctemp.Invoice_Code_link__c) {
+ //瀛樺湪涓庤鍙戠エ鍏宠仈鐨勫嚭搴撳崟
+ invoiceLinkdetList.add(colctemp);
+ }
+ }
+ System.debug('invoiceLinkdetList = ' + invoiceLinkdetList);
+ delete invoiceLinkdetList;
+ }
+ //鏂板缓鍙戠エ鏄庣粏1
+ if (chukudanID.size() > 0) {
+ newinvoicedetails1(chukudanID);
+ }
+ } else {
+ //CHAN-BSS5SQ update by rentongxiao 2020-09-04 end
+ //缂栬緫鍚庝繚瀛�
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ cocinfo = [
+ SELECT
+ Id,
+ Name,
+ Invoice_status__c,
+ Invoice_Date__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForHospital__c,
+ Order_date__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ SummonsForDirction__c,
+ Order_ForCustomerText__c,
+ Invoice_Note__c,
+ Invoice_attachment__c,
+ Invoicedet_attachment__c,
+ Outbound_order__c
+ FROM Consumable_order__c
+ WHERE Id = :invoiceId
+ ];
+ if (cocinfo.size() > 0) {
+ invoiceHead = cocinfo[0];
+ }
+ if (String.isNotBlank(deliveryId)) {
+ for (InvoiceOrderInfo ass : invoiceOrderRecoedschange) {
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ }
+
+ //鎹㈣揣鍗曚骇鍝佹暟閲�
+ Map<String, Decimal> needchangeOrderProcountMap = new Map<String, Decimal>();
+ Map<String, Decimal> returnProcountMap = new Map<String, Decimal>();
+ Map<String, Decimal> changeOrderProcountMap = new Map<String, Decimal>();
+ List<Consumable_Orderdetails__c> detaliFromList = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Unit__c,
+ Box_Piece__c,
+ Invoice_Cost_RMB__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :deliveryId
+ ];
+ for (Consumable_Orderdetails__c changeOD : detaliFromList) {
+ needchangeOrderProcountMap.put(changeOD.Asset_Model_No__c, changeOD.Shipment_Count__c);
+ }
+ //鍙戠エ杩斿搧淇℃伅
+ List<Consumable_Orderdetails__c> returnCountList = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_Unit__c,
+ Box_Piece__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId
+ ];
+
+ for (Consumable_Orderdetails__c changeOD : returnCountList) {
+ if (changeOD.RrturnPro_count__c > 0) {
+ if (returnProcountMap.containsKey(changeOD.Asset_Model_No__c)) {
+ returnProcountMap.put(
+ changeOD.Asset_Model_No__c,
+ returnProcountMap.get(changeOD.Asset_Model_No__c) + changeOD.RrturnPro_count__c
+ );
+ } else {
+ returnProcountMap.put(changeOD.Asset_Model_No__c, changeOD.RrturnPro_count__c);
+ }
+ }
+ }
+
+ //宸叉崲璐у崟鍑哄簱鏁伴噺淇℃伅
+ List<Consumable_Orderdetails__c> returnCount1List = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_Unit__c,
+ Box_Piece__c
+ FROM Consumable_Orderdetails__c
+ WHERE
+ Consumable_order__c IN (
+ SELECT Outboundorder_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Invoice_Code_link__c = :invoiceId
+ )
+ AND Consumable_order__r.Onchange_order__c = TRUE
+ AND Consumable_order__c != :deliveryId
+ ];
+ for (Consumable_Orderdetails__c changeOD : returnCount1List) {
+ changeOrderProcountMap.put(changeOD.Asset_Model_No__c, changeOD.Shipment_Count__c);
+ }
+ outOrderchange(insertDetMap);
+ } else {
+ invoiceHead.Name = coc.Name;
+ invoiceHead.Invoice_status__c = coc.Invoice_status__c;
+ invoiceHead.Invoice_Date__c = coc.Invoice_Date__c;
+ invoiceHead.Dealer_Info__c = accountid;
+ invoiceHead.Invoice_Note__c = coc.Invoice_Note__c;
+ invoiceHead.Invoice_status__c = '鑽夋涓�';
+ invoiceHead.Order_ProType__c = agencyProType;
+ invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'HospitalName +++++' + HospitalName));
+ //return null;
+ if (HospitalName != null && HospitalName != '') {
+ if (HospitalInfo != null && HospitalInfo != '') {
+ invoiceHead.Order_ForHospital__c = HospitalInfo;
+ }
+ } else {
+ invoiceHead.Order_ForHospital__c = null;
+ }
+ invoiceHead.Order_ForDealer__c = SecondDealer == '' ? null : SecondDealer;
+ invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+ update invoiceHead;
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ if (ass.check == true) {
+ insertDetMap.put(ass.esd.Id, invoiceHead.Id);
+ } else {
+ outOrderIdList.add(ass.esd.Id);
+ deleteDetMap.put(ass.esd.Id, invoiceHead.Id);
+ }
+ }
+ if (outOrderIdList.size() > 0) {
+ getdefaultMapinfo(outOrderIdList);
+ }
+ //CHAN-BSS5SQ update by rentongxiao 2020-09-08 start
+ //琚�変腑鐨勫嚭搴撳崟闆嗗悎
+ if (insertDetMap.size() > 0) {
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id, Invoice_Code_link__c, Outboundorder_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c IN :insertDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id
+ ];
+ //瀛樺湪娌℃湁涓庡彂绁ㄥ缓绔嬪叧鑱斿叧绯荤殑鍑哄簱鍗�
+ List<String> templist2 = new List<String>();
+ for (Consumable_order_LinkTable__c colc : existLinkinfo) {
+ templist2.add(colc.Outboundorder_Code_link__c);
+ }
+ //鑾峰彇璇ュ嚭搴撳崟
+ for (String field : insertDetMap.keySet()) {
+ if (!templist2.contains(field)) {
+ //璇ュ嚭搴撳崟涓嶅瓨鍦ㄤ笌閾炬帴琛ㄤ腑,鏂板缓閾炬帴
+ chukudanID.add(field);
+ Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c();
+ invoiceLink.Name = field + insertDetMap.get(field);
+ invoiceLink.Outboundorder_Code_link__c = field;
+ invoiceLink.Invoice_Code_link__c = insertDetMap.get(field);
+ invoiceLinkList.add(invoiceLink);
+ }
+ }
+ upsert invoiceLinkList;
+ }
+ if (deleteDetMap.size() > 0) {
+ List<Consumable_order_LinkTable__c> invoiceLinkdetList = new List<Consumable_order_LinkTable__c>();
+ deleteOutboundorder(deleteDetMap, invoiceHead.Id);
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id, Outboundorder_Code_link__c, Invoice_Code_link__c
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c IN :deleteDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id
+ ];
+ for (Consumable_order_LinkTable__c colctemp : existLinkinfo) {
+ if (deleteDetMap.get(colctemp.Outboundorder_Code_link__c) == colctemp.Invoice_Code_link__c) {
+ //瀛樺湪涓庤鍙戠エ鍏宠仈鐨勫嚭搴撳崟
+ invoiceLinkdetList.add(colctemp);
+ }
+ }
+ delete invoiceLinkdetList;
+ }
+ //CHAN-BSS5SQ update by rentongxiao 2020-09-08 end
+ //鏂板缓鍙戠エ鏄庣粏1
+ if (chukudanID.size() > 0) {
+ newinvoicedetails1(chukudanID);
+ }
+ }
+ }
+ } catch (Exception ex) {
+ Database.rollback(sp);
+ // ApexPages.addMessages(ex);
+ // return null;
+ System.debug('Exception ex = ' + ex.getMessage() + ex.getLineNumber());
+ errorMsg += ex.getMessage() + ex.getLineNumber();
+ }
+ data.put('invoiceId', invoiceId);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = errorMsg;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ public static void newinvoicedetails1(List<String> chukudanID) {
+ //鏂拌鍙戠エ鏄庣粏1
+ List<Consumable_Orderdetails__c> invoiceorderList1 = new List<Consumable_Orderdetails__c>();
+ //鍑哄簱鍗曟槑缁嗘洿鏂�
+ List<Consumable_Orderdetails__c> outOrderList1 = new List<Consumable_Orderdetails__c>();
+ List<Consumable_Orderdetails__c> detaliFromList = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Consumable_Product__c,
+ Intra_Trade_List_RMB__c,
+ Dealer_Custom_Price__c,
+ Sum_of_money__c,
+ Box_Piece__c,
+ Used_date__c,
+ Send_date__c,
+ Invoice_Unit__c,
+ ProductPacking_list_manual__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c IN :chukudanID AND InvoiceProNot_count__c > 0
+ ];
+
+ for (Integer i = 0; i < detaliFromList.size(); i++) {
+ Consumable_Orderdetails__c invoiceInsert1 = new Consumable_Orderdetails__c();
+ invoiceInsert1.Used_date__c = detaliFromList[i].Used_date__c;
+ invoiceInsert1.Send_date__c = detaliFromList[i].Send_date__c;
+ String str = string.valueOf(i + 1);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ invoiceInsert1.Name =
+ coc.Name +
+ '-' +
+ detaliFromList[i].Name.substring(detaliFromList[i].Name.length() - 7, detaliFromList[i].Name.length());
+ invoiceInsert1.Shipment_Count__c = detaliFromList[i].InvoiceProNot_count__c;
+ invoiceInsert1.Consumable_Product__c = detaliFromList[i].Consumable_Product__c;
+ invoiceInsert1.Intra_Trade_List_RMB__c = detaliFromList[i].Intra_Trade_List_RMB__c;
+ invoiceInsert1.Delivery_List_RMB__c = detaliFromList[i].Delivery_List_RMB__c;
+ invoiceInsert1.Dealer_Custom_Price__c = detaliFromList[i].Dealer_Custom_Price__c;
+ invoiceInsert1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+
+ if (detaliFromList[i].Box_Piece__c == '鐩�' && detaliFromList[i].Invoice_Unit__c == '涓�') {
+ invoiceInsert1.Invoice_Unitprice__c =
+ detaliFromList[i].Delivery_List_RMB__c / detaliFromList[i].ProductPacking_list_manual__c;
+ } else {
+ invoiceInsert1.Invoice_Unitprice__c = detaliFromList[i].Delivery_List_RMB__c;
+ }
+ invoiceInsert1.Box_Piece__c = detaliFromList[i].Box_Piece__c;
+ invoiceInsert1.Invoice_Unit__c = detaliFromList[i].Box_Piece__c;
+ if (detaliFromList[i].Invoiced_Procount__c == null)
+ detaliFromList[i].Invoiced_Procount__c = 0;
+ if (detaliFromList[i].RrturnPro_count__c == null)
+ detaliFromList[i].RrturnPro_count__c = 0;
+ invoiceInsert1.Invoiced_Count__c = detaliFromList[i].InvoiceProNot_count__c;
+ if (detaliFromList[i].InvoicedProCost_RMB__c == null)
+ detaliFromList[i].InvoicedProCost_RMB__c = 0;
+ invoiceInsert1.InvoicedProCost_RMB__c = invoiceInsert1.Invoiced_Count__c * invoiceInsert1.Delivery_List_RMB__c;
+ invoiceInsert1.Consumable_order__c = invoiceId;
+ invoiceInsert1.Invoicedet1_OD_link__c = detaliFromList[i].Consumable_order__c;
+ invoiceorderList1.add(invoiceInsert1);
+ }
+ System.debug('invoiceorderList1 +++++' + invoiceorderList1.size());
+ Savepoint sp = Database.setSavepoint();
+ System.debug('invoiceorderList1 = ' + invoiceorderList1);
+ if (invoiceorderList1.size() > 0) {
+ try {
+ System.debug('invoiceorderList1 = ' + invoiceorderList1);
+ insert invoiceorderList1;
+ } catch (Exception ex) {
+ Database.rollback(sp);
+ //ApexPages.addMessages(ex);
+ errorMsg += ex.getMessage();
+ }
+ }
+ }
+
+ public static void getdefaultMapinfo(List<String> orderIdList) {
+ List<Consumable_Orderdetails__c> existLinkinfo = new List<Consumable_Orderdetails__c>();
+ existLinkinfo = [
+ SELECT Id, Consumable_order__c, Consumable_product__c, Asset_Model_No__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c IN :orderIdList
+ ];
+ // for (Integer i = 0; i < existLinkinfo.size(); i++) {
+ // ordermx1defaultMap.put(existLinkinfo[i].Consumable_order__c + existLinkinfo[i].Asset_Model_No__c, 0);
+ // }
+ }
+
+ public static void deleteOutboundorder(Map<String, String> deleteMap, String value) {
+ //鍒犻櫎鍙戠エ鏄庣粏1
+ List<Consumable_Orderdetails__c> detInvoicedet1List = [
+ SELECT Id, Consumable_Shipment_order__c, Consumable_Sale_order__c, Consumable_product__c, Asset_Model_No__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :value AND Invoicedet1_OD_link__c = :deleteMap.keySet()
+ ];
+ System.debug('detInvoicedet1List = ' + detInvoicedet1List);
+ delete detInvoicedet1List;
+ }
+
+ //鎹㈣揣鍗曢摼鎺ヨ〃 鍙戠エ鏄庣粏2鍋氭垚
+ public static void outOrderchange(Map<String, String> insertDetMap) {
+ List<string> chukudanID = new List<string>();
+ List<Consumable_order_LinkTable__c> invoiceLinkList = new List<Consumable_order_LinkTable__c>();
+ Consumable_order__c p = new Consumable_order__c();
+ if (insertDetMap.size() > 0) {
+ for (String field : insertDetMap.keySet()) {
+ List<Consumable_order_LinkTable__c> existLinkinfo = [
+ SELECT Id
+ FROM Consumable_order_LinkTable__c
+ WHERE Outboundorder_Code_link__c = :field
+ ];
+ if (existLinkinfo.size() > 0) {
+ delete existLinkinfo;
+ }
+ chukudanID.add(field);
+ Consumable_order_LinkTable__c invoiceLink = new Consumable_order_LinkTable__c();
+ invoiceLink.Name = field + insertDetMap.get(field);
+ invoiceLink.Outboundorder_Code_link__c = field;
+ invoiceLink.Invoice_Code_link__c = insertDetMap.get(field);
+ invoiceLinkList.add(invoiceLink);
+ p.Id = field;
+ p.ConInvoice_Code__c = insertDetMap.get(field);
+ p.Onchange_order__c = true;
+ update p;
+ }
+ insert invoiceLinkList;
+ }
+ //鎹㈣揣鍑哄簱鍗曟槑缁�1鏇存柊
+ List<Consumable_Orderdetails__c> detaliFrom1List = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Invoice_Unit__c,
+ Box_Piece__c,
+ Consumable_Sale_order__r.Name,
+ Consumable_Shipment_order__r.Name
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c IN :chukudanID
+ ];
+ for (Consumable_Orderdetails__c changeOD : detaliFrom1List) {
+ changeOD.Invoiced_Procount__c = changeOD.Shipment_Count__c;
+ }
+ update detaliFrom1List;
+ }
+
+ //涓婁紶ContentVersion闄勪欢
+ @AuraEnabled
+ public static String saveFile(Id recordId, String fileName, String base64Data) {
+ base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
+ ContentVersion cv = new ContentVersion();
+ cv.Title = fileName;
+ cv.PathOnClient = '/' + fileName;
+ cv.FirstPublishLocationId = recordId;
+ cv.VersionData = EncodingUtil.base64Decode(base64Data);
+ cv.IsMajorVersion = true;
+ insert cv;
+ System.debug('cv.Id = ' + cv.Id);
+ return cv.Id;
+ }
+
+ // 淇濆瓨闄勪欢
+ @AuraEnabled
+ public static ResponseBodyLWC saveAttachment(String attachmentRecoedsLwc,String invoiceId) {
+ System.debug('杩涘叆 saveAttachment');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ invoiceId = invoiceId;
+ attachmentRecoeds = (List<InvoiceOrderInfo>)JSON.deserialize(attachmentRecoedsLwc, List<InvoiceOrderInfo>.class);
+ System.debug('attachmentRecoeds = ' + attachmentRecoeds);
+ try {
+ Consumable_accessories_invoice__c attachmentdetails = new Consumable_accessories_invoice__c();
+ for (InvoiceOrderInfo ass : attachmentRecoeds) {
+ if (!String.isBlank(ass.mailSelectOptsin)) {
+ attachmentdetails.Id = ass.invoiceOrderId;
+ attachmentdetails.Attachment_ID__c = ass.cvInfo.ContentDocumentId;
+ attachmentdetails.Accessories_type__c = ass.mailSelectOptsin;
+ if (String.isBlank(ass.invoiceOrderId)) {
+ attachmentdetails.Invoice_code__c = invoiceId;
+ }
+ upsert attachmentdetails;
+ }
+ }
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // 妫�绱�(鏈紑鍙戠エ鍑哄簱鍗�)
+ @AuraEnabled
+ public static ResponseBodyLWC InvoiceorderSearch(Consumable_order__c cocLwc,String invoiceIdLwc,String accountidLwc,String userWorkLocationLwc,String agencyProTypeLwc,String HospitalInfoLwc,String SecondDealerLwc,String invoiceOrderRecoedsLwc) {
+ System.debug('杩涘叆 InvoiceorderSearch');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ coc = cocLwc;
+ HospitalInfo = HospitalInfoLwc;
+ SecondDealer = SecondDealerLwc;
+ errorMsg = '';
+ invoiceOrderRecoeds = (List<InvoiceOrderInfo>)JSON.deserialize(invoiceOrderRecoedsLwc, List<InvoiceOrderInfo>.class);
+ invoiceId = invoiceIdLwc;
+ accountid = accountidLwc;
+ agencyProType = agencyProTypeLwc;
+ userWorkLocation = userWorkLocationLwc;
+
+ Map<String, String> invoiceOrderMap = new Map<String, String>();
+ String msoql = '';
+ List<InvoiceOrderInfo> invoiceOrderdetailMid = new List<InvoiceOrderInfo>();
+ if (String.isBlank(invoiceId)) {
+ msoql = makeSoql();
+ } else {
+ msoql = makeSoqlInit();
+ }
+ invoiceOrderList = new List<Consumable_order__c>();
+ invoiceOrderList = Database.query(msoql);
+ for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
+ if (ass.check == true) {
+ invoiceOrderdetailMid.add(ass);
+ invoiceOrderMap.put(ass.esd.Name, ass.esd.Name);
+ }
+ }
+ invoiceOrderRecoeds = new List<InvoiceOrderInfo>();
+ invoiceOrderRecoeds.addAll(invoiceOrderdetailMid);
+ for (Integer i = 0; i < invoiceOrderList.size(); i++) {
+ if (invoiceOrderMap.containsKey(invoiceOrderList[i].Name)) {
+ } else {
+ invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderList[i]));
+ invoiceOrderMap.put(invoiceOrderList[i].Name, invoiceOrderList[i].Name);
+ }
+ }
+ data.put('invoiceOrderRecoeds',invoiceOrderRecoeds);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ private static String makeSoql() {
+ String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c ';
+ soql += ' WHERE Dealer_Info__c = \'' + accountid + '\'';
+ soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\'';
+ soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\'';
+ soql += ' ) ';
+ soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ soql += ' AND Order_ProType__c =\'' + agencyProType + '\'';
+ soql += ' AND Billed_Status__c != \'鍏ㄩ儴寮�绁╘'';
+ soql += ' AND SummonsForDirction__c != \'浜掔浉璋冭揣\'';
+ if (HospitalInfo != null && HospitalInfo != '') {
+ soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\'';
+ }
+ if (String.isNotEmpty(SecondDealer)) {
+ soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\'';
+ }
+ if (coc.Order_ForDealerText__c != null) {
+ soql += ' AND ShipmentAccount__c = \'' + coc.Order_ForDealerText__c + '\'';
+ }
+ soql += ' AND InvoiceNotPro_total_amount__c > 0';
+ soql += ' AND Onchange_order__c = false limit 1000';
+ return soql;
+ }
+
+ private static String makeSoqlInit() {
+ String soql = 'SELECT Id, Order_ForDealer__r.Name,Order_ForHospital__r.Name,Order_ForDealerText__c, Name,Outbound_Date__c,ShipmentAccount__c,Shipment_total_amount__c,RrturnPro_total_amount__c,Total_Invoiced_Procount__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c,Invoice_total_amount__c,Billed_Status__c FROM Consumable_order__c ';
+ soql += ' WHERE Dealer_Info__c = \'' + accountid + '\'';
+ soql += ' AND (recordtypeid = \'' + System.Label.RT_ConOrder_Sale + '\'';
+ soql += ' OR recordtypeid = \'' + System.Label.RT_ConOrder_Shipment + '\'';
+ soql += ' ) ';
+ soql += ' AND Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ soql += ' AND Order_ProType__c =\'' + agencyProType + '\'';
+ soql += ' AND SummonsForDirction__c != \'浜掔浉璋冭揣\' ';
+ if (HospitalInfo != null && HospitalInfo != '') {
+ soql += ' AND Order_ForHospital__c = \'' + HospitalInfo + '\'';
+ }
+ if (SecondDealer != null) {
+ soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\'';
+ }
+ if (coc.Order_ForDealerText__c != null) {
+ soql += ' AND ShipmentAccount__c = \'' + coc.Order_ForDealerText__c + '\'';
+ }
+ soql += ' AND InvoiceNotPro_total_amount__c > 0';
+ soql += ' AND Onchange_order__c = false limit 1000';
+ return soql;
+ }
+
+ // 鍒犻櫎鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC deleteButton(String invoiceIdLwc,Consumable_order__c cocLwc) {
+ System.debug('杩涘叆 deleteButton');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ coc = cocLwc;
+ invoiceId = invoiceIdLwc;
+ system.debug('====invoiceId==========>' + invoiceId);
+ List<Consumable_Orderdetails__c> consList = [
+ SELECT id, Consumable_order__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId
+ ];
+ try {
+ system.debug('====cons==========>' + consList);
+ delete consList;
+ if (coc.id == invoiceId && coc.Invoice_status__c == '鑽夋涓�') {
+ delete coc;
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ } catch (Exception e) {
+ // ApexPages.addMessages(e);
+ // return null;
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), '');
+ }
+ }
+
+ // 鎻愪氦鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC approval(List<String> outOrderStringListLwc,Map<String, Consumable_Orderdetails__c> outordercountMapLwc,String invoiceIdLwc) {
+ System.debug('杩涘叆 approval');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ outOrderStringList = outOrderStringListLwc;
+ outordercountMap = outordercountMapLwc;
+ invoiceId= invoiceIdLwc;
+ //鏇存柊鍙戠エ鏄庣粏2閾炬帴
+ Consumable_order__c P = new Consumable_order__c();
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ List<Consumable_order_details2__c> invoiceorderList2 = new List<Consumable_order_details2__c>();
+ //鏇存柊鍑哄簱鍗曟槑缁�1
+ List<Consumable_Orderdetails__c> outOrderdetUp1List = new List<Consumable_Orderdetails__c>();
+ //闇�瑕佹洿鏂板嚭搴撳崟鏄庣粏1
+ List<Consumable_Orderdetails__c> outOrderdet1List = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Consumable_order__r.Name,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Box_Piece__c,
+ Invoice_Unit__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c IN :outOrderStringList
+ ];
+ for (Integer i = 0; i < outOrderdet1List.size(); i++) {
+ if (outordercountMap.containsKey(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)) {
+ Consumable_Orderdetails__c invoiceUpdte1 = new Consumable_Orderdetails__c();
+ invoiceUpdte1.Id = outOrderdet1List[i].Id;
+ invoiceUpdte1.Invoice_Unit__c = outordercountMap.get(
+ outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c
+ )
+ .Invoice_Unit__c;
+ if (
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Box_Piece__c ==
+ '鐩�' &&
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Invoice_Unit__c ==
+ '涓�'
+ ) {
+ Decimal OldinvoicedProcount = 0;
+ OldinvoicedProcount = (outordercountMap.get(
+ outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c
+ )
+ .Invoiced_Count__c /
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)
+ .ProductPacking_list_manual__c)
+ .setScale(2);
+ invoiceUpdte1.Invoiced_Procount__c = outOrderdet1List[i].Invoiced_Procount__c + OldinvoicedProcount;
+ } else {
+ invoiceUpdte1.Invoiced_Procount__c =
+ outOrderdet1List[i].Invoiced_Procount__c +
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)
+ .Invoiced_Count__c;
+ }
+ invoiceUpdte1.Invoice_Unitprice__c = outordercountMap.get(
+ outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c
+ )
+ .Invoice_Unitprice__c;
+ invoiceUpdte1.InvoicedProCost_RMB__c = invoiceUpdte1.Invoiced_Procount__c * outOrderdet1List[i].Delivery_List_RMB__c;
+
+ Decimal invoicedProcount = 0;
+ if (
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Box_Piece__c ==
+ '鐩�' &&
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c).Invoice_Unit__c ==
+ '涓�'
+ ) {
+ invoicedProcount = (outordercountMap.get(
+ outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c
+ )
+ .Invoiced_Count__c /
+ outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)
+ .ProductPacking_list_manual__c)
+ .setScale(2);
+ } else {
+ invoicedProcount = outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)
+ .Invoiced_Count__c;
+ }
+
+ if (outOrderdet1List[i].InvoiceProNot_count__c < invoicedProcount) {
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.Error,
+ // '鍑哄簱鍗�' +
+ // outOrderdet1List[i].Consumable_order__r.Name +
+ // '涓紝' +
+ // outOrderdet1List[i].Asset_Model_No__c +
+ // '杩樻病寮�绁ㄦ暟閲忓皬浜庡彂绁ㄦ暟閲忥紝璇风‘璁ゆ槸鍚︽湁杩斿搧'
+ // )
+ // );
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍑哄簱鍗�' + outOrderdet1List[i].Consumable_order__r.Name + '涓紝' + outOrderdet1List[i].Asset_Model_No__c + '杩樻病寮�绁ㄦ暟閲忓皬浜庡彂绁ㄦ暟閲忥紝璇风‘璁ゆ槸鍚︽湁杩斿搧', '');
+ }
+
+ outOrderdetUp1List.add(invoiceUpdte1);
+ }
+ }
+ Savepoint sp = Database.setSavepoint();
+ try {
+ //鍑哄簱鍗曟槑缁�1鏇存柊
+ if (outOrderdetUp1List.size() > 0) {
+ ControllerUtil.updateOrderDetails1Satus(outOrderdetUp1List);
+ }
+ //鍙戠エ鐘舵�佹洿鏂�
+ cocinfo = [
+ SELECT Id, Name, Invoice_status__c, Dealer_Info__c, Order_ForHospital__c, SummonsForDirction__c
+ FROM Consumable_order__c
+ WHERE Id = :invoiceId
+ ];
+ System.debug('cocinfo = ' + cocinfo);
+ if (cocinfo.size() > 0) {
+ p = cocinfo[0];
+ }
+ System.debug('p = ' + p);
+ p.Invoice_status__c = '鎻愪氦';
+ update p;
+ } catch (Exception ex) {
+ Database.rollback(sp);
+ // ApexPages.addMessages(ex);
+ // return null;
+ return new ResponseBodyLWC('Error', 500, ex.getMessage() + ' ' + ex.getLineNumber(), '');
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ class InvoiceOrderInfo implements Comparable {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Boolean oldCheck { get; set; }
+ @AuraEnabled
+ public Consumable_order__c esd { get; set; }
+ @AuraEnabled
+ public Consumable_Orderdetails__c esdet { get; set; }
+ @AuraEnabled
+ public Attachment attach { get; set; }
+ @AuraEnabled
+ public ContentVersion cvInfo{ get; set; }
+ @AuraEnabled
+ public String mailSelectOptsin { get; set; }
+ public List<SelectOption> mailSelectOpts { get; set; }
+ @AuraEnabled
+ public Map<String,String> mailSelectOptsMap { get; set; }
+ @AuraEnabled
+ public String invoiceOrderId { get; set; }
+ @AuraEnabled
+ public Decimal needInvoiceCount { get; set; }
+
+ // 鍑哄簱璁㈠崟
+ public InvoiceOrderInfo(Consumable_order__c e) {
+ check = false;
+ oldCheck = false;
+ esd = e;
+ needInvoiceCount = 0;
+ }
+ // 鍑哄簱璁㈠崟鏄庣粏1
+ public InvoiceOrderInfo(Consumable_Orderdetails__c e) {
+ esdet = e;
+ }
+ //闄勪欢
+ public InvoiceOrderInfo(Attachment e) {
+ attach = e;
+ mailSelectOpts = new List<SelectOption>();
+ mailSelectOpts.add(new SelectOption('鍙戠エ鍜屾槑缁�', '鍙戠エ鍜屾槑缁�'));
+ mailSelectOpts.add(new SelectOption('鍙戠エ', '鍙戠エ'));
+ mailSelectOpts.add(new SelectOption('鏄庣粏', '鏄庣粏'));
+ }
+ //ContentVersion
+ public InvoiceOrderInfo(ContentVersion cv) {
+ cvInfo = cv;
+ mailSelectOptsMap = new Map<String,String>();
+ mailSelectOptsMap.put('鍙戠エ鍜屾槑缁�', '鍙戠エ鍜屾槑缁�');
+ mailSelectOptsMap.put('鍙戠エ', '鍙戠エ');
+ mailSelectOptsMap.put('鏄庣粏', '鏄庣粏');
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConInvoiceViewController.cls-meta.xml b/force-app/main/default/classes/LexConInvoiceViewController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexConInvoiceViewController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexConInvoicedetailsController.cls b/force-app/main/default/classes/LexConInvoicedetailsController.cls
new file mode 100644
index 0000000..18a4fb5
--- /dev/null
+++ b/force-app/main/default/classes/LexConInvoicedetailsController.cls
@@ -0,0 +1,392 @@
+public with sharing class LexConInvoicedetailsController {
+ //鍑哄簱鍗曚娇鐢�
+ public static Consumable_order__c coc { get; set; }
+
+ //鍙戠エ浣跨敤
+ public static Consumable_order__c invoicecode { get; set; }
+
+ //浠锋牸璁$畻缁撴灉
+ public static Decimal sumPrice {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 Integer invoiceOrderRecoedsCount {
+ get {
+ return consumableorderdetails1Records == null ? 0 : consumableorderdetails1Records.size();
+ }
+ }
+
+ //椤甸潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init(String orderIdLwc,String invoiceIdLwc) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ orderId = orderIdLwc;
+ invoiceId = invoiceIdLwc;
+ consumableorderdetails1Records = new List<ConsumableorderdetailsInfo>();
+ sumPrice = 0;
+ coc = new Consumable_order__c();
+ //鍑哄簱鍗曚俊鎭�
+ coc = [SELECT Id, Name, Outbound_Date__c, Order_ForDealerText__c, Dealer_Info__c FROM Consumable_order__c WHERE Id = :orderId];
+ //鍙戠エ淇℃伅
+ invoicecode = [
+ SELECT Id, Name, ShipmentAccount__c, Order_ForCustomerText__c, Order_ForDealerText__c, Dealer_Info__c
+ FROM Consumable_order__c
+ WHERE Id = :invoiceId
+ ];
+ //鍙戠エ鏄庣粏1
+ Map<String, Consumable_Orderdetails__c> invoiceorderdet1CountMap = new Map<String, Consumable_Orderdetails__c>();
+ List<Consumable_Orderdetails__c> invoiceorderdetails1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Consumable_Count__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Invoice_Unit__c,
+ Invoicedet1_OD_link__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId AND Invoicedet1_OD_link__c = :orderId
+ ];
+ for (Integer i = 0; i < invoiceorderdetails1.size(); i++) {
+ invoiceorderdet1CountMap.put(invoiceorderdetails1[i].Asset_Model_No__c, invoiceorderdetails1[i]);
+ }
+ //鍑哄簱鍗曟槑缁�1锛岀敾闈㈡樉绀轰娇鐢�
+ List<Consumable_Orderdetails__c> consumableorderdetails1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Consumable_Count__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Consumable_Product__c,
+ Intra_Trade_List_RMB__c,
+ Dealer_Custom_Price__c,
+ Sum_of_money__c,
+ Used_date__c,
+ Send_date__c,
+ Box_Piece__c,
+ Invoice_Unit__c,
+ Consumable_Product__r.Packing_list_manual__c,
+ ProductPacking_list_manual__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :orderId
+ ];
+ for (Integer i = 0; i < consumableorderdetails1.size(); i++) {
+ consumableorderdetails1Records.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i]));
+ }
+ for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) {
+ if (invoiceorderdet1CountMap.containsKey(ass.esd.Asset_Model_No__c)) {
+ ass.check = true;
+ if (
+ invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c == null ||
+ invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c == ''
+ ) {
+ ass.esd.Invoice_Unit__c = ass.esd.Box_Piece__c;
+ } else {
+ ass.esd.Invoice_Unit__c = invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoice_Unit__c;
+ }
+ if (
+ invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c == null ||
+ invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c == 0
+ ) {
+ ass.invoiceCount = ass.esd.Invoiced_Count__c;
+ } else {
+ ass.invoiceCount = invoiceorderdet1CountMap.get(ass.esd.Asset_Model_No__c).Invoiced_Count__c;
+ }
+
+ if (ass.esd.Box_Piece__c == '鐩�' && ass.esd.Invoice_Unit__c == '涓�') {
+ ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual;
+ } else {
+ ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
+ }
+ Decimal invoiceAllprice = 0.00;
+ invoiceAllprice = (ass.invoiceCount * ass.esd.Invoice_Unitprice__c).setScale(2);
+ ass.invoiceAllprice = invoiceAllprice;
+ } else {
+ ass.invoiceCount = ass.esd.InvoiceProNot_count__c;
+ ass.esd.Invoice_Unit__c = ass.esd.Box_Piece__c;
+ ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
+ }
+ }
+ data.put('invoicecode',invoicecode);
+ data.put('coc',coc);
+ data.put('consumableorderdetails1Records',consumableorderdetails1Records);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ @AuraEnabled
+ 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);
+ invoiceId = invoiceIdLwc;
+ orderId = orderIdLwc;
+ System.debug('consumableorderdetails1Records = ' + consumableorderdetails1Records);
+ System.debug('invoiceId = ' + invoiceId);
+ System.debug('orderId = ' + orderId);
+
+ Savepoint sp = Database.setSavepoint();
+ //鏂拌鍙戠エ鏄庣粏1
+ List<Consumable_Orderdetails__c> invoiceorderList1 = new List<Consumable_Orderdetails__c>();
+ //鏇存柊鍙戠エ鏄庣粏1
+ List<Consumable_Orderdetails__c> invoiceorderUpList1 = new List<Consumable_Orderdetails__c>();
+ //鍒犻櫎鍙戠エ鏄庣粏1
+ List<Consumable_Orderdetails__c> invoiceorderDeList1 = new List<Consumable_Orderdetails__c>();
+
+ Map<String, Consumable_Orderdetails__c> invoiceordet1Map = new Map<String, Consumable_Orderdetails__c>();
+
+ List<String> consumableorderList = new List<String>();
+ List<String> consumableNameList = new List<String>();
+ try {
+ //鏇存柊鍑哄簱鍗曟槑缁�1
+ for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) {
+ consumableorderList.add(ass.esd.Asset_Model_No__c);
+ }
+
+ //鍙戠エ鏄庣粏1鑾峰彇
+ List<Consumable_Orderdetails__c> invoiceorderdetails1 = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Consumable_Count__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_No__c,
+ Invoice_Unit__c,
+ Box_Piece__c,
+ Invoicedet1_OD_link__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId AND Invoicedet1_OD_link__c = :orderId AND Asset_Model_No__c IN :consumableorderList
+ ];
+ for (Integer i = 0; i < invoiceorderdetails1.size(); i++) {
+ invoiceordet1Map.put(
+ invoiceorderdetails1[i].Invoicedet1_OD_link__c + invoiceorderdetails1[i].Asset_Model_No__c,
+ invoiceorderdetails1[i]
+ );
+ }
+ List<Consumable_Orderdetails__c> invoicedetails1count = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Invoicedet1_OD_link__c,
+ Asset_Model_No__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Consumable_Count__c,
+ Shipment_Count__c,
+ RrturnPro_count__c,
+ Delivery_List_RMB__c,
+ InvoicedProCost_RMB__c,
+ Invoiced_Procount__c,
+ Invoiced_Count__c,
+ Sum_of_money__c,
+ Invoice_Unitprice__c,
+ InvoiceProNot_count__c,
+ Invoice_Cost_RMB__c,
+ Invoice_Unit__c,
+ Invoice_No__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :invoiceId
+ ];
+ Integer invoiceRecordscon = invoicedetails1count.size() + 1;
+
+ for (ConsumableorderdetailsInfo ass : consumableorderdetails1Records) {
+ if (ass.check == true && ass.invoiceCount > 0) {
+ if (String.isEmpty(String.valueOf(ass.invoiceCount))) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇疯緭鍏ュ彂绁ㄦ暟閲忥紒'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ彂绁ㄦ暟閲忥紒', '');
+ }
+ if (ass.esd.Box_Piece__c == '鐩�' && ass.esd.Invoice_Unit__c == '涓�') {
+ if (ass.invoiceCount > (ass.esd.InvoiceProNot_count__c * ass.Packing_list_manual).setScale(0)) {
+ // ass.esd.InvoiceProNot_count__c.addError('鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�', '');
+ }
+ } else {
+ if (ass.invoiceCount > ass.esd.InvoiceProNot_count__c) {
+ // ass.esd.InvoiceProNot_count__c.addError('鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍙戠エ鏁伴噺涓嶈兘瓒呰繃杩樻病鍙戠エ鏁伴噺锛�', '');
+ }
+ }
+
+ //if(ass.esd.Invoice_Unit__c =='涓�'){
+ String invoiceCount = String.valueOf(ass.invoiceCount);
+ if (!Pattern.matches('^\\+{0,1}[1-9]\\d*', invoiceCount)) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鍙戠エ鏁伴噺蹇呴』鏄暣鏁�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍙戠エ鏁伴噺蹇呴』鏄暣鏁�', '');
+ }
+ //}
+
+ if (invoiceordet1Map.containsKey(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)) {
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Shipment_Count__c = ass.invoiceCount;
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Invoiced_Count__c = ass.invoiceCount;
+ //invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c = invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Delivery_List_RMB__c * ass.invoiceCount;
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)
+ .Invoice_Unit__c = ass.esd.Invoice_Unit__c;
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Box_Piece__c = ass.esd.Box_Piece__c;
+ if (ass.esd.Box_Piece__c == '鐩�' && ass.esd.Invoice_Unit__c == '涓�') {
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c =
+ (ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual) * ass.invoiceCount;
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).Invoice_Unitprice__c =
+ ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual;
+ } else {
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c).InvoicedProCost_RMB__c =
+ ass.esd.Delivery_List_RMB__c * ass.invoiceCount;
+ invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)
+ .Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
+ }
+
+ invoiceorderUpList1.add(invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c));
+ invoiceRecordscon++;
+ } else {
+ String str = string.valueOf(invoiceRecordscon);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ Consumable_Orderdetails__c invoiceInsert1 = new Consumable_Orderdetails__c();
+ invoiceInsert1.Used_date__c = ass.esd.Used_date__c;
+ invoiceInsert1.Send_date__c = ass.esd.Send_date__c;
+ invoiceInsert1.Name =
+ invoicecode.Name +
+ '-' +
+ ass.esd.Name.substring(ass.esd.Name.length() - 7, ass.esd.Name.length());
+ invoiceInsert1.Shipment_Count__c = ass.invoiceCount;
+ invoiceInsert1.Consumable_Product__c = ass.esd.Consumable_Product__c;
+ invoiceInsert1.Intra_Trade_List_RMB__c = ass.esd.Intra_Trade_List_RMB__c;
+ invoiceInsert1.Delivery_List_RMB__c = ass.esd.Delivery_List_RMB__c;
+ invoiceInsert1.Dealer_Custom_Price__c = ass.esd.Dealer_Custom_Price__c;
+ invoiceInsert1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ if (ass.esd.Box_Piece__c == '鐩�' && ass.esd.Invoice_Unit__c == '涓�') {
+ invoiceInsert1.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c / ass.Packing_list_manual;
+ } else {
+ invoiceInsert1.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
+ }
+ //invoiceInsert1.Invoice_Unitprice__c = ass.esd.Invoice_Unitprice__c;
+ invoiceInsert1.Invoice_Unit__c = ass.esd.Invoice_Unit__c;
+ invoiceInsert1.Box_Piece__c = ass.esd.Box_Piece__c;
+ if (ass.esd.Invoiced_Procount__c == null)
+ ass.esd.Invoiced_Procount__c = 0;
+ invoiceInsert1.Invoiced_Count__c = ass.invoiceCount;
+ if (ass.esd.InvoicedProCost_RMB__c == null)
+ ass.esd.InvoicedProCost_RMB__c = 0;
+ invoiceInsert1.InvoicedProCost_RMB__c = ass.invoiceCount * invoiceInsert1.Invoice_Unitprice__c;
+ invoiceInsert1.Consumable_order__c = invoiceId;
+ invoiceInsert1.Invoicedet1_OD_link__c = orderId;
+ invoiceRecordscon++;
+ invoiceorderList1.add(invoiceInsert1);
+ }
+ } else {
+ if (invoiceordet1Map.containsKey(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c)) {
+ invoiceorderDeList1.add(invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c));
+ }
+ }
+ }
+
+ if (invoiceorderList1.size() > 0) {
+ insert invoiceorderList1;
+ }
+ if (invoiceorderUpList1.size() > 0) {
+ update invoiceorderUpList1;
+ }
+ if (invoiceorderDeList1.size() > 0) {
+ delete invoiceorderDeList1;
+ }
+ } catch (Exception e) {
+ ApexPages.addmessages(e);
+ // Database.rollback(sp);
+ // return null;
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), '');
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // Data Bean
+ class ConsumableorderdetailsInfo {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Boolean oldCheck { get; set; }
+ @AuraEnabled
+ public Consumable_Orderdetails__c esd { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Decimal invoiceCount { get; set; }
+ @AuraEnabled
+ public Decimal invoiceAllprice { get; set; }
+ @AuraEnabled
+ public Decimal Packing_list_manual { get; set; }
+ public List<SelectOption> Invoice_UnitOpts { get; set; }
+ @AuraEnabled
+ public Map<String,String> Invoice_UnitOptsMap { get; set; }
+ // 娑堣�楀搧浜у搧鏄庣粏
+ public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
+ check = false;
+ oldCheck = false;
+ esd = e;
+ Prod = e.Consumable_Product__r;
+ invoiceAllprice = 0;
+
+ Packing_list_manual = e.Consumable_Product__r.Packing_list_manual__c;
+
+ Invoice_UnitOpts = new List<SelectOption>();
+ Invoice_UnitOpts.add(new SelectOption('鐩�', '鐩�'));
+ Invoice_UnitOpts.add(new SelectOption('涓�', '涓�'));
+
+ Invoice_UnitOptsMap = new Map<String,String>();
+ Invoice_UnitOptsMap.put('鐩�', '鐩�');
+ Invoice_UnitOptsMap.put('涓�', '涓�');
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConInvoicedetailsController.cls-meta.xml b/force-app/main/default/classes/LexConInvoicedetailsController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexConInvoicedetailsController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexConsumableAccountController.cls b/force-app/main/default/classes/LexConsumableAccountController.cls
new file mode 100644
index 0000000..9925a02
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableAccountController.cls
@@ -0,0 +1,422 @@
+public without sharing class LexConsumableAccountController {
+ //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
+ public static String agencyProType { get; set; }
+ public static String agencyProTypestr { get; set; }
+ //閫夐」鍗″悕绉�
+ public static String filterName { get; set; }
+ //閫夐」鍗$被鍨�
+ public static String hosptialType { get; set; }
+ public static ApexPages.StandardSetController setCon { get; set; }
+ //鐢婚潰鏄剧ず鏁伴噺
+ public static Integer size { get; set; }
+ public static Integer noOfRecords { get; set; }
+ //鏄剧ず闆嗗悎
+ public static List<Account> pageRecords { get; set; }
+ //缁忛攢鍟嗕俊鎭�
+ private static String accountName { get; set; }
+ private static String accountId { get; set; }
+ //鎺掑簭浣跨敤
+ // public static String sortKey { get; set; }
+ // public static String preSortKey { get; private set; }
+ // public static Boolean sortOrderAsc { get; private set; }
+ // public static String[] sortOrder { get; private set; }
+ // //鎺掑簭浣跨敤
+ // private static String[] orderby = new String[]{ 'Name','State_Master__c','Salesdepartment_HP__c','CreatedDate','Is_Active__c','RecordType.Name','Grade__c','OCM_Category__c','City_Master__c','Town__c','Phone'};
+ //涓婂懆寮�濮嬨�佺粨鏉熸棩鏈�
+ private static Datetime lastweekstart { get; set; }
+ private static Datetime lastweekend { get; set; }
+ // page
+ public static Integer pagesize { get; set; }
+ public static Integer pageToken { get; set; }
+ public static String sortField { get; set; }
+ public static String sortOrder { get; set; }
+ public static Integer totalcount { get; set; }
+
+ //鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init(Integer pageSizeLWC, Integer pageTokenLWC, String fiscalYear) {
+ try {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ pageSize = pageSizeLWC;
+ pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
+
+ User Useracc = [SELECT accountid, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
+ accountId = [SELECT id, Name FROM account WHERE id = :Useracc.accountid].id;
+ agencyProType = Useracc.UserPro_Type__c;
+ if (String.isBlank(Useracc.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ agencyProTypestr = '%' + agencyProType + '%';
+ System.debug('accountId = ' + accountId);
+ System.debug('agencyProTypestr = ' + agencyProTypestr);
+ List<Account> allSelectAccount = [
+ SELECT
+ id,
+ Name,
+ State_Master__c,
+ State_Master__r.Name,
+ Salesdepartment_HP__c,
+ CreatedDate,
+ Is_Active__c,
+ RecordType.Name,
+ Grade__c,
+ OCM_Category__c,
+ City_Master__c,
+ City_Master__r.Name,
+ Town__c,
+ Phone
+ FROM Account
+ WHERE
+ id IN (
+ SELECT Hospital__c
+ FROM Agency_Hospital_Link__c
+ WHERE Agency__c = :accountId AND Hosptial_Type__c LIKE :agencyProTypestr
+ )
+ ];
+ totalCount = allSelectAccount.size();
+
+ List<Account> selectAccList = [
+ SELECT
+ id,
+ Name,
+ State_Master__c,
+ State_Master__r.Name,
+ Salesdepartment_HP__c,
+ CreatedDate,
+ Is_Active__c,
+ RecordType.Name,
+ Grade__c,
+ OCM_Category__c,
+ City_Master__c,
+ City_Master__r.Name,
+ Town__c,
+ Phone
+ FROM Account
+ WHERE
+ id IN (
+ SELECT Hospital__c
+ FROM Agency_Hospital_Link__c
+ WHERE Agency__c = :accountId AND Hosptial_Type__c LIKE :agencyProTypestr
+ )
+ LIMIT :pageSize
+ ];
+ System.debug('selectAccList = ' + selectAccList);
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ //閿�閲忓墠鍗佺殑瀹㈡埛
+ // List<Account> acList = [
+ // SELECT
+ // id,
+ // Name,
+ // State_Master__c,
+ // State_Master__r.Name,
+ // Salesdepartment_HP__c,
+ // CreatedDate,
+ // Is_Active__c,
+ // RecordType.Name,
+ // Grade__c,
+ // OCM_Category__c,
+ // City_Master__c,
+ // City_Master__r.Name,
+ // Town__c,
+ // Phone
+ // FROM Account
+ // WHERE State_Master__r.Name != '' AND City_Master__r.Name != '' AND Is_Active__c = '鏈夊姽' AND RecordType.Name = '鐥呴櫌'
+ // LIMIT 10
+ // ];
+ TopInfo topInfo = new TopInfo();
+
+ Date today = Date.today();
+ Integer lastYear = today.year() - 1;
+ Integer thisYear = today.year();
+ Integer nextYear = today.year() + 1;
+ Date lastDatetime = Date.newInstance(lastYear, 4, 1);
+ Date thisDatetime = Date.newInstance(thisYear, 4, 1);
+ Date thisDatetime2 = Date.newInstance(thisYear, 4, 1);
+ Date nextDatetime = Date.newInstance(nextYear, 4, 1);
+
+ AggregateResult[] arList = null;
+
+ System.debug('fiscalYear = ' + fiscalYear);
+ if (fiscalYear == 'thisYear') {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime, nextDatetime);
+ topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ arList = LexConsumableAccountSOQL.getAccountBySales(thisDatetime, nextDatetime);
+ } else if (fiscalYear == 'lastYear') {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, thisDatetime2);
+ topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, thisDatetime2);
+ } else {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, nextDatetime);
+ topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime);
+ }
+
+ //鏌ヨ瀹㈡埛淇℃伅锛堝悕绉帮紝鐪侊紝鍘匡級
+ List<String> accountList = new List<String>();
+ for (AggregateResult ar : arList) {
+ System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount')));
+ if(String.valueOf(ar.get('thisAmount')) != '0.0'){
+ accountList.add(String.valueOf(ar.get('hospitalName')));
+ topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount'))));
+ }
+ }
+
+ System.debug('accountList = ' + accountList);
+ System.debug('topInfo = ' + topInfo);
+
+ List<Account> acList = [
+ SELECT
+ id,
+ Name,
+ State_Master__c,
+ State_Master__r.Name,
+ Salesdepartment_HP__c,
+ CreatedDate,
+ Is_Active__c,
+ RecordType.Name,
+ Grade__c,
+ OCM_Category__c,
+ City_Master__c,
+ City_Master__r.Name,
+ Town__c,
+ Phone
+ FROM Account
+ WHERE Name = :accountList
+ ];
+
+ List<Account> acListTemp = new List<Account>();
+
+ for (String s : accountList) {
+ for (Account a : acList) {
+ if (s == a.Name) {
+ acListTemp.add(a);
+ }
+ }
+ }
+
+ topInfo.acList = acListTemp;
+
+ data.put('topInfo', topInfo);
+ data.put('pageRecords', selectAccList);
+ data.put('paginatedAccounts', paginatedAccounts);
+ data.put('accountId', accountId);
+ data.put('agencyProType', agencyProType);
+ data.put('agencyProTypestr', agencyProTypestr);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = '';
+ return res;
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
+ }
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC changeFiscalYearView(String fiscalYear) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ try {
+ TopInfo topInfo = new TopInfo();
+
+ Date today = Date.today();
+ Integer lastYear = today.year() - 1;
+ Integer thisYear = today.year();
+ Integer nextYear = today.year() + 1;
+ Date lastDatetime = Date.newInstance(lastYear, 4, 1);
+ Date thisDatetime = Date.newInstance(thisYear, 4, 1);
+ Date thisDatetime2 = Date.newInstance(thisYear, 4, 1);
+ Date nextDatetime = Date.newInstance(nextYear, 4, 1);
+
+ AggregateResult[] arList = null;
+
+ System.debug('fiscalYear = ' + fiscalYear);
+ if (fiscalYear == 'thisYear') {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime, nextDatetime);
+ topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ arList = LexConsumableAccountSOQL.getAccountBySales(thisDatetime, nextDatetime);
+ } else if (fiscalYear == 'lastYear') {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, thisDatetime2);
+ topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, thisDatetime2);
+ } else {
+ AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, nextDatetime);
+ topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
+ System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
+ arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime);
+ }
+ //鏌ヨ瀹㈡埛淇℃伅锛堝悕绉帮紝鐪侊紝鍘匡級
+ List<String> accountList = new List<String>();
+ for (AggregateResult ar : arList) {
+ System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount')));
+ if(String.valueOf(ar.get('thisAmount')) != '0.0'){
+ accountList.add(String.valueOf(ar.get('hospitalName')));
+ topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount'))));
+ }
+
+ }
+ System.debug('accountList = ' + accountList);
+ System.debug('topInfo = ' + topInfo);
+ List<Account> acList = [
+ SELECT
+ id,
+ Name,
+ State_Master__c,
+ State_Master__r.Name,
+ Salesdepartment_HP__c,
+ CreatedDate,
+ Is_Active__c,
+ RecordType.Name,
+ Grade__c,
+ OCM_Category__c,
+ City_Master__c,
+ City_Master__r.Name,
+ Town__c,
+ Phone
+ FROM Account
+ WHERE Name = :accountList
+ ];
+ List<Account> acListTemp = new List<Account>();
+ for (String s : accountList) {
+ for (Account a : acList) {
+ if (s == a.Name) {
+ acListTemp.add(a);
+ }
+ }
+ }
+ topInfo.acList = acListTemp;
+ data.put('topInfo', topInfo);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = '';
+ return res;
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
+ }
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC changelistView(
+ String filterNameLwc,
+ String accountIdLwc,
+ String agencyProTypeLwc,
+ Integer pageSizeLWC,
+ Integer pageTokenLWC,
+ String sortFieldLWC,
+ String sortOrderLWC
+ ) {
+ try {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ filterName = filterNameLwc;
+ accountId = accountIdLwc;
+ agencyProTypestr = agencyProTypeLwc;
+ pageSize = pageSizeLWC;
+ pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
+ sortField = sortFieldLWC;
+ sortOrder = sortOrderLWC;
+
+ String soql = makeSoql(filterName, accountId);
+ System.debug('soql1+++++++ ' + soql);
+ List<Account> allSelectAccount = Database.query(soql);
+
+ totalCount = allSelectAccount.size();
+ if (String.isNotBlank(sortField)) {
+ soql += ' order by ' + sortField + ' ' + sortOrder;
+ }
+ soql += ' limit ' + pagesize + ' offset ' + pageToken;
+ System.debug('soql2+++++++ ' + soql);
+ List<Account> selectAccList = Database.query(soql);
+ System.debug('selectAccList = ' + selectAccList);
+
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ data.put('pageRecords', selectAccList);
+ data.put('paginatedAccounts', paginatedAccounts);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = '';
+ return res;
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), '');
+ }
+ }
+
+ //sql鏂囦綔鎴�
+ private static String makeSoql(String viewName, String accountId) {
+ Date st = Date.today().addDays(-7).toStartOfWeek();
+ lastweekstart = Datetime.newInstance(st.year(), st.month(), st.day(), 8, 0, 0);
+ lastweekend = lastweekstart.addDays(7);
+ String soql = 'SELECT id,Name,State_Master__c,Salesdepartment_HP__c,CreatedDate,Is_Active__c,RecordType.Name,State_Master__r.Name,City_Master__r.Name';
+ soql += ' ,Grade__c,OCM_Category__c,City_Master__c,Town__c,Phone FROM Account';
+ soql +=
+ ' WHERE id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c =:accountId AND Hosptial_Type__c like \'%' +
+ String.escapeSingleQuotes(agencyProTypestr.replaceAll('%', '\\%')) +
+ '%\')';
+ if (viewName == '61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌') {
+ soql += ' AND Is_Active__c = \'' + '鑽夋涓�' + '\'';
+ }
+ if (viewName == '62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌') {
+ soql += ' AND Is_Active__c = \'' + '鐢宠涓�' + '\'';
+ }
+ if (viewName == '63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�') {
+ soql += ' AND Is_Active__c = \'' + '鏈夋晥' + '\'';
+ soql += ' AND CreatedDate >= :lastweekstart ';
+ soql += ' AND CreatedDate < :lastweekend ';
+ }
+ System.debug('soql +++++' + soql);
+ return soql;
+ }
+
+ //鍒嗛〉Bean
+ public class PaginatedAccounts {
+ @AuraEnabled
+ public Integer nextPageToken;
+ @AuraEnabled
+ public Integer pageNumber { get; set; }
+ @AuraEnabled
+ public Integer totalRecords { get; set; }
+ @AuraEnabled
+ public Integer recordStart { get; set; }
+ @AuraEnabled
+ public Integer recordEnd { get; set; }
+ }
+
+ //top10 Account
+ public class TopInfo {
+ @AuraEnabled
+ public Decimal saleAmount { get; set; }
+ @AuraEnabled
+ public List<Account> acList { get; set; }
+ @AuraEnabled
+ public List<Decimal> deList { get; set; }
+
+ public TopInfo() {
+ acList = new List<Account>();
+ deList = new List<Decimal>();
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableAccountController.cls-meta.xml b/force-app/main/default/classes/LexConsumableAccountController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableAccountController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexConsumableAccountInfoController.cls b/force-app/main/default/classes/LexConsumableAccountInfoController.cls
new file mode 100644
index 0000000..09f8d19
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableAccountInfoController.cls
@@ -0,0 +1,49 @@
+public without sharing class LexConsumableAccountInfoController {
+ //鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init(String accId) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ Account obj = new Account();
+ if (accId != null) {
+ List<Account> accList = [
+ SELECT
+ Id,
+ Name,
+ Owner.Name,
+ Site,
+ Alias_Name2__c,
+ Grade__c,
+ OCM_Category__c,
+ Is_Active__c,
+ Ban_On_Use_Reason__c,
+ Attribute_Type__c,
+ Speciality_Type__c,
+ State_Master__r.Name,
+ City_Master__r.Name,
+ Town__c,
+ Street__c,
+ Address_Together__c,
+ Phone,
+ PhoneCall__c,
+ Fax,
+ Postal_Code__c,
+ Parent.Name,
+ Address__c
+ FROM Account
+ WHERE Id = :accId
+ ];
+ if (accList != null && accList.size() > 0) {
+ obj = accList.get(0);
+ }
+ }else {
+ return new ResponseBodyLWC('Error', 500, 'accId涓虹┖', '');
+ }
+ data.put('obj', obj);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = '';
+ return res;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableAccountInfoController.cls-meta.xml b/force-app/main/default/classes/LexConsumableAccountInfoController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableAccountInfoController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexConsumableAccountSOQL.cls b/force-app/main/default/classes/LexConsumableAccountSOQL.cls
new file mode 100644
index 0000000..eef1437
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableAccountSOQL.cls
@@ -0,0 +1,27 @@
+public with sharing class LexConsumableAccountSOQL {
+ public static AggregateResult[] getAccountBySales(Datetime thisDatetime ,Datetime nextDatetime){
+ AggregateResult[] arList = new List<AggregateResult>([
+ SELECT count(id), Consumable_order__r.Order_ForHospital__r.name hospitalName, sum(Sale_amount__c) thisAmount
+ FROM Consumable_Orderdetails__c
+ WHERE
+ CreatedDate >= :thisDatetime
+ AND CreatedDate < :nextDatetime
+ AND Consumable_order__r.Order_ForHospital__r.name != ''
+ GROUP BY Consumable_order__r.Order_ForHospital__r.Name
+ ORDER BY sum(Sale_amount__c) DESC
+ LIMIT 10
+ ]);
+ return arList;
+ }
+
+ public static AggregateResult[] getAccountTotalSales(Datetime thisDatetime ,Datetime nextDatetime){
+ AggregateResult[] saleAmountList = [
+ SELECT sum(Sale_amount__c) saleAmount
+ FROM Consumable_Orderdetails__c
+ WHERE CreatedDate >= :thisDatetime AND CreatedDate < :nextDatetime
+ ];
+ return saleAmountList;
+ }
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableAccountSOQL.cls-meta.xml b/force-app/main/default/classes/LexConsumableAccountSOQL.cls-meta.xml
new file mode 100644
index 0000000..754ecb1
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableAccountSOQL.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>57.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexConsumableController.cls b/force-app/main/default/classes/LexConsumableController.cls
new file mode 100644
index 0000000..ae8b99b
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableController.cls
@@ -0,0 +1,2264 @@
+public without sharing class LexConsumableController {
+ /*****************妞滅储鐢�******************/
+ public static Consumable_order__c coc { get; set; } // FIMXE Consumable_order__c 銇偆銉炽偣銈裤兂銈广�乻ql澶氥仚銇�
+ public static String category1 { get; set; }
+ public static String category5 { get; set; }
+ public static String category4 { get; set; }
+ public static String category3 { get; set; }
+ public static String category_Goods { get; set; }
+ public static Boolean specialCampaign { get; set; }
+ public static Boolean cansee { get; set; }
+ //缁忛攢鍟嗗悎鍚屽悕绉�
+ public static String contractName { get; set; }
+ //缁忛攢鍟嗗悎鍚孖D
+ public static String contractId { get; set; }
+ //缁忛攢鍟嗗畾浠锋煡鐪嬫潈闄�
+ public static Boolean dealerPricesee { get; set; }
+ /*****************鐢婚潰鍒濆鍖栫敤********************************/
+ /******20160313_add**************/
+ //public String idCheck {get;set;}
+ public static Boolean editAble { get; set; }
+ public static Boolean edoffersPrice { get; set; }
+ public static String statusEdit { get; set; }
+ public static Boolean returnOrder { get; set; }
+ public static String searchDone { get; set; }
+ //鏆傜敤20160323
+ public static Decimal disCount = 0;
+ //鎬讳环鏍艰绠楃粨鏋�
+ public static Decimal sumPrice { get; set; }
+ //鑷畾涔夌壒浠烽噾棰�
+ public static Decimal bargainPrice { get; set; }
+ //浜у搧涓婁笅闄�
+ public static String[] proLimitAndDate = new List<String>{};
+ /*****************鐢婚潰琛ㄧずBean******************/
+ private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview { get; set; }
+ public static Integer ConsumableorderdetailsCount {
+ get {
+ return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size();
+ }
+ }
+ public static Integer ConsumableorderdetailsviewCount {
+ get {
+ return consumableorderdetailsRecordsview == null ? 0 : consumableorderdetailsRecordsview.size();
+ }
+ }
+ public static List<String> lower = new List<String>();
+ //闄勪欢
+ public static List<ConsumableorderdetailsInfo> attachmentRecoeds { get; set; }
+ public static List<String> DealerProductId { get; set; }
+ public static Boolean editDelCommitBtnDisabled { get; private set; }
+ public static Boolean saveBtnDisabled { get; private set; }
+ public static Boolean sorderBtnDisabled { get; private set; }
+ public static String decisionCode { get; set; }
+ // 淇濆瓨鍚庡姩浣滐細 1.妫�绱� 2.鎺掑簭
+ public static String baseUrl { get; private set; }
+ public static String sortKey { get; set; }
+ public static String preSortKey { get; private set; }
+ public static Boolean sortOrderAsc { get; private set; }
+ public static String[] sortOrder { get; private set; }
+ private static List<String> contactDealer = new List<String>();
+ private static String[] columus = new List<String>{
+ 'Consumable_Product__r.Name',
+ 'Consumable_Product__r.Asset_Model_No__c',
+ 'Consumable_Product__r.Intra_Trade_List_RMB__c',
+ '',
+ '',
+ 'Consumable_Product__r.Category3__c',
+ 'Consumable_Product__r.Category4__c',
+ 'Consumable_Product__r.Category5__c'
+ };
+ private static String[] columus_no = new List<String>{
+ 'Product2__c.Name',
+ 'Product2__c.Asset_Model_No__c',
+ 'Product2__c.Intra_Trade_List_RMB__c',
+ '',
+ '',
+ 'Category3__c',
+ 'Category4__c',
+ 'Category5__c'
+ };
+ // 宸查�夋嫨浜у搧鏄庣粏
+ private static List<Attachment> attachmentinfo = new List<Attachment>();
+ /*****************銈姐兗銉堟檪鍐嶆绱㈡潯浠讹紙鐢婚潰銇嬨倝銇叆鍔涙潯浠躲倰鐒¤銇欍倠銇熴倎锛�******************/
+ private static String cate1ForSort = null;
+ private static String accountid = null;
+ private static String accountName = null;
+ // 浜у搧 ID
+ public static String ESetId { get; set; }
+ private static String userId = '';
+ //private String[] ProidListAll = new String[]{};
+ public static List<SelectOption> categoryOptionList { get; set; }
+ public static List<SelectOption> category4OptionList { get; set; }
+ public static List<SelectOption> category5OptionList { get; set; }
+ public static List<CusOption> category3Option { get; set; }
+ public static List<CusOption> category4Option { get; set; }
+ public static List<CusOption> category5Option { get; set; }
+ private static Map<Id, Dealer_Product__c> DealerProductMap = new Map<Id, Dealer_Product__c>();
+ public static List<String> orderzaikuId = new List<String>();
+ //鍒嗛〉鍔熻兘
+ public static Integer size { get; set; }
+ public static Integer pageLimit { get; set; }
+ public static Integer noOfRecords { get; set; }
+ public static ApexPages.StandardSetController con { get; set; }
+ public static String soql { get; set; }
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+ public static String agencyProType { get; set; }
+ public static String agencyProType1 {get;set;} //lt 20230526 瀹夊窘涓ょエ鍒� add
+ private static Boolean OSHFLG;//lt 20230517 瀹夊窘涓ょエ鍒� add
+ public static String methodType { get; set; }
+ public static String hospitalName { get; set; }
+ public static String hospitalId { get; set; }
+ public static String tempidHp { get; set; }
+ public static String tempidPp { get; set; }
+ private static List<String> hpids = new List<String>();
+ private static Boolean isfirst = false;
+ //鎶ラ敊鍜岃鍛婁俊鎭�
+ public static List<String> errorMsgList = new List<String>();
+ public static List<String> warningMsgList = new List<String>();
+ //鏋勯�犳柟娉�
+ public LexConsumableController() {
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ DealerProductId = new List<String>();
+ attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
+ editAble = false;
+ edoffersPrice = false;
+ returnOrder = false;
+ categoryOptionList = new List<SelectOption>();
+ category4OptionList = new List<SelectOption>();
+ category5OptionList = new List<SelectOption>();
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
+ }
+
+ private static void initStandardController() {
+ con = new ApexPages.StandardSetController(Database.getQueryLocator(soql));
+ con.setPageSize(size);
+ noOfRecords = con.getResultSize();
+ }
+
+ public static List<Product2__c> product2s() {
+ return (List<Product2__c>) con.getRecords();
+ }
+
+ private static List<ConsumableorderdetailsInfo> getPageInfo() {
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
+ if (ass.check == true) {
+ selectedIdMap.put(ass.Prod.id, ass.Prod.id);
+ reSet.add(ass);
+ }
+ }
+
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
+ if (editAble) {
+ consumableorderdetailsRecordsview = reSet;
+ }
+ Integer pagestartNo = (con.getPageNumber() * size) - size;
+ Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1);
+ Integer addNo = 0;
+ for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) {
+ Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
+ if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) {
+ addNo++;
+ //continue;
+ }
+ // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) {
+ // break;
+ // }
+ else {
+ if (consumableorderdetailsRecords[i].check == false) {
+ consumableorderdetailsRecords[i].esd = orderdetails1;
+ }
+ //consumableorderdetailsRecords[i].esd.Dealer_Custom_Price__c = consumableorderdetailsRecords[i].Prod.Intra_Trade_List_RMB__c * disCount / 100;
+ consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]);
+ addNo++;
+ }
+ // if (addNo >= size)
+ // break;
+ }
+ return consumableorderdetailsRecordsview;
+ }
+
+ @AuraEnabled
+ public static Results init(String type, String esetId, String keywordStr) {
+ Results results = new Results();
+ results.isNoteStay = LexUtility.getIsNoteStay();
+ errorMsgList = new List<String>();
+ warningMsgList = new List<String>();
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ DealerProductId = new List<String>();
+ attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
+ editAble = false;
+ edoffersPrice = false;
+ returnOrder = false;
+ categoryOptionList = new List<SelectOption>();
+ category4OptionList = new List<SelectOption>();
+ category5OptionList = new List<SelectOption>();
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
+ ESetId = esetId;
+ methodType = type;
+ if(String.isBlank(methodType) && String.isNotBlank(ESetId)){
+ List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid];
+ methodType = oclist.get(0).orderPattern__c;
+ }
+ statusEdit = keywordStr;
+ System.debug('Param:'+ESetId+'---'+methodType+'---'+statusEdit);
+ try {
+ sortKey = '1';
+ preSortKey = '1';
+ sortOrderAsc = false;
+ sortOrder = new String[8];
+ sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
+ cate1ForSort = '';
+ decisionCode = '';
+ sumPrice = 0;
+ specialCampaign = false;
+ if (ESetId != null && ESetId != '' && statusEdit == '' && statusEdit == null) {
+ editAble = false;
+ } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) {
+ editAble = true;
+ } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) {
+ editAble = true;
+ }
+ userId = UserInfo.getUserId();
+ List<user> Useracc = new List<user>();
+ //lt 20230517 瀹夊窘涓ょエ鍒� add ,OSHFLG__c
+ Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c,OSHFLG__c FROM user WHERE id = :userId ];
+ accountid = Useracc[0].accountid;
+ userWorkLocation = Useracc[0].Work_Location__c;
+ agencyProType = Useracc[0].UserPro_Type__c;
+ agencyProType1 = Useracc[0].UserPro_Type__c; //lt 20230526 瀹夊窘涓ょエ鍒� add
+ //lt 20230526 瀹夊窘涓ょエ鍒� start
+ OSHFLG = Useracc[0].OSHFLG__c; //lt 20230517 瀹夊窘涓ょエ鍒� add
+ if(OSHFLG){
+ agencyProType1 = 'OSH';
+ }
+ else if(String.isBlank(Useracc[0].UserPro_Type__c)){
+ agencyProType1 = 'ET';
+ }
+ //lt 20230526 瀹夊窘涓ょエ鍒� end
+ if (String.isBlank(Useracc[0].UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ //閿欒淇℃伅鎻愮ず
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder') && agencyProType == 'ET') {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鎮ㄦ病鏈夎璐у尰闄㈢壒浠蜂骇鍝佺殑鏉冮檺!'));
+ errorMsgList.add('鎮ㄦ病鏈夎璐у尰闄㈢壒浠蜂骇鍝佺殑鏉冮檺!');
+ }
+ contactDealer = new List<String>();
+ Date dateToday = Date.today();
+ //鏌ヨ缁忛攢鍟嗕笅鎵�鏈夋湁鏁堝悎鍚�
+ List<Account> contractList = [
+ SELECT Id, Name, RecordType.DeveloperName
+ FROM Account
+ WHERE
+ RecordType.DeveloperName = 'AgencyContract'
+ AND Contract_Decide_Start_Date__c <= :dateToday
+ AND Contract_Decide_End_Date__c >= :dateToday
+ and Contact_Type__c like :agencyProType1//lt 20230517 瀹夊窘涓ょエ鍒� add 1
+ and Agent_Ref__c =:accountid
+ and OSH_Dealer__c =: OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
+ ];
+ for (Account contract : contractList) {
+ contactDealer.add(contract.Id);
+ }
+ DealerProductMap = new Map<Id, Dealer_Product__c>();
+ DealerProductId = getDealerProductId();
+ Account accountInfo = [
+ SELECT Name, Dealer_discount__c, Product_Limit_Date__c, Product_Limit_DateENG__c
+ FROM account
+ WHERE id = :accountid
+ ];
+ accountName = accountInfo.Name;
+ String product_Limit;
+ if (agencyProType == 'ET') {
+ product_Limit = accountInfo.Product_Limit_Date__c;
+ } else {
+ product_Limit = accountInfo.Product_Limit_DateENG__c;
+ }
+ if (product_Limit != null && product_Limit != '') {
+ proLimitAndDate = product_Limit.split(',');
+ }
+ saveBtnDisabled = false;
+ sorderBtnDisabled = false;
+ coc = new Consumable_order__c();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ if (String.isBlank(agencyProType)) {
+ //return ;
+ }
+ List<Product2__c> Product2Selected = new List<Product2__c>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ //缁忛攢鍟嗗湪搴撴暟鎹�
+ List<Consumable_order_details2__c> countDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Box_Piece__c,
+ hospitalSpecialOffer__c,
+ promotionorder__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 Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Isoverdue__c = 1
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ];
+ if (ESetId == null || ESetId == '') {
+ //鑾峰彇缁忛攢鍟嗛粯璁ょ殑涓�涓悎鍚�
+ List<Account> contract = [
+ SELECT id, Name, State_Master__c, State_Master__r.Name
+ FROM Account
+ WHERE
+ ParentId = :accountid
+ AND Contact_Type__c like :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1
+ AND Contract_Decide_Start_Date__c <= :Date.Today()
+ AND Contract_Decide_End_Date__c >= :Date.Today()
+ AND OSH_Dealer__c =: OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
+ ];
+ if (contract.size() == 1) {
+ contractName = contract[0].Name;
+ contractId = contract[0].Id;
+ }
+ editDelCommitBtnDisabled = true;
+ List<String> DealerProductId = new List<String>();
+ soql = makeSoql('', '', '', '', '', false, DealerProductId);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ initStandardController();
+ product2Selected = Database.query(soql);
+
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(product2Selected[i]));
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ //鍙湁鍦ㄥ崗璁璐ф椂浼氳蛋杩欎釜for寰幆 鍏朵粬涓ょ璁㈣揣妯″紡閮借蛋鐨剆earchorderdetails鏂规硶
+ if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
+ for (Integer i = 0; i < countDel.size(); i++) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ //缁忛攢鍟嗗畾浠� 璁$畻
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ bss.sortBy = sortOrderAsc;
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ consumableorderdetailsRecords.add(bss);
+ }
+ consumableorderdetailsRecords.sort();
+ if (methodType != null && methodType != '' && (methodType.equals('hospitalorder') || methodType.equals('promotionorder'))) {
+ searchorderdetails(methodType,accountid,hospitalId,contractId,userWorkLocation,accountName,proLimitAndDate,editAble);
+ isfirst = true;
+ }
+ getPageInfo();
+ } else {
+ if (methodType != null && methodType.equals('hospitalorder')) {
+ List<Consumable_order__c> oclist = [
+ SELECT orderPattern__c, Order_ForHospital__c, Order_ForHospital__r.Name
+ FROM Consumable_order__c
+ WHERE id = :ESetid
+ ];
+ if (oclist.get(0).orderPattern__c.equals('hospitalorder')) {
+ hospitalName = oclist.get(0).Order_ForHospital__r.Name;
+ hospitalId = oclist.get(0).Order_ForHospital__c;
+ }
+ }
+ List<Consumable_Orderdetails__c> ConsumableorderdetailsSelected = new List<Consumable_Orderdetails__c>();
+ //淇敼
+ List<Consumable_order__c> qs = new List<Consumable_order__c>();
+ qs = [
+ SELECT
+ Id,
+ Name,
+ Order_status__c,
+ Consumable_pdf_insert_day__c,
+ Dealer_Info__c,
+ Deliver_date__c,
+ Order_Reason__c,
+ Order_date__c,
+ Contract_application_decision__c,
+ Total_amount__c,
+ Offers_Price__c,
+ Order_effective_contact__c,
+ Order_effective_contact__r.Name
+ FROM Consumable_order__c
+ WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation
+ ];
+ if (qs.size() > 0) {
+ coc = qs[0];
+ decisionCode = coc.Contract_application_decision__c;
+ contractName = coc.Order_effective_contact__r.Name;
+ contractId = coc.Order_effective_contact__r.Id;
+ }
+ if (qs[0].Order_status__c == '宸叉彁浜�' || qs[0].Order_status__c == '鎵瑰噯' || qs[0].Order_status__c == '闄勪欢涓婁紶瀹屾垚') {
+ saveBtnDisabled = true;
+ sorderBtnDisabled = true;
+ editDelCommitBtnDisabled = false;
+ }
+ // 閬告姙娓堛伩銇槑缁嗐倰鍙栧緱
+ ConsumableorderdetailsSelected = [
+ SELECT
+ Id,
+ Name,
+ Consumable_order__c,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Count__c,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Sum_of_money__c,
+ Consumable_Product__r.SFDA_Status__c,
+ Consumable_Product__r.Product2__r.Packing_list_manual__c,
+ Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
+ Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
+ FROM Consumable_Orderdetails__c
+ WHERE
+ recordtypeid = :System.Label.RT_ConOrderDetail1_Order
+ AND Consumable_order__c = :ESetId
+ AND Order_Owner_WorkLocal__c = :userWorkLocation
+ AND Consumable_order__r.Dealer_Info__c = :accountid
+ ];
+ for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) {
+ if(cdc1.Consumable_Product__c != null){
+ orderzaikuId.add(cdc1.Consumable_Product__c);
+ }
+ }
+ soql = makeSoqlorderdet();
+ System.debug('soql:'+soql);
+ size = orderzaikuId.size();
+ initStandardController();
+ product2Selected = Database.query(soql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ for (Integer i = 0; i < countDel.size(); i++) {
+ //add by rentx 2020-12-09
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (
+ String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))
+ ) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ consumableorderdetailsRecords.add(bss);
+ }
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ ass.sortBy = sortOrderAsc;
+ for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) {
+ sumPrice += cdc1.Sum_of_money__c;
+ if (ass.prod.Id == cdc1.Consumable_Product__c) {
+ ass.check = true;
+ ass.esd = cdc1;
+ }
+ }
+ }
+ //闄勪欢
+ // attachmentinfo = [SELECT Id, Name, OwnerId, Owner.Name FROM Attachment WHERE parentid = :ESetId];
+ // if (attachmentinfo.size() > 0) {
+ // for (Integer i = 0; i < attachmentinfo.size(); i++) {
+ // attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
+ // }
+ // }
+ List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :ESetId];
+ if (cvInfo.size() > 0) {
+ for (Integer i = 0; i < cvInfo.size(); i++) {
+ attachmentRecoeds.add(new ConsumableorderdetailsInfo(cvInfo[i]));
+ }
+ }
+ //
+ consumableorderdetailsRecords.sort();
+ getPageInfo();
+ }
+ //璁$畻搴撳瓨涓娿�佷笅闄�
+ productLimtAndDate();
+ lowerRecord();
+ //鏄庣粏鎺掑簭
+ List<String> upper = new List<String>();
+ if (String.isNotBlank(ESetid)) {
+ for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) {
+ if(bss.esd.Consumable_count__c != null && bss.allnumber != null && bss.upperlimit != null){
+ if (bss.esd.Consumable_count__c + bss.allnumber > bss.upperlimit) {
+ upper.add(bss.esd.Consumable_Product__r.Name__c);
+ }
+ }
+ }
+ }
+ if (upper.size() > 0) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺瓒呭嚭搴撳瓨涓婇檺!'));
+ warningMsgList.add('瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺瓒呭嚭搴撳瓨涓婇檺!');
+ for (Integer i = 0; i < upper.size(); i++) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, upper[i]));
+ warningMsgList.add(upper[i]);
+ }
+ }
+ if (lower.size() > 0) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺浣庝簬搴撳瓨涓嬮檺!'));
+ warningMsgList.add('瀛樺湪浠ヤ笅浜у搧璁㈣揣鏁伴噺浣庝簬搴撳瓨涓嬮檺!');
+ for (Integer i = 0; i < lower.size(); i++) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, lower[i]));
+ warningMsgList.add(lower[i]);
+ }
+ }
+ //浠锋牸鏌ョ湅鏉冮檺
+ Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe();
+ cansee = dfr.isAccessible();
+ AggregateResult[] categoryList = [
+ SELECT Count(id), Category3_text__c c3c
+ FROM Product2__c
+ WHERE Estimation_Entry_Possibility__c = '鈼�' AND Product_Type__c LIKE :agencyProType AND Category3_text__c != NULL
+ GROUP BY Category3_text__c
+ ];
+ //categoty3
+ // categoryOptionList = new List<SelectOption>();
+ category3Option = new List<CusOption>();
+ // categoryOptionList.add(new SelectOption('', '-鏃�-'));
+ category3Option.add(new CusOption('-鏃�-',''));
+ for (AggregateResult category3Search : categoryList) {
+ String deliverycnt = String.valueOf(category3Search.get('c3c'));
+ // categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
+ category3Option.add(new CusOption(deliverycnt,deliverycnt));
+ }
+ //categoty4
+ // category4OptionList = new List<SelectOption>();
+ category4Option = new List<CusOption>();
+ // category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4Option.add(new CusOption('-鏃�-',''));
+ //categoty5
+ // category5OptionList = new List<SelectOption>();
+ category5Option = new List<CusOption>();
+ // category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5Option.add(new CusOption('-鏃�-',''));
+ //return msg
+ consumableorderdetailsRecordsview = consumableorderdetailsRecords;
+ getConsumableShowTableFieldValue();
+ results.result = 'Success';
+ results.coc = coc;
+ results.editAble = editAble;
+ results.edoffersPrice = edoffersPrice;
+ results.editDelCommitBtnDisabled = EditDelCommitBtnDisabled;
+ results.category3Option = category3Option;
+ results.category4Option = category4Option;
+ results.category5Option = category5Option;
+ results.hospitalName = hospitalName;
+ results.contractName = contractName;
+ results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
+ results.attachmentRecoeds = attachmentRecoeds;
+ results.cansee = cansee;
+ results.agencyProType = agencyProType;
+ results.agencyProType1 = agencyProType1;
+ results.OSHFLG = OSHFLG;
+ results.userWorkLocation = userWorkLocation;
+ results.accountName = accountName;
+ results.category_Goods = category_Goods;
+ results.specialCampaign = specialCampaign;
+ results.dealerProductId = DealerProductId;
+ results.accountid = accountid;
+ results.hospitalId = hospitalId;
+ results.contractId = contractId;
+ results.contactDealer = contactDealer;
+ results.errorMsgList = errorMsgList;
+ results.warningMsgList = warningMsgList;
+ results.methodType = methodType;
+ results.proLimitAndDate = proLimitAndDate;
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ @AuraEnabled
+ public static Results categoryAllload(String agencyProTypeStr, String category3Str){
+ Results results = new Results();
+ agencyProType = agencyProTypeStr;
+ category3 = category3Str;
+ try {
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ // category4OptionList = new List<SelectOption>();
+ category4Option = new List<CusOption>();
+ // category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ category4Option.add(new CusOption(deliverycnt4, deliverycnt4));
+ }
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+ // category5OptionList = new List<SelectOption>();
+ category5Option = new List<CusOption>();
+ // category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ category5Option.add(new CusOption(deliverycnt5, deliverycnt5));
+ }
+ results.category4Option = category4Option;
+ results.category5Option = category5Option;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ @AuraEnabled
+ public static Results categoryload(String agencyProTypeStr, String category3Str, String category4Str){
+ Results results = new Results();
+ agencyProType = agencyProTypeStr;
+ category3 = category3Str;
+ category4 = category4Str;
+ try {
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ // category4OptionList = new List<SelectOption>();
+ category4Option = new List<CusOption>();
+ // category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ category4Option.add(new CusOption(deliverycnt4, deliverycnt4));
+ }
+
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Product_Type__c LIKE :agencyProType
+ AND Category3_text__c = :category3
+ AND Category4_text__c = :category4
+ AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+ // category5OptionList = new List<SelectOption>();
+ category5Option = new List<CusOption>();
+ // category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5Option.add(new CusOption('-鏃�-', ''));
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ // category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ category5Option.add(new CusOption(deliverycnt5, deliverycnt5));
+ }
+ results.category4Option = category4Option;
+ results.category5Option = category5Option;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ // 鐢婚潰鍒濆鍖�
+ public static void lowerRecord() {
+ List<ConsumableorderdetailsInfo> lowerRecord = new List<ConsumableorderdetailsInfo>();
+ //搴撳瓨鏄庣粏鍙栧緱
+ Map<String, ConsumableorderdetailsInfo> midMaprecord = new Map<String, ConsumableorderdetailsInfo>();
+ List<Product2__c> product2Selected = [
+ SELECT Id, Name, Name__c, Intra_Trade_List_RMB__c, Asset_Model_No__c
+ FROM Product2__c
+ WHERE Pro2_Dealer_Object__c = TRUE AND Estimation_Entry_Possibility__c = '鈼�'
+ ];
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ lowerRecord.add(new ConsumableorderdetailsInfo(product2Selected[i]));
+ //鍏堟妸ConsumableorderdetailsRecords 鍋氭垚map
+ midMaprecord.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ List<Consumable_order_details2__c> countDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Guarantee_period_for_products__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ hospitalSpecialOffer__c,
+ promotionorder__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 != NULL
+ AND Isoverdue__c = 1
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ //AND Consumable_order_minor__r.Dealer_Info__c = :accountid
+ AND Dealer_Info_text__c = :accountName
+ ];
+ for (Integer i = 0; i < countDel.size(); i++) {
+ //add by rentx 2020-12-09
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ lowerRecord = new List<ConsumableorderdetailsInfo>();
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ for (ConsumableorderdetailsInfo bss : midMaprecord.values()) {
+ lowerRecord.add(bss);
+ }
+ allProductLimt(lowerRecord);
+ for (ConsumableorderdetailsInfo bss : lowerRecord) {
+ if (bss.allnumber < bss.lowerlimit) {
+ lower.add(bss.Prod.Name__c);
+ }
+ }
+ }
+
+ //搴撳瓨涓婁笅闄�
+ public static void productLimtAndDate() {
+ String nowName = null, nowRightAsstModelNo = null;
+ Map<String, String> productLimt = new Map<String, String>();
+ for (Integer i = 0; i < proLimitAndDate.size(); i++) {
+ nowName = proLimitAndDate[i];
+ if (nowName.indexOf('|') >= 0) {
+ nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
+ nowName = nowName.subString(nowName.indexOf('|') + 1);
+ }
+ productLimt.put(nowRightAsstModelNo, nowName);
+ }
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) {
+ ass.lowerlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|'))
+ );
+ ass.upperlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1)
+ );
+ }
+ }
+ }
+
+ //鍏ㄩ儴搴撳瓨涓婁笅闄�
+ private static void allProductLimt(List<ConsumableorderdetailsInfo> lowerRecord) {
+ String nowName = null, nowRightAsstModelNo = null;
+ Map<String, String> productLimt = new Map<String, String>();
+ for (Integer i = 0; i < proLimitAndDate.size(); i++) {
+ nowName = proLimitAndDate[i];
+ if (nowName.indexOf('|') >= 0) {
+ nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
+ nowName = nowName.subString(nowName.indexOf('|') + 1);
+ }
+ productLimt.put(nowRightAsstModelNo, nowName);
+ }
+ for (ConsumableorderdetailsInfo ass : lowerRecord) {
+ if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) {
+ ass.lowerlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|'))
+ );
+ ass.upperlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1)
+ );
+ }
+ }
+ }
+
+ @AuraEnabled
+ public static Results searchConsumableorderdetails(
+ String userWorkLocationStr,
+ String agencyProTypeStr,
+ String accountNameStr,
+ String accountIdStr,
+ String hospitalIdStr,
+ String contractIdStr,
+ String category1Str,
+ String category3Str,
+ String category4Str,
+ String category5Str,
+ String category_GoodStr,
+ Boolean specialCampaignStr,
+ String dealerProductIdStr,
+ String methodTypeStr,
+ String consumableorderdetailsRecordsviewStr,
+ Boolean editAbleStr,
+ List<String> proLimitAndDateList
+ ){
+ Results results = new Results();
+ errorMsgList = new List<String>();
+ warningMsgList = new List<String>();
+ userWorkLocation = userWorkLocationStr;
+ agencyProType = agencyProTypeStr;
+ accountName = accountNameStr;
+ accountid = accountIdStr;
+ hospitalId = hospitalIdStr;
+ contractId = contractIdStr;
+ category1 = category1Str;
+ category3 = category3Str;
+ category4 = category4Str;
+ category5 = category5Str;
+ category_Goods = category_GoodStr;
+ specialCampaign = specialCampaignStr;
+ methodType = methodTypeStr;
+ editAble = editAbleStr;
+ proLimitAndDate = proLimitAndDateList;
+ dealerProductId = (List<String>)JSON.deserialize(dealerProductIdStr, List<String>.class);
+ consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
+ try {
+ searchDone = 'searchDone';
+ sortKey = '1';
+ preSortKey = '1';
+ sortOrderAsc = false;
+ sortOrder = new String[7];
+ sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ List<ConsumableorderdetailsInfo> derdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ List<Consumable_order_details2__c> countDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Box_Piece__c,
+ //add by rentx 2020-12-09
+ hospitalSpecialOffer__c,
+ promotionorder__c
+ //add by rentx 2020-12-09
+ 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 != NULL
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ];
+ List<Product2__c> product2Selected = new List<Product2__c>();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ soql = makeSoql(category1, category_Goods, category3, category4, category5, specialCampaign, DealerProductId);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ initStandardController();
+ System.debug('soql:'+soql);
+ product2Selected = Database.query(soql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ for (Integer i = 0; i < countDel.size(); i++) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) {
+ if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) {
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecordsa0l0l0000000byXAAQ
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ if (selectedIdMap.containsKey(bss.Prod.id)) {
+ continue;
+ } else {
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ bss.sortBy = sortOrderAsc;
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsRecords.add(bss);
+ }
+ }
+ consumableorderdetailsRecords.sort();
+ productLimtAndDate();
+ getPageInfo();
+ sortKey = '1';
+ preSortKey = '1';
+ sortOrderAsc = false;
+ sortOrder = new String[7];
+ sortOrder = new List<String>{ ' ', ' ', '銆�', '', '', '', '', '' };
+ cate1ForSort = category1;
+ // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
+ // makeMessage();
+ results.errorMsgList = errorMsgList;
+ results.warningMsgList = warningMsgList;
+ if(consumableorderdetailsRecords.size() > 0){
+ getConsumableShowTableFieldValue();
+ results.result = 'Success';
+ results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
+ results.errorMsg = '鎼滅储鍒�' + consumableorderdetailsRecords.size() + '浠朵骇鍝�';
+ }else {
+ getConsumableShowTableFieldValue();
+ results.result = 'Fail';
+ results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
+ results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�';
+ }
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鍖婚櫌--妫�绱�
+ @AuraEnabled
+ public static Results searchorderdetails(
+ String methodTypeStr,
+ String accountIdStr,
+ String hospitalIdStr,
+ String contractIdStr,
+ String userWorkLocationStr,
+ String accountNameStr,
+ List<String> proLimitAndDateList,
+ Boolean editAbleStr
+ ){
+ Results results = new Results();
+ methodType = methodTypeStr;
+ accountId = accountIdStr;
+ hospitalId = hospitalIdStr;
+ contractId = contractIdStr;
+ userWorkLocation = userWorkLocationStr;
+ accountName = accountNameStr;
+ proLimitAndDate = proLimitAndDateList;
+ editAble = editAbleStr;
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
+ try {
+ soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
+ if (methodType.equals('hospitalorder')) {
+ //鍖婚櫌id 鏈夊��
+ List<hospitalprice__c> hplist = [
+ SELECT id, product__c
+ FROM hospitalprice__c
+ WHERE account__c = :accountid AND hospital__c = :hospitalId
+ ];
+ if (hplist != null && hplist.size() > 0) {
+ List<String> hpids = new List<String>();
+ for (hospitalprice__c hc : hplist) {
+ hpids.add(hc.product__c);
+ }
+
+ if (hpids != null && hpids.size() > 0) {
+ soql += ' AND Id in : hpids ';
+ }
+ } else {
+ //璇ュ尰闄笅娌℃湁绗﹀悎鍖婚櫌鐗逛环鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ }
+ } else if (methodType.equals('promotionorder')) {
+ List<Dealer_Product__c> dpclist = [
+ SELECT Id, Dealer_Product2__c
+ FROM Dealer_Product__c
+ WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
+ ];
+ if (dpclist != null && dpclist.size() > 0) {
+ String ids = '(';
+ for (Dealer_Product__c hc : dpclist) {
+ hpids.add(hc.Dealer_Product2__c);
+ ids += '\'' + hc.Dealer_Product2__c + '\',';
+ }
+ ids = ids.substring(0, ids.length() - 1) + ')';
+ if (hpids != null && hpids.size() > 0) {
+ // soql += ' AND Id in : hpids ';
+ soql += ' AND Id in ' + ids;
+ }
+ } else {
+ //璇ョ粡閿�鍟嗕笅娌℃湁淇冮攢浠锋牸鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ }
+ }
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ initStandardController();
+ List<Product2__c> product2Selected = new List<Product2__c>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ product2Selected = Database.query(soql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ List<Consumable_order_details2__c> countDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Box_Piece__c,
+ hospitalSpecialOffer__c,
+ promotionorder__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 != NULL
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ //AND Consumable_order_minor__r.Dealer_Info__c = :accountid
+ AND Dealer_Info_text__c = :accountName
+ ];
+ for (Integer i = 0; i < countDel.size(); i++) {
+ if (methodType.equals('hospitalorder')) {
+ if (countDel[i].hospitalSpecialOffer__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ } else if (methodType.equals('promotionorder')) {
+ if (countDel[i].promotionorder__c == true) {
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
+ ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
+ if (countDel[i].Box_Piece__c == '鐩�') {
+ Jstage.allnumber = Jstage.allnumber + 1;
+ } else {
+ Jstage.allnumber_piece = Jstage.allnumber_piece + 1;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap.put(countDel[i].Consumable_Product__c, Jstage);
+ }
+ }
+ }
+ }
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecordsa0l0l0000000byXAAQ
+ for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ if (selectedIdMap.containsKey(bss.Prod.id)) {
+ continue;
+ } else {
+ if (DealerProductMap.containsKey(bss.Prod.Id)) {
+ bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c;
+ bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c;
+ bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c;
+ }
+ bss.sortBy = sortOrderAsc;
+ bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsRecords.add(bss);
+ }
+ }
+ consumableorderdetailsRecords.sort();
+ productLimtAndDate();
+ getPageInfoForHos();
+ sortKey = '1';
+ preSortKey = '1';
+ sortOrderAsc = false;
+ sortOrder = new String[7];
+ sortOrder = new List<String>{ ' ', ' ', '銆�', '', '', '', '', '' };
+ cate1ForSort = category1;
+ // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
+ noOfRecords = consumableorderdetailsRecords.size();
+ getConsumableShowTableFieldValue();
+ results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
+ if(consumableorderdetailsRecordsview.size() > 0){
+ results.result = 'Success';
+ results.errorMsg = '鍏辨悳绱㈠埌'+consumableorderdetailsRecordsview.size()+'鏉℃暟鎹�';
+ }else {
+ results.result = 'Fail';
+ results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�';
+ }
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鐢ㄦ埛鍒囨崲鍖婚櫌鏃跺彇娑堥�変腑鐨勪骇鍝�
+ private static List<ConsumableorderdetailsInfo> getPageInfoForHos() {
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ consumableorderdetailsRecordsview = new List<ConsumableorderdetailsInfo>();
+ if (editAble) {
+ consumableorderdetailsRecordsview = reSet;
+ }
+ Integer pagestartNo = (con.getPageNumber() * size) - size;
+ Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1);
+ Integer addNo = 0;
+ for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) {
+ Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
+ if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) {
+ addNo++;
+ //continue;
+ }
+ // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) {
+ // break;
+ // }
+ else {
+ if (consumableorderdetailsRecords[i].check == false) {
+ consumableorderdetailsRecords[i].esd = orderdetails1;
+ }
+ consumableorderdetailsRecordsview.add(consumableorderdetailsRecords[i]);
+ addNo++;
+ }
+ // if (addNo >= size){
+ // break;
+ // }
+ }
+ return consumableorderdetailsRecordsview;
+ }
+ //add by rentx 2020-12-03 end =====================================================================================================================
+ //鐗逛环
+ public static void OffersPrice() {
+ edoffersPrice = true;
+ }
+
+ //寰楀埌淇冮攢浜у搧Id
+ private static List<String> getDealerProductId() {
+ List<String> ProductId = new List<String>();
+ Map<String, String> DealerProductIdMap = new Map<String, String>();
+ Date dateToday = Date.today();
+ List<Dealer_Product__c> DealerProductList = [
+ SELECT
+ Id,
+ Name,
+ Dealer_Product2__c,
+ Special_Campaign_Price__c,
+ Campaign_StartDate__c,
+ Campaign_EndDate__c,
+ Dealer_Contact__c,
+ OrderGoods_Limit__c
+ FROM Dealer_Product__c
+ WHERE
+ Dealer_Contact__c IN :contactDealer
+ AND Campaign_StartDate__c <= :dateToday
+ AND Campaign_EndDate__c >= :dateToday
+ AND Special_Campaign_Price__c != NULL
+ ];
+ for (Dealer_Product__c dealerProduct : DealerProductList) {
+ if (DealerProductIdMap.containsKey(dealerProduct.Dealer_Product2__c)) {
+ continue;
+ } else {
+ ProductId.add(dealerProduct.Dealer_Product2__c);
+ DealerProductIdMap.put(dealerProduct.Dealer_Product2__c, dealerProduct.Dealer_Product2__c);
+ }
+ }
+ return ProductId;
+ }
+
+ private static String makeSoql(
+ String CateName,
+ String CateCode,
+ String Category3,
+ String Category4,
+ String Category5,
+ Boolean specialCampaign,
+ List<String> DealerProductId
+ ) {
+ String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
+ // add begin ================================================================================================
+ if (methodType != null && methodType.equals('hospitalorder')) {
+ //濡傛灉鏄尰闄㈢壒浠�
+ //1.鍒ゆ柇 鍖婚櫌id鏄惁鏈夊�� 濡傛灉鏈夊�� 鍒欐牴鎹尰闄d鍘� 鍖婚櫌鐗逛环琛ㄤ腑鑾峰彇浜у搧id
+ //鍖婚櫌id 鏈夊��
+ if (hospitalId == null || hospitalId == '') {
+ soql += ' and id = null ';
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '璇烽�夋嫨鍖婚櫌'));
+ warningMsgList.add('璇烽�夋嫨鍖婚櫌');
+ } else {
+ List<hospitalprice__c> hplist = [
+ SELECT id, product__c
+ FROM hospitalprice__c
+ WHERE account__c = :accountid AND hospital__c = :hospitalId
+ ];
+ if (hplist != null && hplist.size() > 0) {
+ hpids = new List<String>();
+ for (hospitalprice__c hc : hplist) {
+ hpids.add(hc.product__c);
+ }
+ if (hpids != null && hpids.size() > 0) {
+ soql += ' AND Id in : hpids ';
+ }
+ } else {
+ //璇ュ尰闄笅娌℃湁绗﹀悎鍖婚櫌鐗逛环鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ return soql;
+ }
+ }
+ }
+ //淇冮攢璁㈣揣
+ if (methodType != null && methodType.equals('promotionorder')) {
+ if (contractId == null || contractId == '') {
+ soql += ' and id = null ';
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '璇烽�夋嫨鍚堝悓'));
+ warningMsgList.add('璇烽�夋嫨鍚堝悓');
+ } else {
+ //1.鏌ヨ鎵�鏈夌粡閿�鍟嗕骇鍝�
+ List<Dealer_Product__c> dpclist = [
+ SELECT Id, Dealer_Product2__c
+ FROM Dealer_Product__c
+ WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
+ ];
+
+ if (dpclist != null && dpclist.size() > 0) {
+ hpids = new List<String>();
+ for (Dealer_Product__c hc : dpclist) {
+ hpids.add(hc.Dealer_Product2__c);
+ }
+ if (hpids != null && hpids.size() > 0) {
+ soql += ' AND Id in : hpids ';
+ }
+ } else {
+ //璇ョ粡閿�鍟嗕笅娌℃湁淇冮攢浠锋牸鐨勪骇鍝�
+ soql += ' AND Id = null ';
+ return soql;
+ }
+ }
+ }
+ //add end ===================================================================================================
+ if (!String.isBlank(CateName)) {
+ soql +=
+ ' AND (Name__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\' or Asset_Model_No__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\')';
+ }
+ if (!String.isBlank(Category3)) {
+ soql += ' AND Category3__c = \'' + Category3 + '\'';
+ }
+ if (!String.isBlank(Category4)) {
+ soql += ' AND Category4__c = \'' + Category4 + '\'';
+ }
+ if (!String.isBlank(Category5)) {
+ soql += ' AND Category5__c = \'' + Category5 + '\'';
+ }
+ if (agencyProType == 'ET') {
+ soql += ' AND Pro2_Dealer_Object__c = true';
+ }
+ if (agencyProType == 'ENG') {
+ soql += ' AND Pro2_Dealer_ENG__c = true';
+ }
+ soql += ' AND Intra_Trade_List_RMB__c > 0 ';
+ System.debug('soql +++++++++++ ' + soql);
+ return soql;
+ }
+
+ private static String makeSoqlorderdet() {
+ String sqlTail = '(\'';
+ for (Integer i = 0; i < orderzaikuId.size(); i++) {
+ if (i < orderzaikuId.size() - 1) {
+ sqlTail += orderzaikuId[i] + '\',\'';
+ } else {
+ sqlTail += orderzaikuId[i] + '\')';
+ }
+ }
+ String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'鈼媆' ';
+ System.debug('sqlTail:'+sqlTail);
+ System.debug('orderzaikuId:'+orderzaikuId);
+ if (orderzaikuId.size() > 0) {
+ soql += ' AND Id in' + sqlTail;
+ }
+ return soql;
+ }
+
+ // 缂栬緫鎸夐挳
+ @AuraEnabled
+ public static Results setEditAble(String eSetidStr){
+ Results results = new Results();
+ ESetId = eSetidStr;
+ try {
+ statusEdit = 'Redirect';
+ List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid];
+ String url = '/lexconsumable?ESetid=' + ESetid + '&KeyWords=' + statusEdit + '&type=' + oclist.get(0).orderPattern__c;
+ results.result = 'Success';
+ results.url = url;
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ // 鍐嶇敵璇�
+ @AuraEnabled
+ public static Results backOrder(String eSetidStr) {
+ Results results = new Results();
+ ESetId = eSetidStr;
+ statusEdit = 'Redirect';
+ returnOrder = true;
+ try {
+ statusEdit = 'Redirect';
+ List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid];
+ String url = '/lexconsumable?ESetid=' + ESetid + '&KeyWords=' + statusEdit + '&type=' + oclist.get(0).orderPattern__c;
+ results.result = 'Success';
+ results.url = url;
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //涓婁紶闄勪欢
+ @AuraEnabled
+ public static Results filesUpload(String pId, String fileName, String base64Data) {
+ Results results = new Results();
+ try {
+ base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
+ ContentVersion cv = new ContentVersion();
+ cv.Title = fileName;
+ cv.PathOnClient = '/' + fileName;
+ cv.FirstPublishLocationId = pId;
+ cv.VersionData = EncodingUtil.base64Decode(base64Data);
+ cv.IsMajorVersion = true;
+ insert cv;
+ Consumable_order__c c = [SELECT Id FROM Consumable_order__c WHERE Id =:pId];
+ c.Consumable_pdf_insert_day__c = Date.today();
+ update c;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鍒犻櫎鎸夐挳
+ @AuraEnabled
+ public static Results delConsumable(String eSetidStr){
+ Results results = new Results();
+ ESetId = eSetidStr;
+ try {
+ Consumable_order__c cord = new Consumable_order__c(Id = ESetId);
+ List<Consumable_Orderdetails__c> orderdetails1 = [
+ SELECT Id
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :EsetId
+ ];
+ delete orderdetails1;
+ delete cord;
+ results.result = 'Success';
+ results.url = '/lexconsumableordermanage';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ // 鎻愪氦鎸夐挳
+ @AuraEnabled
+ public static Results sorder(String eSetidStr,String accountidStr){
+ Results results = new Results();
+ errorMsgList = new List<String>();
+ warningMsgList = new List<String>();
+ ESetId = eSetidStr;
+ accountid = accountidStr;
+ Savepoint sp = Database.setSavepoint();
+ try {
+ Map<Id, String> prodMap = new Map<Id, String>();
+ Consumable_order__c P = new Consumable_order__c();
+ P = new Consumable_order__c();
+ p.Id = ESetId;
+ p.Order_date__c = Date.today();
+ p.Order_status__c = '闄勪欢涓婁紶瀹屾垚';
+ for (Consumable_Orderdetails__c cod1 : [
+ SELECT Consumable_product__r.Product2__c, Consumable_product__r.Name__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :ESetId
+ ]) {
+ prodMap.put(cod1.Consumable_product__r.Product2__c, cod1.Consumable_product__r.Name__c);
+ }
+ // GZW 鎻愪氦浜у搧鏃犳晥 鍑洪敊璇秷鎭�
+ System.debug(prodMap);
+ Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide(prodMap, accountid, '');
+ System.debug(chkMap);
+ if (chkMap.size() > 0) {
+ if (chkMap.containsKey('agency')) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��'));
+ errorMsgList.add('绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��');
+ }
+ for (String proId : prodMap.keySet()) {
+ if (chkMap.containsKey(proId)) {
+ if (chkMap.get(proId) == '1') {
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.Error, '浜у搧 ' + prodMap.get(proId) + ' 娌℃湁鏈夋晥鐨勬敞鍐岃瘉銆�')
+ // );
+ errorMsgList.add('浜у搧 ' + prodMap.get(proId) + ' 娌℃湁鏈夋晥鐨勬敞鍐岃瘉銆�');
+ } else if (chkMap.get(proId) == '2') {
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.Error, '浜у搧 ' + prodMap.get(proId) + ' 瓒呰繃缁忛攢鍟嗙粡钀ヨ寖鍥淬��')
+ // );
+ errorMsgList.add('浜у搧 ' + prodMap.get(proId) + ' 瓒呰繃缁忛攢鍟嗙粡钀ヨ寖鍥淬��');
+ }
+ }
+ }
+ results.result = 'Fail';
+ results.errorMsg = '';
+ results.errorMsgList = errorMsgList;
+ results.warningMsgList = warningMsgList;
+ return results;
+ }
+ update p;
+ Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
+ psr.setObjectId(ESetId);
+ Approval.ProcessResult submitResult = Approval.process(psr);
+ results.result = 'Success';
+ results.url = '/lexconsumableordermanage';
+ } catch (Exception e) {
+ Database.rollback(sp);
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ // 椹冲洖璁㈠崟copy
+ @AuraEnabled
+ public static Results ordrCopy(
+ String contractNameStr,
+ String cocStr,
+ String agencyProTypeStr,
+ String accountidStr,
+ String consumableorderdetailsRecordsviewStr,
+ String contactDealerStr,
+ String methodTypeStr,
+ String hospitalIdStr,
+ String contractIdStr,
+ String agencyProType1Str,
+ Boolean OSHFLGStr
+ ) {
+ ESetId = '';
+ return save(contractNameStr,cocStr,agencyProTypeStr,accountidStr,consumableorderdetailsRecordsviewStr,contactDealerStr,methodTypeStr,ESetId,hospitalIdStr,contractIdStr,agencyProType1Str,OSHFLGStr);
+ }
+
+ //淇濆瓨鎸夐挳
+ @AuraEnabled
+ public static Results save(
+ String contractNameStr,
+ String cocStr,
+ String agencyProTypeStr,
+ String accountidStr,
+ String consumableorderdetailsRecordsviewStr,
+ String contactDealerStr,
+ String methodTypeStr,
+ String eSetIdStr,
+ String hospitalIdStr,
+ String contractIdStr,
+ String agencyProType1Str,
+ Boolean OSHFLGStr
+ ){
+ Results results = new Results();
+ errorMsgList = new List<String>();
+ warningMsgList = new List<String>();
+ contractName = contractNameStr;
+ agencyProType = agencyProTypeStr;
+ accountid = accountidStr;
+ methodType = methodTypeStr;
+ ESetId = eSetIdStr;
+ hospitalId = hospitalIdStr;
+ contractId = contractIdStr;
+ agencyProType1 = agencyProType1Str;
+ OSHFLG = OSHFLGStr;
+ coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class);
+ contactDealer = (List<String>)JSON.deserialize(contactDealerStr, List<String>.class);
+ consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class);
+ if(coc.Offers_Price__c != null){
+ String offerStr = String.valueOf(coc.Offers_Price__c);
+ bargainPrice = Decimal.valueOf(offerStr.replace(',',''));
+ }
+ Savepoint sp = Database.setSavepoint();
+ try {
+ if (String.isEmpty(contractName)) {
+ // coc.Order_effective_contact__c.addError('璇烽�夋嫨鍚堝悓');
+ results.result = 'Fail';
+ results.errorMsg = '璇烽�夋嫨鍚堝悓';
+ return results;
+ }
+ List<Account> contract = [
+ SELECT Id, Name, Contract_Department_Class__c, Contract_Quote_Decide_Flag__c
+ FROM account
+ WHERE
+ Name = :contractName
+ AND Id =: contractId //lt 20230517 瀹夊窘涓ょエ鍒� add
+ AND Contract_Decide_Start_Date__c <= :Date.Today()
+ AND Contract_Decide_End_Date__c >= :Date.Today()
+ AND Contact_Type__c like :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1
+ AND Agent_Ref__c =:accountid
+ AND OSH_Dealer__c =: OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
+ ];
+ if (contract.size() <= 0) {
+ // coc.Order_effective_contact__c.addError('涓嶅瓨鍦ㄧ殑鍚堝悓锛岃閲嶆柊纭銆�');
+ results.result = 'Fail';
+ results.errorMsg = '涓嶅瓨鍦ㄧ殑鍚堝悓锛岃閲嶆柊纭銆�';
+ return results;
+ } else {
+ if (String.isEmpty(contract[0].Contract_Quote_Decide_Flag__c)) {
+ // coc.Order_effective_contact__c.addError('鍚堝悓鏃犳晥锛岃閲嶆柊纭銆�');
+ results.result = 'Fail';
+ results.errorMsg = '鍚堝悓鏃犳晥锛岃閲嶆柊纭銆�';
+ return results;
+ }
+ }
+ Integer FLG = 0;
+ Integer Count = 0;
+ //add by rentx 2020-11-25
+ List<String> tpids = new List<String>();
+ //add by rentx 2020-11-25
+ for (ConsumableorderdetailsInfo CheckCount : consumableorderdetailsRecordsview) {
+ FLG = FLG + 1;
+ if (CheckCount.check == false) {
+ Count = Count + 1;
+ }
+ if (CheckCount.check == true) {
+ //add by rentx 2020-11-25
+ tpids.add(CheckCount.Prod.Id);
+ //add by rentx 2020-11-25
+ if (CheckCount.esd.Consumable_Count__c == null || CheckCount.esd.Consumable_Count__c == 0) {
+ // CheckCount.esd.Consumable_Count__c.addError('璇疯緭鍏ラ噰璐暟閲�');
+ results.result = 'Fail';
+ results.errorMsg = '璇疯緭鍏ラ噰璐暟閲�';
+ return results;
+ }
+ if (
+ CheckCount.orderGoods_Limit > 0 &&
+ math.mod(Integer.valueOf(CheckCount.esd.Consumable_Count__c), Integer.valueOf(CheckCount.orderGoods_Limit)) > 0
+ ) {
+ // CheckCount.esd.Consumable_Count__c.addError('璇疯緭鍏ヤ績閿�鏁伴噺鐨勫�嶆暟');
+ results.result = 'Fail';
+ results.errorMsg = '璇疯緭鍏ヤ績閿�鏁伴噺鐨勫�嶆暟';
+ return results;
+ }
+ }
+ }
+ if (Count == FLG) {
+ results.result = 'Fail';
+ results.errorMsg = '璇烽�夋嫨鎵�闇�娑堣�楀搧';
+ return results;
+ }
+ //=======================================鍖婚櫌鐗逛环,鏈夐噾棰濈殑璇濆彇閲戦
+ Map<String, Decimal> dealerHospitalmMap = new Map<String, Decimal>();
+ List<hospitalprice__c> hplist = [select Id,hospital__c,mPrice__c,pPrice__c,product__c,account__c
+ from hospitalprice__c
+ where product__c in :tpids and mPrice__c <> null and account__c=:accountid
+ ];
+ for (hospitalprice__c dealerProduct : hplist) {
+ if (dealerProduct.mPrice__c != null) {
+ dealerHospitalmMap.put('' + dealerProduct.hospital__c + dealerProduct.product__c,dealerProduct.mPrice__c);
+ }
+ }
+ //淇冮攢璁㈣揣 鏍规嵁缁忛攢鍟嗕骇鍝佷腑鐨勬暟鎹绠楅噾棰�
+ //=======================================浜у搧鐗规畩鎶樻墸
+ Map<String, Decimal> dealerPDiscountMap = new Map<String, Decimal>();
+ Map<String, Decimal> dealerMPDiscountMap = new Map<String, Decimal>();
+ //1.鑾峰彇鏈夊紑濮嬬粨鏉熸棩鐨勪骇鍝�
+ Date dateToday = Date.today();
+ List<Dealer_Product__c> haveDateList = [
+ SELECT
+ Id,
+ Name,
+ Dealer_Product2__c,
+ Special_Campaign_Price__c,
+ Campaign_StartDate__c,
+ Campaign_EndDate__c,
+ Dealer_Contact__c,
+ OrderGoods_Limit__c,
+ Special_Discount__c
+ FROM Dealer_Product__c
+ WHERE
+ Dealer_Contact__c IN :contactDealer
+ AND Campaign_StartDate__c <= :dateToday
+ AND Campaign_EndDate__c >= :dateToday
+ AND (Special_Discount__c != NULL
+ OR Special_Campaign_Price__c != NULL)
+ ];
+ //2.鑾峰彇娌℃湁寮�濮嬬粨鏉熸棩鐨勪骇鍝�
+ List<Dealer_Product__c> DealerProductList = [
+ SELECT
+ Id,
+ Name,
+ Dealer_Product2__c,
+ Special_Campaign_Price__c,
+ Campaign_StartDate__c,
+ Campaign_EndDate__c,
+ Dealer_Contact__c,
+ Special_Discount__c,
+ OrderGoods_Limit__c
+ FROM Dealer_Product__c
+ WHERE Dealer_Contact__c IN :contactDealer AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
+ ];
+ for (Dealer_Product__c dealerProduct : DealerProductList) {
+ //濡傛灉淇冮攢浠锋牸涓簄ull 鍒欒缃壒娈婃姌鎵�(鐧惧垎姣�)鍒伴泦鍚�
+ if (dealerProduct.Special_Campaign_Price__c == null) {
+ dealerPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Discount__c
+ );
+ } else {
+ dealerMPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Campaign_Price__c
+ );
+ }
+ }
+ //杩欐牱鍋氭槸涓轰簡璁$畻淇冮攢浠锋牸鏃� 浼樺厛璁$畻淇冮攢寮�濮嬬粨鏉熸棩涓嶄负绌虹殑浜у搧
+ //濡傛灉璇ラ泦鍚堟湁鍊� 鍒欒鏄庨渶瑕佹牴鎹綋鍓嶇殑閲戦鎴栬�呮姌鎵f潵璁$畻
+ if (haveDateList != null && haveDateList.size() > 0) {
+ for (Dealer_Product__c dealerProduct : haveDateList) {
+ if (dealerProduct.Special_Campaign_Price__c == null) {
+ dealerPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Discount__c
+ );
+ dealerMPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c);
+ } else {
+ dealerMPDiscountMap.put(
+ '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
+ dealerProduct.Special_Campaign_Price__c
+ );
+ dealerPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c);
+ }
+ }
+ }
+ //=======================================缁忛攢鍟嗗悎鍚屾姌鎵�
+ List<Account> at = [
+ SELECT id, Name, State_Master__c, State_Master__r.Name, Sales_Section__c, Dealer_discount__c
+ FROM Account
+ WHERE
+ Name = :contractName
+ AND Id =: contractId //lt 20230517 瀹夊窘涓ょエ鍒� add
+ AND Contact_Type__c like :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1
+ AND Contact_Type__c LIKE :agencyProType
+ AND Contract_Decide_Start_Date__c <= :Date.Today()
+ AND Contract_Decide_End_Date__c >= :Date.Today()
+ AND Contract_Decide_End_Date__c >= :Date.Today()
+ AND OSH_Dealer__c =: OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
+ ];
+ if (at.size() > 0 && at[0].Dealer_discount__c != null) {
+ disCount = at[0].Dealer_discount__c;
+ } else {
+ disCount = 100;
+ }
+ Consumable_order__c P = new Consumable_order__c();
+ List<Consumable_Orderdetails__c> Ins = new List<Consumable_Orderdetails__c>();
+ //鏂板缓璁㈠崟鏃�
+ if (String.isBlank(ESetId)) {
+ Integer i = 1;
+ Integer Roll = 0;
+ p.Name = '*';
+ p.Order_status__c = '鑽夋涓�';
+ p.Dealer_Info__c = accountid;
+ p.Order_ProType__c = agencyProType;
+ p.Offers_Price__c = coc.Offers_Price__c;
+ p.Order_date__c = coc.Order_date__c;
+ p.Order_effective_contact__c = contract[0].Id;
+ p.Order_Reason__c = coc.Order_Reason__c;
+ p.RecordTypeid = System.Label.RT_ConOrder_Order;
+ p.Overrule_order__c = coc.Id;
+ if (String.isNotBlank(methodType)) {
+ p.orderPattern__c = methodType;
+ }
+ insert p;
+ List<Consumable_order__c> Consumable_order = [SELECT Name, orderPattern__c FROM Consumable_order__c WHERE id = :p.id];
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
+ Roll = Roll + 1;
+ if (ass.check == true) {
+ if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) {
+ // ass.esd.Consumable_Count__c.addError('璇疯緭鍏ラ噰璐暟閲�');
+ results.result = 'Fail';
+ results.errorMsg = '璇疯緭鍏ラ噰璐暟閲�';
+ return results;
+ } else {
+ Consumable_Orderdetails__c InsAfterDel = new Consumable_Orderdetails__c();
+ String str = string.valueOf(i);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ InsAfterDel.Name = Consumable_order[0].Name + '-' + str;
+ InsAfterDel.Consumable_Count__c = ass.esd.Consumable_Count__c;
+ InsAfterDel.Consumable_order__c = p.id;
+ InsAfterDel.Consumable_Product__c = ass.Prod.id;
+ InsAfterDel.Box_Piece__c = '鐩�';
+ //鍗忚璁㈣揣
+ if (methodType.equals('agreementorder')) {
+ Consumable_order[0].orderPattern__c = 'agreementorder';
+
+ InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c * disCount / 100;
+ //=====================================================================================update by rentx 2020-11-25
+ } else if (methodType.equals('promotionorder')) {
+ Consumable_order[0].orderPattern__c = 'promotionorder';
+ //淇冮攢璁㈣揣
+ //濡傛灉淇冮攢浠锋牸涓嶄负null 鍒欑洿鎺ヤ娇鐢ㄤ績閿�浠锋牸鏉ヨ绠楅噾棰�
+ if (dealerMPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get('' + contract[0].Id + ass.Prod.Id);
+ system.debug('cai 0' + InsAfterDel.Intra_Trade_List_RMB__c);
+ } else if (dealerPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c =
+ ass.Prod.Intra_Trade_List_RMB__c *
+ dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) /
+ 100;
+ system.debug('cai 00' + InsAfterDel.Intra_Trade_List_RMB__c);
+ }
+ //=====================================================================================update by rentx 2020-11-25
+ } else if (methodType.equals('hospitalorder')) {
+ //鍖婚櫌鐗逛环
+ Consumable_order[0].Order_ForHospital__c = hospitalId;
+ Consumable_order[0].orderPattern__c = 'hospitalorder';
+ if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) {
+ //鐩存帴鏍规嵁淇冮攢閲戦璁$畻
+ InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id);
+ }
+ } else if (DealerProductMap.containsKey(ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c;
+ system.debug('cai 2' + InsAfterDel.Intra_Trade_List_RMB__c);
+ InsAfterDel.Purchase_Unitprtprice_From__c = '淇冮攢';
+ InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c;
+ }
+ InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ i++;
+ Ins.add(InsAfterDel);
+ }
+ }
+ }
+ ESetId = p.id;
+ if (Consumable_order.size() > 0) {
+ update Consumable_order;
+ }
+ }
+ //淇敼涔嬪悗 淇濆瓨璁㈠崟
+ if (Ins.size() > 0) {
+ insert Ins;
+ } else {
+ //淇敼,鑾峰彇娑堣�楀搧璁㈠崟
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ cocinfo = [
+ SELECT Id, Name, Order_status__c, Dealer_Info__c, Deliver_date__c, Order_Reason__c, Offers_Price__c
+ FROM Consumable_order__c
+ WHERE Id = :ESetId
+ ];
+ if (cocinfo.size() > 0) {
+ p = cocinfo[0];
+ }
+ p.Name = coc.Name;
+ p.Dealer_Info__c = accountid;
+ p.Order_ProType__c = agencyProType;
+ p.Order_date__c = coc.Order_date__c;
+ p.Order_effective_contact__c = contract[0].Id;
+ p.Order_Reason__c = coc.Order_Reason__c;
+ if (bargainPrice != null) {
+ p.Offers_Price__c = bargainPrice;
+ }
+ update p;
+ List<Consumable_order__c> Consumable_order = [SELECT Name, orderPattern__c FROM Consumable_order__c WHERE id = :p.id];
+ List<Consumable_Orderdetails__c> qs = new List<Consumable_Orderdetails__c>();
+ qs = [
+ SELECT Id
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Dealer_Info__c = :accountid
+ ];
+ if (qs.size() > 0) {
+ delete qs;
+ }
+ Integer i = 1;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) {
+ if (ass.check == true) {
+ Consumable_Orderdetails__c InsAfterDel = new Consumable_Orderdetails__c();
+ if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) {
+ // ass.esd.Consumable_Count__c.addError('璇疯緭鍏ラ噰璐暟閲�');
+ results.result = 'Fail';
+ results.errorMsg = '璇疯緭鍏ラ噰璐暟閲�';
+ return results;
+ } else {
+ String str = string.valueOf(i);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ InsAfterDel.Name = Consumable_order[0].Name + '-' + str;
+ InsAfterDel.Consumable_Count__c = ass.esd.Consumable_Count__c;
+ InsAfterDel.Consumable_order__c = ESetId;
+ InsAfterDel.Consumable_Product__c = ass.Prod.id;
+ InsAfterDel.Box_Piece__c = '鐩�';
+ //鍗忚璁㈣揣
+ if (methodType.equals('agreementorder')) {
+ Consumable_order[0].orderPattern__c = 'agreementorder';
+ InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c * disCount / 100;
+ } else if (methodType.equals('promotionorder')) {
+ Consumable_order[0].orderPattern__c = 'promotionorder';
+ //淇冮攢璁㈣揣
+ if (dealerMPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get('' + contract[0].Id + ass.Prod.Id);
+ } else if (dealerPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c =
+ ass.Prod.Intra_Trade_List_RMB__c *
+ dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) /
+ 100;
+ }
+ } else if (methodType.equals('hospitalorder')) {
+ Consumable_order[0].orderPattern__c = 'hospitalorder';
+ //鍖婚櫌鐗逛环
+ Consumable_order[0].Order_ForHospital__c = hospitalId;
+ if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) {
+ //鐩存帴鏍规嵁淇冮攢閲戦璁$畻
+ InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id);
+ }
+ } else if (DealerProductMap.containsKey(ass.Prod.Id)) {
+ InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c;
+ InsAfterDel.Purchase_Unitprtprice_From__c = '淇冮攢';
+ InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c;
+ }
+ // ==================================================涔嬪墠鐨勪績閿�璁㈣揣鐨勯�昏緫
+ InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ i++;
+ Ins.add(InsAfterDel);
+ }
+ }
+ }
+ if (Ins.size() > 0) {
+ insert Ins;
+ }
+ }
+ results.result = 'Success';
+ results.eSetId = ESetId;
+ } catch (Exception e) {
+ Database.rollback(sp);
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鍒犻櫎闄勪欢
+ @AuraEnabled
+ public static Results deleteAtt(String contentVersionId){
+ Results results = new Results();
+ try {
+ ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId];
+ String contentDocumentId = conVersion.ContentDocumentId;
+ ContentDocument conDocument = [SELECT Id FROM ContentDocument where Id = :contentDocumentId];
+ delete conDocument;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ public static void getConsumableShowTableFieldValue(){
+ for(ConsumableorderdetailsInfo con :consumableorderdetailsRecordsview){
+ if(con.Prod != null){
+ con.recordId = con.Prod.Id;
+ if(!con.oldCheck){
+ con.prodName = con.Prod.Name__c;
+ // System.debug('ProdName:'+con.Prod.Id+'---'+con.Prod.Name__c);
+ }
+ con.prodSFDAStatus = con.Prod.SFDA_Status__c;
+ con.prodCategory3 = con.Prod.Category3__c;
+ con.prodCategory4 = con.Prod.Category4__c;
+ con.prodCategory5 = con.Prod.Category5__c;
+ con.prodIntraTradeList = con.Prod.Intra_Trade_List_RMB__c;
+ }
+ if(con.esd != null){
+ // if(con.oldCheck){
+ // con.prodName = con.esd.Consumable_Product__r.Name__c;
+ // }
+ con.consumableCount = con.esd.Consumable_count__c;
+ }
+ }
+ }
+
+ class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Boolean oldCheck { get; set; }
+ @AuraEnabled
+ public Consumable_Orderdetails__c esd { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Integer packing_list { get; set; }
+ @AuraEnabled
+ public Date expiration_Date { get; set; }
+ @AuraEnabled
+ public String approbation_No { get; set; }
+ @AuraEnabled
+ public Decimal allnumber { get; set; }
+ @AuraEnabled
+ public Decimal allnumber_piece { get; set; }
+ @AuraEnabled
+ public Decimal oldConsumableCount { get; set; }
+ @AuraEnabled
+ public Boolean canSelect { get; set; }
+ @AuraEnabled
+ public ContentVersion Concc { get; set; }
+ @AuraEnabled
+ public Boolean sortBy { get; set; }
+ @AuraEnabled
+ public Decimal upperlimit { get; set; }
+ @AuraEnabled
+ public Decimal lowerlimit { get; set; }
+ @AuraEnabled
+ public Decimal SpecialCampaignPrice { get; set; }
+ @AuraEnabled
+ public Decimal orderGoods_Limit { get; set; }
+ @AuraEnabled
+ public Date Campaign_EndDate { get; set; }
+ @AuraEnabled
+ public String recordId { get; set; }
+ @AuraEnabled
+ public String prodName { get; set; }
+ @AuraEnabled
+ public String prodSFDAStatus { get; set; }
+ @AuraEnabled
+ public String prodCategory3 { get; set; }
+ @AuraEnabled
+ public String prodCategory4 { get; set; }
+ @AuraEnabled
+ public String prodCategory5 { get; set; }
+ @AuraEnabled
+ public Decimal prodIntraTradeList { get; set; }
+ @AuraEnabled
+ public Decimal consumableCount { get; set; }
+
+
+ // 宸插瓨浜у搧鏄庣粏
+ public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
+ check = true;
+ oldCheck = true;
+ esd = e;
+ Prod = e.Consumable_Product__r;
+ oldConsumableCount = e.Consumable_Count__c;
+ canSelect = true;
+ allnumber = 0;
+ allnumber_piece = 0;
+ }
+
+ public ConsumableorderdetailsInfo(Product2__c e) {
+ check = false;
+ oldCheck = false;
+ esd = new Consumable_Orderdetails__c();
+ Prod = e;
+ oldConsumableCount = null;
+ canSelect = true;
+ allnumber = 0;
+ allnumber_piece = 0;
+ }
+ //闄勪欢
+ public ConsumableorderdetailsInfo(ContentVersion e) {
+ Concc = e;
+ }
+ // 鎺掑簭Consumable_order__c
+ public Integer compareTo(Object compareTo) {
+ ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo;
+ Integer returnValue = 0;
+ if (check == true) {
+ if (sortBy == false) {
+ if (allnumber > compareToesd.allnumber) {
+ returnValue = -1;
+ } else if (allnumber < compareToesd.allnumber) {
+ returnValue = 1;
+ }
+ return returnValue;
+ } else {
+ if (allnumber > compareToesd.allnumber) {
+ returnValue = 1;
+ } else if (allnumber < compareToesd.allnumber) {
+ returnValue = -1;
+ }
+ return returnValue;
+ }
+ } else {
+ if (sortBy == false) {
+ if (allnumber > compareToesd.allnumber) {
+ returnValue = -1;
+ } else if (allnumber < compareToesd.allnumber) {
+ returnValue = 1;
+ }
+ return returnValue;
+ } else {
+ if (allnumber > compareToesd.allnumber) {
+ returnValue = 1;
+ } else if (allnumber < compareToesd.allnumber) {
+ returnValue = -1;
+ }
+ return returnValue;
+ }
+ }
+ }
+ }
+
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public String eSetId;
+ @AuraEnabled
+ public String agencyProType;
+ @AuraEnabled
+ public String userWorkLocation;
+ @AuraEnabled
+ public String accountName;
+ @AuraEnabled
+ public String accountid;
+ @AuraEnabled
+ public String hospitalId;
+ @AuraEnabled
+ public String contractId;
+ @AuraEnabled
+ public String category_Goods;
+ @AuraEnabled
+ public Consumable_order__c coc;
+ @AuraEnabled
+ public Boolean edoffersPrice;
+ @AuraEnabled
+ public Boolean editDelCommitBtnDisabled;
+ @AuraEnabled
+ public Boolean editAble;
+ @AuraEnabled
+ public String hospitalName;
+ @AuraEnabled
+ public String contractName;
+ @AuraEnabled
+ public List<CusOption> category3Option;
+ @AuraEnabled
+ public List<CusOption> category4Option;
+ @AuraEnabled
+ public List<CusOption> category5Option;
+ @AuraEnabled
+ public List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview;
+ @AuraEnabled
+ public List<ConsumableorderdetailsInfo> attachmentRecoeds;
+ @AuraEnabled
+ public Boolean cansee;
+ @AuraEnabled
+ public List<String> errorMsgList;
+ @AuraEnabled
+ public List<String> warningMsgList;
+ @AuraEnabled
+ public Boolean hasWarning;
+ @AuraEnabled
+ public Boolean hasError;
+ @AuraEnabled
+ public Boolean specialCampaign;
+ @AuraEnabled
+ public List<String> dealerProductId;
+ @AuraEnabled
+ public List<String> contactDealer;
+ @AuraEnabled
+ public String url;
+ @AuraEnabled
+ public String methodType;
+ @AuraEnabled
+ public List<String> proLimitAndDate;
+ @AuraEnabled
+ public Boolean isNoteStay;
+ @AuraEnabled
+ public Boolean OSHFLG;
+ @AuraEnabled
+ public String agencyProType1;
+ }
+
+ public class CusOption {
+ CusOption(String label, String value) {
+ this.label = label;
+ this.value = value;
+ }
+
+ @AuraEnabled
+ public String label;
+ @AuraEnabled
+ public String value;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableController.cls-meta.xml b/force-app/main/default/classes/LexConsumableController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexConsumableGoodsInfo.cls b/force-app/main/default/classes/LexConsumableGoodsInfo.cls
new file mode 100644
index 0000000..e60bfdd
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableGoodsInfo.cls
@@ -0,0 +1,642 @@
+public without sharing class LexConsumableGoodsInfo {
+
+ //鎵�鏈変骇鍝佷竴瑙�
+ @AuraEnabled
+ public static Results initTotalNum(String ordId, String type){
+ Results results = new Results();
+ List<ShowRecords> allOtherDetIifo = new List<ShowRecords>();
+ Set<String> orderId = new Set<String>();
+ if(ordId != '1'){
+ orderId.add(ordId);
+ }
+ try {
+ if(!(orderId.size() > 0)){
+ String userId = UserInfo.getUserId();
+ List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
+ FROM user
+ WHERE id = :userId ];
+ String accountid = userList[0].accountid;
+ String userPro_Type = userList[0].UserPro_Type__c;
+ String userWorklocation = userList[0].Work_Location__c;
+ String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
+ List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
+ //20200916 ljh update start
+ if(Test.isRunningTest()){
+ if(type !=null && type.equals('all')){
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }else{
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }
+
+ }else{
+ if(type !=null && type.equals('all')){
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }else{
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }
+ }
+ for(Consumable_order__c conorder : conorderlist){
+ String temp = (String)conorder.Id;
+ orderId.add(temp);
+ }
+ System.debug('ANY o'+orderId);
+ }
+ List<Consumable_Orderdetails__c> conOrderList1 = new List<Consumable_Orderdetails__c>();
+ if(Test.isRunningTest()){
+ conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c];
+ }else{
+ conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c WHERE Consumable_order__c =:orderId];
+ }
+
+ Map<String,Decimal> allConOrderMap = new Map<String,Decimal>();
+ for(Consumable_Orderdetails__c con : conOrderList1){
+ if(con.Consumable_count__c == null){
+ con.Consumable_count__c = 0;
+ }
+ if(allConOrderMap.containsKey(con.Asset_Model_No__c)){
+ allConOrderMap.put(con.Asset_Model_No__c,allConOrderMap.get(con.Asset_Model_No__c)+con.Consumable_count__c);
+ }else{
+ allConOrderMap.put(con.Asset_Model_No__c, con.Consumable_count__c);
+ }
+ }
+ for(String pmodel : allConOrderMap.keySet()){
+ if(allConOrderMap.get(pmodel) > 0){
+ ShowRecords showrecord2 = new ShowRecords();
+ showrecord2.recordCount = allConOrderMap.get(pmodel);
+ showrecord2.prodModel = pmodel;
+ allOtherDetIifo.add(showrecord2);
+ }
+ }
+ results.result = 'Success';
+ results.recordList = allOtherDetIifo;
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //宸插埌璐т骇鍝佷竴瑙�
+ @AuraEnabled
+ public static Results initArrDet(String orderId){
+ Results results = new Results();
+ List<ShowRecords> arrDetIifo = new List<ShowRecords>();
+ try{
+ List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId];
+ Map<String,String> srtMap = new Map<String,String>();
+ for(Consumable_order_details2__c con : conList){
+ srtMap.put(con.Bar_Code__c, con.Id);
+ }
+ List<String> str = new List<String>();
+ for(String s : srtMap.keySet()){
+ str.add(srtMap.get(s));
+ }
+ List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
+ WHERE Id =: str
+ GROUP BY Asset_Model_No__c];
+ for(Integer i = 0 ; i< arrDetList.size();i++){
+ arrDetIifo.add(new showRecords(arrDetList[i]));
+ }
+ results.recordList = arrDetIifo;
+ results.result = 'Success';
+ }catch (Exception e){
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //宸插埌璐т骇鍝佷竴瑙圓ll
+ @AuraEnabled
+ public static Results initArrDetAll(String type){
+ Results results = new Results();
+ List<ShowRecords> allArrDetIifo = new List<ShowRecords>();
+ try{
+ String userId = UserInfo.getUserId();
+ List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
+ FROM user
+ WHERE id = :userId ];
+ String accountid = userList[0].accountid;
+ String userPro_Type = userList[0].UserPro_Type__c;
+ String userWorklocation = userList[0].Work_Location__c;
+ Date orderdate = Date.today().addDays(-7);
+ String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
+ List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
+ //20200916 ljh update start
+ if(Test.isRunningTest()){
+ //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ if(type !=null && type.equals('all')){
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }else{
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }
+
+ }else{
+ //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ if(type !=null && type.equals('all')){
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }else{
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }
+ }
+ //20200916 ljh update end
+ // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ System.debug('======'+conorderlist+'daxiao:'+conorderlist.size());
+ for(Consumable_order__c conorder : conorderlist){
+ System.debug('======'+conorder.Owner.Name+'======');
+ }
+ Set<String> orderId = new Set<String>();
+ for(Consumable_order__c conorder : conorderlist){
+ orderId.add(conorder.Id);
+ }
+ System.debug('ANY o'+orderId);
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ if(Test.isRunningTest()){
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
+ }else{
+ //20200916 ljh update start
+ //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ if(type !=null && type.equals('all')){
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ }else{
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ }
+ //20200916 ljh update end
+ }
+ // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ Map<String,String> srtMap = new Map<String,String>();
+ for(Consumable_order_details2__c con : conList){
+ srtMap.put(con.Bar_Code__c, con.Id);
+ }
+ List<String> str = new List<String>();
+ for(String s : srtMap.keySet()){
+ str.add(srtMap.get(s));
+ }
+ List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
+ WHERE Id =: str
+ GROUP BY Asset_Model_No__c];
+ // List<showRecords> allArrDetIifo = new List<showRecords>();
+ for(Integer i = 0 ; i< arrDetList.size();i++){
+ allArrDetIifo.add(new showRecords(arrDetList[i]));
+ }
+ results.recordList = allArrDetIifo;
+ results.result = 'Success';
+ }catch (Exception e){
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鏈埌璐т骇鍝佷竴瑙�
+ @AuraEnabled
+ public static Results initDeliveryDet(String orderId){
+ Results results = new Results();
+ List<ShowRecords> notArrDetIifo = new List<ShowRecords>();
+ try{
+ List<AggregateResult> notArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = false
+ AND Consumable_order_minor__c = :orderId
+ GROUP BY Asset_Model_No__c];
+ for(Integer i = 0 ; i< notArrDetList.size();i++){
+ notArrDetIifo.add(new showRecords(notArrDetList[i]));
+ }
+ results.recordList = notArrDetIifo;
+ results.result = 'Success';
+ }catch (Exception e){
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鏈埌璐т骇鍝佷竴瑙圓ll
+ @AuraEnabled
+ public static Results initDeliveryDetAll(String type){
+ Results results = new Results();
+ List<ShowRecords> allNotArrDetIifo = new List<ShowRecords>();
+ try{
+ String userId = UserInfo.getUserId();
+ List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
+ FROM user
+ WHERE id = :userId ];
+ String accountid = userList[0].accountid;
+ String userPro_Type = userList[0].UserPro_Type__c;
+ String userWorklocation = userList[0].Work_Location__c;
+ Date orderdate = Date.today().addDays(-7);
+ String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
+ List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
+ //20200916 ljh update start
+ if(Test.isRunningTest()){
+ //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ if(type !=null && type.equals('all')){
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }else{
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }
+
+ }else{
+ //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ if(type !=null && type.equals('all')){
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }else{
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }
+ }
+ //20200916 ljh update end
+ // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ System.debug('======'+conorderlist+'daxiao:'+conorderlist.size());
+ for(Consumable_order__c conorder : conorderlist){
+ System.debug('======'+conorder.Owner.Name+'======');
+ }
+ Set<String> orderId = new Set<String>();
+ for(Consumable_order__c conorder : conorderlist){
+ orderId.add(conorder.Id);
+ }
+ System.debug('ANY o'+orderId);
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ if(Test.isRunningTest()){
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
+ }else{
+ //20200916 ljh update start
+ //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ if(type !=null && type.equals('all')){
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ }else{
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ }
+ //20200916 ljh update end
+ }
+ // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ Map<String,String> srtMap = new Map<String,String>();
+ for(Consumable_order_details2__c con : conList){
+ srtMap.put(con.Bar_Code__c, con.Id);
+ }
+ List<String> str = new List<String>();
+ for(String s : srtMap.keySet()){
+ str.add(srtMap.get(s));
+ }
+ List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
+ WHERE Id =: str and Cancellation_Flag__c = false
+ GROUP BY Asset_Model_No__c];
+ // List<showRecords> allArrDetIifo = new List<showRecords>();
+ for(Integer i = 0 ; i< arrDetList.size();i++){
+ allNotArrDetIifo.add(new showRecords(arrDetList[i]));
+ }
+ results.recordList = allNotArrDetIifo;
+ results.result = 'Success';
+ }catch (Exception e){
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //杩樻病鍙戣揣鏁伴噺
+ @AuraEnabled
+ public static Results initNotArrDet(String orderId){
+ Results results = new Results();
+ List<Consumable_Orderdetails__c> otherArrDetIifo = new List<Consumable_Orderdetails__c>();
+ List<ShowRecords> otherArrList = new List<ShowRecords>();
+ try{
+ List<showRecords> arrDetIifo = new List<showRecords>();
+ List<showRecords> notArrDetIifo = new List<showRecords>();
+ List<showRecords> allArrDetIifo = new List<showRecords>();
+ // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId];
+ List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId];
+ Map<String,String> srtMap = new Map<String,String>();
+ for(Consumable_order_details2__c con : conList){
+ srtMap.put(con.Bar_Code__c, con.Id);
+ }
+ List<String> str = new List<String>();
+ for(String s : srtMap.keySet()){
+ str.add(srtMap.get(s));
+ }
+ List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
+ WHERE Id =: str AND Dealer_Arrive__c = true
+ GROUP BY Asset_Model_No__c];
+ for(Integer i = 0 ; i< arrDetList.size();i++){
+ arrDetIifo.add(new showRecords(arrDetList[i]));
+ }
+
+ List<AggregateResult> notArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = false
+ AND Consumable_order_minor__c = :orderId
+ GROUP BY Asset_Model_No__c];
+ for(Integer i = 0 ; i< notArrDetList.size();i++){
+ notArrDetIifo.add(new showRecords(notArrDetList[i]));
+ }
+
+ // List<AggregateResult> allArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
+ // WHERE Id =: str
+ // GROUP BY Asset_Model_No__c];
+ List<Consumable_Orderdetails__c> allArrDetList = [SELECT Asset_Model_No__c,Consumable_count__c FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c =: orderId];
+ // for(Integer i = 0 ; i< allArrDetList.size();i++){
+ // allArrDetIifo.add(new showRecords(notArrDetList[i]));
+ // }
+ Map<String,Decimal> arrDetMap = new Map<String,Decimal>();
+ for(showRecords arr : arrDetIifo){
+ arrDetMap.put(arr.prodModel, arr.recordCount);
+ }
+ for(showRecords notarr : notArrDetIifo){
+ if(arrDetMap.containsKey(notarr.prodModel)){
+ arrDetMap.put(notarr.prodModel, arrDetMap.get(notarr.prodModel)+notarr.recordCount);
+ }else{
+ arrDetMap.put(notarr.prodModel, notarr.recordCount);
+ }
+ }
+ List<String> AssetModelNoEdList = new List<String>();//20200904 ljh add
+ for(Consumable_Orderdetails__c allarr : allArrDetList){
+ for(String promodel : arrDetMap.keySet()){
+ if(allarr.Asset_Model_No__c == promodel){
+ if((allarr.Consumable_count__c - arrDetMap.get(promodel)) > 0){
+ allarr.Consumable_count__c = (allarr.Consumable_count__c - arrDetMap.get(promodel));
+ otherArrDetIifo.add(allarr);
+ }
+ AssetModelNoEdList.add(promodel);//20200904 ljh add
+ }
+ }
+ }
+ //20200904 ljh add start
+ for(Consumable_Orderdetails__c allarr1 : allArrDetList){
+ if(!AssetModelNoEdList.contains(allarr1.Asset_Model_No__c)){
+ otherArrDetIifo.add(allarr1);
+ }
+ }
+ for(Consumable_Orderdetails__c conOrderDetail : otherArrDetIifo){
+ ShowRecords record = new ShowRecords();
+ record.prodModel = conOrderDetail.Asset_Model_No__c;
+ record.recordCount = conOrderDetail.Consumable_count__c;
+ otherArrList.add(record);
+ }
+ results.recordList = otherArrList;
+ results.result = 'Success';
+ }catch (Exception e){
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //杩樻病鍙戣揣鏁伴噺All
+ @AuraEnabled
+ public static Results initNotArrDetAll(String type){
+ Results results = new Results();
+ List<ShowRecords> allOtherDetIifo = new List<ShowRecords>();
+ try{
+ String userId = UserInfo.getUserId();
+ List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
+ FROM user
+ WHERE id = :userId ];
+ String accountid = userList[0].accountid;
+ String userPro_Type = userList[0].UserPro_Type__c;
+ String userWorklocation = userList[0].Work_Location__c;
+ Date orderdate = Date.today().addDays(-7);
+ String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
+ List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
+ //20200916 ljh update start
+ if(Test.isRunningTest()){
+ //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ if(type !=null && type.equals('all')){
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }else{
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }
+
+ }else{
+ //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ if(type !=null && type.equals('all')){
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }else{
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }
+ }
+ //20200916 ljh update end
+ // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ System.debug('======'+conorderlist+'daxiao:'+conorderlist.size());
+ for(Consumable_order__c conorder : conorderlist){
+ System.debug('======'+conorder.Owner.Name+'======');
+ }
+ Set<String> orderId = new Set<String>();
+ for(Consumable_order__c conorder : conorderlist){
+ orderId.add(conorder.Id);
+ }
+ System.debug('ANY o'+orderId);
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ if(Test.isRunningTest()){
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
+ }else{
+ //20200916 ljh update start
+ //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ if(type !=null && type.equals('all')){
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ }else{
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ }
+ //20200916 ljh update end
+ }
+ // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ Map<String,String> srtMap = new Map<String,String>();
+ for(Consumable_order_details2__c con : conList){
+ srtMap.put(con.Bar_Code__c, con.Id);
+ }
+ List<String> str = new List<String>();
+ for(String s : srtMap.keySet()){
+ str.add(srtMap.get(s));
+ }
+ List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
+ WHERE Id =: str and Cancellation_Flag__c = false
+ GROUP BY Asset_Model_No__c];
+ Map<String,Decimal> conOrderMap = new Map<String,Decimal>();
+ for(AggregateResult agg : arrDetList){
+ conOrderMap.put(String.valueOf(agg.get('prodModel')), Integer.valueOf(agg.get('recordCount')));
+ }
+
+ List<Consumable_Orderdetails__c> conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c WHERE Consumable_order__c =: orderId ];
+ Map<String,Decimal> allConOrderMap = new Map<String,Decimal>();
+ for(Consumable_Orderdetails__c con : conOrderList1){
+ if(con.Consumable_count__c == null){
+ con.Consumable_count__c = 0;
+ }
+ if(allConOrderMap.containsKey(con.Asset_Model_No__c)){
+ allConOrderMap.put(con.Asset_Model_No__c,allConOrderMap.get(con.Asset_Model_No__c)+con.Consumable_count__c);
+ }else{
+ allConOrderMap.put(con.Asset_Model_No__c, con.Consumable_count__c);
+ }
+ }
+ for(String pmodel : allConOrderMap.keySet()){
+ if(conOrderMap.containsKey(pmodel)){
+ if(allConOrderMap.get(pmodel) - conOrderMap.get(pmodel) > 0){
+ showRecords showrecord1 = new showRecords();
+ showrecord1.recordCount = allConOrderMap.get(pmodel) - conOrderMap.get(pmodel);
+ showrecord1.prodModel = pmodel;
+ allOtherDetIifo.add(showrecord1);
+ }
+ }else{
+ showRecords showrecord2 = new showRecords();
+ showrecord2.recordCount = allConOrderMap.get(pmodel);
+ showrecord2.prodModel = pmodel;
+ allOtherDetIifo.add(showrecord2);
+ }
+ }
+ results.recordList = allOtherDetIifo;
+ results.result = 'Success';
+ }catch (Exception e){
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�
+ @AuraEnabled
+ public static Results initMoreThan7(String orderId){
+ Results results = new Results();
+ List<ShowRecords> morethansevendaysIifo = new List<ShowRecords>();
+ try{
+ List<AggregateResult> morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
+ WHERE Consumable_order_minor__c != null
+ AND Dealer_Shipment__c = false
+ AND Dealer_Arrive__c = false
+ AND Dealer_Saled__c = false
+ AND Consumable_order_minor__r.showFalseNotshowTrue__c = false
+ AND Deliver_date__c < LAST_N_DAYS:7
+ AND Consumable_order_minor__c = :orderId
+ GROUP BY Asset_Model_No__c];
+
+ for(Integer i = 0 ; i< morethan7daysList.size() ; i++){
+ morethansevendaysIifo.add(new showRecords(morethan7daysList[i]));
+ }
+ results.recordList = morethansevendaysIifo;
+ results.result = 'Success';
+ }catch (Exception e){
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ //鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁癆ll
+ @AuraEnabled
+ public static Results initMoreThan7All(String type){
+ Results results = new Results();
+ List<ShowRecords> morethansevendaysIifo = new List<ShowRecords>();
+ try{
+ String userId = UserInfo.getUserId();
+ List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
+ FROM user
+ WHERE id = :userId ];
+ String accountid = userList[0].accountid;
+ String userPro_Type = userList[0].UserPro_Type__c;
+ String userWorklocation = userList[0].Work_Location__c;
+ Date orderdate = Date.today().addDays(-7);
+ String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
+ List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
+ //20200916 ljh update start
+ if(Test.isRunningTest()){
+ //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ if(type !=null && type.equals('all')){
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }else{
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }
+
+ }else{
+ //conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ if(type !=null && type.equals('all')){
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }else{
+ conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
+ }
+ }
+ system.debug('==============>conorderlist'+conorderlist);
+ system.debug('==============>conorderlist'+conorderlist.size());
+ //20200916 ljh update end
+ // List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '璁㈠崟' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
+ System.debug('======'+conorderlist+'daxiao:'+conorderlist.size());
+ for(Consumable_order__c conorder : conorderlist){
+ System.debug('======'+conorder.Owner.Name+'======');
+ }
+ Set<String> orderId = new Set<String>();
+ for(Consumable_order__c conorder : conorderlist){
+ orderId.add(conorder.Id);
+ }
+ System.debug('ANY o'+orderId);
+ List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
+ if(Test.isRunningTest()){
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
+ }else{
+ //20200916 ljh update start
+ //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ if(type !=null && type.equals('all')){
+ system.debug('all============');
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ system.debug('allconList==========='+conList.size());
+ }else{
+ system.debug('notall=============');
+ conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ system.debug('notallconList==========='+conList.size());
+ }
+ //20200916 ljh update end
+ }
+ // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
+ Map<String,String> srtMap = new Map<String,String>();
+ for(Consumable_order_details2__c con : conList){
+ srtMap.put(con.Bar_Code__c, con.Id);
+ }
+ List<String> str = new List<String>();
+ for(String s : srtMap.keySet()){
+ str.add(srtMap.get(s));
+ }
+ List<AggregateResult> morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
+ WHERE Id =: str and Cancellation_Flag__c = false
+ AND Consumable_order_minor__c != null
+ AND Dealer_Shipment__c = false
+ AND Dealer_Arrive__c = false
+ AND Dealer_Saled__c = false
+ AND Consumable_order_minor__r.showFalseNotshowTrue__c = false
+ AND Deliver_date__c < LAST_N_DAYS:7
+ GROUP BY Asset_Model_No__c];
+ system.debug('Morethan7daysList================>'+morethan7daysList.size());
+ for(Integer i = 0 ; i< morethan7daysList.size() ; i++){
+ morethansevendaysIifo.add(new showRecords(morethan7daysList[i]));
+ system.debug('MorethansevendaysIifo+++++++'+morethansevendaysIifo);
+ }
+ results.recordList = morethansevendaysIifo;
+ results.result = 'Success';
+ }catch (Exception e){
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public List<ShowRecords> recordList;
+ }
+
+
+ public class ShowRecords implements Comparable {
+ @AuraEnabled
+ public Decimal recordCount { get; set; }
+ @AuraEnabled
+ public String prodModel { get; set; }
+
+ public ShowRecords() {}
+
+ public ShowRecords(AggregateResult e) {
+ recordCount =Integer.valueOf(e.get('recordCount'));
+ prodModel = String.valueOf(e.get('prodModel'));
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableGoodsInfo.cls-meta.xml b/force-app/main/default/classes/LexConsumableGoodsInfo.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableGoodsInfo.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexConsumableOrderManageController.cls b/force-app/main/default/classes/LexConsumableOrderManageController.cls
new file mode 100644
index 0000000..0f4fc14
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableOrderManageController.cls
@@ -0,0 +1,332 @@
+/***
+ *
+ *
+ *
+ *
+ */
+public without sharing class LexConsumableOrderManageController {
+ public static Consumable_order__c coc { get; set; }
+ public static String agencyProType { get; set; }
+ public static String category1 { get; set; }
+ public static String baseUrl { get; private set; }
+ private static String[] columus = new List<String>{ 'Product2__c.Name' };
+ public static List<SelectOption> provinceOpts { get; set; }
+ public static List<CusOption> provinceCusOpts;
+ private static String accountid = null;
+ public static List<String> title { get; private set; }
+ public static List<String> column;
+ public static List<List<String>> columns { get; private set; }
+ public static List<Consumable_order__c> raesList { get; private set; }
+ private static String userWorkLocation;
+ public static Boolean hasHop { get; set; }
+ public static Boolean hasSpecial { get; set; }
+ public LexConsumableOrderManageController() {
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ }
+
+ @AuraEnabled
+ public static Results init1() {
+ Results results = new Results();
+ results.isNoteStay = LexUtility.getIsNoteStay();
+ try {
+ String userId = UserInfo.getUserId();
+ // String userId = '0050l000007CAieAAG';
+ List<user> Useracc = new List<user>();
+ Useracc = [
+ SELECT accountid, Work_Location__c, UserPro_Type__c
+ FROM user
+ WHERE id = :userId
+ ];
+ accountid = Useracc[0].accountid;
+ agencyProType = Useracc[0].UserPro_Type__c;
+ if (String.isBlank(Useracc[0].UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ userWorkLocation = Useracc[0].Work_Location__c;
+ coc = new Consumable_order__c();
+ // 鑾峰緱璁㈠崟涓�瑙�
+ Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap();
+ Schema.FieldSet fs = fsMap.get('order_view');
+ // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
+ List<FieldSetMember> fsmList = fs.getFields();
+ // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
+ title = new List<String>();
+ column = new List<String>();
+ columns = new List<List<String>>();
+ List<CusCol> cols = new List<CusCol>();
+ for (FieldSetMember fsm : fsmList) {
+ //add by Link
+ CusCol col = new CusCol();
+ col.label = fsm.getLabel();
+ col.fieldName = fsm.getFieldPath();
+ col.hideDefaultActions = true;
+ // col.sortable = true;
+ col.wrapText = true;
+ if (fsm.getFieldPath() == 'Order_ForHospital__c') {
+ col.type = 'url';
+ col.fieldName = 'hosUrl';
+ TypeAttr typeAttributes1 = new TypeAttr();
+ CusLable cusLabel = new CusLable();
+ cusLabel.fieldName = 'hosName';
+ typeAttributes1.label = cusLabel;
+ typeAttributes1.target = '_blank';
+ col.typeAttributes = typeAttributes1;
+ }
+ if (fsm.getFieldPath() == 'Name') {
+ col.type = 'url';
+ col.fieldName = 'nameUrl';
+ TypeAttr typeAttributes1 = new TypeAttr();
+ CusLable cusLabel = new CusLable();
+ cusLabel.fieldName = 'Name';
+ typeAttributes1.label = cusLabel;
+ typeAttributes1.target = '_blank';
+ col.typeAttributes = typeAttributes1;
+ }
+ cols.add(col);
+ //update by rentx 2020-12-22 start
+ if (fsm.getLabel() == '鍖婚櫌' && agencyProType != null && agencyProType == 'ET') {
+ } else {
+ title.add(fsm.getLabel());
+ }
+ if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') {
+ } else {
+ column.add(fsm.getFieldPath());
+ columns.add(fsm.getFieldPath().split('\\.'));
+ }
+ }
+ provinceOpts = new List<SelectOption>();
+ provinceOpts.add(new SelectOption('', '-鏃�-'));
+ provinceOpts.add(new SelectOption('鑽夋涓�', '鑽夋涓�'));
+ provinceOpts.add(new SelectOption('宸叉彁浜�', '宸叉彁浜�'));
+ provinceOpts.add(new SelectOption('鎵瑰噯', '鎵瑰噯'));
+ provinceOpts.add(new SelectOption('椹冲洖', '椹冲洖'));
+ //閽堝lwc鐨勮嚜瀹氫箟option
+ provinceCusOpts = new List<CusOption>();
+ provinceCusOpts.add(new CusOption('-鏃�-', ''));
+ provinceCusOpts.add(new CusOption('鑽夋涓�', '鑽夋涓�'));
+ provinceCusOpts.add(new CusOption('宸叉彁浜�', '宸叉彁浜�'));
+ provinceCusOpts.add(new CusOption('鎵瑰噯', '鎵瑰噯'));
+ provinceCusOpts.add(new CusOption('椹冲洖', '椹冲洖'));
+ // 鑾峰緱鏄剧ず鏁版嵁
+ raesList = new List<Consumable_order__c>();
+ String soql = 'select Id';
+ for (String s : column) {
+ soql += ',' + s;
+ }
+ soql += ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' + '璁㈠崟' + '\'';
+ soql += ' and RecordtypeId = \'' + System.Label.RT_ConOrder_Order + '\'';
+ soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\'';
+ soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
+ soql += ' and Dealer_Info__c =\'' + accountid + '\' order by Order_status__c ';
+ System.debug('====soql====' + soql);
+ raesList = Database.query(soql);
+ //add by rentx 2021-3-10 start
+ //涓� hasHop 璧嬪�� 鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈夌壒浠峰尰闄�
+ List<hospitalprice__c> hopList = [SELECT id, hospital__c FROM hospitalprice__c WHERE account__c = :accountid];
+ if (hopList == null || hopList.size() == 0) {
+ hasHop = false;
+ } else {
+ hasHop = true;
+ }
+ //涓� hasSpecial 璧嬪�� 鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈変績閿�鍟嗗搧
+ //鏌ヨ褰撳墠缁忛攢鍟嗕笅鐨勬湁鏁堝悎鍚�
+ List<Account> contractList = [
+ SELECT Id, Name, RecordType.DeveloperName
+ FROM Account
+ WHERE RecordType.DeveloperName = 'AgencyContract' AND Contact_Type__c LIKE :agencyProType AND Agent_Ref__c = :accountid
+ ];
+ List<Id> dealIds = new List<Id>();
+ if (contractList != null && contractList.size() > 0) {
+ for (Account acc : contractList) {
+ dealIds.add(acc.Id);
+ }
+ List<Dealer_Product__c> deList = [SELECT id FROM Dealer_Product__c WHERE Dealer_Contact__c IN :dealIds];
+ if (deList == null || deList.size() == 0) {
+ hasSpecial = false;
+ } else {
+ hasSpecial = true;
+ }
+ } else {
+ hasSpecial = false;
+ }
+ results.result = 'Success';
+ results.provinceOpts = provinceCusOpts;
+ results.raesList = raesList;
+ results.agencyProType = agencyProType;
+ results.userWorkLocation = userWorkLocation;
+ results.accountid = accountid;
+ results.hasHop = hasHop;
+ results.hasSpecial = hasSpecial;
+ results.title = title;
+ results.cols = cols;
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.raesList = new List<Consumable_order__c>();
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ @AuraEnabled
+ public static Results searchConsumableorderdetails(
+ String categoryStr,
+ Date orderDate,
+ String orderStatus,
+ String accountidStr,
+ String agencyProTypeStr,
+ String userWorkLocationStr
+ ) {
+ Results results = new Results();
+ agencyProType = agencyProTypeStr;
+ userWorkLocation = userWorkLocationStr;
+ accountid = accountidStr;
+ if (String.isBlank(categoryStr)) {
+ category1 = null;
+ } else {
+ category1 = categoryStr;
+ }
+ coc = new Consumable_order__c();
+ if (String.isBlank(orderStatus)) {
+ coc.Order_status__c = null;
+ } else {
+ coc.Order_status__c = orderStatus;
+ }
+ coc.Order_date__c = orderDate;
+ try {
+ Date cate2 = coc.Order_date__c;
+ String cate3 = coc.Order_status__c;
+ // 鑾峰緱璁㈠崟涓�瑙�
+ Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap();
+ Schema.FieldSet fs = fsMap.get('order_view');
+ // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
+ List<FieldSetMember> fsmList = fs.getFields();
+ // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
+ title = new List<String>();
+ column = new List<String>();
+ columns = new List<List<String>>();
+ for (FieldSetMember fsm : fsmList) {
+ //update by rentx 2020-12-22 start
+ if (fsm.getLabel() == '鍖婚櫌' && agencyProType != null && agencyProType == 'ET') {
+ } else {
+ title.add(fsm.getLabel());
+ }
+ if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') {
+ } else {
+ column.add(fsm.getFieldPath());
+ columns.add(fsm.getFieldPath().split('\\.'));
+ }
+ }
+ // 鑾峰緱鏄剧ず鏁版嵁
+ raesList = new List<Consumable_order__c>();
+ String soql = 'select Id';
+ for (String s : column) {
+ soql += ',' + s;
+ }
+ soql +=
+ ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' +
+ '璁㈠崟' +
+ '\' and RecordtypeId = \'' +
+ System.Label.RT_ConOrder_Order +
+ '\' and Dealer_Info__c =\'' +
+ accountid +
+ '\' ';
+ soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
+ if (!String.isBlank(category1)) {
+ soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' ';
+ }
+ if (cate2 != null) {
+ soql += ' and Order_date__c = :cate2';
+ }
+ if (cate3 != null) {
+ soql += ' and Order_status__c = :cate3 ';
+ }
+ soql += ' order by Order_status__c ';
+ system.debug('====soql:' + soql);
+ raesList = Database.query(soql);
+ system.debug('====raesList:' + raesList);
+ if (raesList.size() > 0) {
+ results.result = 'Success';
+ results.raesList = raesList;
+ results.errorMsg = '鍏辨湁' + raesList.size() + '涓鍗�';
+ } else {
+ results.result = 'Fail';
+ results.raesList = new List<Consumable_order__c>();
+ results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏宠鍗�';
+ }
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.raesList = new List<Consumable_order__c>();
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public List<CusOption> provinceOpts;
+ @AuraEnabled
+ public List<String> title;
+ @AuraEnabled
+ public String accountid;
+ @AuraEnabled
+ public String agencyProType;
+ @AuraEnabled
+ public String userWorkLocation;
+ @AuraEnabled
+ public Boolean hasHop;
+ @AuraEnabled
+ public Boolean hasSpecial;
+ @AuraEnabled
+ public List<Consumable_order__c> raesList;
+ @AuraEnabled
+ public List<CusCol> cols;
+ @AuraEnabled
+ public Boolean isNoteStay;
+ }
+
+ public class CusOption {
+ CusOption(String label, String value) {
+ this.label = label;
+ this.value = value;
+ }
+
+ @AuraEnabled
+ public String label;
+ @AuraEnabled
+ public String value;
+ }
+
+ public class CusCol {
+ @AuraEnabled
+ public String label;
+ @AuraEnabled
+ public String fieldName;
+ @AuraEnabled
+ public String type;
+ @AuraEnabled
+ public Boolean sortable;
+ @AuraEnabled
+ public Boolean wrapText;
+ @AuraEnabled
+ public Boolean hideDefaultActions;
+ @AuraEnabled
+ public TypeAttr typeAttributes;
+ }
+
+ public class TypeAttr {
+ @AuraEnabled
+ public CusLable label;
+ @AuraEnabled
+ public String target;
+ }
+
+ public class CusLable {
+ @AuraEnabled
+ public String fieldName;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexConsumableOrderManageController.cls-meta.xml b/force-app/main/default/classes/LexConsumableOrderManageController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexConsumableOrderManageController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexDealerInquiryModifyStateController.cls b/force-app/main/default/classes/LexDealerInquiryModifyStateController.cls
new file mode 100644
index 0000000..efb18df
--- /dev/null
+++ b/force-app/main/default/classes/LexDealerInquiryModifyStateController.cls
@@ -0,0 +1,866 @@
+public with sharing class LexDealerInquiryModifyStateController {
+ public static List<OpportunityInfo> oppRecords { get; set; }
+ // 銉氥兗銈搞儸銈ゃ偄銈︺儓銇儏鍫便倰鍙栧緱
+ private static Map<String, Map<String, String>> editLayoutItemRWMap = New Map<String, Map<String, String>>();
+ // private Map<String, Map<String, String>> editLayoutItemRWMapRt = null;
+ public static List<OpportunityInfo> OPPORTList { get; set; }
+ /*****************妞滅储鐢�******************/
+
+ /*******************妫�绱㈠睘鎬у��*******************/
+
+ public static String accSearch { get; set; }//缁忛攢鍟嗗尰闄�
+ public static String aooSearch { get; set; }//鎷呭綋浜�
+ public static String numtext1 { get; set; } //鏁版嵁瀛楁01
+ public static String numtext { get; set; }//鏁版嵁瀛楁03
+ public static String numtext2 { get; set; } //鏁版嵁瀛楁02
+ public static String timetext1 { get; set; } //鏃ユ湡01
+ public static String timetext2 { get; set; } //鏃ユ湡02
+ public static Agency_Opportunity__c tmpAO { get; set; } //妫�绱㈡棩鏈熺敤
+ public static Agency_Opportunity__c tmpBO { get; set; } //妫�绱㈡棩鏈熺敤
+ public static String limits { get; set; }//鏃ユ湡03
+
+ public static List<SelectOption> dateOpts { get; private set; }
+ public static List<CusOption> textCusOpts;
+ public static List<SelectOption> textOpts { get; private set; }
+
+ public static List<CusOption> timeCusOpts;
+ public static List<SelectOption> timeOpts { get; private set; }
+
+ public static List<CusOption> equalCusOpts;
+ public static List<SelectOption> equalOpts { get; private set; }
+ public static List<SelectOption> timeequalOpts { get; private set; }
+ public static List<CusOption> limitCusOpts;
+ public static List<SelectOption> limitOpts { get; private set; }
+
+ /*****************鐢婚潰琛ㄧずBean******************/
+ public static Integer oppCount { get; set; }
+ public static String saveType { get; set; }
+
+ public static String sortKey { get; set; }
+ public static String preSortKey { get; set; }
+ public static Boolean sortOrderAsc { get; set; }
+ public static String[] sortOrder { get; set; }
+ public static String[] columus = new String[] {'Id'};
+ public static String[] selColumus = null;
+ public static Set<String> columusSet = new Set<String> {'Id'};
+
+ // 椤圭洰set 瀛楁鏍囩
+ public static List<String> titleLeft { get; private set; }
+ public static List<String> titleRight { get; private set; }
+ // 椤圭洰set 瀛楁鍚�
+ public static List<List<String>> columnsLeftApi { get; private set; } // 鍙傜収闋呯洰鐢�
+ public static List<List<String>> columnsRightApi { get; private set; } // 鍙傜収闋呯洰鐢�
+ public static List<String> columnLeftCss { get; private set; } // css 鐢�
+ public static List<String> columnRightCss { get; private set; } // css 鐢�
+ public static Map<String, String> columnLeftRW { get; private set; } // r,w,wm鐢�
+ public static Map<String, String> columnRightRW { get; private set; } // r,w,wm鐢�
+ private static String strColumus;
+ private static String strRtColumus;
+
+ @TestVisible private static String accTypeForSort = null;
+ private static Integer oppLimit = 500;
+
+ // page
+ public static Integer pagesize { get; set; }
+ public static Integer pageToken { get; set; }
+ public static String sortField { get; set; }
+ // public static String sortOrder { get; set; }
+
+ public static Integer totalcount { get; set; }
+
+ public LexDealerInquiryModifyStateController() {
+ }
+
+ @AuraEnabled
+ public static Results init(Integer pageSizeLWC,Integer pageTokenLWC) {
+ pageSize = pageSizeLWC;
+ pageToken = pageTokenLWC;
+ Results results = new Results();
+ oppRecords = new List<OpportunityInfo>();
+
+ //dateOpts = new List<SelectOption>();
+ //dateOpts.add(new SelectOption('', '--鏃�--'));
+ //dateOpts.add(new SelectOption('Registration_Day__c', '鐧诲綍鏃�'));
+ //dateOpts.add(new SelectOption('Ban_On_Use_Date__c', '绂佺敤鏃ユ湡'));
+
+ //鏁版嵁瀛楁涓嬫媺鍒楄〃
+ // textOpts = new List<SelectOption>();
+ // textOpts.add(new SelectOption('', '--鏃�--'));
+ // textOpts.add(new SelectOption('Agency_Opportunity_No__c', '缁忛攢鍟嗚浠风紪鐮�'));
+ // textOpts.add(new SelectOption('Agency__r.Name', '缁忛攢鍟�'));
+ // textOpts.add(new SelectOption('Agency_Hospital__r.Name', '缁忛攢鍟嗗尰闄�'));
+ // textOpts.add(new SelectOption('Department_Cateogy__c', '绉戝鍒嗙被'));
+ // textOpts.add(new SelectOption('Change_To_Opportunity_T__c', '璇环鍚嶇О'));
+ // // textOpts.add(new SelectOption('Name', '璇环鍚嶇О'));
+ // textOpts.add(new SelectOption('StageName__c', '璇环闃舵'));
+ // textOpts.add(new SelectOption('Oly_Inquiry_Status1__c', '鐘舵��1'));
+ // //绮剧悽绉戞妧 zxk 2021-08-25 start
+ // // textOpts.add(new SelectOption('Oly_Inquiry_Status2__c', '鐘舵��2'));
+ // textOpts.add(new SelectOption('Oly_Inquiry_Stage__c', 'Oly璇环闃舵'));
+ // //绮剧悽绉戞妧 zxk 2021-08-25 end
+ // textOpts.add(new SelectOption('Hospital_City_Master__c', '甯�'));
+
+ //custom option
+ textCusOpts = new List<CusOption>();
+ textCusOpts.add(new CusOption('', '--鏃�--'));
+ textCusOpts.add(new CusOption('Agency_Opportunity_No__c', '缁忛攢鍟嗚浠风紪鐮�'));
+ textCusOpts.add(new CusOption('Agency__r.Name', '缁忛攢鍟�'));
+ textCusOpts.add(new CusOption('Agency_Hospital__r.Name', '缁忛攢鍟嗗尰闄�'));
+ textCusOpts.add(new CusOption('Department_Cateogy__c', '绉戝鍒嗙被'));
+ textCusOpts.add(new CusOption('Change_To_Opportunity_T__c', '璇环鍚嶇О'));
+ textCusOpts.add(new CusOption('StageName__c', '璇环闃舵'));
+ textCusOpts.add(new CusOption('Oly_Inquiry_Status1__c', '鐘舵��1'));
+ textCusOpts.add(new CusOption('Oly_Inquiry_Stage__c', 'Oly璇环闃舵'));
+ textCusOpts.add(new CusOption('Hospital_City_Master__c', '甯�'));
+
+
+ // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.Salesdepartment_HP__c', '閿�鍞湰閮�'));
+ // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.State_Master__r.Name', '鐪�'));
+ // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.City_Master__r.Name', '甯�'));
+ //鏃ユ湡瀛楁涓嬫媺鍒楄〃
+ // timeOpts = new List<SelectOption>();
+ // timeOpts.add(new SelectOption('', '--鏃�--'));
+ // timeOpts.add(new SelectOption('Created_Day__c', '鍒涘缓鏃�'));
+ // timeOpts.add(new SelectOption('Bid_Planned_Date__c', '棰勬祴鎷涙爣鏃�'));
+ // timeOpts.add(new SelectOption('Forecasted_Bid_Date__c', '棰勬祴涓爣鏃�'));
+ // timeOpts.add(new SelectOption('Close_Forecasted_Date__c', '棰勬祴涓嶰LY绛剧害鏃�'));
+ // timeOpts.add(new SelectOption('Lost_Opportunity_Date__c', '澶卞崟鏃ユ湡'));
+ // timeOpts.add(new SelectOption('Deleted_Reason_Date__c', '鍙栨秷鏃ユ湡'));
+
+ timeCusOpts = new List<CusOption>();
+ timeCusOpts.add(new CusOption('', '--鏃�--'));
+ timeCusOpts.add(new CusOption('Created_Day__c', '鍒涘缓鏃�'));
+ timeCusOpts.add(new CusOption('Bid_Planned_Date__c', '棰勬祴鎷涙爣鏃�'));
+ timeCusOpts.add(new CusOption('Forecasted_Bid_Date__c', '棰勬祴涓爣鏃�'));
+ timeCusOpts.add(new CusOption('Close_Forecasted_Date__c', '棰勬祴涓嶰LY绛剧害鏃�'));
+ timeCusOpts.add(new CusOption('Lost_Opportunity_Date__c', '澶卞崟鏃ユ湡'));
+ timeCusOpts.add(new CusOption('Deleted_Reason_Date__c', '鍙栨秷鏃ユ湡'));
+
+
+
+ //鏁版嵁瀛楁涓棿杩炴帴绗﹀彿
+ // equalOpts = new List<SelectOption>();
+ // equalOpts.add(new SelectOption('=', '绛変簬'));
+ // equalOpts.add(new SelectOption('<>', '涓嶇瓑浜�'));
+ // equalOpts.add(new SelectOption('<', '<'));
+ // equalOpts.add(new SelectOption('>', '>'));
+ // equalOpts.add(new SelectOption('<=', '<='));
+ // equalOpts.add(new SelectOption('>=', '>='));
+ // equalOpts.add(new SelectOption('contains', '鍖呭惈'));
+ // equalOpts.add(new SelectOption('notcontains', '涓嶅寘鍚�'));
+ // equalOpts.add(new SelectOption('starts with', '璧峰瀛楃'));
+
+ equalCusOpts = new List<CusOption>();
+ equalCusOpts.add(new CusOption('=', '绛変簬'));
+ equalCusOpts.add(new CusOption('<>', '涓嶇瓑浜�'));
+ equalCusOpts.add(new CusOption('<', '<'));
+ equalCusOpts.add(new CusOption('>', '>'));
+ equalCusOpts.add(new CusOption('<=', '<='));
+ equalCusOpts.add(new CusOption('>=', '>='));
+ equalCusOpts.add(new CusOption('contains', '鍖呭惈'));
+ equalCusOpts.add(new CusOption('notcontains', '涓嶅寘鍚�'));
+ equalCusOpts.add(new CusOption('starts with', '璧峰瀛楃'));
+
+ //鏃ユ湡瀛楁杩炴帴绗﹀彿
+ //timeequalOpts = new List<SelectOption>();
+ //timeequalOpts.add(new SelectOption('=', '绛変簬'));
+ //timeequalOpts.add(new SelectOption('<>', '涓嶇瓑浜�'));
+ //timeequalOpts.add(new SelectOption('<', '<'));
+ //timeequalOpts.add(new SelectOption('>', '>'));
+ //timeequalOpts.add(new SelectOption('<=', '<='));
+ //timeequalOpts.add(new SelectOption('>=', '>='));
+ //鏁版嵁鏄剧ず鏉℃暟
+ // limitOpts = new List<SelectOption>();
+ // limitOpts.add(new SelectOption('10', '10'));
+ // limitOpts.add(new SelectOption('20', '20'));
+ // limitOpts.add(new SelectOption('50', '50'));
+ // limitOpts.add(new SelectOption('100', '100'));
+ // limitOpts.add(new SelectOption('200', '200'));
+ // limitOpts.add(new SelectOption('1000', '鍏ㄩ儴'));
+ //鏁版嵁鏄剧ず榛樿鏉℃暟
+ limits = '20';
+
+ limitCusOpts = new List<CusOption>();
+ limitCusOpts.add(new CusOption('10', '10'));
+ limitCusOpts.add(new CusOption('20', '20'));
+ limitCusOpts.add(new CusOption('50', '50'));
+ limitCusOpts.add(new CusOption('100', '100'));
+ limitCusOpts.add(new CusOption('200', '200'));
+ limitCusOpts.add(new CusOption('1000', '鍏ㄩ儴'));
+ try{
+ PartnerSoapSforceCom.Soap soap = new PartnerSoapSforceCom.Soap();
+ soap.SessionHeader = new PartnerSoapSforceCom.SessionHeader_element();
+ soap.SessionHeader.sessionId = UserInfo.getSessionId();
+ soap.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/partner/services/Soap/u/33.0';
+ // soap.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/u/33.0';
+
+ PartnerSoapSforceCom.DescribeLayoutResult dlr = new PartnerSoapSforceCom.DescribeLayoutResult();
+ if (System.Test.isRunningTest()) {
+ // UnitTest 鐢�
+ // PartnerSoapSforceCom.DescribeLayoutResult dlr = new PartnerSoapSforceCom.DescribeLayoutResult();
+ PartnerSoapSforceCom.RecordTypeMapping rtMap = new PartnerSoapSforceCom.RecordTypeMapping();
+ PartnerSoapSforceCom.DescribeLayout editLayout = new PartnerSoapSforceCom.DescribeLayout();
+ PartnerSoapSforceCom.DescribeLayoutSection editLayoutSection = new PartnerSoapSforceCom.DescribeLayoutSection();
+ PartnerSoapSforceCom.DescribeLayoutRow layoutRow = new PartnerSoapSforceCom.DescribeLayoutRow();
+ PartnerSoapSforceCom.DescribeLayoutItem layoutItem = new PartnerSoapSforceCom.DescribeLayoutItem();
+ PartnerSoapSforceCom.DescribeLayoutComponent layoutComponent = new PartnerSoapSforceCom.DescribeLayoutComponent();
+ dlr.recordTypeMappings = new List<PartnerSoapSforceCom.RecordTypeMapping>();
+ dlr.recordTypeMappings.add(rtMap);
+ rtMap.recordTypeId = 'recordTypeId';
+ dlr.layouts = new List<PartnerSoapSforceCom.DescribeLayout>();
+ dlr.layouts.add(editLayout);
+ editLayout.editLayoutSections = new List<PartnerSoapSforceCom.DescribeLayoutSection>();
+ editLayout.editLayoutSections.add(editLayoutSection);
+ editLayoutSection.layoutRows = new List<PartnerSoapSforceCom.DescribeLayoutRow>();
+ editLayoutSection.layoutRows.add(layoutRow);
+ layoutRow.layoutItems = new List<PartnerSoapSforceCom.DescribeLayoutItem>();
+ layoutRow.layoutItems.add(layoutItem);
+ layoutItem.layoutComponents = new List<PartnerSoapSforceCom.DescribeLayoutComponent>();
+ layoutItem.layoutComponents.add(layoutComponent);
+ // return dlr;
+ } else {
+ dlr = soap.describeLayout('Agency_Opportunity__c', null, null);
+ // dlr = soap.describeLayout('asdas', null, null);
+ }
+
+ // PartnerSoapSforceCom.DescribeLayoutResult dlr = soap.describeLayout('Agency_Opportunity__c', null, null);
+ Map<String, PartnerSoapSforceCom.DescribeLayout> layputMap = new Map<String, PartnerSoapSforceCom.DescribeLayout>();
+ for (PartnerSoapSforceCom.DescribeLayout layout : dlr.layouts) {
+ layputMap.put(layout.id, layout);
+ }
+ for (Integer lidx = 0; lidx < dlr.recordTypeMappings.size(); lidx++) {
+ String recordTypeId = dlr.recordTypeMappings[lidx].recordTypeId;
+ Map<String, String> rtnInner = new Map<String, String>();
+ editLayoutItemRWMap.put(recordTypeId, rtnInner);
+ System.debug('recordTypeId=' + recordTypeId);
+ PartnerSoapSforceCom.DescribeLayout layout = layputMap.get(dlr.recordTypeMappings[lidx].layoutId);
+ for (PartnerSoapSforceCom.DescribeLayoutSection section : layout.editLayoutSections) {
+ for (PartnerSoapSforceCom.DescribeLayoutRow row : section.layoutRows) {
+ for (PartnerSoapSforceCom.DescribeLayoutItem item : row.layoutItems) {
+ if (item.layoutComponents != null && item.layoutComponents.size() > 0
+ && String.isBlank(item.layoutComponents[0].value) == false) {
+ rtnInner.put(item.layoutComponents[0].value, 'r');
+ if (item.editableForUpdate) {
+ rtnInner.put(item.layoutComponents[0].value, 'w');
+ }
+ if (item.required) {
+ rtnInner.put(item.layoutComponents[0].value, 'wm');
+ }
+ }
+ }
+ }
+ }
+ }
+ // editLayoutItemRWMap = SoapApi.getEditRWByRecordType('Agency_Opportunity__c', null);
+ tmpAO = new Agency_Opportunity__c();
+ tmpBO = new Agency_Opportunity__c();
+ setLayoutRWInfo();
+ searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey);
+ System.debug('limitCusOpts==>'+limitCusOpts);
+ System.debug('searchOppInner==>'+ searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey));
+ LexDealerInquiryModifyStateController.Results returnList = searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey);
+ System.debug('returnList==>'+ returnList);
+ //鍒嗛〉
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ totalCount = oppRecords.size();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ Integer startIdx;
+ Integer endIdx;
+ List<OpportunityInfo> pageoppRecords = new List<OpportunityInfo>();
+ startIdx = pageToken;
+ endIdx = startIdx + pageSize;
+ if (endIdx > oppRecords.size()) {
+ endIdx = oppRecords.size();
+ }
+ for (Integer i = startIdx; i < endIdx; i++) {
+ pageoppRecords.add(oppRecords.get(i));
+ }
+ //end
+
+ //鍥炰紶鍙傛暟
+ results.result = 'Success';
+ results.oppRecords = oppRecords;
+ results.timeCusOpts = timeCusOpts;
+ results.equalCusOpts = equalCusOpts;
+ results.limitCusOpts = limitCusOpts;
+ results.textCusOpts = textCusOpts;
+ results.limits = limits;
+ results.strColumus = strColumus;
+ results.strRtColumus = strRtColumus;
+ results.paginatedAccounts = paginatedAccounts;
+ results.pageoppRecords = pageoppRecords;
+ results.Msg = returnList.Msg;
+
+
+ System.debug('results==>'+results);
+
+ }catch (Exception e) {
+ results.result = 'Fail';
+ results.Msg = e.getLineNumber()+'---'+e.getMessage();
+ }
+
+ // return null;
+ return results;
+ }
+ //鐢ㄤ簬鑾峰彇缁忛攢鍟嗚浠峰瓧娈甸泦鍜岃浠峰瓧娈甸泦浠ュ強鐩稿簲鐨勮鍐欐潈闄�
+ @TestVisible private static void setLayoutRWInfo() {
+ // if (this.sortOrder == null) {
+ if (sortOrder == null) {
+ selColumus = new String[] {};
+ strColumus = '';
+ ID accRecordTypeId = accTypeForSort;
+
+ Map<String, String> DESC_RW = editLayoutItemRWMap.get('012100000006KW7AAM');
+ Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Agency_Opportunity__c').getDescribe().fieldSets.getMap();
+ Schema.FieldSet fs = fsMap.get('DealerInquiryModifyState');
+ List<FieldSetMember> fsmList = fs.getFields();
+ titleLeft = new List<String>();
+ List<String> columnLeft = new List<String>();
+ columnLeftCss = new List<String>();
+ columnsLeftApi = new List<List<String>>();
+ columnLeftRW = new Map<String, String>();
+ for (FieldSetMember fsm : fsmList) {
+ titleLeft.add(fsm.getLabel());
+ columnLeft.add(fsm.getFieldPath());
+ List<String> splitFieldPath = fsm.getFieldPath().split('\\.');
+ columnsLeftApi.add(splitFieldPath);
+ if (DESC_RW == null) {
+ columnLeftRW.put(fsm.getFieldPath(), 'r');
+ } else if (splitFieldPath.size() == 1) {
+ String rw = DESC_RW.get(fsm.getFieldPath());
+ if (rw != null) {
+ columnLeftRW.put(fsm.getFieldPath(), rw);
+ } else {
+ columnLeftRW.put(fsm.getFieldPath(), 'r');
+ }
+ } else {
+ columnLeftRW.put(fsm.getFieldPath(), 'r');
+ }
+ }
+ for (String str : columnLeftRW.keySet()) {
+ System.debug(str + '=+=+=+=+=' + columnLeftRW.get(str));
+ }
+ for (String s : columnLeft) {
+ if (columusSet.contains(s) == false) {
+ columus.add(s);
+ columusSet.add(s);
+ }
+ if (selColumus.contains(s) == false) {
+ selColumus.add(s);
+ }
+ columnLeftCss.add(s.replace('.', '_'));
+ }
+ strRtColumus = '';
+ Schema.FieldSet fsRt = fsMap.get('DealerOpportunity');
+ List<FieldSetMember> fsmListRt = fsRt.getFields();
+ titleRight = new List<String>();
+ List<String> columnRight = new List<String>();
+ columnRightCss = new List<String>();
+ columnsRightApi = new List<List<String>>();
+ columnRightRW = new Map<String, String>();
+
+ for (FieldSetMember fsm : fsmListRt) {
+ titleRight.add(fsm.getLabel());
+ columnRight.add(fsm.getFieldPath());
+ List<String> splitFieldPath = fsm.getFieldPath().split('\\.');
+ columnsRightApi.add(splitFieldPath);
+ if (DESC_RW == null) {
+ columnRightRW.put(fsm.getFieldPath(), 'r');
+ } else if (splitFieldPath.size() == 1) {
+ String rw = DESC_RW.get(fsm.getFieldPath());
+ if (rw != null) {
+ columnRightRW.put(fsm.getFieldPath(), rw);
+ } else {
+ columnRightRW.put(fsm.getFieldPath(), 'r');
+ }
+ } else {
+ columnRightRW.put(fsm.getFieldPath(), 'r');
+ }
+ }
+ for (String s : columnRight) {
+ selColumus.add(s);
+ if (strRtColumus == '') {
+ strRtColumus = s;
+ } else {
+ strRtColumus = strRtColumus + ',' + s;
+ }
+ columnRightCss.add(s.replace('.', '_'));
+
+ }
+ strColumus = String.join(columus, ',');
+ System.debug('======-======-======strColumus' + strColumus);
+ System.debug('======-======-======strRtColumus' + strRtColumus);
+ sortOrderAsc = true;
+ sortOrder = new String[selColumus.size()];
+ for (Integer i = 0; i < selColumus.size(); i++) sortOrder[i] = '銆�';
+ }
+ }
+ //鐢ㄤ簬鎷兼帴SOQL璇彞 鏍规嵁涓嶅悓妫�绱㈡潯浠舵嫾鎺ヤ笉鍚孲OQL璇彞銆�
+ @AuraEnabled
+ public static Results searchOppInner(String strColumus,String strRtColumus,String accSearch,String aooSearch,String numtext,String numtext1,String numtext2,String sortKeyLWC) {
+ Results results = new Results();
+ sortKey = sortKeyLWC;
+
+ //SOQL:鎷兼帴妫�绱㈡潯浠朵互鍙婄粡閿�鍟嗚浠风殑SOQL璇彞
+ // List<User> userlist2 = [select id,name from user where Contactid in (select id from Contact)];
+ // String querySoql = '';
+ // Integer queryint = 0;
+ // for(User user : userlist2){
+ // if(queryint == 0){
+ // querySoql += '\''+user.Id+'\'';
+ // queryint++;
+ // }else{
+ // querySoql += ',\''+user.Id+'\'';
+ // }
+
+ // }
+ // System.debug('pppqqq222'+userlist2);
+ // System.debug('pppqqq333'+querySoql);
+ // AND Ownerid in ( '+querySoql+')'
+
+ String soql = 'SELECT Change_To_Opportunity__r.Id , Agency_Hospital__r.Name , Product_Category1__r.Name , Product_Category2__r.Name , Product_Category3__r.Name , Agency_Person__r.Name , Agency__r.Name , Change_To_Opportunity__r.Name ,' +
+ strColumus + ',' + strRtColumus +
+ ' FROM Agency_Opportunity__c WHERE recordType.DeveloperName = \'Opportunity\' ';
+ //鏁版嵁瀛楁锛氱粡閿�鍟嗗尰闄� +SOQL
+ if (!String.isBlank(accSearch)) {
+ accSearch = accSearch.trim();
+ // soql += 'AND Agency__r.Name ' + ' LIKE \'%' + accSearch + '%\' ';
+ soql += 'AND Agency_Hospital__r.Name ' + ' LIKE \'%' + accSearch + '%\' ';
+ }
+ //鏁版嵁瀛楁锛氭媴褰撲汉 +SOQL
+ if (!String.isBlank(aooSearch)) {
+ String newAooSearch = aooSearch.trim();
+ // soql += 'AND Change_To_Opportunity__r.Owner.Alias = ' + '\'' + newAooSearch + '\'';//Name
+ soql += 'AND Agency_PersonName__c ' + ' LIKE \'%' + newAooSearch + '%\' ';
+ }
+ //鏁版嵁瀛楁锛�03 鎵嬪姩濉啓椤� 鍑嗗璋冪敤makeTextSql锛�
+ if (!String.isBlank(numtext)) {
+ String newNumtext = numtext.trim();
+ String str = makeTextSql(numtext1, numtext2, newNumtext);
+ soql += str;
+ System.debug('+++++++++++++=============++++++++++++++++++' + soql);
+ }
+ //鐐瑰嚮鎺掑簭
+ // System.debug('==-=-=-=-=-=this.sortKey'+Integer.valueOf(this.sortKey)+'===titleLeft.size'+titleLeft.size()+7);
+ //start娉ㄩ噴 by WangXueqin
+ // if (String.isBlank(this.sortKey)) {
+ // soql += ' order by LastModifiedDate desc limit ' + Integer.valueOf(limits);
+ // } else {
+ // if (Integer.valueOf(this.sortKey) <= titleLeft.size() + 7) {
+ // soql += ' order by ' + this.selColumus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') + ' limit ' + Integer.valueOf(limits);
+ // } else {
+ // soql += ' order by Change_To_Opportunity__r.' + this.selColumus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last') + ' limit ' + Integer.valueOf(limits);
+ // }
+ // }
+ // system.debug(soql);
+ //end
+
+
+
+ // List<User> userlist1 = [select id,name from user ];
+ // System.debug('pppqqq111'+userlist1);
+
+ List<Agency_Opportunity__c> InfoList = Database.query(soql);
+ System.debug('+++++++-------------------'+InfoList);
+
+ // List<Agency_Opportunity__c> InfoList = ControllerUtil.DatabaseQuery(soql);
+ // System.debug('InfoList[0].Change_To_Opportunity_T__c'+InfoList[0].Change_To_Opportunity_T__c);
+ for (Agency_Opportunity__c apt : InfoList) {
+ System.debug('pppqqq' + apt.Agency_PersonName__c + '====' + apt.Name);
+ }
+
+ List<OpportunityInfo> oppinfoList = new List<OpportunityInfo>();
+ if (InfoList != null && InfoList.size() > 0) {
+ String str = '';
+ for (Agency_Opportunity__c agc : InfoList) {
+ if (str == '' && agc.Change_To_Opportunity__r.Id != null) {
+ str = '\'' + agc.Change_To_Opportunity__r.Id + '\'';
+ } else if (agc.Change_To_Opportunity__r.Id != null) {
+ str += ',\'' + agc.Change_To_Opportunity__r.Id + '\'';
+
+ }
+ }
+ for (Agency_Opportunity__c info : InfoList) {
+ oppinfoList.add(new OpportunityInfo(info, info));
+ oppinfoList[oppinfoList.size() - 1].lineNo = oppinfoList.size() - 1;
+ }
+ }
+ oppRecords = oppinfoList.clone();
+ oppCount = oppRecords.size();
+ //鏄剧ず鎻愮ず鎿嶄綔淇℃伅
+ if (String.isBlank(saveType) && String.isBlank(sortKey)) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '鍙栧緱鏈�杩戠殑 ' + oppCount + ' 鏉℃暟鎹�'));
+ results.result = 'Success';
+ results.Msg = '鍙栧緱鏈�杩戠殑 ' + oppCount + ' 鏉℃暟鎹�';
+ return results;
+ } else if (!String.isBlank(sortKey)) {
+ if (oppCount > oppLimit) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '鏁版嵁瓒呰繃' + oppLimit + '浠讹紝鍙樉绀哄墠' + oppLimit + '浠�'));
+ results.result = 'Success';
+ results.Msg = '鏁版嵁瓒呰繃' + oppLimit + '浠讹紝鍙樉绀哄墠' + oppLimit + '浠�';
+
+ } else {
+ results.result = 'Success';
+ results.Msg = '鍏辨湁 ' + oppCount + ' 鏉℃暟鎹�';
+
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '鍏辨湁 ' + oppCount + ' 鏉℃暟鎹�'));
+ }
+ } else {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '鍏辨湁 ' + oppCount + ' 鏉℃暟鎹�'));
+ results.result = 'Success';
+ results.Msg = '鍏辨湁 ' + oppCount + ' 鏉℃暟鎹�';
+ }
+ // //鍒嗛〉
+ // PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ // totalCount = oppRecords.size();
+ // paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ // paginatedAccounts.recordStart = pageToken + 1;
+ // paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ // Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ // paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ // paginatedAccounts.totalRecords = totalCount;
+
+ // Integer startIdx;
+ // Integer endIdx;
+ // List<OpportunityInfo> pageoppRecords = new List<OpportunityInfo>();
+ // startIdx = pageToken;
+ // endIdx = startIdx + pageSize;
+ // if (endIdx > oppRecords.size()) {
+ // endIdx = oppRecords.size();
+ // }
+ // for (Integer i = startIdx; i < endIdx; i++) {
+ // pageoppRecords.add(oppRecords.get(i));
+ // }
+ // //end
+
+
+ //鍥炰紶鍙傛暟
+ results.result = 'Success';
+ results.oppRecords = oppRecords;
+ return results;
+
+ }
+ //妫�绱㈡潯浠讹細鏁版嵁瀛楁1锛屾暟鎹瓧娈�2锛屾暟鎹瓧娈�3鍧囨弧瓒宠繘鍏ユ鏂规硶 鍒ゆ柇澶氱鎯呭喌
+ private static String makeTextSql(String textOpts, String equalOpts, String numtext) {
+ String soql = '';
+ if (!String.isBlank(textOpts)) {
+ //瀵绘壘妫�绱㈡潯浠跺寘鍚�� 鈥� 绌烘牸鐨勫閲嶆绱㈡潯浠�
+ //system.debug('314-textOpts:'+textOpts);
+ if ((equalOpts == 'contains' || equalOpts == 'notcontains') && numtext.contains(',')) {
+ //system.debug('316-equalOpts:'+equalOpts);
+ //system.debug('316-numtext:'+numtext);
+ String[] vals = numtext.split(',');
+ String cSql = '';
+ soql += ' AND (';
+ for (Integer icount = 0; icount < vals.size(); icount++) {
+
+ //绮剧悽绉戞妧 zxk 2021-08-25 start
+ String val = vals[icount];
+ if (equalOpts == 'contains') {
+ cSql = makeTextSqlStr(textOpts, equalOpts, val);
+ soql += cSql;
+
+ if (icount < vals.size() - 1) {
+ soql += ' OR ';
+ }
+ } else if (equalOpts == 'notcontains') {
+ cSql = makeTextSqlStr(textOpts, equalOpts, val);
+ soql += cSql;
+ if (icount < vals.size() - 1) {
+ soql += ' AND ';
+ }
+ }
+
+ }
+ //绮剧悽绉戞妧 zxk 2021-08-25 end
+
+
+ // String val = vals[icount];
+ // cSql = this.makeTextSqlStr(textOpts, equalOpts, val);
+ // system.debug(cSql);
+ // soql += cSql;
+ // if (icount < vals.size() - 1) {
+ // soql += ' OR ';
+ // }
+ // }
+ soql += ')';
+ }
+ //瀵绘壘妫�绱㈡潯浠跺寘鍚�橈紝鈥� 閫楀彿鐨勫閲嶆绱㈡潯浠�
+ else if ((equalOpts == '=' || equalOpts == '<>') && numtext.contains(',')) {
+ String[] vals = numtext.split(',');
+ soql += ' AND ( ';
+ for (Integer icount = 0; icount < vals.size(); icount++) {
+ String val = vals[icount];
+ if (equalOpts == '=') {
+ soql += textOpts + ' = \'' + val + '\'';
+ if (icount < vals.size() - 1) {
+ soql += ' OR ';
+ }
+ } else if (equalOpts == '<>') {
+ soql += textOpts + ' <> \'' + val + '\'';
+ if (icount < vals.size() - 1) {
+ soql += ' AND ';
+ }
+ }
+ }
+ soql += ')';
+ }
+ //妫�绱㈣繛鎺ョ涓哄寘鍚互鍙婁笉鍖呭惈
+ else if (equalOpts.equals('contains') || equalOpts.equals('notcontains')) {
+ if (equalOpts.equals('contains')) {
+ soql += ' AND ' + textOpts + ' LIKE \'%' + numtext + '%\'';
+ } else if (equalOpts.equals('notcontains')) {
+ soql += ' AND ( NOT ' + textOpts + ' LIKE \'%' + numtext + '%\' ) ';
+ }
+ }
+ //妫�绱㈣繛鎺ョ涓虹瓑浜庝互鍙婁笉绛変簬
+ else if (equalOpts == '=' || equalOpts == '<>') {
+ soql += 'AND ' + textOpts + equalOpts + '\'' + numtext + '\'';
+ }
+
+ //绮剧悽绉戞妧 zxk 2021-08-25 start
+ //璧峰瀛楃
+ else if (equalOpts == 'starts with' && numtext.contains(' ')) {
+ String[] vals = numtext.split(' ');
+ soql += ' AND ( ';
+ for (Integer icount = 0; icount < vals.size(); icount++) {
+ String val = vals[icount];
+ if (equalOpts == 'starts with') {
+ soql += ' ' + textOpts + ' LIKE \'%' + val + '%\'' ;
+ if (icount < vals.size() - 1) {
+ soql += ' OR ';
+
+ }
+ }
+ }
+ soql += ')';
+
+ }
+ //绮剧悽绉戞妧 zxk 2021-08-25 end
+
+ // //璧峰瀛楃
+ // else if (equalOpts == 'starts with'){
+ // soql += 'AND ' + textOpts + ' LIKE \'' + numtext + '%\'';
+ // }
+ //妫�绱㈣繛鎺ョ鐨勫叾浠栨儏鍐�
+ else {
+ String cSql = makeTextSqlStr(textOpts, equalOpts, numtext);
+ if (equalOpts != '<>') {
+ soql += cSql;
+ } else {
+ soql += ' and (NOT ' + cSql + ') ';
+ }
+ }
+ }
+ return soql;
+ }
+ //妫�绱㈡潯浠讹細鏁版嵁瀛楁1锛屾暟鎹瓧娈�2锛屾暟鎹瓧娈�3鍧囨弧瓒筹紝骞朵笖杩涘叆makeTextSql锛堬級涔嬪悗锛屽唴鍚暟鎹瓧娈靛寘鍚绉嶆椂杩涘叆姝ゆ柟娉曘��
+ @TestVisible private static String makeTextSqlStr(String textOpts, String equalOpts, String val) {
+ String soql = '';
+ if (!String.isBlank(textOpts)) {
+ String tmpVal = val;
+ if (!String.isBlank(tmpVal)) {
+ if (equalOpts == 'contains' || equalOpts == 'notcontains') {
+ if (equalOpts == 'contains') {
+ soql += ' ' + textOpts + ' LIKE \'%' + val + '%\'' ;
+ } else if (equalOpts == 'notcontains') {
+ soql += ' ( NOT ' + textOpts + ' LIKE \'%' + val + '%\' ) ' ;
+ }
+ } else if (equalOpts == '=' || equalOpts == '<>') {
+ if (equalOpts == '=') {
+ soql += ' AND ' + textOpts + ' = ' + val ;
+ } else if (equalOpts == '<>') {
+ soql += ' AND ' + textOpts + ' <> ' + val ;
+ }
+ }
+ } else {
+ soql = ' AND ' + textOpts;
+ if (equalOpts == '=') {
+ soql += ' = ' + tmpVal;
+ } else if (equalOpts == '<>') {
+ soql += ' <> ' + tmpVal;
+ } else if (equalOpts == 'contains') {
+ soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\'';
+ } else if (equalOpts == 'notcontains') {
+ soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\'';
+ } else if (equalOpts == 'starts with') {
+ soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\'';
+ } else {
+ soql += ' ' + equalOpts + ' ' + tmpVal;
+ }
+ }
+ }
+ return soql;
+ }
+
+ //妫�绱㈡寜閽細鐐瑰嚮妫�绱㈡寜閽Е鍙戞鏂规硶锛�
+ // public static PageReference chick() {
+ // setLayoutRWInfo();
+ // searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey,pageSizeLWC,pageTokenLWC);
+ // return null;
+ // }
+ //椤甸潰鍐呭鏈変慨鏀规椂锛岄〉闈㈠垽鏂悗浼犲�肩粰changeFlg浠ュ強changeFlgRt灞炴�э紝鐐瑰嚮淇濆瓨鏃惰皟鐢ㄦ鏂规硶锛岃繘琛屼繚瀛樸��
+ @AuraEnabled
+ public static Results save(List<OpportunityInfo> oppRecordsLWC) {
+ //system.debug('oppRecords[1].opp:' + oppRecords[1].opp +' oppRecords[1].AgcOpp:' + oppRecords[1].AgcOpp );
+ Results results = new Results();
+ oppRecords = oppRecordsLWC;
+ try {
+ List<Agency_Opportunity__c> updTarget = new List<Agency_Opportunity__c>();
+ // List<Opportunity> updOpps = new List<Opportunity>();
+ for (OpportunityInfo oi : oppRecords) {
+ if (oi.changeFlg == '1') {
+ oi.changeFlg = '0';
+ updTarget.add(oi.AgcOpp);
+
+ }
+ // if (oi.changeFlgRt == '1' && oi.opp.id != null) {
+ // oi.changeFlgRt = '0';
+ // updOpps.add(oi.opp);
+ // }
+ }
+ if (updTarget.size() > 0) {
+ system.debug('updTarget.size:' + updTarget.size() );
+ update updTarget;
+ }
+ // if (updOpps.size() > 0) {
+ // update updOpps;
+ // }
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '淇濆瓨瀹屼簡'));
+ results.result = 'Success';
+ results.Msg = '淇濆瓨瀹屼簡';
+ return results;
+ } catch (Exception e) {
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇风‘瀹氱瀹ゅ垎绫诲拰浜у搧鍖哄垎鐨勫叧绯�'));
+ }
+ if(saveType == '1') {
+ searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey);
+ saveType = '';
+ } else if (saveType == '2') {
+ sortTable();
+ saveType = '';
+ } else {
+ }
+ return null;
+ }
+ //鍏ㄩ儴灞曞紑璋冪敤姝ゆ柟娉�
+ public static PageReference sortTable() {
+ oppRecords = new List<OpportunityInfo>();
+ if (sortKey == preSortKey) {
+ if (String.isBlank(sortKey) == false) {
+ // 鏂瑰悜銇屽銈忋倠銇伩
+ sortOrderAsc = !sortOrderAsc;
+ sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
+ }
+ } else {
+ sortOrderAsc = true;
+ if (String.isBlank(preSortKey) == false) {
+ sortOrder[Integer.valueOf(preSortKey)] = '銆�';
+ }
+ sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
+ }
+ preSortKey = sortKey;
+
+ setLayoutRWInfo();
+ searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey);
+ return null;
+ }
+ //鍒嗛〉Bean
+ public class PaginatedAccounts {
+ @AuraEnabled
+ public Integer nextPageToken;
+ @AuraEnabled
+ public Integer pageNumber { get; set; }
+ @AuraEnabled
+ public Integer totalRecords { get; set; }
+ @AuraEnabled
+ public Integer recordStart { get; set; }
+ @AuraEnabled
+ public Integer recordEnd { get; set; }
+ }
+
+ //鑷畾涔夌被OpportunityInfo锛岀敤浜庡垱寤鸿櫄鎷熷瓧娈碉紝鍚堝苟杈撳嚭銆�
+ class OpportunityInfo {
+ // public Opportunity opp { get; set; }
+ @AuraEnabled
+ public Agency_Opportunity__c opp { get; set; }
+ @AuraEnabled
+ public Boolean canEdit { get; private set; }
+ @AuraEnabled
+ public Boolean hasError { get; private set; }
+ @AuraEnabled
+ public Boolean hasFieldError { get; private set; }
+ @AuraEnabled
+ public Integer lineNo { get; private set; }
+ @AuraEnabled
+ public String changeFlg { get; set; }
+ @AuraEnabled
+ public String changeFlgRt { get; set; }
+ @AuraEnabled
+ public Boolean ifLock { get; set; }
+ //public String accType { get; private set; }
+ @AuraEnabled
+ public Agency_Opportunity__c AgcOpp { get; set; }
+ public OpportunityInfo(Agency_Opportunity__c record, Agency_Opportunity__c oppo) {
+ opp = oppo;
+ canEdit = true;
+ hasError = false;
+ hasFieldError = false;
+ lineNo = 0;
+ changeFlg = '0';
+ changeFlgRt = '0';
+ ifLock = Approval.isLocked(record);
+ AgcOpp = record;
+ }
+ }
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String Msg;
+ @AuraEnabled
+ public List<OpportunityInfo> oppRecords;
+ @AuraEnabled
+ public Integer oppCount ;
+ @AuraEnabled
+ public List<CusOption> timeCusOpts;
+ @AuraEnabled
+ public List<CusOption> textCusOpts;
+ @AuraEnabled
+ public List<CusOption> equalCusOpts;
+ @AuraEnabled
+ public List<CusOption> limitCusOpts;
+ @AuraEnabled
+ public String limits;
+ @AuraEnabled
+ public String strColumus;
+ @AuraEnabled
+ public String strRtColumus;
+ @AuraEnabled
+ public List<OpportunityInfo> pageoppRecords;
+ @AuraEnabled
+ public PaginatedAccounts paginatedAccounts;
+ @AuraEnabled
+ public Boolean canEdit;
+ @AuraEnabled
+ public String changeFlg;
+ }
+ public class CusOption {
+ CusOption(String value,String label) {
+ this.label = label;
+ this.value = value;
+ }
+
+ @AuraEnabled
+ public String label;
+ @AuraEnabled
+ public String value;
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexDealerInquiryModifyStateController.cls-meta.xml b/force-app/main/default/classes/LexDealerInquiryModifyStateController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexDealerInquiryModifyStateController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexInventoryController.cls b/force-app/main/default/classes/LexInventoryController.cls
new file mode 100644
index 0000000..564eded
--- /dev/null
+++ b/force-app/main/default/classes/LexInventoryController.cls
@@ -0,0 +1,1283 @@
+public without sharing class LexInventoryController {
+ // page
+ public static Integer pagesize { get; set; }
+ public static Integer pageToken { get; set; }
+ public static String sortField { get; set; }
+ public static String sortOrder { get; set; }
+
+ public static Integer totalcount { get; set; }
+ //鍒嗛〉浣跨敤鏁版嵁
+ public static String fileName { get; set; }
+ public static Integer size{get;set;}
+ public static Integer noOfRecords{get; set;}
+ public static List<ConsumableorderdetailsInfo> codPageRecords { get; set; } // 涓㈠け鍜屽贰鍥炵殑,鐢婚潰鏄剧ず鐢�
+ public static ApexPages.StandardSetController setCon { get; set; }
+ @AuraEnabled
+ public static List<Consumable_order_details2__c> setConDetails2 { get; set; }
+ public static Map<Id,String> pandiandetailsMap = new Map<Id,String>();
+ /*****************妞滅储鐢�******************/
+ public static String barcode { get; set; }
+ public static Boolean done { get; set; }
+ /*****************鐢婚潰琛ㄧずBean******************/
+ //椤甸潰涓绘暟鎹樉绀虹敤
+ private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
+ //鐩樼偣鍒扮殑浜у搧
+ public static List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
+ public static List<Consumable_order_details2__c> showcod2nid = new List<Consumable_order_details2__c>();
+
+ //public List<Consumable_order_details2__c> pandiandetailsList { get; set; }
+ public static List<List<Consumable_order_details2__c>> pandiandetailsListShow { get; set; }
+ //瀵诲洖鏄庣粏
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserrordummy; // 涓㈠け鍜屽贰鍥炵殑,瀹為檯鐐掍綔鐢�
+ @AuraEnabled
+ public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; } // 浜у搧鍗曚綅鐨凩ist
+ public static List<Consumable_order_details2__c> InsListUp = New List<Consumable_order_details2__c>();
+
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsviewRecords;
+
+ public static Integer consumableorderdetailsCount {
+ get {
+ return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size();
+ }
+ }
+ //list<String> notexitlist = new list<String>();
+ public static Map<String,String> reFindProduct = new Map<String,String>();
+ //鎺掑簭鐢�
+ // public static String sortKey;
+ // public static String preSortKey;
+ // public static Boolean sortOrderAsc;
+ // public static String[] sortOrder;
+ //private Set<String> carCodeListLose = new Set<String>(); //ProductCount_Res 鏈夛紝BarCodeListP 娌℃湁
+ /*****************缁忛攢鍟咺D******************/
+ private static String accountid = null;
+ private static String accountName = null;
+ // 鐩樼偣 ID
+ private static String eSetId = '';
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+ //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
+ public static String agencyProType {get;set;}
+ public static String sqlagencyProType;
+ //鍒ゆ柇鎿嶄綔浜哄憳鏄惁鐩樼偣
+ public static Boolean iSinventory = false;
+
+ public LexInventoryController(){
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ done = false;
+
+ consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+ consumableorderdetailsRecordserrordummy = new List<ConsumableorderdetailsInfo>();
+ codPageRecords = new List<ConsumableorderdetailsInfo>();
+ //codPageRecordsShow = new List<ConsumableorderdetailsInfo>();
+ }
+
+ private static void initStandardController(){
+ // init standard controller
+ List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE Id in :pandiandetailsMap.keySet()
+ order by Name desc];
+ setConDetails2 = showcod2;
+ System.debug('setConDetails2===>'+setConDetails2);
+ // setCon = new ApexPages.StandardSetController(showcod2);
+ // // sets the number of records in each page set
+ // setCon.setPageSize(size);
+ // noOfRecords = setCon.getResultSize();
+ }
+
+ public static List<Consumable_order_details2__c> cod2s() {
+ return setConDetails2;
+ }
+ //Changes the size of pagination
+ public static PageReference refreshPageSize() {
+ setCon.setPageSize(size);
+ //showcod2nid = cod2s();
+ makepagerecords();
+ return null;
+ }
+
+ public static List<ConsumableorderdetailsInfo> makepagerecords() {
+ showcod2nid = cod2s();
+ codPageRecords = new List<ConsumableorderdetailsInfo>();
+ for (Consumable_order_details2__c cod2 : showcod2nid) {
+ codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id)));
+ }
+ System.debug('===>codPageRecords1'+codPageRecords);
+ return codPageRecords;
+ }
+
+ // 鐢婚潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init() {
+
+
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String,object> data = new Map<String,object>();
+ res.entity = data;
+
+ consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+ setConDetails2 = new List<Consumable_order_details2__c>();
+ String url = '鍦ㄥ簱璋冩暣涓�瑙�';
+ fileName = EncodingUtil.urlEncode(url, 'UTF-8');
+ List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE Id in :pandiandetailsMap.keySet()
+ order by Name];
+ System.debug('pandiandetailsMap====>'+pandiandetailsMap);
+ initStandardController();
+ makepagerecords();
+ // sortKey = '1';
+ // preSortKey = '1';
+ // sortOrderAsc = false;
+ // sortOrder = new String[1];
+ // sortOrder = new String[]{' ',' ','鈫�'};
+
+ String userId = UserInfo.getUserId();
+ //String userId = '00510000006k82X';
+ //String userId = '00510000005QO75';
+ user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =:userId];
+ accountid = Useracc.Accountid;
+ userWorkLocation = Useracc.Work_Location__c;
+ agencyProType = Useracc.UserPro_Type__c;
+ if(String.isBlank(Useracc.UserPro_Type__c)){
+ agencyProType = 'ET';
+ }
+ sqlagencyProType = '%' + agencyProType + '%';
+ Account accountInfo = [SELECT Name,Dealer_discount__c FROM account WHERE id =:accountid];
+ accountName = accountInfo.Name;
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String,Product2__c> midMap = new Map<String,Product2__c>();
+ List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
+ Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
+ //DB202302357027 娑堣�楀搧杩芥函绯荤粺鏃犳硶姝e父浣跨敤鈥斺�旂洏鐐归〉闈㈡搷浣滃嵆鎶ラ敊 fy start
+ //寮�濮嬪埗浣滆〃澶存暟鎹�
+ // List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c,
+ // SFDA_Status__c,Packing_list_manual__c,
+ // Asset_Model_No__c
+ // from Product2__c
+ // //where Estimation_Entry_Possibility__c = '鈼�'
+ // where Product_Type__c like : sqlagencyProType
+ // ];
+ // for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){
+ // midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]);
+ // }
+ //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
+ List<Consumable_order_details2__c> ProductCount_Res = [select Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__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 Cancellation_Flag__c = false
+ AND Bar_Code__c !=null
+ AND Product_Type__c like : sqlagencyProType
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ AND Dealer_Info_text__c = :accountName];
+ //DB202302357027 娑堣�楀搧杩芥函绯荤粺鏃犳硶姝e父浣跨敤鈥斺�旂洏鐐归〉闈㈡搷浣滃嵆鎶ラ敊 fy start
+ //寮�濮嬪埗浣滆〃澶存暟鎹�
+ Set<Id> Product2cIdSet = new Set<Id>();
+ for(Consumable_order_details2__c con_or_d2item: ProductCount_Res){
+ Product2cIdSet.add(con_or_d2item.Consumable_Product__c);
+ }
+ List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c,
+ SFDA_Status__c,Packing_list_manual__c,
+ Asset_Model_No__c
+ from Product2__c
+ //where Estimation_Entry_Possibility__c = '鈼�'
+ where Id in:Product2cIdSet
+ and Product_Type__c like : sqlagencyProType
+ ];
+ for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){
+ midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]);
+ }
+ system.debug('productCount_Unfull_bak'+productCount_Unfull_bak.size());
+ // String erro='productCount_Unfull_bak:'+productCount_Unfull_bak.size();
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, erro));
+ //DB202302357027 娑堣�楀搧杩芥函绯荤粺鏃犳硶姝e父浣跨敤鈥斺�旂洏鐐归〉闈㈡搷浣滃嵆鎶ラ敊 fy end
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ProductCount_Res ' + ProductCount_Res.size()));
+ for(Integer i = 0 ; i< ProductCount_Res.size();i++){
+ //鐒跺悗寰幆CountDel鍋欱ox鍜宲iece2涓猰ap
+ if(MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '鐩�'){
+
+ if(newMidBoxMap.containsKey(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c)){
+ ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c).clone();
+ Jstage.countid = Jstage.countid+1 ;
+ if(ProductCount_Res[i].Isoverdue__c == 1){
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
+ newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage);
+ }else{
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(ProductCount_Res[i].Consumable_Product__c));
+ Jstage.countid = Jstage.countid+1 ;
+ if(ProductCount_Res[i].Isoverdue__c == 1){
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
+ newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage);
+ }
+ }else if(MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '涓�'){
+ if(newMidPieceMap.containsKey(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c)){
+ ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c).clone();
+ Jstage.countid = Jstage.countid+1 ;
+ if(ProductCount_Res[i].Isoverdue__c == 1){
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
+ newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage);
+ }else{
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(ProductCount_Res[i].Consumable_Product__c));
+ Jstage.countid = Jstage.countid+1 ;
+ if(ProductCount_Res[i].Isoverdue__c == 1){
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
+ newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage);
+ }
+ }
+ }
+ for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){
+ bss.overlimitCount = bss.countid - bss.limitCount;
+ boxRecords.add(bss);
+ }
+ boxRecords.sort();
+ for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
+ bss.overlimitCount = bss.countid - bss.limitCount;
+ }
+ for(ConsumableorderdetailsInfo bss : boxRecords){
+ consumableorderdetailsRecords.add(bss);
+ if(newMidPieceMap.containsKey(bss.Prod.Id + '涓�')){
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓�'));
+ //newMidPieceMap绉婚櫎宸茬粡娣诲姞鐨凱iece
+ newMidPieceMap.remove(bss.Prod.Id + '涓�');
+ }
+ }
+ for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓�'));
+ }
+ //consumableorderdetailsCount = consumableorderdetailsRecords.size();
+ listCut();
+
+
+
+
+
+ data.put('ConsumableorderdetailsRecordsview',JSON.serialize(ConsumableorderdetailsRecordsview));
+ data.put('userWorkLocation',userWorkLocation);
+ data.put('agencyProType',agencyProType);
+ data.put('accountName',accountName);
+ data.put('accountid',accountid);
+
+ data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords));
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ private static void listCut(){
+ //鎷嗗垎鏆傜敤list
+ List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsInfo c = null;
+ ConsumableorderdetailsRecordsbreak.clear();
+ ConsumableorderdetailsRecordsbreakover.clear();
+ consumableorderdetailsRecordsview.clear();
+ //閫夋嫨浜у搧view
+ ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
+ if(consumableorderdetailsRecords.size() > 1000){
+ for(Integer i = 0; i < consumableorderdetailsRecords.size(); i++){
+ if(i < 1000){
+ c = consumableorderdetailsRecords.get(i);
+ ConsumableorderdetailsRecordsbreak.add(c);
+ }else{
+ c = consumableorderdetailsRecords.get(i);
+ ConsumableorderdetailsRecordsbreakover.add(c);
+ }
+ }
+ consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreak);
+ consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreakover);
+ }else{
+ consumableorderdetailsRecordsview.add(consumableorderdetailsRecords);
+ }
+ }
+ //========20160311======ADD_Start================================
+ // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
+ //========20160311======ADD_Start================================
+ public static List<String> ParseBarCode(String Code){
+ Map<String,Integer> barcodeCountMap = new Map<String,Integer>();
+ String[] Cache = new String[]{};
+ Cache = Code.split('\n');
+ List <String> Buff = new List<String>();
+ for(String A : Cache){
+ A = A.trim().toUpperCase();
+ if(barcodeCountMap.containsKey(A)){
+ barcodeCountMap.put(A,barcodeCountMap.get(A) + 1);
+ }else{
+ barcodeCountMap.put(A,1);
+ }
+ Buff.add(A + barcodeCountMap.get(A));
+ }
+ return Buff;
+
+ }
+
+
+
+ //test
+
+ // @AuraEnabled
+ // public static ResponseBodyLWC searchConsumableorderdetails(String sqlagencyProType,String userWorkLocation,String accountName,String barcode,List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsLWC){
+ // return new ResponseBodyLWC('Error',500, 'test', '');
+ // }
+ //========20160311======ADD_End==================================
+ // BarCode褰曞叆
+ @AuraEnabled
+ public static ResponseBodyLWC searchConsumableorderdetails(String agencyProType,String userWorkLocation,String accountName,String barcode,String consumableorderdetailsRecordsLWC,Integer pageSizeLWC, Integer pageTokenLWC, String sortFieldLWC, String sortOrderLWC){
+ pageSize = pageSizeLWC;
+ pageToken = pageTokenLWC;
+ sortField = sortFieldLWC;
+ sortOrder = sortOrderLWC;
+
+ System.debug('===>consumableorderdetailsRecordsLWC'+consumableorderdetailsRecordsLWC);
+ List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class);
+ // ConsumableorderdetailsInfo[] consumableorderdetailsRecords=(List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class);
+ system.debug('=====>consumableorderdetailsRecordsLWC'+consumableorderdetailsRecordsLWC);
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String,object> data = new Map<String,object>();
+ res.entity = data;
+
+ sqlagencyProType = '%' + agencyProType + '%';
+
+
+
+
+ /* BarCodelist鍋氭垚 */
+ //FIXME barcodeSet 鍋氭垚锛孭roductCount_ResSet 鍋氭垚
+ List<Consumable_order_details2__c> pandiandetailsList = new List<Consumable_order_details2__c>();
+ pandiandetailsListShow = new List<List<Consumable_order_details2__c>>();
+ done = false;
+ List<String> BarCodeListP = ParseBarCode( barcode );
+ //鏌ヨ搴撳瓨 杩藉姞杩斿搧搴撳瓨
+ List<Consumable_order_details2__c> ProductCount_Res = [select Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
+ Bar_Code_search__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 Cancellation_Flag__c = false
+ AND Bar_Code__c !=null
+ AND Product_Type__c like : sqlagencyProType
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ AND Dealer_Info_text__c = :accountName ];
+ reFindProduct.clear();
+ Map<String,ConsumableorderdetailsInfo> barCodeListAdjustMap = new Map<String,ConsumableorderdetailsInfo>();
+ //barCodeListLoseMap.clear();
+ Set<String> carCodeListLose = new Set<String>();
+ List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsAdjust = new List<ConsumableorderdetailsInfo>();
+ Map<String,String> proIdNotinpage = new Map<String,String>();
+ List<Consumable_order_details2__c> reFindProductList = new List<Consumable_order_details2__c>();
+ codPageRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordserrordummy = new List<ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> reFindProductaddtopage = new List<ConsumableorderdetailsInfo>();
+ pandiandetailsMap.clear();
+ reSet = new List<Consumable_order_details2__c>();
+ /* 鍒ゆ柇BarCode鏄惁涓虹┖ */
+ if (barcode == null || barcode == ''){
+ //鍏堝彇鍑烘墍鏈変涪澶变骇鍝�
+ for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
+ // 20200509 gzw add 鐩樼偣鏁伴噺鍒濆鍖�
+ ass.Pandian = 0;
+ // 20200509 gzw add 鐩樼偣鏁伴噺鍒濆鍖�
+ if(ass.check==true){
+ //ass.Diff = ass.countid - ass.Pandian;
+ for(integer i = 0 ; i < ProductCount_Res.size();i++){
+ if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){
+ if(carCodeListLose.contains(ProductCount_Res[i].Bar_Code__c)){
+ continue;
+ }else{
+
+ //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'涓㈠け'));
+ //pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
+ ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i]));
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code__c);
+ }
+ }
+ }
+ }
+ }
+
+ //宸茬粡鍑哄簱鐨勪骇鍝�
+ List<Consumable_order_details2__c> reSet1 = [SELECT Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
+ Bar_Code_search__c,Dealer_Info_text__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = TRUE
+ AND (Dealer_Shipment__c= TRUE
+ or Dealer_Saled__c = TRUE)
+ AND Dealer_Returned__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c in :carCodeListLose
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name ];
+ Map<String,Consumable_order_details2__c> needreturnMap = new Map<String,Consumable_order_details2__c>();
+ for(Consumable_order_details2__c cod2 :reSet1){
+ needreturnMap.put(cod2.Bar_Code__c,cod2);
+ }
+
+ // 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
+ reSet1 = [SELECT Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
+ Bar_Code_search__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 Cancellation_Flag__c = FALSE
+ AND Bar_Code__c in :carCodeListLose
+ AND (Dealer_Info_text__c != :accountName
+ OR (Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c != :userWorkLocation)
+ )
+ ORDER BY Name ];
+ Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>();
+ for(Consumable_order_details2__c cod2 :reSet1){
+ otherAgProMap.put(cod2.Bar_Code__c,cod2);
+ }
+ carCodeListLose.clear();
+
+
+ for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
+ if(ass.check==true){
+ ass.Diff = ass.countid - ass.Pandian;
+ for(integer i = 0 ; i < ProductCount_Res.size();i++){
+ if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){
+ if(carCodeListLose.contains(ProductCount_Res[i].Bar_Code_search__c)){
+ continue;
+ }else{
+ if(needreturnMap.containsKey(ProductCount_Res[i].Bar_Code__c)){
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'璇ヤ骇鍝佹湭杩斿搧'));
+ pandiandetailsMap.put(ProductCount_Res[i].Id, '璇ヤ骇鍝佹湭杩斿搧');
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
+ continue;
+
+ }
+ if(otherAgProMap.containsKey(ProductCount_Res[i].Bar_Code__c)){
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'璇ヤ骇鍝佸綊灞炰簬' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '鐨勫簱瀛樸��'));
+ pandiandetailsMap.put(ProductCount_Res[i].Id, '璇ヤ骇鍝佸綊灞炰簬' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '鐨勫簱瀛樸��');
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
+ continue;
+
+ }
+ if (ProductCount_Res[i].Isoverdue__c == 0) {
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��'));
+ pandiandetailsMap.put(ProductCount_Res[i].Id, '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��');
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
+ ass.Diff--;
+ continue;
+ }
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'涓㈠け'));
+ pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
+ }
+ }
+ }
+ }else{
+ ass.Pandian = 0;
+ ass.Diff = 0;
+ }
+ }
+ List<Consumable_order_details2__c> showcod2 = new List<Consumable_order_details2__c>();
+ if (pandiandetailsMap.keySet().size() > 0) {
+ showcod2 = [select Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE Id in :pandiandetailsMap.keySet()
+ order by Name];
+ }
+ initStandardController();
+ showcod2nid = cod2s();
+
+ for (Consumable_order_details2__c cod2 : showcod2nid) {
+ codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id)));
+ }
+
+ iSinventory = true;
+ if(codPageRecords.size() > 0) done = true;
+ consumableorderdetailsRecordserrordummy.clear();
+
+ //pandiandetailsList = new list<Consumable_order_details2__c>();
+ pandiandetailsList = [select Id, Bar_Code__c,Consumable_Product__r.Name__c,
+ Box_Piece__c,Lose_reason__c
+ FROM Consumable_order_details2__c
+ WHERE Id in :pandiandetailsMap.keySet()
+ order by Name];
+ for(Consumable_order_details2__c codDet : pandiandetailsList){
+ codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id);
+ }
+ List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>();
+ for(Consumable_order_details2__c cod2 : pandiandetailsList){
+ pandiandetailsListMid.add(cod2);
+ if(pandiandetailsListMid.size() == 1000){
+ pandiandetailsListShow.add(pandiandetailsListMid);
+ pandiandetailsListMid = new List<Consumable_order_details2__c>();
+ }
+ }
+ if(pandiandetailsListMid.size() > 0){
+ pandiandetailsListShow.add(pandiandetailsListMid);
+ }
+
+ //鍒嗛〉
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ totalCount = codPageRecords.size();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ Integer startIdx;
+ Integer endIdx;
+ List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>();
+ startIdx = pageToken;
+ endIdx = startIdx + pageSize;
+ if (endIdx > codPageRecords.size()) {
+ endIdx = codPageRecords.size();
+ }
+ for (Integer i = startIdx; i < endIdx; i++) {
+ pageCodeRecords.add(codPageRecords.get(i));
+ }
+
+ data.put('paginatedAccounts', paginatedAccounts);
+ data.put('pageCodeRecords', pageCodeRecords);
+
+ //end
+ data.put('codPageRecords',JSON.serialize(codPageRecords));
+ data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords));
+ data.put('consumableorderdetailsRecordsview',JSON.serialize(consumableorderdetailsRecordsview));
+ data.put('pandiandetailsMap',pandiandetailsMap);
+ System.debug('iSinventory===>'+iSinventory);
+ System.debug('codPageRecords===>'+codPageRecords);
+ data.put('iSinventory',JSON.serialize(iSinventory));
+ data.put('reSet1',reSet1);
+ System.debug('reSet1===>'+reSet1);
+ res.code = 200;
+ res.status = 'Success1';
+
+ return res;
+
+ }
+
+
+
+ //CHAN-B7J4NB 鍙湁涓�涓椂锛岀洏鐐逛笉鍒�
+ //init();
+ //CHAN-B7J4NB
+ Map<String,String> showproductIdMap = new Map<String,String>();
+ for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
+ showproductIdMap.put(ass.prod.Id + ass.boxPiece, ass.prod.Id + ass.boxPiece);
+ }
+// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCodeListP' + BarCodeListP));
+ /***************************************************************************/
+ // BarCode鐨勬绱� 鎵�鏈夊湪搴�
+ reSet = [select Id,Consumable_Product__c,Consumable_Product__r.Name__c,
+ Box_Piece__c,Bar_Code_search__c,Isoverdue__c
+ from Consumable_order_details2__c
+ where Bar_Code_search__c in :BarCodeListP
+ AND 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 Cancellation_Date__c = null
+ and Bar_Code__c !=null
+ AND Product_Type__c like : sqlagencyProType
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ order by Name];
+ System.debug('reSet===>'+reSet);
+ Map<String, Integer> pandianProdIdCountMap = new Map<String, Integer>(); // ProdId 鍗樹綅
+ // 20200509 add gzw 璁板綍闇�瑕侀攢瀛樻暟閲�
+ Map<String, Integer> pandianoverdueCountMap = new Map<String, Integer>(); // ProdId 鍗樹綅
+ // 20200509 add gzw 璁板綍闇�瑕侀攢瀛樻暟閲�
+ Map<String,ConsumableorderdetailsInfo> barCodeListPandianMap = new Map<String,ConsumableorderdetailsInfo>(); // 鏄庣窗銉愩兗銈炽兗銉� 鍗樹綅
+ //鐩樼偣鍒扮殑鏄庣粏
+ for(Consumable_order_details2__c rs : reSet){
+ //BarCodeListPandian.add(rs.Bar_Code_search__c);
+ for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
+ if(rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece){
+ ass.check = true;
+ }
+ }
+
+ barCodeListPandianMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs));
+ if (rs.Isoverdue__c == 0) {
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��'));
+ pandiandetailsMap.put(rs.Id, '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��');
+ if (pandianoverdueCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) {
+ pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1);
+ } else {
+ pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, pandianoverdueCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1);
+ }
+ continue;
+ }
+ if (pandianProdIdCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) {
+ pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1);
+ } else {
+ pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, pandianProdIdCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1);
+ }
+ }
+
+ // 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
+ List<Consumable_order_details2__c> reSet1 = [SELECT Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c,
+ Bar_Code_search__c,Dealer_Info_text__c
+ FROM Consumable_order_details2__c
+ WHERE (Dealer_Arrive__c = TRUE
+ or Dealer_Shipment__c= TRUE
+ or Dealer_Saled__c = TRUE)
+ AND Dealer_Returned__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code_search__c in :BarCodeListP
+ AND (Dealer_Info_text__c != :accountName
+ OR (Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c != :userWorkLocation)
+ )
+ ORDER BY Name ];
+ Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>();
+ for(Consumable_order_details2__c cod2 :reSet1){
+ otherAgProMap.put(cod2.Bar_Code__c,cod2);
+ }
+ // 闇�瑕佸叆搴撶殑浜у搧
+ for(Consumable_order_details2__c cod2 : reSet1){
+ for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
+ if(cod2.Consumable_Product__c == ass.Prod.Id && cod2.Box_Piece__c == ass.boxPiece){
+ ass.check = true;
+ }
+ }
+ if(!showproductIdMap.containsKey(cod2.Consumable_product__c + cod2.Box_Piece__c)){
+ reFindProductList.add(cod2);
+ proIdNotinpage.put(cod2.Consumable_Product__c, cod2.Box_Piece__c);
+ }
+ if(!barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c)
+ && otherAgProMap.containsKey(cod2.Bar_Code__c)
+ && (otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == true
+ || otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == true) ){
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'鏃犳浜у搧鐨勫簱瀛橈紝璇峰叆搴撱��'));
+ pandiandetailsMap.put(cod2.Id, '鏃犳浜у搧鐨勫簱瀛橈紝璇峰叆搴撱��');
+ }
+ }
+ //瀵诲洖鏄庣粏
+ List<Consumable_order_details2__c> productAdjust = new List<Consumable_order_details2__c>();
+ productAdjust = [select Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,Lose_reason__c,
+ Asset_Model_No__c,Box_Piece__c,Bar_Code_search__c,Isoverdue__c
+ from Consumable_order_details2__c
+ where Bar_Code_search__c in :BarCodeListP
+ and Bar_Code__c !=null
+ and Lose_Flag__c = true
+ AND Product_Type__c like : sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ order by Name];
+
+
+ for (Consumable_order_details2__c rs : productAdjust){
+ // 杩囨湡搴撳瓨閿�瀛� 20200427 gzw add srart
+ if (rs.Isoverdue__c == 0 || rs.Lose_reason__c == '杩囨湡搴撳瓨閿�瀛�' ) {
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'杩囨湡鎴栬�呴攢瀛樹骇鍝侊紝鏃犳硶瀵诲洖鍏ュ簱'));
+ pandiandetailsMap.put(rs.Id, '杩囨湡鎴栬�呴攢瀛樹骇鍝侊紝鏃犳硶瀵诲洖鍏ュ簱');
+ carCodeListLose.add(rs.Bar_Code_search__c);
+ continue;
+ }
+ // 杩囨湡搴撳瓨閿�瀛� 20200427 gzw add end
+ for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
+ if(rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece){
+ ass.check = true;
+ }
+ }
+ if(!showproductIdMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c)){
+ reFindProductList.add(rs);
+ proIdNotinpage.put(rs.Consumable_Product__c, rs.Box_Piece__c);
+ }
+ if(barCodeListAdjustMap.containsKey(rs.Bar_Code_search__c)){
+ continue;
+ }else{
+ barCodeListAdjustMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs));
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'瀵诲洖'));
+ pandiandetailsMap.put(rs.Id, '瀵诲洖');
+ consumableorderdetailsRecordsAdjust.add(new ConsumableorderdetailsInfo(rs));
+ }
+ }
+ if(reFindProductList.size() > 0){
+ Map<String,Product2__c> midMap = new Map<String,Product2__c>();
+ List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
+ Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
+ List<Product2__c> product_Refind = [select Id, Name,Name__c,SFDA_Status__c,Packing_list_manual__c,Asset_Model_No__c
+ from Product2__c
+ WHERE Id in :proIdNotinpage.keySet()];
+ for(Product2__c pro : product_Refind){
+ midMap.put(pro.Id, pro);
+ }
+ for(Integer i = 0 ; i< reFindProductList.size();i++){
+ //鐒跺悗寰幆CountDel鍋欱ox鍜宲iece2涓猰ap
+ if(MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '鐩�'){
+
+ if(newMidBoxMap.containsKey(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c)){
+ ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c).clone();
+ Jstage.countid = 0 ;
+ if(reFindProductList[i].Isoverdue__c == 1){
+ Jstage.limitCount = 0;
+ }
+ Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
+ newMidBoxMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage);
+}else{
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(reFindProductList[i].Consumable_Product__c));
+ Jstage.countid = 0 ;
+ if(reFindProductList[i].Isoverdue__c == 1){
+ Jstage.limitCount = 0;
+ }
+ Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
+ newMidBoxMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage);
+ }
+ }else if(MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '涓�'){
+ if(newMidPieceMap.containsKey(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c)){
+ ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(reFindProductList[i].Consumable_product__c+reFindProductList[i].Box_Piece__c).clone();
+ Jstage.countid = 0 ;
+ if(reFindProductList[i].Isoverdue__c == 1){
+ Jstage.limitCount = 0;
+ }
+ Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
+ newMidPieceMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage);
+ }else{
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(reFindProductList[i].Consumable_Product__c));
+ Jstage.countid = 0 ;
+ if(reFindProductList[i].Isoverdue__c == 1){
+ Jstage.limitCount = 0;
+ }
+ Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
+ newMidPieceMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage);
+ }
+ }
+ }
+ for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){
+ bss.check = true;
+ bss.overlimitCount = bss.countid - bss.limitCount;
+ boxRecords.add(bss);
+ }
+ boxRecords.sort();
+ for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
+ bss.check = true;
+ bss.overlimitCount = bss.countid - bss.limitCount;
+ }
+ for(ConsumableorderdetailsInfo bss : boxRecords){
+ consumableorderdetailsRecords.add(bss);
+ if(newMidPieceMap.containsKey(bss.Prod.Id + '涓�')){
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓�'));
+ //newMidPieceMap绉婚櫎宸茬粡娣诲姞鐨凱iece
+ newMidPieceMap.remove(bss.Prod.Id + '涓�');
+ }
+ }
+ for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓�'));
+ }
+ }
+
+ //鍏堝彇鍑烘湭鐩樼偣鍒扮殑浜у搧
+ for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
+ if(ass.check == true){
+ for(integer i = 0 ; i<ProductCount_Res.size();i++){
+ if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){
+ if(barCodeListPandianMap.get(ProductCount_Res[i].Bar_Code_search__c) != null){
+ continue;
+ }else{
+ carCodeListLose.add(ProductCount_Res[i].Bar_Code__c);
+ ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i]));
+ //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'涓㈠け'));
+ //pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
+ }
+ }
+ }
+ }
+ }
+ //宸茬粡鍑哄簱鐨勪骇鍝�
+ List<Consumable_order_details2__c> reSet2 = [SELECT Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
+ Bar_Code_search__c,Dealer_Info_text__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = TRUE
+ AND (Dealer_Shipment__c= TRUE
+ or Dealer_Saled__c = TRUE)
+ AND Dealer_Returned__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code_search__c in :BarCodeListP
+ AND Dealer_Info_text__c = :accountName
+ ORDER BY Name ];
+ Map<String,Consumable_order_details2__c> needreturnMap = new Map<String,Consumable_order_details2__c>();
+ for(Consumable_order_details2__c cod2 :reSet2){
+ needreturnMap.put(cod2.Bar_Code__c,cod2);
+ }
+ //// 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
+ //List<Consumable_order_details2__c> reSet1 = [SELECT Id, Name,Consumable_Product__c,
+ // Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c,
+ // Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c,
+ // Bar_Code_search__c,Dealer_Info_text__c
+ // FROM Consumable_order_details2__c
+ // WHERE (Dealer_Arrive__c = TRUE
+ // or Dealer_Shipment__c= TRUE
+ // or Dealer_Saled__c = TRUE)
+ // AND Dealer_Returned__c = FALSE
+ // AND Cancellation_Flag__c = FALSE
+ // AND Bar_Code_search__c in :BarCodeListP
+ // AND (Dealer_Info_text__c != :accountName
+ // OR (Dealer_Info_text__c = :accountName
+ // AND Arrive_Owner_Work_Location__c != :userWorkLocation)
+ // )
+ // ORDER BY Name ];
+ //Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>();
+ //for(Consumable_order_details2__c cod2 :reSet1){
+ // otherAgProMap.put(cod2.Bar_Code__c,cod2);
+ //}
+ carCodeListLose.clear();
+ //鏈洏鐐瑰埌鐨勪骇鍝�
+ for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
+ if(ass.check == true){
+ for(integer i = 0 ; i<ProductCount_Res.size();i++){
+ if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){
+ if(barCodeListPandianMap.containsKey(ProductCount_Res[i].Bar_Code_search__c)){
+ continue;
+ }
+ if (ProductCount_Res[i].Isoverdue__c == 0) {
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��'));
+ pandiandetailsMap.put(ProductCount_Res[i].Id, '璇ヤ骇鍝佸凡缁忚繃鏈夋晥鏈燂紝璇烽攢瀛樸��');
+ if (pandianoverdueCountMap.containsKey(ProductCount_Res[i].Consumable_product__c + ProductCount_Res[i].Box_Piece__c) == false) {
+ pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, 1);
+ } else {
+ pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, pandianoverdueCountMap.get(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c) + 1);
+ }
+ continue;
+ }
+
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'涓㈠け'));
+ pandiandetailsMap.put(ProductCount_Res[i].Id, '涓㈠け');
+ }
+ }
+ // 鍚屾椂瀛樺湪鍏朵粬缁忛攢鍟嗗簱瀛樹骇鍝�
+ for(Consumable_order_details2__c cod2 : reSet1){
+ if(cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c){
+ if(barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c)
+ && otherAgProMap.containsKey(cod2.Bar_Code__c)
+ && otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == false
+ && otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == false ){
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'璇ヤ骇鍝佸綊灞炰簬' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '鐨勫簱瀛樸��'));
+ pandiandetailsMap.put(cod2.Id, '璇ヤ骇鍝佸綊灞炰簬' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '鐨勫簱瀛樸��');
+ continue;
+ }
+ }
+ }
+ // 闇�瑕佽繑鍝佺殑浜у搧
+ for(Consumable_order_details2__c cod2 : reSet2){
+ if(cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c){
+ if(needreturnMap.containsKey(cod2.Bar_Code__c)){
+ consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'璇ヤ骇鍝佺洰鍓嶅嚭搴撶姸鎬侊紝璇疯繑鍝併��'));
+ pandiandetailsMap.put(cod2.Id, '璇ヤ骇鍝佺洰鍓嶅嚭搴撶姸鎬侊紝璇疯繑鍝併��');
+ continue;
+ }
+ }
+ }
+ }
+ }
+
+ //鏇存柊涓绘槑缁嗗崟
+ if(barCodeListPandianMap.size() > 0){
+ for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
+ if(ass.check == true){
+ integer countSum = 0;
+ if (pandianProdIdCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
+ countSum = pandianProdIdCountMap.get(ass.Prod.Id + ass.boxPiece);
+ }
+ integer overdueSum = 0;
+ if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
+ overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece);
+ }
+ ass.Pandian = countSum;
+ ass.Diff = ass.countid - countSum - overdueSum;
+ ass.refind = 0;
+ }
+ }
+ }else{
+ for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
+ if(ass.check == true){
+ integer overdueSum = 0;
+ if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
+ overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece);
+ }
+ ass.Diff = ass.countid - ass.Pandian - overdueSum;
+ }
+ }
+ }
+
+
+ //瀵诲洖鍋氭垚
+ for(ConsumableorderdetailsInfo ass :consumableorderdetailsRecords){
+ for(ConsumableorderdetailsInfo adjust :consumableorderdetailsRecordsAdjust){
+ if(ass.Prod.Name__c == adjust.Prod.Name__c && ass.boxPiece == adjust.orderdetails2.Box_Piece__c){
+ if(reFindProduct.containsKey(adjust.orderdetails2.Bar_Code_search__c)){
+ continue;
+ }else {
+ ass.Pandian ++;
+ ass.refind ++;
+ reFindProduct.put(adjust.orderdetails2.Bar_Code_search__c,adjust.orderdetails2.Bar_Code_search__c);
+ }
+ }
+ }
+ }
+ if (pandiandetailsMap.keySet().size() > 0) {
+ List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE Id in :pandiandetailsMap.keySet()
+ order by Name];
+ initStandardController();
+ showcod2nid = cod2s();
+
+ }
+ for (Consumable_order_details2__c cod2 : showcod2nid) {
+ codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id)));
+ }
+ if(codPageRecords.size() > 0) done = true;
+ iSinventory = true;
+ consumableorderdetailsRecordserrordummy.clear();
+ pandiandetailsList = [select Id, Bar_Code__c,Consumable_Product__r.Name__c,
+ Box_Piece__c,Lose_reason__c
+ FROM Consumable_order_details2__c
+ WHERE Id in :pandiandetailsMap.keySet()
+ order by Name];
+ for(Consumable_order_details2__c codDet : pandiandetailsList){
+ codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id);
+ }
+ List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>();
+ for(Consumable_order_details2__c cod2 : pandiandetailsList){
+ pandiandetailsListMid.add(cod2);
+ if(pandiandetailsListMid.size() == 1000){
+ pandiandetailsListShow.add(pandiandetailsListMid);
+ pandiandetailsListMid = new List<Consumable_order_details2__c>();
+ }
+ }
+ if(pandiandetailsListMid.size() > 0){
+ pandiandetailsListShow.add(pandiandetailsListMid);
+ }
+ //鍒嗛〉
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ totalCount = codPageRecords.size();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ Integer startIdx;
+ Integer endIdx;
+ List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>();
+ startIdx = pageToken;
+ endIdx = startIdx + pageSize;
+ if (endIdx > codPageRecords.size()) {
+ endIdx = codPageRecords.size();
+ }
+ for (Integer i = startIdx; i < endIdx; i++) {
+ pageCodeRecords.add(codPageRecords.get(i));
+ }
+
+ data.put('paginatedAccounts', paginatedAccounts);
+ data.put('pageCodeRecords', pageCodeRecords);
+
+ //end
+
+ System.debug('=====>codPageRecords2'+codPageRecords);
+ System.debug('=====>consumableorderdetailsRecords'+consumableorderdetailsRecords);
+ data.put('codPageRecords',JSON.serialize(codPageRecords));
+ data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords));
+ System.debug('iSinventory===>'+iSinventory);
+ data.put('iSinventory',JSON.serialize(iSinventory));
+ System.debug('pandiandetailsMap===>'+pandiandetailsMap);
+ data.put('pandiandetailsMap',pandiandetailsMap);
+ data.put('reSet',reSet);
+ data.put('consumableorderdetailsRecordsview',JSON.serialize(consumableorderdetailsRecordsview));
+ System.debug('=====>consumableorderdetailsRecordsview'+consumableorderdetailsRecordsview);
+ res.code = 200;
+ res.status = 'Sucess';
+ return res;
+ }
+
+ // 淇濆瓨鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC save(Boolean iSinventory,String consumableorderdetailsRecordsLWC,String accountid,String agencyProType,Map<Id,String> pandiandetailsMap,List<Consumable_order_details2__c> reSet) {
+ List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class);
+ agencyProType = agencyProType;
+ accountid =accountid;
+ pandiandetailsMap = pandiandetailsMap;
+ reSet =reSet;
+ System.debug('pandiandetailsMap===>'+pandiandetailsMap);
+
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ // 璺宠繃鏄庣粏2涓嶅繀瑕佹洿鏂�
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ if(!iSinventory){
+ return new ResponseBodyLWC('Error',500, '璇峰厛褰曞叆BarCode', '');
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇峰厛鐐广�怋arCode褰曞叆銆�'));
+ // return null;
+ }
+ integer Lo = 0;
+ for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){
+ if(header.check==true){
+ Lo++;
+ }
+ }
+ if(Lo == 0){
+ iSinventory = false;
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇烽�夋嫨瑕佺洏鐐圭殑鏄庣粏'));
+ // return null;
+ return new ResponseBodyLWC('Error',500, '璇烽�夋嫨瑕佺洏鐐圭殑鏄庣粏', '');
+ }
+ for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){
+ if(header.check==true){
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + ' '+header.prod.Name__c));
+ //return null;
+ if((header.DiffReason == ''||header.DiffReason ==null)&&header.Diff>0){
+ return new ResponseBodyLWC('Error',500, header.prod.Name__c + '璇疯緭鍏ュ樊寮傚師鍥�', '');
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + '璇疯緭鍏ュ樊寮傚師鍥�'));
+ // return null;
+ }else if ((header.DiffReason != ''&&header.DiffReason !=null)&&header.Diff==0){
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鏃犱涪澶变骇鍝侊紝涓嶉渶瑕佸~鍐欏樊寮傚師鍥�'));
+ // return null;
+ return new ResponseBodyLWC('Error',500, header.prod.Name__c + '鏃犱涪澶变骇鍝侊紝涓嶉渶瑕佸~鍐欏樊寮傚師鍥�', '');
+ }
+ }
+ }
+ Integer orderDetNo = 1;
+ Savepoint sp = Database.setSavepoint();
+ Consumable_order__c Po = new Consumable_order__c();
+ Po.Name ='*';
+ Po.Order_status__c = '鎵瑰噯';
+ Po.Inventory_date__c = Date.today();
+ Po.Order_type__c = '鐩樼偣';
+ Po.Dealer_Info__c = accountid;
+ Po.Order_ProType__c = agencyProType;
+ Po.RecordTypeid = System.Label.RT_ConOrder_Inventory;
+ try{
+ insert Po;
+ eSetId = Po.id;
+ List<Consumable_order__c> Consumable_order = [SELECT Name FROM Consumable_order__c WHERE id =:Po.id];
+ List<Consumable_orderdetails__c> InsList = New List<Consumable_orderdetails__c>();
+ List<Consumable_order_details2__c> InsListUp = New List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> updListAdjust = New List<Consumable_order_details2__c>();
+ Map<String,String> ErrorName = new Map<String,String>();
+ Map<String,Boolean> CheckTF = new Map<String,Boolean>();
+ for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){
+ if(header.check==true){
+ Consumable_orderdetails__c insPan = new Consumable_orderdetails__c();
+ insPan = new Consumable_orderdetails__c();
+ String str = string.valueOf(orderDetNo);
+ if(str.length() == 1){
+ str = '0' + str;
+ }
+ insPan.Name = Consumable_order[0].Name + '-'+ str;
+ insPan.Consumable_Product__c = header.ProdId;
+ ErrorName.put(insPan.Consumable_Product__c,header.DiffReason);
+ CheckTF.put(insPan.Consumable_product__c,true);
+ insPan.Consumable_order__c = Po.Id;
+ insPan.Lose_reason__c = header.DiffReason;
+ insPan.Diff__c = header.Diff;
+ insPan.Product_Refind__c = header.refind;
+ insPan.inventory_sum__c = header.Pandian;
+ insPan.Count_Sum__c = header.countid;
+ insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
+ orderDetNo ++;
+ InsList.add(insPan);
+ }
+ }
+ if(InsList.size()>0){
+ insert InsList;
+ }
+ List<Consumable_order_details2__c> showcod2 = [select Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE Id in :pandiandetailsMap.keySet()
+ order by Name];
+ for(Consumable_order_details2__c cod : showcod2){
+ Consumable_order_details2__c InsDetail = new Consumable_order_details2__c();
+ InsDetail.Id =cod.Id;
+ InsDetail.Consumable_Inventory_order__c = po.Id;
+ InsDetail.Inventory_date__c = Date.today();
+ // 20210224 gzw CHAN-BXF3PG start
+ // if(pandiandetailsMap.get(cod.Id) == '涓㈠け' ){
+ if(pandiandetailsMap.get(cod.Id) == '涓㈠け' && CheckTF.containsKey(cod.Consumable_product__c)){
+ // 20210224 gzw CHAN-BXF3PG end
+ InsDetail.Lose_reason__c = ErrorName.get(cod.Consumable_product__c);
+ InsDetail.Lose_Flag__c = true;
+ }else if(pandiandetailsMap.get(cod.Id) == '瀵诲洖' ){
+ InsDetail.Lose_reason__c = '';
+ InsDetail.Lose_Flag__c = false;
+ }else{
+ continue;
+ }
+ InsListUp.add(InsDetail);
+ }
+ for(Consumable_order_details2__c rs : reSet){
+ rs.Inventory_date__c = Date.today();
+ }
+ if(reSet.size() > 0){
+ update reSet;
+ }
+ if(InsListUp.size()>0){
+ ControllerUtil.updateOrderDetailsSatus(InsListUp);// Commented By DTT - Li Jun for testing 20230407
+ }
+
+ }catch (Exception e) {
+ Database.rollback(sp);
+ // ApexPages.addMessages(ex);
+ return new ResponseBodyLWC('Error',500, e.getMessage()+e.getLineNumber(), '');
+ // return null;
+ }
+ // FIXME impliment BarCodeListAdjust
+ /************************************************************************************************/
+ // return ProS();
+ data.put('eSetId',eSetId);
+ data.put('InsListUp',InsListUp);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ //鐩樼偣涓�瑙�
+ public PageReference ProS() {
+ // 杩斿洖鐩樼偣涓�瑙�
+ PageReference ref = new Pagereference('/apex/InventoryList?eSetId=' + eSetId);
+ ref.setRedirect(true);
+ return ref;
+ }
+ //CSV鍑哄姏
+ public PageReference doClick() {
+ Pagereference pr = page.InventoryCSV;
+ return pr;
+ }
+ //鍒嗛〉Bean
+ public class PaginatedAccounts {
+ @AuraEnabled
+ public Integer nextPageToken;
+ @AuraEnabled
+ public Integer pageNumber { get; set; }
+ @AuraEnabled
+ public Integer totalRecords { get; set; }
+ @AuraEnabled
+ public Integer recordStart { get; set; }
+ @AuraEnabled
+ public Integer recordEnd { get; set; }
+ }
+
+ // Data Bean
+ class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Consumable_orderdetails__c orderdetails1 { get; set; }
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Decimal countid { get; set; }
+ @AuraEnabled
+ public String ProdId{get;set;}
+ @AuraEnabled
+ public Decimal Pandian { get; set; }
+ @AuraEnabled
+ public Decimal Diff { get; set; }
+ @AuraEnabled
+ public Decimal refind { get; set; }
+ @AuraEnabled
+ public String DiffReason { get; set; }
+ @AuraEnabled
+ public Boolean canSelect { get; set; }
+ @AuraEnabled
+ public Boolean sortBy { get; set; }
+ @AuraEnabled
+ public Decimal limitCount { get; set; }
+ @AuraEnabled
+ public Decimal overlimitCount { get; set; }
+ @AuraEnabled
+ public String boxPiece { get; set; }
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) {
+
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ //e.Lose_reason__c = str;
+ DiffReason = str;
+ }
+
+ // 宸插瓨鍦ㄦ秷鑰楀搧鏄庣粏鐢�
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ check = false;
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ canSelect = true;
+ }
+ public ConsumableorderdetailsInfo(Product2__c e) {
+ check = false;
+ //orderdetails1 = new Consumable_orderdetails__c();
+ Prod = e;
+ canSelect = true;
+ ProdId = string.valueOf(e.id);
+ countid =0;
+ Pandian = 0;
+ refind = 0;
+ Diff = 0;
+ limitCount = 0;
+ overlimitCount = 0;
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ ConsumableorderdetailsInfo compareToesd =(ConsumableorderdetailsInfo)compareTo;
+ Integer returnValue = 0;
+ if (countid > compareToesd.countid ) {
+ returnValue = -1;
+ } else if (countid < compareToesd.countid ) {
+ returnValue = 1;
+ }
+ return returnValue;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexInventoryController.cls-meta.xml b/force-app/main/default/classes/LexInventoryController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexInventoryController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexInventoryListController.cls b/force-app/main/default/classes/LexInventoryListController.cls
new file mode 100644
index 0000000..a4e9395
--- /dev/null
+++ b/force-app/main/default/classes/LexInventoryListController.cls
@@ -0,0 +1,103 @@
+public without sharing class LexInventoryListController {
+ /*****************妞滅储鐢�******************/
+ public static Consumable_order__c coc { get; set; }
+ public static String baseUrl {get;private set;}
+ /*****************鐢婚潰琛ㄧずBean******************/
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; }
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsError { get; set; }
+ // 鐩樼偣鏄庣粏1
+ private static List<Consumable_orderdetails__c> consumableorderdetails1 = new List<Consumable_orderdetails__c>();
+ // 鐩樼偣鏄庣粏2
+ private static List<Consumable_order_details2__c> consumableorderdetailsSelected = new List<Consumable_order_details2__c>();
+
+ // 鐩樼偣鍗曞彿 ID
+ private static String ESetId = '';
+ public LexInventoryListController() {
+ //Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ ESetId = ApexPages.currentPage().getParameters().get('esetId');
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsError = new List<ConsumableorderdetailsInfo>();
+ }
+ // 鐢婚潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init(String eSetId) {
+ system.debug('eSetId====>'+eSetId);
+ ESetId = eSetId;
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ consumableorderdetailsRecordsError = new List<ConsumableorderdetailsInfo>();
+
+ coc = new Consumable_order__c();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ List<Consumable_order__c> qs = New List<Consumable_order__c>();
+ qs = [select Name,Inventory_date__c,Order_date__c From Consumable_order__c Where Id =:ESetId];
+ System.debug('qs===>'+qs);
+ if (qs.size()>0){
+ coc = qs[0];
+ }
+ // 閬告姙娓堛伩銇槑缁嗐倰鍙栧緱
+ consumableorderdetailsSelected = [
+ select Id, Name, Consumable_Product__c,
+ Consumable_Product__r.Name, Sterilization_limit__c,
+ Deliver_date__c,Consumable_Product__r.Name__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,Bar_Code__c,
+ Consumable_Product__r.Asset_Model_No__c,Lose_Flag__c,
+ recordtypeid,Lose_reason__c
+ from Consumable_order_details2__c
+ where Consumable_Inventory_order__c = :ESetId
+ order by Name ];
+ System.debug('consumableorderdetailsSelected==>'+consumableorderdetailsSelected);
+
+ for (Integer i = 0; i < consumableorderdetailsSelected.size(); i++) {
+ consumableorderdetailsRecordsError.add(new ConsumableorderdetailsInfo(consumableorderdetailsSelected[i]));
+ }
+ consumableorderdetails1 = [
+ select Id, Name,Diff__c,inventory_sum__c,
+ Count_Sum__c,Consumable_order__c,
+ Consumable_Product__c,Consumable_Product__r.Name,Consumable_Count__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,Consumable_Product__r.Name__c,
+ Sum_of_money__c,recordtypeid,Lose_reason__c,Product_Refind__c
+ from Consumable_orderdetails__c
+ where Consumable_order__c = :ESetId
+ order by Name ];
+ for (Integer i = 0; i < consumableorderdetails1.size(); i++) {
+ consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i]));
+ }
+ data.put('qs',qs);
+ System.debug('consumableorderdetailsRecords====>'+consumableorderdetailsRecords);
+ data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords));
+ data.put('ConsumableorderdetailsRecordsError',JSON.serialize(ConsumableorderdetailsRecordsError));
+ // if(ConsumableorderdetailsRecordsError.size()!=null){
+ // data.put('ConsumableorderdetailsRecordsError',JSON.serialize(ConsumableorderdetailsRecordsError));
+ // }
+ System.debug('ConsumableorderdetailsRecordsError====>'+ConsumableorderdetailsRecordsError);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // Data Bean
+ class ConsumableorderdetailsInfo implements Comparable {
+ public Consumable_orderdetails__c orderdetails1 { get; set; }
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ public Product2__c Prod { get; set; }
+ // 鏄庣粏1
+ public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) {
+ orderdetails1 = e;
+ Prod = e.Consumable_Product__r;
+ }
+ // 鏄庣粏2
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexInventoryListController.cls-meta.xml b/force-app/main/default/classes/LexInventoryListController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexInventoryListController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexInventoryViewController.cls b/force-app/main/default/classes/LexInventoryViewController.cls
new file mode 100644
index 0000000..cc2ec34
--- /dev/null
+++ b/force-app/main/default/classes/LexInventoryViewController.cls
@@ -0,0 +1,1114 @@
+public without sharing class LexInventoryViewController {
+ /*****************鐢婚潰琛ㄧずBean******************/
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+
+ // page
+ public static Integer pagesize { get; set; }
+ public static Integer pageToken { get; set; }
+ public static String sortField { get; set; }
+ public static String sortOrder { get; set; }
+
+ public static Integer totalcount { get; set; }
+ // public static Integer pagecount { get; set; }
+ // public static Integer currentpage { get; set; }
+ // public static Boolean hasPrevious { get; set; }
+ // public static Boolean hasNext { get; set; }
+ public static List<ConsumableorderdetailsInfo> pageRecords { get; set; }
+ public static String soql { get; set; }
+
+ // public static String sortKey { get; set; }
+ // public static String preSortKey { get; private set; }
+ // public static Boolean sortOrderAsc { get; private set; }
+ // public static String[] sortOrder { get; private set; }
+ // private static String[] columus = new List<String>{
+ // 'Product2__c.Name__c',
+ // 'Asset_Model_No__c',
+ // '',
+ // 'Category3__c',
+ // 'Category4__c',
+ // 'Category5__c',
+ // ''
+ // };
+
+ public static String[] proLimitAndDate = new List<String>{};
+ private static Map<String, Date> productkucun = new Map<String, Date>();
+ public static List<SelectOption> categoryOptionList { get; set; }
+ @AuraEnabled
+ public static Map<String, String> categoryOptionMap { get; set; }
+ public static List<SelectOption> category4OptionList { get; set; }
+ @AuraEnabled
+ public static Map<String, String> category4OptionMap { get; set; }
+ public static List<SelectOption> category5OptionList { get; set; }
+ @AuraEnabled
+ public static Map<String, String> category5OptionMap { get; set; }
+ public static String category5 { get; set; }
+ public static String category4 { get; set; }
+ public static String category3 { get; set; }
+ public static String category_Goods { get; set; }
+ public static String category1 { get; set; }
+ public static Boolean editAble { get; set; }
+ // 缁忛攢鍟嗗湪搴撲骇鍝両D
+ public static List<String> orderDetZaikuList = new List<String>();
+ // 浜у搧 ID
+ public static String ESetId { get; set; }
+ public static String idCheck { get; set; }
+ /*****************銈姐兗銉堟檪鍐嶆绱㈡潯浠讹紙鐢婚潰銇嬨倝銇叆鍔涙潯浠躲倰鐒¤銇欍倠銇熴倎锛�******************/
+ private static String accountid = null;
+ public static String accountName { get; set; }
+ // 鏌ョ湅浜у搧
+ // private String[] ProidListAll = new String[]{};
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+ // 缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
+ public static String agencyProType { get; set; }
+ public static String sqlagencyProType;
+
+ // add by rentx 2021-3-10
+ public static Boolean hasHos { get; set; }
+ // add by rentx 2021-3-10
+
+ public LexInventoryViewController() {
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+ editAble = false;
+ categoryOptionList = new List<SelectOption>();
+ category4OptionList = new List<SelectOption>();
+ category5OptionList = new List<SelectOption>();
+ categoryOptionMap = new Map<String, String>();
+ category4OptionMap = new Map<String, String>();
+ category5OptionMap = new Map<String, String>();
+
+ // page
+ // pagesize = Integer.valueof(system.label.orderdetLimitsize);
+ // currentpage = 0;
+ }
+ @AuraEnabled
+ public static ResponseBodyLWC init(Integer pageSizeLWC, Integer pageTokenLWC, String sortFieldLWC, String sortOrderLWC) {
+ pageSize = pageSizeLWC;
+ pageToken = pageTokenLWC;
+ sortField = sortFieldLWC;
+ sortOrder = sortOrderLWC;
+
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ categoryOptionMap = new Map<String, String>();
+ category4OptionMap = new Map<String, String>();
+ category5OptionMap = new Map<String, String>();
+
+
+ // 鍙栫敤鎴稩D
+ String userId = UserInfo.getUserId();
+ User useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
+ accountid = useracc.accountid;
+ userWorkLocation = useracc.Work_Location__c;
+ agencyProType = Useracc.UserPro_Type__c;
+ if (String.isBlank(Useracc.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ Account accountInfo = [SELECT Name, Dealer_discount__c, Product_Limit_Date__c FROM account WHERE id = :accountid];
+ accountName = accountInfo.Name;
+ // 缁忛攢鍟嗘煡鐪嬩骇鍝�
+ String product_Limit = accountInfo.Product_Limit_Date__c;
+
+ if (product_Limit != null && product_Limit != '') {
+ proLimitAndDate = product_Limit.split(',');
+ }
+
+ List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String, Product2__c> MidMap = new Map<String, Product2__c>();
+ Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
+ // 搴撳瓨鏄庣粏鍙栧緱
+ sqlagencyProType = '%' + agencyProType + '%';
+ orderDetZaikuList = new List<String>();
+ System.debug('sqlagencyProType = ' + sqlagencyProType);
+ System.debug('accountName = ' + accountName);
+ System.debug('userWorkLocation = ' + userWorkLocation);
+ List<AggregateResult> orderDetZaiku = [
+ SELECT count(Id), Consumable_Product__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Cancellation_Flag__c = FALSE
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ GROUP BY Consumable_Product__c
+ ];
+
+ for (AggregateResult zaikuId : orderDetZaiku) {
+ orderDetZaikuList.add(String.valueOf(zaikuId.get('Consumable_Product__c')));
+ }
+ System.debug('orderDetZaikuList = ' + orderDetZaikuList);
+ List<Consumable_order_details2__c> CountDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Recordtypeid,
+ Guarantee_period_for_products__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ hospitalSpecialOffer__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 Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ];
+ System.debug('MidMap = ' + MidMap);
+ System.debug('CountDel111 = ' + CountDel);
+ System.debug('orderDetZaikuList = ' + orderDetZaikuList);
+ List<Product2__c> product2Selected = [
+ SELECT
+ Id,
+ Name,
+ Name__c,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Category3__c,
+ Category4__c,
+ Category5__c,
+ SFDA_Status__c,
+ Product2__r.SFDA_Approbation_No__c,
+ Product2__r.SFDA_Expiration_Date__c,
+ Product2__r.Packing_list_manual__c
+ FROM Product2__c
+ WHERE Id IN :orderDetZaikuList
+ ];
+ System.debug('product2Selected = ' + product2Selected);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, product2Selected[i]);
+ }
+ System.debug('MidMap = ' + MidMap);
+ /////////////////////====================================update by rentx
+ Map<String, ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
+ // update by rentx 2021-01-27 start
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ // 鐒跺悗寰幆CountDel鍋欱ox鍜宲iece2涓猰ap
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '鐩�') {
+ String tex = 'A';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ tex = 'B';
+ }
+ if (newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
+ ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)
+ .clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+ } else {
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+ }
+ } else if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '涓�') {
+ String tex = 'A';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ tex = 'B';
+ }
+ if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
+ ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
+ CountDel[i].Consumable_Product__c +
+ CountDel[i].Box_Piece__c +
+ tex
+ )
+ .clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+ } else {
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+ }
+ }
+ }
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ // 鎶夿oxmap閲岀殑鍊间粠鏂拌祴缁檅oxRecords
+ System.debug('newMidBoxMap = ' + newMidBoxMap);
+ for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) {
+ if (bss.allnumber > 0) {
+ bss.sortBy = false;
+ bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ bss.overlimitCount = bss.allnumber - bss.limitCount;
+ boxRecords.add(bss);
+ }
+ }
+
+ boxRecords.sort();
+ for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+ if (bss.allnumber > 0) {
+ bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ bss.overlimitCount = bss.allnumber - bss.limitCount;
+ }
+ }
+ for (ConsumableorderdetailsInfo bss : boxRecords) {
+ consumableorderdetailsRecords.add(bss);
+ // 璇ヤ骇鍝佹槸鍖婚櫌鐗逛环浜у搧
+ if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '涓狟')) {
+ if (newMidPieceMap.get(bss.Prod.Id + '涓狟').hospitalSpecialOffer) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狟'));
+ newMidPieceMap.remove(bss.Prod.Id + '涓狟');
+ }
+ }
+
+ if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '涓狝')) {
+ // if (newMidPieceMap.get(bss.Prod.Id+'涓狝')) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狝'));
+ newMidPieceMap.remove(bss.Prod.Id + '涓狝');
+ // }
+ }
+ }
+ for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+ if (newMidPieceMap.containsKey(bss.Prod.Id + '涓狟')) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狟'));
+ }
+ }
+ for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+ if (newMidPieceMap.containsKey(bss.Prod.Id + '涓狝')) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狝'));
+ }
+ }
+ productLimtAndDate();
+ datelimitSearch();
+
+ // add by rentx 2021-3-10 start
+ Integer hosnum = 0;
+ // add by rentx 2021-3-10 end
+ for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) {
+ if (productkucun.get(bss.Prod.Id) != null) {
+ bss.guaranteeperiod = productkucun.get(bss.Prod.Id);
+ }
+
+ // add by rentx 2021-3-10 start
+ if (bss.hospitalSpecialOffer) {
+ hosnum = hosnum + 1;
+ }
+ }
+ if (hosnum > 0) {
+ hasHos = true;
+ } else {
+ hasHos = false;
+ }
+ // add by rentx 2021-3-10 end
+ // listCut();
+
+ AggregateResult[] categoryList = [
+ SELECT Count(id), Category3_text__c c3c
+ FROM Product2__c
+ WHERE Estimation_Entry_Possibility__c = '鈼�' AND Product_Type__c LIKE :agencyProType AND Category3_text__c != NULL
+ GROUP BY Category3_text__c
+ ];
+
+ categoryOptionList = new List<SelectOption>();
+ categoryOptionList.add(new SelectOption('', '-鏃�-'));
+ categoryOptionMap.put('', '-鏃�-');
+ for (AggregateResult category3Search : categoryList) {
+ String deliverycnt = String.valueOf(category3Search.get('c3c'));
+ categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
+ categoryOptionMap.put(deliverycnt, deliverycnt);
+ }
+
+ category4OptionList = new List<SelectOption>();
+ category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4OptionMap.put('', '-鏃�-');
+
+ category5OptionList = new List<SelectOption>();
+ category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5OptionMap.put('', '-鏃�-');
+ System.debug('categoryOptionList===>' + category4OptionList);
+ System.debug('category4OptionList===>' + category4OptionList);
+ System.debug('category5OptionList===>' + category4OptionList);
+
+ //// 鎬讳欢鏁�
+ totalcount = consumableorderdetailsRecords.size();
+ //// 椤垫暟
+ // pagecount = (totalcount + pagesize - 1) / pagesize;
+
+ //// 鏄剧ず绗竴椤�
+
+ // moveToFirst();
+ makeCurrentPageRecords();
+ // data.put('categoryOptionList',categoryOptionList);
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ data.put('paginatedAccounts', paginatedAccounts);
+
+ data.put('categoryOptionMap', categoryOptionMap);
+ data.put('category4OptionMap', category4OptionMap);
+ data.put('category5OptionMap', category5OptionMap);
+
+ data.put('agencyProType', agencyProType);
+ data.put('orderDetZaikuList', orderDetZaikuList);
+ data.put('accountid', accountid);
+ data.put('accountName', accountName);
+ data.put('sqlagencyProType', accountName);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('agencyProType', agencyProType);
+ data.put('pageRecords', pageRecords);
+ data.put('consumableorderdetailsRecords', consumableorderdetailsRecords);
+ data.put('hasHos', hasHos);
+ data.put('productLimtAndDate',proLimitAndDate);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+ @AuraEnabled
+ public static ResponseBodyLWC categoryAllload(String category3LWC,String agencyProTypeLWC) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ category3 = category3LWC;
+ agencyProType = '%' + agencyProTypeLWC + '%';
+
+ System.debug('category3LWC===>'+category3LWC);
+ System.debug('agencyProType===>'+agencyProType);
+
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Category3_text__c = :category3
+ AND Product_Type__c LIKE :agencyProType
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ category4OptionList = new List<SelectOption>();
+ category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4OptionMap = new Map<String, String>();
+ category4OptionMap.put('', '-鏃�-');
+
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ category4OptionMap.put(deliverycnt4, deliverycnt4);
+ }
+
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Category3_text__c = :category3
+ AND Product_Type__c LIKE :agencyProType
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+
+ category5OptionList = new List<SelectOption>();
+ category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5OptionMap = new Map<String, String>();
+ category5OptionMap.put('', '-鏃�-');
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ category5OptionMap.put(deliverycnt5, deliverycnt5);
+ }
+ System.debug('绫诲埆4'+category4OptionList);
+ System.debug('绫诲埆5'+category5OptionList);
+ data.put('category4OptionMap', category4OptionMap);
+ data.put('category5OptionMap', category5OptionMap);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ public static void categoryload() {
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Category3_text__c = :category3
+ AND Product_Type__c LIKE :agencyProType
+ AND Category4_text__c != NULL
+ AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ category4OptionList = new List<SelectOption>();
+ category4OptionList.add(new SelectOption('', '-鏃�-'));
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ }
+
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE
+ Estimation_Entry_Possibility__c = '鈼�'
+ AND Category3_text__c = :category3
+ AND Product_Type__c LIKE :agencyProType
+ AND Category4_text__c = :category4
+ AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+
+ category5OptionList = new List<SelectOption>();
+ category5OptionList.add(new SelectOption('', '-鏃�-'));
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ }
+ }
+ // 妫�绱�
+ @AuraEnabled
+ public static ResponseBodyLWC searchConsumableorderdetails(
+ String category1,
+ String Category3,
+ String Category4,
+ String Category5,
+ List<String> orderDetZaikuListLWC,
+ String accountName,
+ string agencyProType,
+ string userWorkLocation,
+ Integer pageSizeLWC,
+ Integer pageTokenLWC,
+ String sortFieldLWC,
+ String sortOrderLWC
+ ) {
+ try {
+ System.debug('orderDetZaikuListLWC===>'+orderDetZaikuListLWC);
+ pageSize = pageSizeLWC;
+ pageToken = pageTokenLWC;
+ sortField = sortFieldLWC;
+ sortOrder = sortOrderLWC;
+ orderDetZaikuList = new List<String>();
+
+ orderDetZaikuList = orderDetZaikuListLWC;
+ sqlagencyProType = '%' + agencyProType + '%';
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ System.debug('====>accountName' + accountName);
+ System.debug('====>sqlagencyProType' + sqlagencyProType);
+ System.debug('====>userWorkLocation' + userWorkLocation);
+ System.debug('====>category1' + category1);
+ System.debug('====>Category3' + Category3);
+ System.debug('====>Category4' + Category4);
+ System.debug('====>Category5' + Category5);
+ // sortKey = '2';
+ // preSortKey = '2';
+ // sortOrderAsc = false;
+ // sortOrder = new List<String>(8);
+ // sortOrder = new List<String>{ ' ', '', ' ', ' ', '', '', '', '鈫�' };
+
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ List<Consumable_order_details2__c> CountDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Recordtypeid,
+ Guarantee_period_for_products__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ hospitalSpecialOffer__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 Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ];
+ System.debug('CountDel = ' + CountDel);
+
+ List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String, Product2__c> MidMap = new Map<String, Product2__c>();
+ Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
+
+ // 鎵�鏈変骇鍝佸彇寰�
+ String soql = makeSoql(category1, category_Goods, category3, category4, category5);
+ //orderDetZaikuList
+ System.debug('orderDetZaikuList = ' + orderDetZaikuList);
+ System.debug('accountName = ' + accountName);
+ System.debug('soql====>' + soql);
+ //鎺掑簭
+ // if (String.isNotBlank(sortField) && String.isNotBlank(sortOrder)) {
+ // if(sortFieldLWC != 'limitCount'){
+ // soql += ' ORDER BY ' + sortField + ' ' + sortOrder;
+
+ // }
+ // }
+ System.debug('soql = ' + soql);
+ //soql += ' ORDER BY ' + this.columus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last');
+ List<Product2__c> queryList = Database.query(soql);
+ System.debug('queryList = ' + queryList);
+
+ for (Integer i = 0; i < queryList.size(); i++) {
+ MidMap.put(queryList[i].Id, queryList[i]);
+ }
+ System.debug('MidMap = ' + MidMap);
+ Map<String, ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
+ System.debug('CountDel = ' + CountDel);
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ //鐒跺悗寰幆CountDel鍋欱ox鍜宲iece2涓猰ap
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '鐩�') {
+ String tex = 'A';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ tex = 'B';
+ }
+ if (newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
+ ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
+ CountDel[i].Consumable_Product__c +
+ CountDel[i].Box_Piece__c +
+ tex
+ )
+ .clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+ } else {
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+ }
+ } else if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '涓�') {
+ String tex = 'A';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ tex = 'B';
+ }
+ if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
+ ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
+ CountDel[i].Consumable_Product__c +
+ CountDel[i].Box_Piece__c +
+ tex
+ )
+ .clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+ } else {
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Isoverdue__c == 1) {
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+ }
+ }
+ }
+
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ System.debug('newMidBoxMap = ' + newMidBoxMap);
+ //鎶夿oxmap閲岀殑鍊间粠鏂拌祴缁檅oxRecords
+ for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) {
+ if (bss.allnumber > 0) {
+ bss.sortBy = false;
+ bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ bss.overlimitCount = bss.allnumber - bss.limitCount;
+ boxRecords.add(bss);
+ }
+ }
+
+ boxRecords.sort();
+ for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+ if (bss.allnumber > 0) {
+ bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ bss.overlimitCount = bss.allnumber - bss.limitCount;
+ }
+ }
+ System.debug('boxRecords = ' + boxRecords);
+ for (ConsumableorderdetailsInfo bss : boxRecords) {
+ consumableorderdetailsRecords.add(bss);
+ //璇ヤ骇鍝佹槸鍖婚櫌鐗逛环浜у搧
+ if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '涓狟')) {
+ if (newMidPieceMap.get(bss.Prod.Id + '涓狟').hospitalSpecialOffer) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狟'));
+ newMidPieceMap.remove(bss.Prod.Id + '涓狟');
+ }
+ }
+
+ if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '涓狝')) {
+ // if (newMidPieceMap.get(bss.Prod.Id+'涓狝')) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狝'));
+ newMidPieceMap.remove(bss.Prod.Id + '涓狝');
+ // }
+ }
+ }
+ for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+ if (newMidPieceMap.containsKey(bss.Prod.Id + '涓狟')) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狟'));
+ }
+ }
+ for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+ if (newMidPieceMap.containsKey(bss.Prod.Id + '涓狝')) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狝'));
+ }
+ }
+
+ productLimtAndDate();
+ datelimitSearch();
+ System.debug('consumableorderdetailsRecords zzz = ' + consumableorderdetailsRecords);
+ for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) {
+ if (productkucun.get(bss.Prod.Id) != null) {
+ bss.guaranteeperiod = productkucun.get(bss.Prod.Id);
+ }
+ }
+ //listCut();
+
+ // sortKey = '2';
+ // preSortKey = '2';
+ // sortOrderAsc = false;
+ // sortOrder = new List<String>(8);
+ // sortOrder = new List<String>{ ' ', '', ' ', ' ', '', '', '', '鈫�' };
+
+ // //鎬讳欢鏁�
+ totalcount = consumableorderdetailsRecords.size();
+ // //椤垫暟
+ // pagecount=(totalcount + pagesize - 1) / pagesize;
+
+ //鏄剧ず绗竴椤�
+ //currentpage = 0;
+ //moveToFirst();
+ makeCurrentPageRecords();
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ List<ConsumableorderdetailsInfo> pageRecordsCompare = new List<ConsumableorderdetailsInfo>();
+ System.debug('queryList = ' + JSON.serialize(queryList));
+ for (Integer i = 0; i < queryList.size(); i++) {
+ for(ConsumableorderdetailsInfo ci : pageRecords){
+ if(queryList[i].Id == ci.Prod.Id){
+ System.debug('queryList[i].Id =' + queryList[i].Id);
+ System.debug('ci.Prod.Id =' + queryList[i].Id);
+ pageRecordsCompare.add(ci);
+ }
+ }
+ }
+ data.put('paginatedAccounts', paginatedAccounts);
+ data.put('accountid', accountid);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('agencyProType', agencyProType);
+ data.put('pageRecords', pageRecordsCompare);
+ data.put('hasHos', hasHos);
+ system.debug('===========>pageRecords' + pageRecordsCompare);
+ system.debug('===========>data' + data);
+ if (pageRecords.isEmpty()) {
+ res.msg = '鏈悳绱㈠埌鐩稿叧娑堣�楀搧璁㈠崟锛�';
+ res.status = 'fail';
+ res.code = 500;
+ } else {
+ res.status = 'Success';
+ res.msg = '鍏辨湁' + pageRecords.size() + '鏉℃暟鎹�';
+ res.code = 200;
+ System.debug('res = ' + res);
+ }
+ return res;
+ } catch (Exception e) {
+ return new ResponseBodyLWC('Error', 500, e.getStackTraceString(), '');
+ }
+ }
+
+ public static void productLimtAndDate() {
+ String nowName = null, nowRightAsstModelNo = null;
+ Map<String, String> productLimt = new Map<String, String>();
+ for (Integer i = 0; i < proLimitAndDate.size(); i++) {
+ nowName = proLimitAndDate[i];
+ if (nowName.indexOf('|') >= 0) {
+ nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
+ nowName = nowName.subString(nowName.indexOf('|') + 1);
+ }
+ productLimt.put(nowRightAsstModelNo, nowName);
+ }
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) {
+ ass.lowerlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|'))
+ );
+ ass.upperlimit = decimal.valueOf(
+ productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1)
+ );
+ }
+ }
+ }
+
+ public static void datelimitSearch() {
+ List<String> barcodekucun = new List<String>();
+ List<Consumable_order_details2__c> orderkucun = [
+ SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Recordtypeid, Guarantee_period_for_products__c, Sterilization_limit__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 != NULL
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY Consumable_Product__c, Sterilization_limit__c ASC
+ ];
+ for (Integer i = 0; i < orderkucun.size(); i++) {
+ if (productkucun.containsKey(orderkucun[i].Consumable_Product__c)) {
+ continue;
+ } else {
+ productkucun.put(orderkucun[i].Consumable_Product__c, orderkucun[i].Sterilization_limit__c);
+ }
+ }
+ }
+
+ //鍚嶇О鎺掑簭
+ // public static void SortLimited() {
+ // Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ // Map<String, ConsumableorderdetailsInfo> newMap = new Map<String, ConsumableorderdetailsInfo>();
+ // if (sortKey == preSortKey) {
+ // // 鏂瑰悜銇屽銈忋倠銇伩
+ // sortOrderAsc = !sortOrderAsc;
+ // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
+ // } else {
+ // sortOrderAsc = true;
+ // sortOrder[Integer.valueOf(preSortKey)] = ' ';
+ // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
+ // }
+
+ // preSortKey = sortKey;
+ // // 鎵�鏈変骇鍝佸彇寰�
+ // String soql = makeSoql(null, null, null, null, null);
+ // soql += ' ORDER BY ' + columus[Integer.valueOf(sortKey)] + ' ' + (sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last');
+ // List<Product2__c> queryList = Database.query(soql);
+ // for (Integer i = 0; i < queryList.size(); i++) {
+ // MidMap.put(queryList[i].Id + '鐩�', null);
+ // MidMap.put(queryList[i].Id + '涓�', null);
+ // }
+
+ // //update by rentx 2020-12-29
+ // for (Integer i = 0; i < pageRecords.size(); i++) {
+ // if (MidMap.containsKey(pageRecords[i].prod.Id + pageRecords[i].BoxPiece)) {
+ // ConsumableorderdetailsInfo Jstage = pageRecords[i].clone();
+ // if (Jstage.hospitalSpecialOffer == true) {
+ // newMap.put(pageRecords[i].prod.id + pageRecords[i].BoxPiece, Jstage);
+ // } else {
+ // MidMap.put(pageRecords[i].prod.id + pageRecords[i].BoxPiece, Jstage);
+ // }
+ // }
+ // }
+
+ // pageRecords = new List<ConsumableorderdetailsInfo>();
+
+ // //update byr entx 2020-12-29
+ // //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機pageRecords
+ // for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+ // if (bss != null) {
+ // pageRecords.add(bss);
+ // if (newMap.get(bss.Prod.Id + bss.BoxPiece) != null) {
+ // pageRecords.add(newMap.get(bss.Prod.Id + bss.BoxPiece));
+ // newMap.remove(bss.Prod.Id + bss.BoxPiece);
+ // }
+ // }
+ // }
+ // for (ConsumableorderdetailsInfo bss : newMap.values()) {
+ // if (bss != null) {
+ // pageRecords.add(bss);
+ // }
+ // }
+ // }
+
+ //搴撳瓨鎺掑簭
+ // public static void SortStore() {
+ // if (sortKey == preSortKey) {
+ // // 鏂瑰悜銇屽銈忋倠銇伩
+ // sortOrder = !sortOrder;
+ // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
+ // } else {
+ // sortOrderAsc = true;
+ // sortOrder[Integer.valueOf(preSortKey)] = ' ';
+ // sortOrder[Integer.valueOf(sortKey)] = (sortOrderAsc == true ? '鈫�' : '鈫�');
+ // }
+ // preSortKey = sortKey;
+
+ // for (ConsumableorderdetailsInfo ass : pageRecords) {
+ // ass.sortBy = sortOrderAsc;
+ // }
+ // pageRecords.sort();
+ // }
+
+
+ //妫�绱ql鏂囧仛鎴�
+ private static String makeSoql(String CateName, String CateCode, String Category3, String Category4, String Category5) {
+ System.debug('orderDetZaikuList = ' + orderDetZaikuList);
+ String sqlTail = '(\'';
+ for (Integer i = 0; i < orderDetZaikuList.size(); i++) {
+ if (i < orderDetZaikuList.size() - 1) {
+ sqlTail += orderDetZaikuList[i] + '\',\'';
+ } else {
+ sqlTail += orderDetZaikuList[i] + '\')';
+ }
+ }
+ String soql = 'select Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Category3__c,Category4__c,Category5__c,';
+ soql += ' SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c FROM Product2__c ';
+ soql += ' WHERE Id in' + sqlTail;
+ if (!String.isBlank(CateName)) {
+ soql +=
+ ' AND (Name__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\' or Asset_Model_No__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\')';
+ }
+ if (!String.isBlank(Category3)) {
+ soql += ' AND Category3__c = \'' + Category3 + '\'';
+ }
+ if (!String.isBlank(Category4)) {
+ soql += ' AND Category4__c = \'' + Category4 + '\'';
+ }
+ if (!String.isBlank(Category5)) {
+ soql += ' AND Category5__c = \'' + Category5 + '\'';
+ }
+ return soql;
+ }
+ //棣栭〉
+ // public static void moveToFirst() {
+ // if (currentpage == 1)
+ // return;
+ // currentpage = 1;
+ // canMove();
+ // }
+
+ // //灏鹃〉
+ // public static void moveToLast() {
+ // if (currentpage >= pagecount)
+ // return;
+ // currentpage = pagecount;
+ // canMove();
+ // }
+
+ // //涓婁竴椤�
+ // public static void moveToPrevious() {
+ // if (currentpage == 1)
+ // return;
+ // currentpage = currentpage - 1;
+ // canMove();
+ // }
+
+ // //涓嬩竴椤�
+ // public static void moveToNext() {
+ // if (currentpage >= pagecount)
+ // return;
+
+ // currentpage = currentpage + 1;
+ // canMove();
+ // }
+
+ // //鍒ゆ柇鏄惁鍙炕椤�
+ // public static void canMove() {
+ // hasPrevious = false;
+ // hasNext = false;
+ // if (pagecount > 1 && currentpage > 1)
+ // hasPrevious = true;
+ // if (pagecount > 1 && currentpage < pagecount)
+ // hasNext = true;
+ // }
+
+ //鍒锋柊褰撳墠椤�
+ // public static PageReference refreshPageSize() {
+ // makeCurrentPageRecords();
+ // return null;
+ // }
+
+ //缂栬緫褰撳墠椤靛唴瀹�
+ public static void makeCurrentPageRecords() {
+ // pageRecords = new List<ConsumableorderdetailsInfo>();
+ // System.debug('consumableorderdetailsRecords =' + consumableorderdetailsRecords);
+ // for (Integer i = 0; i < consumableorderdetailsRecords.size(); i++) {
+ // pageRecords.add(consumableorderdetailsRecords.get(i));
+ // }
+
+ Integer startIdx;
+ Integer endIdx;
+ pageRecords = new List<ConsumableorderdetailsInfo>();
+ startIdx = pageToken;
+ endIdx = pageToken + pageSize;
+ if (endIdx > consumableorderdetailsRecords.size()) {
+ endIdx = consumableorderdetailsRecords.size();
+ }
+ for (Integer i = startIdx; i < endIdx; i++) {
+ pageRecords.add(consumableorderdetailsRecords.get(i));
+ }
+ }
+
+ //鍒嗛〉Bean
+ public class PaginatedAccounts {
+ @AuraEnabled
+ public Integer nextPageToken;
+ @AuraEnabled
+ public Integer pageNumber { get; set; }
+ @AuraEnabled
+ public Integer totalRecords { get; set; }
+ @AuraEnabled
+ public Integer recordStart { get; set; }
+ @AuraEnabled
+ public Integer recordEnd { get; set; }
+ }
+
+ // Data Bean
+ class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Consumable_order_details2__c esd { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Decimal allnumber { get; set; }
+ @AuraEnabled
+ public Integer packing_list { get; set; }
+ @AuraEnabled
+ public Date expiration_Date { get; set; }
+ @AuraEnabled
+ public String approbation_No { get; set; }
+ @AuraEnabled
+ public Consumable_order__c Concc { get; set; }
+ @AuraEnabled
+ public Boolean sortBy { get; set; }
+ @AuraEnabled
+ public Decimal upperlimit { get; set; }
+ @AuraEnabled
+ public Decimal lowerlimit { get; set; }
+ @AuraEnabled
+ public String BoxPiece { get; set; }
+ @AuraEnabled
+ public Date guaranteeperiod { get; set; }
+ @AuraEnabled
+ public Decimal limitCount { get; set; }
+ @AuraEnabled
+ public Decimal overlimitCount { get; set; }
+ @AuraEnabled
+ public Boolean hospitalSpecialOffer { get; set; }
+
+ public ConsumableorderdetailsInfo(Product2__c e) {
+ esd = new Consumable_order_details2__c();
+ Prod = e;
+ allnumber = 0;
+ limitCount = 0;
+ overlimitCount = 0;
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo;
+ Integer returnValue = 0;
+ if (sortBy == false) {
+ if (allnumber > compareToesd.allnumber) {
+ returnValue = -1;
+ } else if (allnumber < compareToesd.allnumber) {
+ returnValue = 1;
+ }
+ return returnValue;
+ } else {
+ if (allnumber > compareToesd.allnumber) {
+ returnValue = 1;
+ } else if (allnumber < compareToesd.allnumber) {
+ returnValue = -1;
+ }
+ return returnValue;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexInventoryViewController.cls-meta.xml b/force-app/main/default/classes/LexInventoryViewController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexInventoryViewController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexLicenceReminderController.cls b/force-app/main/default/classes/LexLicenceReminderController.cls
new file mode 100644
index 0000000..97a1cf3
--- /dev/null
+++ b/force-app/main/default/classes/LexLicenceReminderController.cls
@@ -0,0 +1,53 @@
+public without sharing class LexLicenceReminderController {
+
+ @AuraEnabled
+ public static Results initReminder(){
+ Results results = new Results();
+ try {
+ User useracc = [SELECT AccountId, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()];
+ String accountId = useracc.AccountId;
+ List<Account> accList = [SELECT Name,Medical_Equipment_Expiration_Date__c FROM Account WHERE Id =:accountId];
+ Account accountInfo = new Account();
+ if(accList.size() == 1){
+ accountInfo = accList[0];
+ }else{
+ results.result = 'Fail';
+ results.isShowReminder = false;
+ results.errorMsg = '鏈幏鍙栧埌缁忛攢鍟嗕俊鎭�';
+ return results;
+ }
+ if(accountInfo.Medical_Equipment_Expiration_Date__c != null){
+ Integer days = LexUtility.getLicenceReminderDays();
+ Date today = Date.today();
+ // Date today = Date.newInstance(2024, 7, 21);
+ Integer numberDaysDue = today.daysBetween(accountInfo.Medical_Equipment_Expiration_Date__c);
+ if(numberDaysDue > days){
+ results.isShowReminder = false;
+ }else{
+ results.isShowReminder = true;
+ results.days = numberDaysDue;
+ }
+ results.result = 'Success';
+ }else {
+ results.result = 'Fail';
+ results.errorMsg = '鏈幏鍙栧埌鍖荤枟鍣ㄦ缁忚惀浼佷笟璁稿彲璇佹湁鏁堟湡闄�';
+ }
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.isShowReminder = false;
+ results.errorMsg = e.getLineNumber()+'---'+e.getMessage();
+ }
+ return results;
+ }
+
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public Boolean isShowReminder;
+ @AuraEnabled
+ public Integer days;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexLicenceReminderController.cls-meta.xml b/force-app/main/default/classes/LexLicenceReminderController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexLicenceReminderController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexOutboundorderImportController.cls b/force-app/main/default/classes/LexOutboundorderImportController.cls
new file mode 100644
index 0000000..a1f00f6
--- /dev/null
+++ b/force-app/main/default/classes/LexOutboundorderImportController.cls
@@ -0,0 +1,919 @@
+public without sharing class LexOutboundorderImportController {
+ //缁忛攢鍟嗕骇鍝佸垎绫�
+ public static String agencyProType { get; set; }
+ private static String sqlagencyProType;
+ public static Blob csvFileBody { get; set; }
+ public static string csvAsString { get; set; }
+ public static String[] csvFileLines { get; set; }
+ public static List<ConsumableorderdetailsInfo> orderRecords { get; set; }
+ public static List<String[]> csvRecordStr { get; set; }
+ public static Map<String, String> hospitalconMap { get; set; }
+ public static Map<String, String> product2conMap { get; set; }
+ public static Map<String, String> hospitalSysMap { get; set; }
+ public static Map<String, String> secondAgencyMap { get; set; }
+ private static String accountid { get; set; }
+ private static String accountName { get; set; }
+ private static Integer messageCount;
+ public static boolean saveFLGbln { get; set; }
+ private static List<String> barcodeList { get; set; }
+ private static List<String> barcodePieceList { get; set; }
+ public static Map<String, Integer> barcodePieceMap { get; set; }
+ public static boolean errorflg { get; set; }
+ public static String errorMessage { get; set; }
+ private static String userWorkLocation { get; set; }
+ public static String errorMsg { get; set; }
+
+ @AuraEnabled
+ public static ResponseBodyLWC init() {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ messageCount = 0;
+ errorflg = false;
+ errorMessage = null;
+ User useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
+ accountid = Useracc.accountid;
+ userWorkLocation = Useracc.Work_Location__c;
+ agencyProType = Useracc.UserPro_Type__c;
+ if (String.isBlank(Useracc.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ sqlagencyProType = '%' + agencyProType + '%';
+ Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
+ accountName = accountInfo.name;
+
+ data.put('accountid', accountid);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('agencyProType', agencyProType);
+ data.put('accountName', accountName);
+ data.put('sqlagencyProType', sqlagencyProType);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = '';
+ return res;
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC importCSVFile(
+ String base64DataLwc,
+ String sqlagencyProTypeLwc,
+ String userWorkLocationLwc,
+ String accountNameLwc
+ ) {
+ System.debug('enter importCSVFile');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ errorMsg = '';
+ sqlagencyProType = sqlagencyProTypeLwc;
+ userWorkLocation = userWorkLocationLwc;
+ accountName = accountNameLwc;
+ String base64Data = EncodingUtil.urlDecode(base64DataLwc, 'UTF-8');
+ csvFileBody = EncodingUtil.base64Decode(base64Data);
+ product2conMap = new Map<String, String>();
+
+ messageCount = 0;
+ errormessage = null;
+ saveFLGbln = false;
+ csvRecordStr = new List<String[]>();
+ barcodeList = new List<String>();
+ barcodePieceMap = new Map<String, Integer>();
+ barcodePieceList = new List<String>();
+ orderRecords = new List<ConsumableorderdetailsInfo>();
+ hospitalconMap = new Map<String, String>();
+ if (csvFileBody == null) {
+ errorflg = true;
+ saveFLGbln = true;
+ // errormessage = '璇诲彇鍐呭涓虹┖銆�';
+ return new ResponseBodyLWC('Error', 500, '璇诲彇鍐呭涓虹┖銆�', '');
+ } else {
+ //浜у搧鏁版嵁鏌ユ壘
+ map<string, string> orderNameMap = new Map<string, string>();
+ try {
+ csvAsString = csvFileBody.toString();
+ csvFileLines = csvAsString.split('\n');
+ for (Integer i = 0; i < csvFileLines.size(); i++) {
+ string[] csvRecordData = csvFileLines[i].split(',');
+ if (String.isNotBlank(csvRecordData[6])) {
+ barcodeList.add(csvRecordData[6]);
+ if (String.valueOf(csvRecordData[9]) == '涓�') {
+ barcodePieceList.add(csvRecordData[6]);
+ barcodePieceMap.put(csvRecordData[6], Integer.valueOf(csvRecordData[7]));
+ }
+ }
+ String[] csvRecordDataStr = new List<String>(13);
+ for (Integer j = 0; j < csvRecordData.size(); j++) {
+ csvRecordDataStr[j] = csvRecordData[j];
+ }
+ if (i == 0) {
+ csvRecordDataStr[12] = '浜у搧';
+ } else {
+ csvRecordDataStr[12] = '';
+ }
+ csvRecordStr.add(csvRecordDataStr);
+ }
+ Map<String, String> productBarcodeMap = new Map<String, String>();
+ List<Consumable_order_details2__c> cOrderDet = [
+ SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Box_Piece__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c IN :barcodeList
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ];
+ for (Consumable_order_details2__c pdinfo : cOrderDet) {
+ productBarcodeMap.put(pdinfo.Bar_Code__c, pdinfo.Consumable_Product__c);
+ }
+ for (String[] csvlistStr : csvRecordStr) {
+ if (productBarcodeMap.containsKey(csvlistStr[6])) {
+ csvlistStr[12] = productBarcodeMap.get(csvlistStr[6]);
+ } else {
+ }
+ }
+ //妫�绱㈠瓨鍦ㄦ媶鐩掍骇鍝佹暟閲�
+ Map<String, Integer> exitpieceBarcodeMap = new Map<String, Integer>();
+ AggregateResult[] pieceOrderDet = [
+ SELECT count(Id) cnt, Bar_Code__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c IN :barcodePieceList
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Box_Piece__c = '涓�'
+ GROUP BY Bar_Code__c
+ ];
+ for (AggregateResult ar : pieceOrderDet) {
+ exitpieceBarcodeMap.put(String.valueOf(ar.get('Bar_Code__c')), Integer.valueOf(ar.get('cnt')));
+ }
+ for (String bc : barcodePieceList) {
+ if (!exitpieceBarcodeMap.containsKey(bc)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, 'Barcode ' + bc + ' 涓嶅瓨鍦ㄦ垨鍗曚綅閿欒锛岃纭銆�')
+ // );
+ errorMsg += 'Barcode ' + bc + ' 涓嶅瓨鍦ㄦ垨鍗曚綅閿欒锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else if (exitpieceBarcodeMap.containsKey(bc) && exitpieceBarcodeMap.get(bc) < barcodePieceMap.get(bc)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'Barcode ' + bc + ' 搴撳瓨涓嶈冻锛岃纭銆�'));
+ errorMsg += 'Barcode ' + bc + ' 搴撳瓨涓嶈冻锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ }
+ }
+ } catch (Exception e) {
+ //ApexPages.addMessages(e);
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
+ //return new ResponseBodyLWC('Error', 500, e.getMessage()+e.getStackTraceString(), '');
+ }
+ getorderinfo();
+ dataInfoconfim();
+ getorderdet2info(csvRecordStr);
+ if (saveFLGbln == false) {
+ getorderdetinfo(csvRecordStr);
+ }
+ data.put('orderRecords', orderRecords);
+ data.put('saveFLGbln', saveFLGbln);
+ data.put('csvRecordStr', csvRecordStr);
+ data.put('barcodeList', barcodeList);
+ data.put('secondAgencyMap',secondAgencyMap);
+ data.put('hospitalSysMap',hospitalSysMap);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = errorMsg;
+ return res;
+ }
+ }
+
+ public static void getorderinfo() {
+ map<string, string> orderNameMap = new Map<string, string>();
+ try {
+ csvAsString = csvFileBody.toString();
+ csvFileLines = csvAsString.split('\n');
+ for (Integer i = 1; i < csvFileLines.size(); i++) {
+ Consumable_order__c cocObj = new Consumable_order__c();
+ string[] csvRecordData = csvFileLines[i].split(',');
+ if (orderNameMap.containsKey(csvRecordData[0]))
+ continue;
+ cocObj.Name = csvRecordData[0];
+ if (String.isNotBlank(csvRecordData[1])) {
+ cocObj.SummonsForDirction__c = csvRecordData[1];
+ } else {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + csvRecordData[0] + '鍑鸿揣鐩殑涓虹┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗� ' + csvRecordData[0] + '鍑鸿揣鐩殑涓虹┖锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ }
+ cocObj.Order_Attachment__c = csvRecordData[2];
+ cocObj.Order_Indication__c = csvRecordData[3];
+ cocObj.Order_ForCustomerText__c = csvRecordData[4];
+ cocObj.Invoice_Note__c = csvRecordData[5];
+ if (String.isBlank(csvRecordData[11])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + cocObj.Name + '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��')
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cocObj.Name + '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else {
+ cocObj.Outbound_Date__c = Date.parse(csvRecordData[11].trim());
+ }
+ if (String.isNotEmpty(csvRecordData[2])) {
+ hospitalconMap.put(csvRecordData[2].trim(), csvRecordData[0].trim());
+ }
+ orderNameMap.put(csvRecordData[0], csvRecordData[0]);
+ orderRecords.add(new ConsumableorderdetailsInfo(cocObj));
+ }
+ } catch (Exception e) {
+ //return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
+ }
+ }
+
+ public static void dataInfoconfim() {
+ //纭鍖婚櫌淇℃伅
+ hospitalSysMap = new Map<String, String>();
+ secondAgencyMap = new Map<String, String>();
+ for (ConsumableorderdetailsInfo ass : orderRecords) {
+ if (
+ (ass.order.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
+ ass.order.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌' ||
+ ass.order.SummonsForDirction__c == '鍖婚櫌璇曠敤') &&
+ (String.isBlank(ass.hospitalName) ||
+ String.isBlank(ass.hospitalCode) ||
+ String.isBlank(ass.order.Order_ForCustomerText__c))
+ ) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '鍖婚櫌鐩稿叧淇℃伅涓嶈兘绌猴紝璇风‘璁ゃ��')
+ // );
+ errorMsg += '鍑哄簱鍗�' + ass.order.Name + '鍖婚櫌鐩稿叧淇℃伅涓嶈兘绌猴紝璇风‘璁ゃ��<br />';
+ messageCount++;
+ saveFLGbln = true;
+ //return null;
+ }
+ if (ass.order.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�') {
+ if (String.isBlank(ass.agencyName)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗�' + ass.order.Name + '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�<br />';
+ messageCount++;
+ saveFLGbln = true;
+ }
+ }
+ if (ass.order.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌') {
+ if (String.isNotBlank(ass.agencyName)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '涓嶉渶瑕佷簩绾х粡閿�鍟嗭紝璇风‘璁ゃ��')
+ // );
+ errorMsg += '鍑哄簱鍗�' + ass.order.Name + '涓嶉渶瑕佷簩绾х粡閿�鍟嗭紝璇风‘璁ゃ��<br />';
+ messageCount++;
+ saveFLGbln = true;
+ }
+ }
+ if (ass.order.SummonsForDirction__c == '浜掔浉璋冭揣') {
+ if (String.isBlank(ass.agencyName)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗�' + ass.order.Name + '缁忛攢鍟嗕俊鎭笉鑳界┖锛岃纭銆�<br />';
+ messageCount++;
+ saveFLGbln = true;
+ }
+ if (
+ String.isNotBlank(ass.hospitalName) ||
+ String.isNotBlank(ass.hospitalCode) ||
+ String.isNotBlank(ass.order.Order_ForCustomerText__c)
+ ) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗�' + ass.order.Name + '涓嶉渶瑕佸尰闄㈢浉鍏充俊鎭紝璇风‘璁ゃ��')
+ // );
+ errorMsg += '鍑哄簱鍗�' + ass.order.Name + '涓嶉渶瑕佸尰闄㈢浉鍏充俊鎭紝璇风‘璁ゃ��<br />';
+ messageCount++;
+ saveFLGbln = true;
+ }
+ }
+ }
+ System.debug('accountName = ' + accountName);
+ List<Agency_Hospital_Link__c> hospitalInfo = [
+ SELECT Hospital__c, Hospital__r.Management_Code__c, Hospital__r.Name
+ FROM Agency_Hospital_Link__c
+ WHERE Agency__r.Name = :accountName
+ ];
+ List<Dealer_elationship__c> secondAgencyInfo = [
+ SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
+ FROM Dealer_elationship__c
+ WHERE Dealer_principal__r.Name = :accountName
+ ];
+ for (Agency_Hospital_Link__c hpinfo : hospitalInfo) {
+ hospitalSysMap.put(hpinfo.Hospital__r.Management_Code__c, hpinfo.Hospital__c);
+ }
+ for (Dealer_elationship__c safo : secondAgencyInfo) {
+ secondAgencyMap.put(safo.Dealer_subordinate__r.Name, safo.Dealer_subordinate__c);
+ }
+ //鍑哄簱鍗曚俊鎭獙璇�
+ System.debug('hospitalconMap = ' + hospitalconMap);
+ System.debug('hospitalSysMap = ' + hospitalSysMap);
+ for (String widget : hospitalconMap.keySet()) {
+ if (!hospitalSysMap.containsKey(widget)) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // hospitalconMap.get(widget) +
+ // ' 鐨勫尰闄㈢紪鐮�' +
+ // widget +
+ // ' 涓嶅瓨鍦ㄦ垨鑰呬笉鏄湰缁忛攢鍟嗚礋璐g殑鍖婚櫌锛岃纭銆�'
+ // )
+ // );
+ errorMsg +=
+ '鍑哄簱鍗� ' +
+ hospitalconMap.get(widget) +
+ ' 鐨勫尰闄㈢紪鐮�' +
+ widget +
+ ' 涓嶅瓨鍦ㄦ垨鑰呬笉鏄湰缁忛攢鍟嗚礋璐g殑鍖婚櫌锛岃纭銆�<br />';
+ saveFLGbln = true;
+ }
+ }
+ }
+
+ public static void getorderdet2info(List<String[]> csvRecordStr) {
+ barcodeList = new List<String>();
+ try {
+ for (Integer i = 1; i < csvRecordStr.size(); i++) {
+ Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c();
+ string[] csvRecordData = csvRecordStr[i];
+ cod2Obj.TracingCode__c = csvRecordData[0];
+ cod2Obj.Bar_Code__c = csvRecordData[6];
+ if (String.isNotBlank(csvRecordData[6])) {
+ barcodeList.add(csvRecordData[6]);
+ }
+ if (String.isBlank(csvRecordData[9])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '鐨刡arcode ' +
+ // cod2Obj.Bar_Code__c +
+ // ' 涓嶅瓨鍦ㄥ嚭搴撳崟浣嶏紝璇风‘璁ゃ��'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '鐨刡arcode ' + cod2Obj.Bar_Code__c + ' 涓嶅瓨鍦ㄥ嚭搴撳崟浣嶏紝璇风‘璁ゃ��<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else if (String.valueOf(csvRecordData[9]) != '鐩�' && String.valueOf(csvRecordData[9]) != '涓�') {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '鐨刡arcode ' +
+ // cod2Obj.Bar_Code__c +
+ // ' 鍑哄簱鍗曚綅涓嶆纭紝璇风‘璁ゃ��'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '鐨刡arcode ' + cod2Obj.Bar_Code__c + ' 鍑哄簱鍗曚綅涓嶆纭紝璇风‘璁ゃ��';
+ saveFLGbln = true;
+ messageCount++;
+ } else {
+ cod2Obj.Box_Piece__c = csvRecordData[9];
+ }
+ if (String.isBlank(csvRecordData[8])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else if (String.isNotBlank(csvRecordData[8])) {
+ if (
+ Decimal.valueOf(csvRecordData[8]) == 0 &&
+ (String.valueOf(csvRecordData[1]) == '鐩存帴閿�鍞粰鍖婚櫌' ||
+ String.valueOf(csvRecordData[1]) == '閿�鍞粰浜岀骇缁忛攢鍟�')
+ ) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '浜у搧鍑鸿揣鍗曚环涓嶈兘涓�0锛岃纭銆�'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '浜у搧鍑鸿揣鍗曚环涓嶈兘涓�0锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else {
+ cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
+ }
+ }
+ if (String.isBlank(csvRecordData[6])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '鐨勪骇鍝佷腑锛屽瓨鍦╞arcode涓虹┖锛岃纭銆�'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '鐨勪骇鍝佷腑锛屽瓨鍦╞arcode涓虹┖锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else if (String.isBlank(csvRecordData[12])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '鐨刡arcode ' +
+ // cod2Obj.Bar_Code__c +
+ // ' 涓嶅瓨鍦ㄦ垨涓嶆槸鍦ㄥ簱浜у搧锛岃纭銆�'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '鐨刡arcode ' + cod2Obj.Bar_Code__c + ' 涓嶅瓨鍦ㄦ垨涓嶆槸鍦ㄥ簱浜у搧锛岃纭銆�';
+ saveFLGbln = true;
+ messageCount++;
+ }
+ cod2Obj.Return_reason__c = csvRecordData[12];
+ if (String.isBlank(csvRecordData[11])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // cod2Obj.TracingCode__c +
+ // '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + cod2Obj.TracingCode__c + '鐨勪骇鍝佷腑锛屽瓨鍦ㄥ嚭搴撴棩鏈熶负绌猴紝璇风‘璁ゃ��';
+ saveFLGbln = true;
+ messageCount++;
+ } else {
+ cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim());
+ }
+ }
+ } catch (Exception e) {
+ //return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
+ }
+ }
+
+ public static void getorderdetinfo(List<String[]> csvRecordStr) {
+ map<string, string> orderdetMap = new Map<string, string>();
+ try {
+ for (Integer i = 1; i < csvRecordStr.size(); i++) {
+ Consumable_Orderdetails__c codObj = new Consumable_Orderdetails__c();
+ string[] csvRecordData = csvRecordStr[i];
+ if (orderdetMap.containsKey(csvRecordData[0] + csvRecordData[12]))
+ continue;
+ codObj.Remarks__c = csvRecordData[0];
+ if (String.isBlank(csvRecordData[7])) {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + csvRecordData[0] + '浜у搧鍑鸿揣鏁伴噺涓虹┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗� ' + csvRecordData[0] + '浜у搧鍑鸿揣鏁伴噺涓虹┖锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else if (Decimal.valueOf(csvRecordData[7]) > 1 && String.valueOf(csvRecordData[9]) == '鐩�') {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(
+ // ApexPages.severity.ERROR,
+ // '鍑哄簱鍗� ' +
+ // csvRecordData[0] +
+ // '瀛樺湪鍗曚綅鏄洅锛屼骇鍝佸嚭璐ф暟閲忓ぇ浜�1锛岃纭銆�'
+ // )
+ // );
+ errorMsg += '鍑哄簱鍗� ' + csvRecordData[0] + '瀛樺湪鍗曚綅鏄洅锛屼骇鍝佸嚭璐ф暟閲忓ぇ浜�1锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ } else {
+ codObj.Shipment_Count__c = Decimal.valueOf(csvRecordData[7]);
+ }
+ codObj.Box_Piece__c = csvRecordData[9];
+ if (String.isNotBlank(csvRecordData[8])) {
+ codObj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
+ } else {
+ if (messageCount >= 100)
+ break;
+ // ApexPages.addmessage(
+ // new ApexPages.message(ApexPages.severity.ERROR, '鍑哄簱鍗� ' + csvRecordData[0] + '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�')
+ // );
+ errorMsg += '鍑哄簱鍗� ' + csvRecordData[0] + '鍑哄簱鍗� ' + csvRecordData[0] + '浜у搧鍑鸿揣鍗曚环涓虹┖锛岃纭銆�<br />';
+ saveFLGbln = true;
+ messageCount++;
+ }
+ //if(String.isNotBlank(csvRecordData[10])){
+ // codObj.Unitprice_To_agency__c = Decimal.valueOf(csvRecordData[10]);
+ //}
+ codObj.Lose_reason__c = csvRecordData[12];
+ codObj.Used_date__c = Date.parse(csvRecordData[11].trim());
+ product2conMap.put(csvRecordData[12].trim(), csvRecordData[12].trim());
+ orderdetMap.put(csvRecordData[0] + csvRecordData[12], csvRecordData[0] + csvRecordData[12]);
+ //orderdetRecords.add(new ConsumableorderdetailsInfo(codObj));
+ }
+ } catch (Exception e) {
+ //return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
+ }
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC dataImport(
+ List<String[]> csvRecordStrLwc,
+ String orderRecordsLwc,
+ String sqlagencyProTypeLwc,
+ String userWorkLocationLwc,
+ String accountNameLwc,
+ String accountidLwc,
+ String agencyProTypeLwc,
+ Map<String, String> secondAgencyMapLwc,
+ Map<String, String> hospitalSysMapLwc
+ ) {
+ List<ConsumableorderdetailsInfo> orderdetRecords = new List<ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> orderdet2BoxRecords = new List<ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> orderdet2PieceRecords = new List<ConsumableorderdetailsInfo>();
+ product2conMap = new Map<String, String>();
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ csvRecordStr = csvRecordStrLwc;
+ orderRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(orderRecordsLwc, List<ConsumableorderdetailsInfo>.class);
+ System.debug('orderRecords = ' + orderRecords);
+ sqlagencyProType = sqlagencyProTypeLwc;
+ userWorkLocation = userWorkLocationLwc;
+ accountName = accountNameLwc;
+ secondAgencyMap = secondAgencyMapLwc;
+ hospitalSysMap = hospitalSysMapLwc;
+ accountid = accountidLwc;
+ agencyProType = agencyProTypeLwc;
+ System.debug('agencyProType = ' + agencyProType);
+
+ errorMsg = '';
+ System.debug('csvRecordStr = ' + csvRecordStr);
+ orderdetRecords = getorderdetList(csvRecordStr);
+ orderdet2BoxRecords = getorderdet2BoxList(csvRecordStr);
+ orderdet2PieceRecords = getorderdet2pieceList(csvRecordStr);
+ System.debug('orderdetRecords = ' + orderdetRecords);
+ System.debug('orderdet2BoxRecords = ' + orderdet2BoxRecords);
+ System.debug('orderdet2PieceRecords = ' + orderdet2PieceRecords);
+ Savepoint sp = Database.setSavepoint();
+ try {
+ Map<String, String> orderInfoMap = new Map<String, String>();
+ List<Consumable_order__c> coc = new List<Consumable_order__c>();
+ for (ConsumableorderdetailsInfo ass : orderRecords) {
+ ass.order.Order_type__c = '浼犵エ';
+ ass.order.SummonsStatus_c__c = '宸插畬鎴�';
+ ass.order.Order_ProType__c = agencyProType;
+ ass.order.Dealer_Info__c = accountid;
+ ass.order.Order_ForHospital__c = hospitalSysMap.get(ass.hospitalCode);
+ if (secondAgencyMap.containsKey(ass.agencyName)) {
+ ass.order.Order_ForDealer__c = secondAgencyMap.get(ass.agencyName);
+ } else {
+ ass.order.Order_ForDealerText__c = ass.agencyName;
+ }
+ ass.order.RecordTypeId = System.Label.RT_ConOrder_Sale;
+ coc.add(ass.order);
+ }
+ System.debug('coc = ' + coc);
+ if (coc.size() > 0) {
+ insert coc;
+ }
+ for (Consumable_order__c order : coc) {
+ orderInfoMap.put(order.Name, order.Id);
+ }
+ List<Consumable_Orderdetails__c> cod = new List<Consumable_Orderdetails__c>();
+ for (String field : orderInfoMap.keySet()) {
+ Integer i = 1;
+ for (ConsumableorderdetailsInfo ass : orderdetRecords) {
+ if (ass.orderName == field) {
+ String str = string.valueOf(i);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ ass.orderdetails1.Name = ass.orderName + '-' + str;
+ ass.orderdetails1.Consumable_order__c = orderInfoMap.get(ass.orderName);
+ ass.orderdetails1.Consumable_Product__c = ass.productName;
+ ass.orderdetails1.RecordTypeId = System.Label.RT_ConOrderDetail1_Sale;
+ cod.add(ass.orderdetails1);
+ i++;
+ }
+ }
+ }
+ System.debug('cod = ' + cod);
+ if (cod.size() > 0) {
+ insert cod;
+ }
+ //鐩掔殑鏁版嵁妫�绱�
+ List<Consumable_Order_details2__c> cod2List = new List<Consumable_Order_details2__c>();
+ List<Consumable_order_details2__c> cOrderDet = [
+ SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Box_Piece__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c IN :barcodeList
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Box_Piece__c = '鐩�'
+ ];
+ for (ConsumableorderdetailsInfo ass : orderdet2BoxRecords) {
+ Integer idx = 0;
+ for (Consumable_order_details2__c codtest : cOrderDet) {
+ Consumable_Order_details2__c cod2 = new Consumable_Order_details2__c();
+ if (codtest.Bar_Code__c == ass.orderdetails2.Bar_Code__c) {
+ cod2 = codtest;
+ cod2.Consumable_Sale_order__c = orderInfoMap.get(ass.orderName);
+ cod2.Consumable_ZS_order__c = orderInfoMap.get(ass.orderName);
+ cod2.Used_date__c = ass.orderdetails2.Used_date__c;
+ cod2.Send_Date__c = ass.orderdetails2.Send_Date__c;
+ //cod2.Unitprice_To_agency__c = ass.orderdetails2.Unitprice_To_agency__c;
+ cod2.Delivery_List_RMB__c = ass.orderdetails2.Delivery_List_RMB__c;
+ cod2List.add(cod2);
+ cOrderDet.remove(idx);
+ break;
+ }
+ idx++;
+ }
+ }
+
+ //涓殑鏁版嵁妫�绱�
+ List<Consumable_order_details2__c> cOrderDetPiece = [
+ SELECT Id, Bar_Code__c, RemoveBox_No__c, Name, Consumable_Product__c, Box_Piece__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Bar_Code__c IN :barcodePieceList
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Box_Piece__c = '涓�'
+ ORDER BY Bar_Code__c, RemoveBox_No__c DESC
+ ];
+ for (ConsumableorderdetailsInfo ass : orderdet2PieceRecords) {
+ Decimal idy = 1;
+ for (Integer idx = 0; idx < cOrderDetPiece.size(); idx++) {
+ Consumable_Order_details2__c cod2 = new Consumable_Order_details2__c();
+ if (cOrderDetPiece[idx].Bar_Code__c == ass.orderdetails2.Bar_Code__c && idy <= ass.pieceCount) {
+ cod2 = cOrderDetPiece[idx].Clone();
+ cod2.Id = cOrderDetPiece[idx].Id;
+ cod2.Consumable_Sale_order__c = orderInfoMap.get(ass.orderName);
+ cod2.Consumable_ZS_order__c = orderInfoMap.get(ass.orderName);
+ cod2.Used_date__c = ass.orderdetails2.Used_date__c;
+ cod2.Send_Date__c = ass.orderdetails2.Send_Date__c;
+ //cod2.Unitprice_To_agency__c = ass.orderdetails2.Unitprice_To_agency__c;
+ cod2.Delivery_List_RMB__c = ass.orderdetails2.Delivery_List_RMB__c;
+ cod2List.add(cod2);
+ cOrderDetPiece[idx].Bar_Code__c = '';
+ idy++;
+ //break;
+ }
+ }
+ }
+ if (cod2List.size() > 0) {
+ update cod2List;
+ }
+ errorflg = true;
+ //errorMessage = '淇濆瓨瀹屾垚銆�';
+ saveFLGbln = true;
+
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = errorMsg;
+ return res;
+ } catch (Exception e) {
+ Database.rollback(sp);
+ // ApexPages.addMessages(e);
+ // return null;
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getStackTraceString(), '');
+ }
+ }
+
+ public static List<ConsumableorderdetailsInfo> getorderdetList(List<String[]> csvRecordStr) {
+ List<ConsumableorderdetailsInfo> orderdetRecords = new List<ConsumableorderdetailsInfo>();
+ map<string, Decimal> orderdetMap = new Map<string, Decimal>();
+ try {
+ for (Integer i = 1; i < csvRecordStr.size(); i++) {
+ Consumable_Orderdetails__c codObj = new Consumable_Orderdetails__c();
+ string[] csvRecordData = csvRecordStr[i];
+ if (orderdetMap.containsKey(csvRecordData[0] + csvRecordData[12] + csvRecordData[9])) {
+ orderdetMap.put(
+ csvRecordData[0] +
+ csvRecordData[12] +
+ csvRecordData[9],
+ orderdetMap.get(csvRecordData[0] + csvRecordData[12] + csvRecordData[9]) + Decimal.valueOf(csvRecordData[7])
+ );
+ continue;
+ } else {
+ orderdetMap.put(csvRecordData[0] + csvRecordData[12] + csvRecordData[9], Decimal.valueOf(csvRecordData[7]));
+ }
+ codObj.Remarks__c = csvRecordData[0];
+ codObj.Shipment_Count__c = Decimal.valueOf(csvRecordData[7]);
+ codObj.Box_Piece__c = csvRecordData[9];
+ if (String.isNotBlank(csvRecordData[8])) {
+ codObj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
+ }
+ codObj.Lose_reason__c = csvRecordData[12];
+ if (String.isNotBlank(csvRecordData[11])) {
+ codObj.Used_date__c = Date.parse(csvRecordData[11].trim());
+ }
+ product2conMap.put(csvRecordData[12].trim(), csvRecordData[12].trim());
+ orderdetRecords.add(new ConsumableorderdetailsInfo(codObj));
+ }
+ for (ConsumableorderdetailsInfo ass : orderdetRecords) {
+ if (orderdetMap.containsKey(ass.orderName + ass.productName + ass.orderdetails1.Box_Piece__c)) {
+ ass.orderdetails1.Shipment_Count__c = orderdetMap.get(ass.orderName + ass.productName + ass.orderdetails1.Box_Piece__c);
+ }
+ }
+ System.debug('orderdetRecords = ' + orderdetRecords);
+ return orderdetRecords;
+ } catch (Exception e) {
+ // ApexPages.addMessages(e);
+ // return null;
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
+ System.debug('orderdetRecords = null ' + e.getLineNumber());
+ return null;
+ }
+ }
+
+ public static List<ConsumableorderdetailsInfo> getorderdet2BoxList(List<String[]> csvRecordStr) {
+ barcodeList = new List<String>();
+ List<ConsumableorderdetailsInfo> orderdet2BoxRecords = new List<ConsumableorderdetailsInfo>();
+ try {
+ for (Integer i = 1; i < csvRecordStr.size(); i++) {
+ string[] csvRecordData = csvRecordStr[i];
+ if (String.valueOf(csvRecordData[9]) == '鐩�') {
+ Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c();
+ cod2Obj.TracingCode__c = csvRecordData[0];
+ cod2Obj.Bar_Code__c = csvRecordData[6];
+ if (String.isNotBlank(csvRecordData[6])) {
+ barcodeList.add(csvRecordData[6]);
+ }
+ cod2Obj.Box_Piece__c = csvRecordData[9];
+ if (String.isNotBlank(csvRecordData[8])) {
+ cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
+ }
+ //if(String.isNotBlank(csvRecordData[10])){
+ // cod2Obj.Unitprice_To_agency__c = Decimal.valueOf(csvRecordData[10]);
+ //}
+ cod2Obj.Return_reason__c = csvRecordData[12];
+ if (String.valueOf(csvRecordData[1]) == '閿�鍞粰浜岀骇缁忛攢鍟�' || String.valueOf(csvRecordData[1]) == '鐩存帴閿�鍞粰鍖婚櫌') {
+ cod2Obj.Used_date__c = Date.parse(csvRecordData[11].trim());
+ } else {
+ cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim());
+ }
+ orderdet2BoxRecords.add(new ConsumableorderdetailsInfo(cod2Obj));
+ }
+ }
+ return orderdet2BoxRecords;
+ } catch (Exception e) {
+ // ApexPages.addMessages(e);
+ // return null;
+ errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
+ return null;
+ }
+ }
+
+ public static List<ConsumableorderdetailsInfo> getorderdet2pieceList(List<String[]> csvRecordStr) {
+ barcodePieceList = new List<String>();
+ List<ConsumableorderdetailsInfo> orderdet2PieceRecords = new List<ConsumableorderdetailsInfo>();
+ try {
+ for (Integer i = 1; i < csvRecordStr.size(); i++) {
+ string[] csvRecordData = csvRecordStr[i];
+ if (String.valueOf(csvRecordData[9]) == '涓�') {
+ Consumable_Order_details2__c cod2Obj = new Consumable_Order_details2__c();
+ cod2Obj.TracingCode__c = csvRecordData[0];
+ cod2Obj.Bar_Code__c = csvRecordData[6];
+ if (String.isNotBlank(csvRecordData[6])) {
+ barcodePieceList.add(csvRecordData[6]);
+ }
+ cod2Obj.Box_Piece__c = csvRecordData[9];
+ if (String.isNotBlank(csvRecordData[8])) {
+ cod2Obj.Delivery_List_RMB__c = Decimal.valueOf(csvRecordData[8]);
+ }
+ cod2Obj.Return_reason__c = csvRecordData[12];
+ if (String.valueOf(csvRecordData[1]) == '閿�鍞粰浜岀骇缁忛攢鍟�' || String.valueOf(csvRecordData[1]) == '鐩存帴閿�鍞粰鍖婚櫌') {
+ cod2Obj.Used_date__c = Date.parse(csvRecordData[11].trim());
+ } else {
+ cod2Obj.Send_Date__c = Date.parse(csvRecordData[11].trim());
+ }
+ cod2Obj.Rrturn_count__c = Decimal.valueOf(csvRecordData[7]);
+ orderdet2PieceRecords.add(new ConsumableorderdetailsInfo(cod2Obj));
+ }
+ }
+ return orderdet2PieceRecords;
+ } catch (Exception e) {
+ // ApexPages.addMessages(e);
+ // return null;
+ errorMsg += e.getMessage();
+ return null;
+ }
+ }
+
+ class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Consumable_order__c order { get; set; }
+ @AuraEnabled
+ public Consumable_orderdetails__c orderdetails1 { get; set; }
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public String orderName { get; set; }
+ @AuraEnabled
+ public String hospitalCode { get; set; }
+ @AuraEnabled
+ public String hospitalName { get; set; }
+ @AuraEnabled
+ public String agencyName { get; set; }
+ @AuraEnabled
+ public String productName { get; set; }
+ @AuraEnabled
+ public Decimal pieceCount { get; set; }
+ // 鍙栧埌鐨勮鍗曚俊鎭�
+ public ConsumableorderdetailsInfo(Consumable_order__c e) {
+ order = e;
+ hospitalCode = e.Order_Attachment__c;
+ hospitalName = e.Order_Indication__c;
+ agencyName = e.Invoice_Note__c;
+ e.Order_Attachment__c = '';
+ e.Order_Indication__c = '';
+ e.Invoice_Note__c = '';
+ }
+ // 鍙栧埌鐨勮鍗曟槑缁�
+ public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) {
+ orderdetails1 = e;
+ orderName = e.Remarks__c;
+ productName = e.Lose_reason__c;
+ e.Lose_reason__c = '';
+ e.Remarks__c = '';
+ }
+ // 鍙栧埌鐨勪骇鍝佹槑缁�
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ orderdetails2 = e;
+ orderName = e.TracingCode__c;
+ productName = e.Return_reason__c;
+ pieceCount = e.Rrturn_count__c;
+ e.TracingCode__c = '';
+ e.Return_reason__c = '';
+ e.Rrturn_count__c = null;
+ }
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexOutboundorderImportController.cls-meta.xml b/force-app/main/default/classes/LexOutboundorderImportController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexOutboundorderImportController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexOverdueStockController.cls b/force-app/main/default/classes/LexOverdueStockController.cls
new file mode 100644
index 0000000..adbaaa7
--- /dev/null
+++ b/force-app/main/default/classes/LexOverdueStockController.cls
@@ -0,0 +1,380 @@
+public with sharing class LexOverdueStockController {
+
+ /*****************妞滅储鐢�******************/
+ public static String barcode { get; set; }
+
+ // 杩囨湡鍜岄攢瀛�,鐢婚潰鏄剧ず鐢�
+ public static List<orderBean> codPageRecords { get; set; }
+
+ // 杩囨湡鍜岄攢瀛�,鐢婚潰鏄剧ず鐢�
+ public static List<orderBean> overduePageRecords { get; set; }
+
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+ //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
+ private static String agencyProType;
+ private static String sqlagencyProType;
+ // 缁忛攢鍟嗕俊鎭�
+ private static Account accountInfo;
+
+ //鍒ゆ柇鎿嶄綔浜哄憳鏄惁閿�瀛�
+ public static Boolean iSinventory = false;
+
+ public static List<Consumable_order_details2__c> overdueList = new List<Consumable_order_details2__c>();
+
+ public static Integer pageRecordsSize {
+ get {
+ return codPageRecords == null ? 0 : codPageRecords.size();
+ }
+ }
+
+ public LexOverdueStockController() {
+
+ }
+
+ // 鐢婚潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init() {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ codPageRecords = new List<orderBean>();
+ overduePageRecords = new List<orderBean>();
+ // 鑾峰彇鐢ㄦ埛鍜岀粡閿�鍟嗕俊鎭�
+ user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()];
+ userWorkLocation = Useracc.Work_Location__c;
+ agencyProType = Useracc.UserPro_Type__c;
+ if(String.isBlank(Useracc.UserPro_Type__c)){
+ agencyProType = 'ET';
+ }
+ sqlagencyProType = '%' + agencyProType + '%';
+ accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid];
+ // 杩囨湡搴撳瓨姹囨�讳俊鎭�
+ List<AggregateResult> orderDetZaiku = [SELECT count(Id) countsum,
+ Consumable_Product__c prodid,
+ Consumable_Product__r.Name_Text__c prodname,
+ Box_Piece__c boxPiece
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Dealer_Shipment__c = false
+ AND Dealer_Saled__c = false
+ AND Lose_Flag__c = false
+ AND Isoverdue__c = 0
+ AND Dealer_Returned__c = false
+ AND Cancellation_Flag__c = false
+ AND Bar_Code__c !=null
+ AND Product_Type__c like : sqlagencyProType
+ AND Dealer_Info_text__c = :accountInfo.Name
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ group by Consumable_Product__c,Box_Piece__c,Consumable_Product__r.Name_Text__c];
+
+ for(AggregateResult overdue : orderDetZaiku){
+ codPageRecords.add(new orderBean(overdue));
+ }
+
+ system.debug('codPageRecords====>'+codPageRecords);
+ data.put('codPageRecords',JSON.serialize(codPageRecords));
+ data.put('userWorkLocation',userWorkLocation);
+ data.put('accountName',accountInfo.Name);
+ data.put('agencyProType',agencyProType);
+ data.put('orderDetZaiku',JSON.serialize(orderDetZaiku));
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+
+ }
+
+ // BarCode褰曞叆
+ @AuraEnabled
+ public static ResponseBodyLWC searchorderBean(String agencyProTypeLWC,String userWorkLocationLWC,String accountNameLWC,String barcodeLWC,String codPageRecordsLWC){
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ List<orderBean> codPageRecords = (List<orderBean>)JSON.deserialize(codPageRecordsLWC,List<orderBean>.class);
+ sqlagencyProType = '%' + agencyProTypeLWC + '%';
+ system.debug('sqlagencyProType==>'+ sqlagencyProType);
+ barcode = barcodeLWC;
+ system.debug('barcode==>'+ barcode);
+ userWorkLocation = userWorkLocationLWC;
+ // add by Wang Xueqin 2023/04/12
+ // 鑾峰彇鐢ㄦ埛鍜岀粡閿�鍟嗕俊鎭�
+ user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()];
+ accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid];
+
+
+ iSinventory = true;
+ Set<String> barCodeoverdue = new Set<String>();
+ overduePageRecords = new List<orderBean>();
+ List<String> barCodeListP = ParseBarCode( barcode );
+ // 椤甸潰鏄剧ず鏁版嵁鍒濆鍖�
+ for (orderBean codPage : codPageRecords) {
+ codPage.pandian = 0;
+ }
+ // 鏌ヨ鎵�鏈夎繃鏈熷簱瀛�
+ List<Consumable_order_details2__c> orderDetZaiku = [select Id, Name,Consumable_Product__c,
+ Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c,
+ Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Sterilization_limit__c,
+ Bar_Code_search__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Dealer_Shipment__c = false
+ AND Dealer_Saled__c = false
+ AND Lose_Flag__c = false
+ AND Isoverdue__c = 0
+ AND Dealer_Returned__c = false
+ AND Cancellation_Flag__c = false
+ AND Bar_Code__c !=null
+ AND Product_Type__c like : sqlagencyProType
+ AND Dealer_Info_text__c = :accountInfo.Name
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation];
+ // 娌℃湁杈撳叆鏉$爜鏃讹紝寰幆椤甸潰锛屾墍鏈夋墦閽╀骇鍝佸叏閮ㄩ攢瀛�
+ // 鍙栧緱鎵�鏈�
+ overdueList = new List<Consumable_order_details2__c>();
+ if (String.isBlank(barcode)) {
+ System.debug('barcode绌�');
+ for(orderBean codPage : codPageRecords){
+ if (codPage.check) {
+ for(Consumable_order_details2__c cod2 : orderDetZaiku){
+ if(cod2.Consumable_Product__c == codPage.prodid && codPage.boxPiece == cod2.Box_Piece__c){
+ overduePageRecords.add(new orderBean(cod2,'杩囨湡搴撳瓨閿�瀛�'));
+ overdueList.add(cod2);
+ }
+ }
+ codPage.pandian = codPage.overlimitCount;
+ }
+ }
+ // return;
+ System.debug('overduePageRecords = ' + overduePageRecords);
+ data.put('overduePageRecords',JSON.serialize(overduePageRecords));
+ data.put('codPageRecords',JSON.serialize(codPageRecords));
+ data.put('iSinventory',iSinventory);
+ data.put('overdueList',overdueList);
+ res.status = 'Success';
+ res.code = 200;
+ // res.msg = '璇疯緭鍏arCode鍙�';
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // 杈撳叆barcode鏃�
+
+ // BarCode鐨勬绱� 鎵�鏈夊湪搴�
+ List<Consumable_order_details2__c> reSet = [select Id,Consumable_Product__c,
+ Consumable_Product__r.Name__c,Box_Piece__c,Bar_Code_search__c,
+ Dealer_Shipment__c,Dealer_Saled__c,Lose_Flag__c,Bar_Code__c,
+ Cancellation_Flag__c,Isoverdue__c,Sterilization_limit__c
+ from Consumable_order_details2__c
+ where Bar_Code_search__c in :BarCodeListP
+ AND Dealer_Arrive__c = true
+ AND Cancellation_Flag__c = false
+ and Dealer_Returned__c = false
+ and Bar_Code__c !=null
+ AND Product_Type__c like : sqlagencyProType
+ AND Arrive_Owner_Work_Location__c =: userWorkLocation
+ AND Dealer_Info_text__c = :accountInfo.Name
+ order by Name];
+
+ System.debug('reSet===>'+reSet);
+
+
+ for(Consumable_order_details2__c cod2 : reSet){
+ if ((cod2.Dealer_Shipment__c == false && cod2.Dealer_Saled__c == false
+ && cod2.Lose_Flag__c == false && cod2.Cancellation_Flag__c == false) && cod2.Isoverdue__c == 0) {
+ for (orderBean codPage : codPageRecords) {
+ if(cod2.Consumable_Product__c == codPage.prodid && cod2.Box_Piece__c == codPage.boxPiece){
+ overduePageRecords.add(new orderBean(cod2,'杩囨湡搴撳瓨閿�瀛�'));
+ overdueList.add(cod2);
+ codPage.pandian ++;
+ codPage.check = true;
+ }
+ }
+ }else if (cod2.Dealer_Shipment__c || cod2.Dealer_Saled__c) {
+ overduePageRecords.add(new orderBean(cod2,'浜у搧宸茬粡鍑哄簱'));
+ }else{
+ overduePageRecords.add(new orderBean(cod2,'涓嶆槸杩囨湡搴撳瓨'));
+ }
+ }
+ System.debug('overduePageRecords = ' + overduePageRecords);
+ data.put('overduePageRecords',JSON.serialize(overduePageRecords));
+ data.put('codPageRecords',JSON.serialize(codPageRecords));
+ data.put('iSinventory',iSinventory);
+ data.put('overdueList',overdueList);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+
+ // 淇濆瓨鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC save(Boolean iSinventory,string saveCodPageRecords,List<Consumable_order_details2__c> saveoverdueList) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ system.debug('saveCodPageRecords=============>'+saveCodPageRecords);
+ system.debug('saveoverdueList'+saveoverdueList);
+ overdueList = saveoverdueList;
+ // if(saveoverdueList==null){
+ // return new ResponseBodyLWC('Error',500, '璇烽�夋嫨瑕侀攢瀛樼殑鏄庣粏', '');
+
+ // }
+
+ List<orderBean> codPageRecords = (List<orderBean>)JSON.deserialize(saveCodPageRecords,List<orderBean>.class);
+ // List<Consumable_order_details2__c> overdueList = (List<Consumable_order_details2__c>)JSON.deserialize(saveoverdueList,List<Consumable_order_details2__c>.class);
+ // add by Wang Xueqin 2023/04/12
+ // 鑾峰彇鐢ㄦ埛鍜岀粡閿�鍟嗕俊鎭�
+ user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()];
+ accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid];
+
+ // 璺宠繃鏄庣粏2涓嶅繀瑕佹洿鏂�
+ StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
+ if(!iSinventory){
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇峰厛鐐广�怋arCode褰曞叆銆�'));
+ return new ResponseBodyLWC('Error',500, '璇峰厛褰曞叆BarCode', '');
+ // return null;
+ }
+ integer Lo = 0;
+ for(orderBean header : codPageRecords){
+ if(header.check==true){
+ Lo++;
+ }
+ }
+ if(Lo == 0){
+ iSinventory = false;
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇烽�夋嫨瑕侀攢瀛樼殑鏄庣粏銆�'));
+ return new ResponseBodyLWC('Error',500, '璇烽�夋嫨瑕侀攢瀛樼殑鏄庣粏', '');
+ // return null;
+ }
+ Integer orderDetNo = 1;
+ Savepoint sp = Database.setSavepoint();
+ Consumable_order__c po = new Consumable_order__c();
+ po.Name ='*';
+ po.Order_status__c = '鎵瑰噯';
+ po.Inventory_date__c = Date.today();
+ po.Order_type__c = '閿�瀛�';
+ po.Dealer_Info__c = accountInfo.Id;
+ po.Order_ProType__c = agencyProType;
+ po.RecordTypeid = System.Label.RT_ConOrder_Overdue;
+ try{
+ insert po;
+ Consumable_order__c order = [SELECT Name FROM Consumable_order__c WHERE id =:po.id];
+ List<Consumable_orderdetails__c> InsList = New List<Consumable_orderdetails__c>();
+ for(orderBean header : codPageRecords){
+ if(header.check==true){
+ Consumable_orderdetails__c insPan = new Consumable_orderdetails__c();
+ String str = string.valueOf(orderDetNo);
+ if(str.length() == 1){
+ str = '0' + str;
+ }
+ insPan.Name = order.Name + '-'+ str;
+ insPan.Consumable_Product__c = header.prodId;
+ insPan.Consumable_order__c = po.Id;
+ insPan.Lose_reason__c = '杩囨湡搴撳瓨閿�瀛�';
+ insPan.Overdue_count__c = header.pandian;
+ insPan.Overdue_SUM__c = header.overlimitCount;
+ insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
+ orderDetNo ++;
+ InsList.add(insPan);
+ }
+ }
+ // 鐢熸垚鏄庣粏1
+ if(InsList.size()>0){
+ insert InsList;
+ }
+
+ for(Consumable_order_details2__c cod : overdueList){
+ cod.Consumable_Inventory_order__c = po.Id;
+ cod.Inventory_date__c = Date.today();
+ cod.Lose_reason__c = '杩囨湡搴撳瓨閿�瀛�';
+ cod.Lose_Flag__c = true;
+
+ }
+ if(overdueList.size()>0){
+ ControllerUtil.updateOrderDetailsSatus(overdueList);
+ }
+
+ }catch (Exception ex) {
+ Database.rollback(sp);
+ ApexPages.addMessages(ex);
+ return null;
+ }
+ // return new Pagereference('/' + po.Id);
+ data.put('Id',po.Id);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
+ public static List<String> ParseBarCode(String Code){
+ Map<String,Integer> barcodeCountMap = new Map<String,Integer>();
+ String[] Cache = new String[]{};
+ Cache = Code.split('\n');
+ List <String> Buff = new List<String>();
+ for(String A : Cache){
+ A = A.trim().toUpperCase();
+ if(barcodeCountMap.containsKey(A)){
+ barcodeCountMap.put(A,barcodeCountMap.get(A) + 1);
+ }else{
+ barcodeCountMap.put(A,1);
+ }
+ Buff.add(A + barcodeCountMap.get(A));
+ }
+ return Buff;
+ }
+
+ // Data Bean
+ class orderBean implements Comparable {
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Boolean check { get; set; }
+
+ // 杩囨湡搴撳瓨
+ @AuraEnabled
+ public Integer overlimitCount { get; set; }
+ // 閿�瀛樻暟閲�
+ @AuraEnabled
+ public Integer pandian { get; set; }
+ // 閿�瀛樺師鍥�
+ @AuraEnabled
+ public String diffReason { get; set; }
+ // 鍗曚綅
+ @AuraEnabled
+ public String boxPiece { get; set; }
+ @AuraEnabled
+ public String prodname { get; set; }
+ @AuraEnabled
+ public String prodid { get; set; }
+ orderBean(Consumable_order_details2__c e,string str) {
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ DiffReason = str;
+ }
+ public orderBean(AggregateResult e) {
+ check = false;
+ overlimitCount = Integer.valueOf(e.get('countsum'));
+ prodname = String.valueOf(e.get('prodname'));
+ prodid = String.valueOf(e.get('prodid'));
+ boxPiece = String.valueOf(e.get('BoxPiece'));
+ pandian = 0;
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ orderBean compareToesd =(orderBean)compareTo;
+ Integer returnValue = 0;
+ if (overlimitCount > compareToesd.overlimitCount ) {
+ returnValue = -1;
+ } else if (overlimitCount < compareToesd.overlimitCount ) {
+ returnValue = 1;
+ }
+ return returnValue;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexOverdueStockController.cls-meta.xml b/force-app/main/default/classes/LexOverdueStockController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexOverdueStockController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexProductLimitEditController.cls b/force-app/main/default/classes/LexProductLimitEditController.cls
new file mode 100644
index 0000000..3a8ca5b
--- /dev/null
+++ b/force-app/main/default/classes/LexProductLimitEditController.cls
@@ -0,0 +1,61 @@
+public without sharing class LexProductLimitEditController {
+ public static String accountid { get; set; }
+ public static String product_Limit { get; set; }
+ //--------AddStart-----XHL--------------20180929-------------
+ public static String userPro_Type { get; set; }
+ public static Boolean EngFlag = false;
+ public static Boolean ETFlag = false;
+ //--------AddEnd-----XHL--------------20180929-------------
+ // 鐢婚潰鍒濆鍖�
+ public LexProductLimitEditController (){
+ accountid= ApexPages.currentPage().getParameters().get('accountid');
+ //--------AddStart-----XHL--------------20181008-------------
+ userPro_Type= ApexPages.currentPage().getParameters().get('userPro_Type');
+ if(String.isBlank(userPro_Type)){
+ userPro_Type = 'ET';
+ }
+ if(userPro_Type == 'ENG'){
+ EngFlag = true;
+ }else{
+ ETFlag = true;
+ }
+ //--------AddEnd-----XHL--------------20181008-------------
+ }
+ @AuraEnabled
+ public static ResponseBodyLWC init(String accountid,string userPro_Type) {
+ System.debug('userPro_Type==>'+userPro_Type);
+ System.debug('accountid==>'+accountid);
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String,object> data = new Map<String,object>();
+ res.entity = data;
+ if(String.isBlank(userPro_Type)){
+ userPro_Type = 'ET';
+ }
+ if(userPro_Type == 'ENG'){
+ EngFlag = true;
+ }else{
+ ETFlag = true;
+ }
+
+ List<Account> accinfo = New List<Account>();
+ //--------UpdateStart-----XHL--------------20181008-------------
+ accinfo = [SELECT Product_Limit_Date__c,Product_Limit_DateENG__c
+ FROM Account
+ WHERE id =:accountid];
+ if(accinfo.size() > 0){
+ if(EngFlag){
+ product_Limit = accinfo [0].Product_Limit_DateENG__c;
+ }else if(ETFlag){
+ product_Limit = accinfo [0].Product_Limit_Date__c;
+ }
+
+ }
+ System.debug('product_Limit==>'+product_Limit);
+ data.put('product_Limit',product_Limit);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ //--------UpdateEnd-----XHL--------------20181008-------------
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexProductLimitEditController.cls-meta.xml b/force-app/main/default/classes/LexProductLimitEditController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexProductLimitEditController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexRemoveBoxController.cls b/force-app/main/default/classes/LexRemoveBoxController.cls
new file mode 100644
index 0000000..8388cd6
--- /dev/null
+++ b/force-app/main/default/classes/LexRemoveBoxController.cls
@@ -0,0 +1,625 @@
+public without sharing class LexRemoveBoxController {
+ //缁忛攢鍟嗕骇鍝佸垎绫�
+ public static String agencyProType {get;set;}
+ public static String userPro_Typestr = null;
+ public static String barcode { get; set; }
+ /*****************鐢婚潰琛ㄧずBean******************/
+ public static List<ConsumableorderdetailsInfo> consumableInventory { get; set; }
+ //閿欒鏄庣粏
+ public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; }
+ //鎷嗙洅鏄庣粏
+ public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
+ public static boolean saveFLGbln {get;set;}
+ //閿欒淇℃伅
+ public static String alertMessage {set;get;}
+ //鎷嗙洅鏄庣粏浠舵暟
+ public static integer getinventorysize(){
+ return ConsumableorderdetailsRecordsdummy.size();
+ }
+ public static Map<String, String> ExistIdMap = new Map<String, String>();
+ public static Map<String, String> ErrorIdMap = new Map<String, String>();
+ 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;}
+ private static String accountid = null;
+ private static String accountName = null;
+ //public String[] proidList =new String[]{};
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+
+ public LexRemoveBoxController(){
+ baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
+ consumableInventory = new List<ConsumableorderdetailsInfo>();
+ saveFLGbln = FALSE;
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC init() {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ 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];
+ accountid = Useracc[0].accountid;
+ userWorkLocation = Useracc[0].Work_Location__c;
+ agencyProType = 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];
+ //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);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
+ public static List<String> ParseBarCode(String Code){
+ String[] Cache = new String[]{};
+ Cache = Code.split('\n');
+ Set <String> Buff = new Set<String>();
+ for(String A : Cache){
+ Buff.add(A);
+ }
+ List<String> outPut = new List<String>();
+ for(String B :Buff){
+ B = B.trim();
+ outPut.add(B);
+ }
+ return outPut;
+ }
+
+ //鑾峰彇鏄庣粏
+ @AuraEnabled
+ public static ResponseBodyLWC searchConsumableorderdetails(String barcode,String accountName,String userWorkLocation,String agencyProType) {
+
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String,object> data = new Map<String,object>();
+ res.entity = data;
+ userPro_Typestr = '%' + agencyProType + '%';
+ barcode = barcode;
+ accountName = accountName;
+ userWorkLocation = userWorkLocation;
+ ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
+
+
+
+ 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> reSet = new List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
+
+ saveFLGbln = false;
+ alertMessage='';
+
+ //鍒ゆ柇barcode鏄惁涓虹┖
+ if(barcode == null || barcode ==''){
+ return new ResponseBodyLWC('Error',500, '璇疯緭鍏arCode鍙�', '');
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��'));
+ // return;
+ }
+
+ // ExistIdMap.clear();
+ // ErrorIdMap.clear();
+ // notInlist.clear();
+ // ConsumableorderdetailsRecordserror.clear();
+ // 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){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ 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);
+ }
+ }
+ }
+ //鏈埌璐�
+ 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)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佹湭鍒拌揣,涓嶈兘鎷嗙洅';
+ 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){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佽鏍间负1,涓嶈兘鎷嗙洅';
+ 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){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸凡鍑鸿揣';
+ 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){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸凡閿�鍞�';
+ 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){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸凡鎷嗙洅';
+ 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){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }else{
+ String str = '璇ュ晢鍝佸凡缁忓彇娑�,涓嶈兘鎷嗙洅';
+ 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){
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }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);
+ }
+ }
+ }
+
+
+
+ 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) ){
+ // 璺宠繃閿欒鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }
+ else if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) ){
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ }
+ else{
+ ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
+ 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])){
+ continue;
+ }else if(ErrorIdMap.containsKey(BarCodeListP[i])){
+ continue;
+ }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 + '涓嶅瓨鍦�', '');
+ }
+
+
+ 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) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ 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);
+
+
+
+
+ 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, '涓嶅瓨鍦ㄦ媶鐩掓槑缁�', '');
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'涓嶅瓨鍦ㄦ媶鐩掓槑缁�'));
+ // return null;
+ }
+
+ List<String> BarCodeList = new List<String>();
+ for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) {
+ BarCodeList.add(tmp.esd.Bar_Code__c);
+ }
+
+ 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
+ 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
+ ];
+
+ 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;
+ Consumable_order_details2__c delDetails2 = new Consumable_order_details2__c();
+ delDetails2.Id = detail2tmp.Id;
+
+ //鍒犻櫎鎷嗙洅鍓嶅湪搴�
+ //delete delDetails2;
+ orderDetails2del.add(delDetails2);
+
+ for(integer i=0; i < num; i++){
+ Consumable_order_details2__c insertDetails2 = new Consumable_order_details2__c();
+ insertDetails2 = detail2tmp.clone();
+
+ insertDetails2.Id = null;
+ //鍗曚綅锛堢洅/涓級
+ insertDetails2.Box_Piece__c = '涓�';
+ //鎷嗙洅鐣彿
+ insertDetails2.RemoveBox_No__c = i+1;
+ //鎷嗙洅鏃ユ湡
+ 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;
+ }
+ // tcm end
+ //鐧诲綍鎷嗙洅鍚庡湪搴�
+ //insert insertDetails2;
+ orderDetails2ins.add(insertDetails2);
+ }
+ }
+
+ if (orderDetails2del.size()>0){
+ delete orderDetails2del;
+ }
+
+ if(orderDetails2ins.size()>0){
+ insert orderDetails2ins;
+
+ }
+
+ saveFLGbln = true;
+ alertMessage = '鎷嗙洅瀹屾垚';
+ data.put('saveFLGbln',saveFLGbln);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = alertMessage;
+ System.debug('res = ' + res);
+ return res;
+ // return null;
+ }catch(Exception e){
+ Database.rollback(sp);
+ ApexPages.addMessages(e);
+ return null;
+ }
+ }
+
+
+ class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Consumable_order_details2__c esd { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ //public String ProductName { get; set; }
+ //public Boolean canSELECT { get; set; }
+ //public String barCodeNo { get; set; }
+ //public Date sterilizationlimitDate { get; set; }
+ //public String serialNoorLotNo { get; set; }
+ //public String tracingCodeNo { get; set; }
+ @AuraEnabled
+ 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;
+ oldConsumableCount = e.name;
+ ErrorReason = str;
+ }
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ 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;
+ Prod = e;
+ barCodeNo = barCode;
+ sterilizationlimitDate = sterilizationlimit;
+ serialNoorLotNo = serialNoorLot;
+ tracingCodeNo = tracingCode;
+ }
+
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) {
+ //esd = new Consumable_order_details2__c();
+ Prod = e.Consumable_Product__r;
+ //ProductName = productName;
+ barCodeNo = barCode;
+ sterilizationlimitDate = sterilizationlimit;
+ serialNoorLotNo = serialNoorLot;
+ tracingCodeNo = tracingCode;
+ }
+*/
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexRemoveBoxController.cls-meta.xml b/force-app/main/default/classes/LexRemoveBoxController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexRemoveBoxController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexSaleAndDeliveryController.cls b/force-app/main/default/classes/LexSaleAndDeliveryController.cls
new file mode 100644
index 0000000..6f07385
--- /dev/null
+++ b/force-app/main/default/classes/LexSaleAndDeliveryController.cls
@@ -0,0 +1,262 @@
+public with sharing class LexSaleAndDeliveryController {
+ // 鏄剧ず鏁版嵁鏉℃暟闄愬埗
+ private static Integer Select_Limit = 100;
+
+ //鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init() {
+ try {
+ System.debug('init');
+ //缁忛攢鍟唅d
+ String accountid = '';
+ //缁忛攢鍟嗕骇鍝佸垎绫�
+ String agencyProType = '';
+ //鐧诲綍鐢ㄦ埛 ID
+ String userinfoId = '';
+ //鐧诲綍鑰呭伐浣滃湴
+ String userWorkLocation = '';
+
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ 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];
+ accountid = Useracc[0].accountid;
+ agencyProType = 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
+ );
+ //榛樿妫�绱㈡樉绀烘湭瀹屾垚鐨勬寚绀哄崟
+ 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);
+ System.debug('raesList = ' + raesList);
+ data.put('raesList', raesList);
+ res.status = 'Success';
+ res.code = 200;
+ res.msg = '';
+ return res;
+ } catch (Exception e) {
+ 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
+ ) {
+ try {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ 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 Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ if (!String.isBlank(category1)) {
+ soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' ';
+ }
+ if (!String.isBlank(category2)) {
+ soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' ';
+ }
+ if (cate2 != null) {
+ soql += ' and Outbound_Date__c >= :cate2 ';
+ }
+ if (cate3 != null) {
+ soql += ' and Outbound_Date__c <= :cate3 ';
+ }
+ soql += 'and SummonsForDirction__c != \'' + '浜掔浉璋冭揣' + '\' ';
+ soql += 'and SummonsStatus_c__c = \'' + '宸插畬鎴�' + '\' ';
+ soql += 'and Billed_Status__c != \'' + '鍏ㄩ儴寮�绁�' + '\' ';
+ soql += 'order by CreatedDate desc limit ' + Select_Limit;
+ 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(), '');
+ }
+ }
+
+ //杩樻病鍑哄簱鐨勫嚭搴撳崟
+ @AuraEnabled
+ 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>();
+ 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 Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ if (!String.isBlank(category1)) {
+ soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' ';
+ }
+ if (!String.isBlank(category2)) {
+ soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' ';
+ }
+ if (cate2 != null) {
+ soql += ' and Order_date__c >= :cate2 ';
+ }
+ if (cate3 != null) {
+ soql += ' and Order_date__c <= :cate3 ';
+ }
+ soql += 'and SummonsStatus_c__c != \'' + '宸插畬鎴�' + '\' ';
+ 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) {
+ 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(), '');
+ }
+ }
+
+ // 宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�
+ @AuraEnabled
+ 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>();
+ 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 Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+ if (!String.isBlank(category1)) {
+ soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' ';
+ }
+ if (!String.isBlank(category2)) {
+ soql += ' and ShipmentAccount__c like \'%' + String.escapeSingleQuotes(category2.replaceAll('%', '\\%')) + '%\' ';
+ }
+ if (cate2 != null) {
+ soql += ' and Outbound_Date__c >= :cate2 ';
+ }
+ if (cate3 != null) {
+ soql += ' and Outbound_Date__c <= :cate3 ';
+ }
+ soql += 'and SummonsStatus_c__c = \'' + '宸插畬鎴�' + '\' ';
+ soql += 'and Billed_Status__c = \'' + '鍏ㄩ儴寮�绁�' + '\' ';
+ soql += 'order by CreatedDate desc limit ' + Select_Limit;
+ 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(), '');
+ }
+ }
+
+ @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
diff --git a/force-app/main/default/classes/LexSaleAndDeliveryController.cls-meta.xml b/force-app/main/default/classes/LexSaleAndDeliveryController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexSaleAndDeliveryController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexSaleOrderController.cls b/force-app/main/default/classes/LexSaleOrderController.cls
new file mode 100644
index 0000000..d967cc7
--- /dev/null
+++ b/force-app/main/default/classes/LexSaleOrderController.cls
@@ -0,0 +1,1310 @@
+public without sharing class LexSaleOrderController {
+ public static boolean isRunning = false;
+ public static String barcode { get; set; }
+ public static Consumable_order__c coc { get; set; }
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; }
+ @AuraEnabled
+ public static List<Consumable_order_details2__c> consumableorderdetails2Nobox { get; set; }
+ @AuraEnabled
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror { get; set; }
+ public static Map<String, String> existIdMap { get; set; }
+ public static Map<String, String> errorIdMap { get; set; }
+ public static Map<String, String> allMap { get; set; }
+ public static Map<String, String> orderpieceorboxMap { get; set; }
+ public static Map<String, Decimal> orderpriceMap { get; set; }
+ public static Map<String, Decimal> orderagencypriceMap { get; set; }
+ public static Map<String, Decimal> orderdetCountMap { get; set; }
+ public static Map<String, Integer> BarcodeCntMap { get; set; }
+ public static String baseUrl { get; private set; }
+ public static String ESetId { get; set; }
+ public static String accountName { get; set; }
+ public static String userWorkLocation { get; set; }
+ public static Boolean hasSpecialHos { get; set; }
+ public static Map<String, Integer> msiMap { get; set; }
+ public static List<Consumable_orderdetails__c> orderdetails { get; set; }
+ public static String accountid { get; set; }
+
+ @AuraEnabled
+ public static ResponseBodyLWC GoodsDeliveryInit(String ESetId) {
+ System.debug('LexSaleOrderController GoodsDeliveryInit');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ String UserName = UserInfo.getUserId();
+ user useracc = [SELECT Accountid, Work_Location__c FROM user WHERE id = :UserName];
+ accountid = useracc.Accountid;
+ userWorkLocation = useracc.Work_Location__c;
+ Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
+ accountName = accountInfo.Name;
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ coc = new Consumable_order__c();
+ List<Consumable_order_details2__c> arriveDat = new List<Consumable_order_details2__c>();
+ orderpieceorboxMap = new Map<String, String>();
+ orderdetails = new List<Consumable_orderdetails__c>();
+ orderagencypriceMap = new Map<String, Decimal>();
+ orderpriceMap = new Map<String, Decimal>();
+ orderdetCountMap = new Map<String, Decimal>();
+ if (String.isNotBlank(ESetId)) {
+ coc = [
+ SELECT
+ Id,
+ Name,
+ NoConfirmedPrice__c,
+ Order_ForDealer__r.Name,
+ Summons_Order_type__c,
+ Order_status__c,
+ Dealer_Info__c,
+ Dealer_Info__r.Name,
+ SummonsStatus_c__c,
+ Deliver_date__c,
+ Order_Reason__c,
+ Order_date__c,
+ Order_ForHospital__c,
+ SummonsForDirction__c,
+ Arrive_Order__c,
+ Arrive_Order__r.IsShipment__c,
+ Outbound_Date__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_ForCustomerText__c,
+ OutPattern__c
+ FROM Consumable_order__c
+ WHERE Id = :ESetId
+ ];
+ // update end by vivek 2019-7-16
+ if (coc.Arrive_Order__c != null) {
+ arriveDat = [
+ SELECT
+ Id,
+ Name,
+ recordtypeid,
+ Used_account__c,
+ Product_Pattern__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,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Guarantee_period_for_products__c,
+ Box_Piece__c,
+ // gzw add 20210308 鎶ラ敊淇
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE Consumable_ZS_order__c = :ESetId
+ ];
+ for (Integer j = 0; j < arriveDat.size(); j++) {
+ consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(arriveDat[j]));
+ }
+ }
+
+ orderdetails = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__c,
+ Consumable_product__r.Name,
+ Shipment_Count__c,
+ Box_Piece__c,
+ Delivery_List_RMB__c,
+ Unitprice_To_agency__c,
+ isOutPattern__c
+ FROM Consumable_orderdetails__c
+ WHERE Consumable_order__c = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation
+ ];
+
+ for (Integer i = 0; i < orderdetails.size(); i++) {
+ orderpieceorboxMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Box_Piece__c);
+ if (orderdetails[i].Unitprice_To_agency__c != null && orderdetails[i].Unitprice_To_agency__c != 0) {
+ orderagencypriceMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Unitprice_To_agency__c);
+ }
+ orderpriceMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Delivery_List_RMB__c);
+ orderdetCountMap.put(orderdetails[i].Product_Pattern__c, orderdetails[i].Shipment_Count__c);
+ }
+ List<hospitalprice__c> hlist = [
+ SELECT id
+ FROM hospitalprice__c
+ WHERE hospital__c = :coc.ShipmentAccount__c AND account__c = :accountid
+ ];
+ if (hlist == null || hlist.size() == 0) {
+ hasSpecialHos = false;
+ } else {
+ hasSpecialHos = true;
+ }
+ }
+ data.put('consumableorderdetailsRecords', consumableorderdetailsRecords);
+ data.put('consumableorderdetailsRecordserror', consumableorderdetailsRecordserror);
+ data.put('coc', coc);
+ data.put('accountName', accountName);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('accountid', accountid);
+ data.put('orderdetails', orderdetails);
+ data.put('orderpieceorboxMap', orderpieceorboxMap);
+ data.put('orderpriceMap', orderpriceMap);
+ data.put('orderagencypriceMap', orderagencypriceMap);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC SearchPro(
+ Consumable_order__c cocLwc,
+ String barcodeLwc,
+ String accountName,
+ String userWorkLocation,
+ String accountid,
+ List<Consumable_orderdetails__c> orderdetails,
+ Map<String, String> orderpieceorboxMap
+ ) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ coc = cocLwc;
+ orderdetails = orderdetails;
+ barcode = barcodeLwc;
+ accountName = accountName;
+ userWorkLocation = userWorkLocation;
+ accountid = accountid;
+ orderdetails = orderdetails;
+ orderpieceorboxMap = orderpieceorboxMap;
+ //鍒ゆ柇鏄惁鍜岃鍗曡仈鍔�
+ if (coc.Arrive_Order__c != null) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'鏃犻渶鍒拌揣纭锛岃鐩存帴鍑哄簱銆�'));
+ // return;
+ return new ResponseBodyLWC('Error', 500, '鏃犻渶鍒拌揣纭锛岃鐩存帴鍑哄簱', '');
+ }
+ //鍒ゆ柇barcode鏄惁涓虹┖
+ if (barcode == null || barcode == '') {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭BarCode鍙枫��'));
+ // return;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭BarCode鍙�', '');
+ }
+ list<String> exitlist = new List<String>();
+ list<String> notexitlist = new List<String>();
+ existIdMap = new Map<String, String>();
+ errorIdMap = new Map<String, String>();
+ allMap = new Map<String, String>();
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+ List<String> barCodeListP = new List<String>();
+ List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
+ List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
+
+ //BarCodelist鍋氭垚
+ barCodeListP = ParseBarCode(barcode);
+ //閽堝鎵�鏈夊晢鍝佸埌璐х‘璁�
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ recordtypeid,
+ Used_account__c,
+ Product_Pattern__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,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Guarantee_period_for_products__c,
+ hospitalSpecialOffer__c,
+ exchangeOutPattern__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Returned__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c IN :barCodeListP
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY RemoveBox_No__c DESC
+ ];
+ List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
+ Set<Id> proIds = new Set<Id>();
+
+ for (String barcode : barCodeListP) {
+ Integer idx = 0;
+ for (Consumable_order_details2__c cod2 : reSet1) {
+ if (cod2.Bar_Code__c == barcode) {
+ newdet2.add(cod2);
+ reSet1.remove(idx);
+ proIds.add(cod2.Consumable_product__c);
+ break;
+ }
+ idx++;
+ }
+ }
+ Map<String, String> proHosMap = new Map<String, String>();
+ Map<String, String> proIdMap = new Map<String, String>();
+ List<hospitalprice__c> hpList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid];
+ if (hpList != null && hpList.size() > 0) {
+ for (hospitalprice__c hp : hpList) {
+ if (hp.product__c != null && String.valueof(hp.product__c).length() >= 15) {
+ proIdMap.put(('' + hp.product__c).subString(0, 15) + '鏄�', '');
+ if (hp.hospital__c == coc.Order_ForHospital__c) {
+ proHosMap.put(('' + hp.product__c).subString(0, 15) + '鏄�', '');
+ }
+ }
+ }
+ }
+ for (Integer i = 0; i < orderdetails.size(); i++) {
+ for (Integer j = 0; j < newdet2.size(); j++) {
+ if (
+ newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c &&
+ newdet2[j].Box_Piece__c != orderdetails[i].Box_Piece__c
+ ) {
+ String str = '璇ュ晢鍝佸嚭璐у崟浣嶉敊璇�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ }
+ if (coc.OutPattern__c == true) {
+ if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c) {
+ //add by rentx 2021-03-22 start
+ if (newdet2[j].exchangeOutPattern__c == true) {
+ //濡傛灉褰撳墠缁忛攢鍟嗕笅娌℃湁缁存姢瀵瑰簲鐨勭壒浠蜂骇鍝� 鎶ラ敊
+ if (!proIdMap.containsKey(newdet2[j].Product_Pattern__c)) {
+ String str = '娌℃湁缁存姢璇ヤ骇鍝佺殑鐗逛环鍖婚櫌';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ }
+ }
+ //add by rentx 2021-03-22 end
+
+ if (hpList != null && hpList.size() > 0) {
+ if (proHosMap.containsKey(newdet2[j].Product_Pattern__c)) {
+ continue;
+ } else if (!proIdMap.containsKey(newdet2[j].Product_Pattern__c)) {
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸嚭搴撳尰闄㈤敊璇�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //绠$悊缂栫爜涓虹┖鏃讹紝鎶ラ敊
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__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,
+ Box_Piece__c,
+ Arrive_Owner_Work_Location__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Bar_Code__c IN :barCodeListP
+ AND Bar_Code__c != NULL
+ AND Dealer_Arrive__c = TRUE
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND (TracingCode__c = NULL
+ OR TracingCode__c = '')
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ヤ骇鍝佹病鏈夌鐞嗙紪鐮侊紝鏃犳硶鍑哄簱锛岃涓庣壒绾︾粡閿�鍟嗙鐞嗛儴浜哄憳鑱旂郴锛屼慨姝f暟鎹�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__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,
+ Box_Piece__c,
+ Arrive_Owner_Work_Location__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Bar_Code__c IN :barCodeListP
+ AND Bar_Code__c != NULL
+ AND Dealer_Arrive__c = TRUE
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Cancellation_Flag__c = TRUE
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸凡缁忓彇娑�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+
+ //涓嶆槸鏈嚭搴撳崟鐨勫嚭搴撲骇鍝�
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__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,
+ Box_Piece__c,
+ Arrive_Owner_Work_Location__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Bar_Code__c IN :barCodeListP
+ AND Bar_Code__c != NULL
+ AND Dealer_Arrive__c = TRUE
+ 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) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else if (!orderpieceorboxMap.containsKey(reSet1[i].Product_Pattern__c)) {
+ String str = '涓嶆槸鏈嚭搴撳崟鐨勫嚭搴撲骇鍝�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__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,
+ Box_Piece__c,
+ Dealer_Info_text__c,
+ Arrive_Owner_Work_Location__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Bar_Code__c IN :barCodeListP
+ AND Bar_Code__c != NULL
+ AND Dealer_Arrive__c = TRUE
+ AND ((Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c != :userWorkLocation)
+ OR Dealer_Info_text__c != :accountName)
+ AND Cancellation_Flag__c = FALSE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ // 褰撳墠缁忛攢鍟嗘槸鍚﹀瓨鍦ㄦ浜у搧鍒ゆ柇
+ boolean containsFlg = false;
+ for (Consumable_order_details2__c cod2 : newdet2) {
+ if (cod2.Bar_Code__c == reSet1[i].Bar_Code__c) {
+ containsFlg = true;
+ break;
+ }
+ }
+ if (containsFlg == false) {
+ String str = '璇ュ晢鍝佹槸' + reSet1[i].Arrive_Owner_Work_Location__c + '鐨勫簱瀛�';
+ if (reSet1[i].Dealer_Info_text__c != accountName) {
+ str = '璇ュ晢鍝佸湪鍏朵粬缁忛攢鍟嗗簱瀛�';
+ }
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ }
+
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__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,
+ Box_Piece__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Saled__c = TRUE
+ AND Box_Piece__c = '鐩�'
+ AND Dealer_Info_text__c = :accountName
+ AND Dealer_Returned__c = FALSE
+ AND Bar_Code__c IN :barCodeListP
+ 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) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸凡缁忛攢鍞�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__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,
+ Box_Piece__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Shipment__c = TRUE
+ AND Box_Piece__c = '鐩�'
+ AND Dealer_Info_text__c = :accountName
+ AND Dealer_Returned__c = FALSE
+ AND Bar_Code__c IN :barCodeListP
+ 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) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸凡缁忓嚭搴�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__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,
+ Box_Piece__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Lose_Flag__c = TRUE
+ AND Box_Piece__c = '鐩�'
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c IN :barCodeListP
+ 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) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸凡缁忎涪澶�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ reSet = [
+ SELECT
+ Id,
+ Name,
+ recordtypeid,
+ Used_account__c,
+ Product_Pattern__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,
+ Consumable_order_minor__r.Arrive_Order__c,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Guarantee_period_for_products__c,
+ TracingCode__c,
+ Transfer_Time__c,
+ Frist_Transfer_Agency__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Dealer_Returned__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c IN :barCodeListP
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY RemoveBox_No__c DESC
+ ];
+ //瀵瑰簲褰曞叆barcode鏁伴噺鐨勬绱㈢粨鏋�
+ newdet2 = new List<Consumable_order_details2__c>();
+ for (String barcode : barCodeListP) {
+ Integer idx = 0;
+ for (Consumable_order_details2__c cod2 : reSet) {
+ if (cod2.Bar_Code__c == barcode) {
+ newdet2.add(cod2);
+ reSet.remove(idx);
+ break;
+ }
+ idx++;
+ }
+ }
+ Map<String, String> checkBarcodeResult = new Map<String, String>();
+ for (Integer i = 0; i < orderdetails.size(); i++) {
+ Integer a = 0;
+ for (Integer j = 0; j < newdet2.size(); j++) {
+ if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c && a < orderdetails[i].Shipment_Count__c) {
+ if (
+ (existIdMap.containsKey(newdet2[j].Bar_Code__c) && newdet2[j].Bar_Code__c == '鐩�') ||
+ errorIdMap.containsKey(newdet2[j].Bar_Code__c)
+ ) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else if (newdet2[j].Isoverdue__c == 0) {
+ String str = '璇ュ晢鍝佸凡缁忚秴鍑哄噺鑿屾湁鏁堟湡鐨勬湁鏁堣寖鍥�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ } else if (newdet2[j].Box_Piece__c != orderdetails[i].Box_Piece__c) {
+ String str = '璇ュ晢鍝佸嚭璐у崟浣嶉敊璇�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ } else if (!checkBarcodeResult.containsKey(newdet2[j].Bar_Code__c)) {
+ Matcher n = Pattern.compile('[0-9]').matcher(newdet2[j].TracingCode__c);
+ if (n.find()) {
+ if (newdet2[j].TracingCode__c.length() == 5) {
+ String tr = newdet2[j].TracingCode__c;
+ String Ctr = tr.substring(tr.length() - 3,tr.length());
+ String Btr = tr.substring(tr.length() - 4,tr.length()-3);
+ String Atr = tr.substring(tr.length() - 5,tr.length()-4);
+ if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) {
+ String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j],str));
+ errorIdMap.put(newdet2[j].Bar_Code__c,newdet2[j].Bar_Code__c);
+ continue;
+ }
+ }
+ // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
+ // consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ // errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ // continue;
+ }
+ checkBarcodeResult.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(newdet2[j]));
+ a++;
+ existIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ }
+ } else if (newdet2[j].Product_Pattern__c == orderdetails[i].Product_Pattern__c) {
+ if (a >= orderdetails[i].Shipment_Count__c && orderdetails[i].Box_Piece__c == '涓�') {
+ // 璺宠繃瓒呰繃鏁伴噺鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else if (errorIdMap.containsKey(newdet2[j].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ //CHAN-C23BWX update by rentx 2021-04-28 start
+ // String str = '璇ュ晢鍝佽秴鍑鸿璐ф暟閲�';
+ String str = '璇ヤ骇鍝佽秴鍑哄嚭搴撳崟浜у搧鑼冨洿';
+ //CHAN-C23BWX update by rentx 2021-04-28 end
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+ errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+ }
+ }
+ }
+ }
+
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__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,
+ Box_Piece__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Bar_Code__c IN :barCodeListP
+ AND Dealer_Arrive__c = FALSE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Dealer_Info_text__c = :accountName
+ AND ((Consumable_order_minor__c != NULL
+ AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
+ OR (Consumable_order_minor__c = NULL
+ AND Cancellation_Flag__c = FALSE))
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佹湭鍒拌揣纭';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+
+ allMap.putAll(errorIdMap);
+ allMap.putAll(existIdMap);
+ //寰楀埌涓嶅瓨鍦ㄧ殑BarCode
+ for (Integer i = 0; i < barCodeListP.size(); i++) {
+ if (allMap.containsKey(barCodeListP[i])) {
+ continue;
+ } else {
+ exitlist.add(barCodeListP[i]);
+ }
+ }
+ reSet1 = [
+ SELECT
+ Id,
+ Name,
+ Product_Pattern__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,
+ Box_Piece__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE (Dealer_Saled__c = TRUE OR Dealer_Shipment__c = TRUE) AND Dealer_Returned__c = FALSE AND Bar_Code__c IN :exitlist
+ ORDER BY Name
+ ];
+ if (reSet1.size() > 0) {
+ for (Integer i = 0; i < reSet1.size(); i++) {
+ if (errorIdMap.containsKey(reSet1[i].Bar_Code__c) || existIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+ // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+ continue;
+ } else {
+ String str = '璇ュ晢鍝佸凡缁忓嚭璐�';
+ consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+ errorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+ }
+ }
+ }
+ allMap.putAll(errorIdMap);
+ for (Integer i = 0; i < barCodeListP.size(); i++) {
+ if (allMap.containsKey(barCodeListP[i])) {
+ continue;
+ } else {
+ notexitlist.add(barCodeListP[i]);
+ }
+ }
+ if (notexitlist.size() > 0) {
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notexitlist + '涓嶅瓨鍦ㄣ��'));
+ return new ResponseBodyLWC('Error', 500, 'BarCode鍙�' + notexitlist + '涓嶅瓨鍦ㄣ��', '');
+ }
+ data.put('consumableorderdetailsRecords', consumableorderdetailsRecords);
+ data.put('consumableorderdetailsRecordserror', consumableorderdetailsRecordserror);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // 鍘荤殑椤甸潰涓婄殑barcode锛岃浆鎹㈡垚List
+ public static List<String> ParseBarCode(String Code) {
+ String[] Cache = new List<String>{};
+ Cache = Code.split('\n');
+ List<String> Buff = new List<String>();
+ for (String A : Cache) {
+ A = A.trim();
+ Buff.add(A.toUpperCase());
+ }
+ return Buff;
+ }
+
+ // 鍑鸿揣
+ @AuraEnabled
+ public static ResponseBodyLWC ProdElivery(
+ String ESetIdLwc,
+ Consumable_order__c cocLwc,
+ String barcodeLwc,
+ String accountNameLwc,
+ String userWorkLocationLwc,
+ String consumableorderdetailsRecordsLwc,
+ List<Consumable_orderdetails__c> orderdetailsLwc,
+ Map<String, Decimal> orderpriceMapLwc,
+ Map<String, Decimal> orderagencypriceMapLwc
+ ) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ ESetId = ESetIdLwc;
+ coc = cocLwc;
+ barcode = barcodeLwc;
+ accountName = accountNameLwc;
+ userWorkLocation = userWorkLocationLwc;
+ consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
+ consumableorderdetailsRecordsLwc,
+ List<ConsumableorderdetailsInfo>.class
+ );
+ orderdetails = orderdetailsLwc;
+ orderpriceMap = orderpriceMapLwc;
+ orderagencypriceMap = orderagencypriceMap;
+ BarcodeCntMap = new Map<String, Integer>();
+ if (coc.Arrive_Order__r.IsShipment__c == true) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璁㈠崟宸茬粡鍑鸿揣'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璁㈠崟宸茬粡鍑鸿揣', '');
+ }
+
+ if (consumableorderdetailsRecords.size() < 1) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鏃犲嚭璐ф槑缁�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鏃犲嚭璐ф槑缁�', '');
+ }
+
+ Getconsumableorderdetails2Nobox();
+
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ String key = '' + ass.orderdetails2.Bar_Code__c;
+ Integer deliverycnt = BarcodeCntMap.get(key);
+ if (
+ ass.orderdetails2.Box_Piece__c == '涓�' &&
+ (ass.outboundCount == null ||
+ String.valueof(ass.outboundCount) == '' ||
+ ass.outboundCount <= 0)
+ ) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璇疯緭鍏ヤ骇鍝� '+ ass.Prod.Name +' 鐨勫嚭璐ф暟閲�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ヤ骇鍝� ' + ass.Prod.Name + ' 鐨勫嚭璐ф暟閲�', '');
+ }
+ if (ass.outboundCount > deliverycnt) {
+ // ass.orderdetails2.Rrturn_count__c.addError('瓒呭嚭鍑哄簱鏁伴噺');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, ass.orderdetails2.Name + '瓒呭嚭鍑哄簱鏁伴噺', '');
+ }
+ }
+
+ for (Integer i = 0; i < orderdetails.size(); i++) {
+ Decimal a = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.orderdetails2.Product_Pattern__c == orderdetails[i].Product_Pattern__c) {
+ a = a + ass.outboundCount;
+ }
+ }
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+a));
+
+ if (a < orderdetails[i].Shipment_Count__c) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'鏁伴噺灏忎簬鍑鸿揣鏁伴噺'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍟嗗搧' + orderdetails[i].Consumable_product__r.Name + '鏁伴噺灏忎簬鍑鸿揣鏁伴噺', '');
+ } else if (a > orderdetails[i].Shipment_Count__c) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'瓒呭嚭鍑鸿揣鏁伴噺'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍟嗗搧' + orderdetails[i].Consumable_product__r.Name + '瓒呭嚭鍑鸿揣鏁伴噺', '');
+ }
+ }
+ List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
+ Savepoint sp = Database.setSavepoint();
+ List<Consumable_orderdetails__c> orderdetails1List = [
+ SELECT Id, Used_date__c
+ FROM Consumable_orderdetails__c
+ WHERE Consumable_order__c = :ESetId
+ ];
+ try {
+ if (orderdetails1List.size() > 0) {
+ for (Integer i = 0; i < orderdetails1List.size(); i++) {
+ orderdetails1List[i].RecordTypeId = System.Label.RT_ConOrderDetail1_Shipment;
+ orderdetails1List[i].Used_date__c = Date.today();
+ }
+ ControllerUtil.updateOrderDetails1Satus(orderdetails1List);
+ }
+ //coc.Order_type__c = '鍑鸿揣';
+ coc.RecordTypeId = System.Label.RT_ConOrder_Shipment;
+ // update start by vivek 2019-7-15
+ // coc.SummonsStatus_c__c = '宸插畬鎴�';
+ if (coc.NoConfirmedPrice__c) {
+ coc.SummonsStatus_c__c = '浠锋牸鏈畾';
+ } else {
+ coc.SummonsStatus_c__c = '宸插畬鎴�';
+ }
+ // update start by vivek 2019-7-15
+ coc.Outbound_Date__c = Date.today();
+ update coc;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.orderdetails2.Box_Piece__c == '涓�') {
+ Decimal cnt = 1;
+ for (Consumable_order_details2__c codctmp : consumableorderdetails2Nobox) {
+ Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
+ if (codctmp.Bar_Code__c == ass.orderdetails2.Bar_Code__c) {
+ insDetails.Id = codctmp.Id;
+ insDetails.Consumable_Sale_order__c = null;
+ insDetails.Consumable_Return_order__c = null;
+ insDetails.Consumable_ZS_order__c = ESetId;
+ insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ insDetails.Return_date__c = null;
+ insDetails.Return_reason__c = null;
+ insDetails.Consumable_Shipment_order__c = ESetId;
+ insDetails.Send_Date__c = Date.today();
+ if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
+ insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c == null
+ ? 1
+ : ass.orderdetails2.Transfer_Time__c + 1;
+ insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c == null
+ ? coc.Dealer_Info__r.Name
+ : ass.orderdetails2.Frist_Transfer_Agency__c;
+ insDetails.Agency_Transfer__c = true;
+ }
+ cnt++;
+ Ins.add(insDetails);
+ if (cnt > ass.outboundCount)
+ break;
+ }
+ }
+ } else {
+ Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
+ insDetails.Id = ass.orderdetails2.Id;
+ insDetails.Consumable_Sale_order__c = null;
+ insDetails.Consumable_Return_order__c = null;
+ insDetails.Consumable_ZS_order__c = ESetId;
+ insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ insDetails.Return_date__c = null;
+ insDetails.Return_reason__c = null;
+ insDetails.Consumable_Shipment_order__c = ESetId;
+ insDetails.Send_Date__c = Date.today();
+ if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
+ insDetails.Transfer_Time__c = ass.orderdetails2.Transfer_Time__c == null
+ ? 1
+ : ass.orderdetails2.Transfer_Time__c + 1;
+ insDetails.Frist_Transfer_Agency__c = ass.orderdetails2.Frist_Transfer_Agency__c == null
+ ? coc.Dealer_Info__r.Name
+ : ass.orderdetails2.Frist_Transfer_Agency__c;
+ insDetails.Agency_Transfer__c = true;
+ }
+ Ins.add(insDetails);
+ }
+ }
+ if (Ins.size() > 0) {
+ ControllerUtil.updateOrderDetailsSatus(Ins);
+ }
+ if (coc.Arrive_Order__c != null) {
+ Consumable_order__c OrderUps = new Consumable_order__c();
+ OrderUps.Id = coc.Arrive_Order__c;
+ OrderUps.IsShipment__c = true;
+ update OrderUps;
+ }
+ } catch (Exception ex) {
+ Database.rollback(sp);
+ return new ResponseBodyLWC('Error', 500, ex.getMessage(), '');
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // 閿�鍞�
+ @AuraEnabled
+ public static ResponseBodyLWC ProSale(
+ String ESetIdLwc,
+ Consumable_order__c cocLwc,
+ String barcodeLwc,
+ String accountNameLwc,
+ String userWorkLocationLwc,
+ String consumableorderdetailsRecordsLwc,
+ List<Consumable_orderdetails__c> orderdetailsLwc,
+ Map<String, Decimal> orderpriceMapLwc,
+ Map<String, Decimal> orderagencypriceMapLwc
+ ) {
+ System.debug('enter ProSale');
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ ESetId = ESetIdLwc;
+ coc = cocLwc;
+ barcode = barcodeLwc;
+ accountName = accountNameLwc;
+ userWorkLocation = userWorkLocationLwc;
+ consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
+ consumableorderdetailsRecordsLwc,
+ List<ConsumableorderdetailsInfo>.class
+ );
+ orderdetails = orderdetailsLwc;
+ orderpriceMap = orderpriceMapLwc;
+ orderagencypriceMap = orderagencypriceMapLwc;
+ System.debug('ESetId = ' + ESetId);
+ System.debug('coc = ' + coc);
+ System.debug('barcode = ' + barcode);
+ System.debug('accountName = ' + accountName);
+ System.debug('userWorkLocation = ' + userWorkLocation);
+ System.debug('consumableorderdetailsRecords = ' + consumableorderdetailsRecords);
+ System.debug('orderdetails = ' + orderdetails);
+ System.debug('orderpriceMap = ' + orderpriceMap);
+ System.debug('orderagencypriceMap = ' + orderagencypriceMap);
+ BarcodeCntMap = new Map<String, Integer>();
+
+ if (consumableorderdetailsRecords.size() < 1) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鏃犻攢鍞槑缁�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鏃犻攢鍞槑缁�', '');
+ }
+ if (coc.Arrive_Order__r.IsShipment__c == true) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璁㈠崟宸茬粡閿�鍞�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璁㈠崟宸茬粡閿�鍞�', '');
+ }
+ Getconsumableorderdetails2Nobox();
+
+ System.debug('BarcodeCntMap = ' + BarcodeCntMap);
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ String key = '' + ass.orderdetails2.Bar_Code__c;
+ Integer deliverycnt = BarcodeCntMap.get(key);
+ if (ass.orderdetails2.Box_Piece__c == '涓�' &&(ass.outboundCount == null || String.valueof(ass.outboundCount) == '' || ass.outboundCount <= 0)) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璇疯緭鍏ヤ骇鍝� '+ ass.Prod.Name +' 鐨勫嚭璐ф暟閲�'));
+ // return null;
+ System.debug('ass.orderdetails2.Box_Piece__c = ' + ass.orderdetails2.Box_Piece__c);
+ System.debug('ass.outboundCount = ' + ass.outboundCount);
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ヤ骇鍝� ' + ass.Prod.Name + ' 鐨勫嚭璐ф暟閲�', '');
+ }
+ if (ass.outboundCount > deliverycnt) {
+ // ass.orderdetails2.Rrturn_count__c.addError('瓒呭嚭鍑哄簱鏁伴噺');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, ass.orderdetails2.Name + '瓒呭嚭鍑哄簱鏁伴噺', '');
+ }
+ }
+
+ for (Integer i = 0; i < orderdetails.size(); i++) {
+ Decimal a = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.orderdetails2.Product_Pattern__c == orderdetails[i].Product_Pattern__c) {
+ a = a + ass.outboundCount;
+ }
+ }
+ if (a < orderdetails[i].Shipment_Count__c) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'鏁伴噺灏忎簬鍑鸿揣鏁伴噺'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍟嗗搧' + orderdetails[i].Consumable_product__r.Name + '鏁伴噺灏忎簬鍑鸿揣鏁伴噺', '');
+ } else if (a > orderdetails[i].Shipment_Count__c) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'鍟嗗搧'+orderdetails[i].Consumable_product__r.Name +'瓒呭嚭鍑鸿揣鏁伴噺'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '鍟嗗搧' + orderdetails[i].Consumable_product__r.Name + '瓒呭嚭鍑鸿揣鏁伴噺', '');
+ }
+ }
+
+ Savepoint sp = Database.setSavepoint();
+ List<Consumable_orderdetails__c> orderdetails1List = [
+ SELECT Id, Used_date__c
+ FROM Consumable_orderdetails__c
+ WHERE Consumable_order__c = :ESetId
+ ];
+ try {
+ if (orderdetails1List.size() > 0) {
+ for (Integer i = 0; i < orderdetails1List.size(); i++) {
+ orderdetails1List[i].RecordTypeId = System.Label.RT_ConOrderDetail1_Sale;
+ orderdetails1List[i].Used_date__c = Date.today();
+ }
+ ControllerUtil.updateOrderDetails1Satus(orderdetails1List);
+ }
+ //coc.Order_type__c = '閿�鍞�';
+ coc.RecordTypeId = System.Label.RT_ConOrder_Sale;
+ // update start by vivek 2019-7-15
+ // coc.SummonsStatus_c__c = '宸插畬鎴�';
+ if (coc.NoConfirmedPrice__c) {
+ coc.SummonsStatus_c__c = '浠锋牸鏈畾';
+ } else {
+ coc.SummonsStatus_c__c = '宸插畬鎴�';
+ }
+ // update start by vivek 2019-7-15
+ coc.Outbound_Date__c = Date.today();
+ update coc;
+ //閿�鍞槑缁�
+ List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+ if (ass.orderdetails2.Box_Piece__c == '涓�') {
+ Decimal cnt = 1;
+ for (Consumable_order_details2__c codctmp : consumableorderdetails2Nobox) {
+ Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
+ if (codctmp.Bar_Code__c == ass.orderdetails2.Bar_Code__c) {
+ insDetails.Id = codctmp.Id;
+ insDetails.Consumable_Shipment_order__c = null;
+ insDetails.Consumable_Return_order__c = null;
+ insDetails.Consumable_ZS_order__c = ESetId;
+ insDetails.Return_date__c = null;
+ insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ if (orderagencypriceMap.containsKey(ass.orderdetails2.Product_Pattern__c) == true) {
+ insDetails.Unitprice_To_agency__c = orderagencypriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ }
+ insDetails.Return_reason__c = null;
+ insDetails.Used_date__c = Date.today();
+ insDetails.Consumable_Sale_order__c = ESetId;
+ cnt++;
+ Ins.add(insDetails);
+ if (cnt > ass.outboundCount)
+ break;
+ }
+ }
+ } else {
+ Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
+ insDetails.Id = ass.orderdetails2.Id;
+ insDetails.Consumable_Shipment_order__c = null;
+ insDetails.Consumable_Return_order__c = null;
+ insDetails.Consumable_ZS_order__c = ESetId;
+ insDetails.Return_date__c = null;
+ insDetails.Delivery_List_RMB__c = orderpriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ if (orderagencypriceMap.containsKey(ass.orderdetails2.Product_Pattern__c) == true) {
+ insDetails.Unitprice_To_agency__c = orderagencypriceMap.get(ass.orderdetails2.Product_Pattern__c);
+ }
+ insDetails.Return_reason__c = null;
+ insDetails.Used_date__c = Date.today();
+ insDetails.Consumable_Sale_order__c = ESetId;
+ Ins.add(insDetails);
+ }
+ }
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'consumableorderdetails2Nobox +++'+consumableorderdetails2Nobox.size()));
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Ins +++'+Ins));
+ //return null;
+ if (Ins.size() > 0) {
+ ControllerUtil.updateOrderDetailsSatus(Ins);
+ }
+ if (coc.Arrive_Order__c != null) {
+ Consumable_order__c orderUps = new Consumable_order__c();
+ orderUps.Id = coc.Arrive_Order__c;
+ orderUps.IsShipment__c = true;
+ update orderUps;
+ }
+ } catch (Exception e) {
+ Database.rollback(sp);
+ return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getStackTraceString(), '');
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ public static integer Getconsumableorderdetails2Nobox() {
+ if (String.isBlank(barcode)) {
+ return 0;
+ }
+ List<String> barCodeListP = ParseBarCode(barcode);
+ consumableorderdetails2Nobox = new List<Consumable_order_details2__c>();
+ BarcodeCntMap.clear();
+ consumableorderdetails2Nobox = [
+ SELECT
+ Id,
+ Name,
+ recordtypeid,
+ Used_account__c,
+ Product_Pattern__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,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Guarantee_period_for_products__c,
+ hospitalSpecialOffer__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c IN :barCodeListP
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Box_Piece__c = '涓�'
+ ORDER BY RemoveBox_No__c DESC
+ ];
+
+ AggregateResult[] results = [
+ SELECT Bar_Code__c, count(Id) recordCount
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Dealer_Info_text__c = :accountName
+ AND Bar_Code__c IN :barCodeListP
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Box_Piece__c = '涓�'
+ GROUP BY Bar_Code__c
+ ];
+
+ for (AggregateResult ar : results) {
+ String key = '' + ar.get('Bar_Code__c');
+ BarcodeCntMap.put(key, Integer.valueOf(ar.get('recordCount')));
+ }
+ return consumableorderdetails2Nobox.size();
+ }
+
+ class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Consumable_orderdetails__c orderdetails1 { get; set; }
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public String oldConsumableCount { get; set; }
+ @AuraEnabled
+ public String ErrorReason { get; set; }
+ @AuraEnabled
+ public Decimal outboundCount { get; set; }
+
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) {
+ orderdetails1 = new Consumable_orderdetails__c();
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ oldConsumableCount = e.name;
+ ErrorReason = str;
+ }
+
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ orderdetails1 = new Consumable_orderdetails__c();
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ if (e.Box_Piece__c == '鐩�') {
+ outboundCount = 1;
+ }
+ oldConsumableCount = e.name;
+ }
+
+ public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) {
+ orderdetails1 = e;
+ Prod = e.Consumable_Product__r;
+ outboundCount = e.Shipment_Count__c;
+ }
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSaleOrderController.cls-meta.xml b/force-app/main/default/classes/LexSaleOrderController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexSaleOrderController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexSearchContractController.cls b/force-app/main/default/classes/LexSearchContractController.cls
new file mode 100644
index 0000000..1cf641e
--- /dev/null
+++ b/force-app/main/default/classes/LexSearchContractController.cls
@@ -0,0 +1,69 @@
+public without sharing class LexSearchContractController {
+ private static Boolean OSHFLG;//lt 20230517 瀹夊窘涓ょエ鍒� add
+
+ @AuraEnabled
+ public static Results init(String ctype){
+ Results results = new Results();
+ try {
+ //lt 20230517 瀹夊窘涓ょエ鍒� add ,OSHFLG__c
+ User useracc = [SELECT accountid,OSHFLG__c FROM user WHERE id = :UserInfo.getUserId() ];
+ OSHFLG = Useracc.OSHFLG__c; //lt 20230517 瀹夊窘涓ょエ鍒� add;
+ String accountId = Useracc.accountid;
+ List<Account> attList = [SELECT id,Name,State_Master__c,State_Master__r.Name,Sales_Section__c,
+ Contract_Decide_Start_Date__c,Contract_Decide_End_Date__c
+ FROM Account
+ WHERE ParentId = :accountId
+ AND Contact_Type__c like :ctype
+ AND Contract_Decide_Start_Date__c <= :Date.Today()
+ AND Contract_Decide_End_Date__c >= :Date.Today()
+ AND Secondary_contract__c = false
+ AND OSH_Dealer__c =: OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add
+ ];
+ results.attList = attList;
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ @AuraEnabled
+ public static Results searchContract(String searchName, String accountId, String ctype, Boolean OSHFLGStr){
+ Results results = new Results();
+ OSHFLG = OSHFLGStr;
+ try {
+ results.attList = Database.query(makeSoql(searchName,Date.today(),accountId,ctype));
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ private static String makeSoql(String CateName,Date timetest,String accountId, String ctype){
+
+ String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Sales_Section__c,';
+ soql += ' Contract_Decide_Start_Date__c,Contract_Decide_End_Date__c,OSH_Dealer__c FROM Account';
+ soql += ' where ParentId = \'' + accountId + '\'' ;
+ soql += ' AND OSH_Dealer__c = ' + OSHFLG + '' ; //lt 20230517 瀹夊窘涓ょエ鍒� add
+ soql += ' AND Secondary_contract__c = false' ;
+ soql += ' AND Contact_Type__c like \'%' + String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) + '%\'';
+ soql += ' AND Contract_Decide_Start_Date__c <=' + String.valueOf(timetest).substring(0, 10);
+ soql += ' AND Contract_Decide_End_Date__c >= ' + String.valueOf(timetest).substring(0, 10);
+ if(!String.isBlank(CateName)){
+ soql += ' AND Name like \'%' + String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + '%\'';
+ }
+ return soql;
+ }
+
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public List<Account> attList;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSearchContractController.cls-meta.xml b/force-app/main/default/classes/LexSearchContractController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexSearchContractController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexSearchHospitalController.cls b/force-app/main/default/classes/LexSearchHospitalController.cls
new file mode 100644
index 0000000..147544e
--- /dev/null
+++ b/force-app/main/default/classes/LexSearchHospitalController.cls
@@ -0,0 +1,52 @@
+public without sharing class LexSearchHospitalController {
+
+ @AuraEnabled
+ public static Results init(){
+ Results results = new Results();
+ try {
+ User useracc = [SELECT accountid,UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId() ];
+ String accountId = Useracc.accountid;
+ String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Address__c FROM Account';
+ soql += ' where id in (SELECT Hospital__c FROM hospitalprice__c WHERE account__c = :accountId) ' ;
+ soql += ' order by Name desc limit 100';
+ results.attList = Database.query(soql);
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ @AuraEnabled
+ public static Results searchHospital(String searchName, String accountId){
+ Results results = new Results();
+ try {
+ results.attList = Database.query(makeSoql(searchName, accountId));
+ results.result = 'Success';
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+ }
+ return results;
+ }
+
+ private static String makeSoql(String searchName,String accountId){
+ String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Address__c FROM Account';
+ soql += ' where id in (SELECT Hospital__c FROM hospitalprice__c WHERE account__c = :accountId) ' ;
+ if(String.isNotBlank(searchName)){
+ soql += ' AND Name like \'%' + searchName+ '%\'';
+ }
+ soql += ' order by Name desc limit 100';
+ return soql;
+ }
+
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public List<Account> attList;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSearchHospitalController.cls-meta.xml b/force-app/main/default/classes/LexSearchHospitalController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexSearchHospitalController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexSummonsCreatController.cls b/force-app/main/default/classes/LexSummonsCreatController.cls
new file mode 100644
index 0000000..f83dc7a
--- /dev/null
+++ b/force-app/main/default/classes/LexSummonsCreatController.cls
@@ -0,0 +1,2990 @@
+public without sharing class LexSummonsCreatController {
+ public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
+
+ /*****************妞滅储鐢�******************/
+ //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
+ @AuraEnabled
+ public static String agencyProType { get; set; }
+ public static Consumable_order__c coc { get; set; } // 鐢籿iew鐢紝 鍙兘鏄� 鍑哄簱鎸囩ず鍗曪紝 涔熸湁鍙兘鏄埌璐у崟锛� 涔熸湁鍙兘 绌篿nstance
+ public static User localuser { get; set; }
+ public static String category1 { get; set; }
+ public static Integer noOfRecords { get; set; }
+ //public String category_Goods {get ; set;}
+ public static Boolean cansee { get; set; }
+ public static Integer size { get; set; }
+ //缁忛攢鍟嗗畾浠锋煡鐪嬫潈闄�
+ //public static ApexPages.StandardSetController setCon { get; set; }
+ public static Boolean dealerPricesee { get; set; }
+ /*****************鐢婚潰鍒濆鍖栫敤********************************/
+ /******20160313_add**************/
+ public static String IdCheck { get; set; }
+ public static Boolean editAble { get; set; }
+ public static String statusEdit { get; set; }
+ public static String alertMessage { get; set; }
+ public static String SearchDone { get; set; }
+ public static List<String> zaikuId = new List<String>();
+ public static List<String> orderzaikuId = new List<String>();
+ //闄勪欢
+ public static List<ConsumableorderdetailsInfo> attachmentRecoeds { get; set; }
+ public static Boolean getExistarrive() {
+ return (coc.Arrive_Order__c != null);
+ }
+ //鎬讳环鏍艰绠楃粨鏋�
+ @AuraEnabled
+ public static Decimal sumPrice { get; set; }
+ /******20160317_add**************/
+ public static String SummonsFlag { get; set; } // 鏂拌: hidden, 鏇存柊: visible
+ public static String category5 { get; set; }
+ public static String category4 { get; set; }
+ public static String category3 { get; set; }
+ public static List<SelectOption> categoryOptionList { get; set; }
+ public static List<SelectOption> category4OptionList { get; set; }
+ public static List<SelectOption> category5OptionList { get; set; }
+ @AuraEnabled
+ public static Map<String, String> categoryOptionMap { get; set; }
+ @AuraEnabled
+ public static Map<String, String> category4OptionMap { get; set; }
+ @AuraEnabled
+ public static Map<String, String> category5OptionMap { get; set; }
+ /*****************鐢婚潰琛ㄧずBean******************/
+ private static List<ConsumableorderdetailsInfo> consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ //鏄庣粏2
+ @AuraEnabled
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; }
+ //閿欒鏄庣粏
+ @AuraEnabled
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror { get; set; }
+ @AuraEnabled
+ public static List<ConsumableorderdetailsInfo> pageRecords { get; set; }
+ public static List<ConsumableorderdetailsInfoLwc> pageRecordsLwc { get; set; }
+ //public List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; }
+ public static List<ConsumableorderdetailsInfo> consumableorderdetails2Records { get; set; }
+ public static List<Consumable_order__c> consumableInvoiceRecords { get; set; }
+ private static List<ConsumableorderdetailsInfo> consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ private static List<Attachment> attachmentinfo = new List<Attachment>();
+ public static List<Product2__c> product2Selected = new List<Product2__c>();
+ @AuraEnabled
+ public static Map<String, String> orderpieceorboxMap { get; set; }
+ @AuraEnabled
+ public static List<Consumable_orderdetails__c> orderdetails { get; set; }
+ @AuraEnabled
+ public static Map<String, Decimal> orderagencypriceMap { get; set; }
+ @AuraEnabled
+ public static Map<String, Decimal> orderpriceMap { get; set; }
+ @AuraEnabled
+ public static Map<String, Decimal> orderdetCountMap { get; set; }
+ @AuraEnabled
+ public static Boolean hasSpecialHos { get; set; }
+ //閫夋嫨浜у搧size
+ public static Integer consumableorderdetailsCount {
+ get {
+ return pageRecords == null ? 0 : pageRecords.size();
+ }
+ }
+ //娑堣�楀搧鏄庣粏2鏁伴噺
+ public static Integer consumableorderdetails2Count {
+ get {
+ return consumableorderdetails2Records == null ? 0 : consumableorderdetails2Records.size();
+ }
+ }
+ //璁㈣揣鍗曞彿
+ public static String consumableorderId {
+ get {
+ return (coc.Arrive_Order__c);
+ }
+ }
+ //閫夋嫨妗�
+ public static List<SelectOption> provinceOpts { get; set; }
+ @AuraEnabled
+ public static Map<String, String> provinceOptsMap { get; set; }
+ public static String SecondDealer { get; set; }
+ //public List<SelectOption> orderForHospitalOpts { get; set; }
+ public static String HospitalInfo { get; set; }
+ public static String HospitalName { get; set; }
+
+ public static Boolean EditDelCommitBtnDisabled { get; private set; }
+ public static Boolean saveBtnDisabled { get; private set; }
+ public static Boolean SorderBtnDisabled { get; private set; }
+
+ // page
+ public static Integer pagesize { get; set; }
+ public static Integer pageToken { get; set; }
+ //public static String sortField { get; set; }
+ //public static String sortOrder { get; set; }
+ public static Integer totalcount { get; set; }
+ public static Integer addSize { get; set; }
+ //List<ConsumableorderdetailsInfoLwc> reSetLwc
+ public static List<ConsumableorderdetailsInfo> addData { get; set; }
+ public static Map<String, String> skipData { get; set; }
+ // 淇濆瓨鍚庡姩浣滐細 1.妫�绱� 2.鎺掑簭
+ // public static String sortKey { get; set; }
+ // public static String preSortKey { get; private set; }
+ // public static Boolean sortOrderAsc { get; private set; }
+ // public static String[] sortOrder { get; private set; }
+ // private static String[] columus = new List<String>{
+ // 'Consumable_Product__r.Name',
+ // 'Consumable_Product__r.Asset_Model_No__c',
+ // 'Consumable_Product__r.Intra_Trade_List_RMB__c',
+ // '',
+ // '',
+ // 'Consumable_Product__r.Category3__c',
+ // 'Consumable_Product__r.Category4__c',
+ // 'Consumable_Product__r.Category5__c'
+ // };
+ // private static String[] columus_no = new List<String>{
+ // 'Product2__c.Name',
+ // 'Product2__c.Asset_Model_No__c',
+ // 'Product2__c.Intra_Trade_List_RMB__c',
+ // '',
+ // '',
+ // 'Category3__c',
+ // 'Category4__c',
+ // 'Category5__c'
+ // };
+
+ //鍒拌揣鍗曟槑缁�1
+ private static List<Consumable_Orderdetails__c> consumableorderdetailsSelected = new List<Consumable_Orderdetails__c>();
+ //鍒拌揣鍗曟槑缁�2
+ private static List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = new List<Consumable_order_details2__c>();
+
+ //鍑哄簱鍗曟槑缁�2
+ private static List<Consumable_order_details2__c> consumableorderdetails2RecordsList = new List<Consumable_order_details2__c>();
+ /*****************銈姐兗銉堟檪鍐嶆绱㈡潯浠讹紙鐢婚潰銇嬨倝銇叆鍔涙潯浠躲倰鐒¤銇欍倠銇熴倎锛�******************/
+ //private String cate1ForSort = null;
+ private static String accountid = null;
+ @AuraEnabled
+ public static String accountName { get; set; }
+
+ // 浜у搧 ID
+ private static String ESetId = '';
+ @AuraEnabled
+ public static String arriveorder { get; set; }
+ private static String userId = '';
+ //private String[] ProidListAll = new String[]{};
+
+ // 鐧诲綍鑰呭伐浣滃湴
+ @AuraEnabled
+ public static String userWorkLocation { get; set; }
+
+ //add by rentx 2021-01-29
+ public static List<SelectOption> outOutPatternOptionList { get; set; }
+ @AuraEnabled
+ public static Map<String, String> outOutPatternOptionMap { get; set; }
+ public static String outOutPattern { get; set; }
+ public static Boolean hasHos { get; set; }
+ @AuraEnabled
+ public static Boolean hasHosPro { get; set; }
+
+ private static Map<String, String> HosProMap = new Map<String, String>();
+ //add by rentx 2021-01-29
+
+ public LexSummonsCreatController() {
+ System.debug('LexSummonsCreatController');
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ // ESetId = ApexPages.currentPage().getParameters().get('esetId');
+ // arriveorder = ApexPages.currentPage().getParameters().get('arriveorder');
+ // statusEdit = ApexPages.currentPage().getParameters().get('KeyWords');
+ provinceOpts = new List<SelectOption>();
+ provinceOptsMap = new Map<String, String>();
+ pageRecords = new List<ConsumableorderdetailsInfo>();
+ consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetails2Records = new List<ConsumableorderdetailsInfo>();
+ consumableInvoiceRecords = new List<Consumable_order__c>();
+ categoryOptionList = new List<SelectOption>();
+ category4OptionList = new List<SelectOption>();
+ category5OptionList = new List<SelectOption>();
+
+ categoryOptionMap = new Map<String, String>();
+ category4OptionMap = new Map<String, String>();
+ category5OptionMap = new Map<String, String>();
+
+ outOutPatternOptionMap = new Map<String, String>();
+ outOutPatternOptionMap.put('', '-鏃�-');
+ outOutPatternOptionMap.put('ishos', '鍖婚櫌鐗逛环浜у搧');
+ outOutPatternOptionMap.put('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�');
+
+ outOutPatternOptionList.add(new SelectOption('', '-鏃�-'));
+ outOutPatternOptionList.add(new SelectOption('ishos', '鍖婚櫌鐗逛环浜у搧'));
+ outOutPatternOptionList.add(new SelectOption('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�'));
+ HospitalName = '';
+ }
+
+ public static void firstInit(String ESetidJs) {
+ System.debug('enter firstInit');
+ ESetid = ESetidJs;
+ System.debug('ESetid = ' + ESetid);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ provinceOpts = new List<SelectOption>();
+ provinceOptsMap = new Map<String, String>();
+ pageRecords = new List<ConsumableorderdetailsInfo>();
+ consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ attachmentRecoeds = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetails2Records = new List<ConsumableorderdetailsInfo>();
+ consumableInvoiceRecords = new List<Consumable_order__c>();
+ categoryOptionList = new List<SelectOption>();
+ category4OptionList = new List<SelectOption>();
+ category5OptionList = new List<SelectOption>();
+
+ categoryOptionMap = new Map<String, String>();
+ category4OptionMap = new Map<String, String>();
+ category5OptionMap = new Map<String, String>();
+
+ outOutPatternOptionMap = new Map<String, String>();
+ outOutPatternOptionMap.put('', '-鏃�-');
+ outOutPatternOptionMap.put('ishos', '鍖婚櫌鐗逛环浜у搧');
+ outOutPatternOptionMap.put('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�');
+
+ // outOutPatternOptionList.add(new SelectOption('', '-鏃�-'));
+ // outOutPatternOptionList.add(new SelectOption('ishos', '鍖婚櫌鐗逛环浜у搧'));
+ // outOutPatternOptionList.add(new SelectOption('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�'));
+ HospitalName = '';
+ }
+
+ // 鐢婚潰鍒濆鍖�
+ @AuraEnabled
+ public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC) {
+ // try {
+ firstInit(ESetidJs);
+ statusEdit = statusEdit;
+ arriveorder = '';
+ HospitalName = '';
+ provinceOpts = new List<SelectOption>();
+ provinceOptsMap = new Map<String, String>();
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ // public static Integer pagesize { get; set; }
+ // public static Integer pageToken { get; set; }
+ // public static String sortField { get; set; }
+ // public static String sortOrder { get; set; }
+ pagesize = pageSizeLWC;
+ pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
+
+ // sortKey = '1';
+ // preSortKey = '1';
+ // sortOrderAsc = false;
+ // sortOrder = new List<String>(8);
+ // sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
+ //cate1ForSort = '';
+ sumPrice = 0;
+ IdCheck = EsetId;
+ if (ESetId != null && ESetId != '' && (statusEdit == '' || statusEdit == null)) {
+ editAble = false;
+ } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) {
+ editAble = true;
+ } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) {
+ editAble = true;
+ }
+ userId = UserInfo.getUserId();
+ localuser = [SELECT id, State_Hospital__c FROM User WHERE id = :UserInfo.getUserId()];
+ //userId = '00510000005QO75';
+ user Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
+ accountid = Useracc.accountid;
+ userWorkLocation = Useracc.Work_Location__c;
+ agencyProType = Useracc.UserPro_Type__c;
+ if (String.isBlank(Useracc.UserPro_Type__c)) {
+ agencyProType = 'ET';
+ }
+ Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
+ accountName = accountInfo.Name;
+ //coc.Order_date__c = Date.today();
+ list<Dealer_elationship__c> Dealerelationship = new List<Dealer_elationship__c>();
+ Dealerelationship = [
+ SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
+ FROM Dealer_elationship__c
+ WHERE Dealer_principal__c = :accountid
+ ];
+
+ List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
+ AgencyHospitalLink = [SELECT Id, Hospital__c, Hospital__r.Name FROM Agency_Hospital_Link__c WHERE Agency__c = :accountid];
+
+ //add by rentx 2021-3-1 start
+ //鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈夌壒浠峰尰闄�
+ List<hospitalprice__c> hlist = [SELECT id, product__c FROM hospitalprice__c WHERE account__c = :accountid];
+ if (hlist == null || hlist.size() == 0) {
+ hasHos = false;
+ } else {
+ for (hospitalprice__c hp : hlist) {
+ HosProMap.put(hp.product__c, '');
+ }
+ hasHos = true;
+ }
+ //add by rentx 2021-3-1 end
+
+ saveBtnDisabled = false;
+ SorderBtnDisabled = false;
+ String sqlagencyProType = '%' + agencyProType + '%';
+ coc = new Consumable_order__c();
+ consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ //add by rentx 2021-01-29
+ Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>();
+ //add by rentx 2021-01-29
+
+ List<AggregateResult> orderdetailCount = [
+ SELECT count(id), Consumable_Product__c cpc, Box_Piece__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Isoverdue__c = 1
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ GROUP BY Consumable_Product__c, Box_Piece__c
+ ];
+ for (AggregateResult orderdetail : orderdetailCount) {
+ zaikuId.add(String.valueOf(orderdetail.get('cpc')));
+ }
+ System.debug('sqlagencyProType = ' + sqlagencyProType);
+ System.debug('userWorkLocation = ' + userWorkLocation);
+ System.debug('accountName = ' + accountName);
+ List<Consumable_order_details2__c> CountDel = [
+ SELECT
+ Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Recordtypeid,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ //add by rentx 2020-11-27 start
+ hospitalSpecialOffer__c
+ //add by rentx 2020-11-27 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 Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Isoverdue__c = 1
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ AND Dealer_Info_text__c = :accountName
+ ];
+ // 鏂拌
+ if (ESetId == null || ESetId == '') {
+ SummonsFlag = 'hidden';
+ String msoql = makeSoqlinventory();
+ initStandardController(msoql);
+ System.debug('msoql = ' + msoql);
+ product2Selected = Database.query(msoql);
+ if (String.isBlank(arriveorder)) {
+ EditDelCommitBtnDisabled = true;
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ String str = '';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ str = 'isHos';
+ } else {
+ str = 'notHos';
+ }
+ //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
+ //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
+ if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
+ ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ } else {
+ //midmap2涓病鏈夊搴旂殑浜у搧
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ }
+ }
+ System.debug('MidMap2.size() = ' + MidMap2.size());
+ /*//鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
+ Jstage.allnumber = Jstage.allnumber+1 ;
+ if(CountDel[i].Box_Piece__c == '鐩�'){
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ }else if(CountDel[i].Box_Piece__c == '涓�'){
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ }else{
+ Jstage.hospitalSpecialOffer = false;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap.put(CountDel[i].Consumable_Product__c+str, Jstage);
+ }*/
+ }
+
+ //update by rentx 2021-01-29 end
+
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ //update by rentx 2021-01-29
+ // for(ConsumableorderdetailsInfo bss : MidMap.values()){
+ for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
+ //update by rentx 2021-01-29
+ //if(bss.allnumber>0){
+ bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsSelectRecords.add(bss);
+ //}
+ }
+
+ Integer ishosnum = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
+ //ass.sortBy = sortOrderAsc;
+ //add by rentx 2021-3-10
+ if (ass.hospitalSpecialOffer) {
+ ishosnum = ishosnum + 1;
+ }
+ }
+ if (ishosnum > 0) {
+ hasHosPro = true;
+ } else {
+ hasHosPro = false;
+ }
+ consumableorderdetailsSelectRecords.sort();
+ //add by rentx
+ noOfRecords = consumableorderdetailsSelectRecords.size();
+ //add by rentx
+ System.debug('makepagerecords1');
+ makepagerecords();
+ //listCut();
+ } else {
+ if (statusEdit == '' || statusEdit == null) {
+ editAble = false;
+ } else if (statusEdit != '' && statusEdit != null) {
+ editAble = true;
+ }
+ // upadte start by vivek 2019-7-15
+ // coc = [SELECT Id,Name,Summons_Order_type__c,SummonsStatus_c__c,Order_ForDealerText__c,
+ // Dealer_Info__c,Order_ForDealer__c,Order_ForDealer__r.Name,Order_ForDealerTextID__c,
+ // Order_ForHospital__c,SummonsForDirction__c,Order_date__c,Arrive_Order__c,
+ // Order_status__c,Shipment_total_amount__c,Offers_Price__c,
+ // Billed_Status__c,ShipmentAccount__c,Order_Dealer_Info__c,Order_ForCustomerText__c,ConInvoice_Code__c,Onchange_order__c
+ // FROM Consumable_order__c
+ // WHERE Id =:arriveorder AND Order_Owner_WorkLocal__c =: userWorkLocation
+ // AND recordtypeid = :System.Label.RT_ConOrder_Arrive];
+ coc = [
+ SELECT
+ Id,
+ Name,
+ Summons_Order_type__c,
+ NoConfirmedPrice__c,
+ SummonsStatus_c__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForDealerTextID__c,
+ Order_ForHospital__c,
+ SummonsForDirction__c,
+ Order_date__c,
+ Arrive_Order__c,
+ Order_status__c,
+ Shipment_total_amount__c,
+ Offers_Price__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ Order_ForCustomerText__c,
+ ConInvoice_Code__c,
+ Onchange_order__c,
+ OutPattern__c
+ FROM Consumable_order__c
+ WHERE
+ Id = :arriveorder
+ AND Order_Owner_WorkLocal__c = :userWorkLocation
+ AND recordtypeid = :System.Label.RT_ConOrder_Arrive
+ ];
+ // update end by vivek 2019-7-15
+ //鏄庣粏1鑾峰彇
+ consumableorderdetailsSelected = [
+ SELECT
+ Id,
+ Dealer_Custom_Price__c,
+ Delivery_List_RMB__c,
+ Consumable_Product__r.Name__c,
+ Name,
+ Consumable_order__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Shipment_Count__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Sum_of_money__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Consumable_Product__r.SFDA_Status__c,
+ Consumable_count__c,
+ Invoiced_Procount__c,
+ RrturnPro_count__c,
+ InvoiceProNot_count__c,
+ //Unitprice_To_agency__c,
+ Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
+ Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
+ FROM Consumable_Orderdetails__c
+ WHERE Consumable_order__c = :coc.Arrive_Order__c
+ ORDER BY Name
+ ];
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ orderzaikuId.add(cdc1.Consumable_Product__c);
+ }
+ msoql = makeSoqlorderdet();
+ product2Selected = Database.query(msoql);
+ size = product2Selected.size();
+ initStandardController(msoql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ //update by rentx 2021-01-29
+ /*for(Integer i = 0 ; i< CountDel.size();i++){
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
+ Jstage.allnumber = Jstage.allnumber+1 ;
+ if(CountDel[i].Box_Piece__c == '鐩�'){
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ }else if(CountDel[i].Box_Piece__c == '涓�'){
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap.put(CountDel[i].Consumable_Product__c, Jstage);
+ }
+
+ }*/
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ String str = '';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ str = 'isHos';
+ } else {
+ str = 'notHos';
+ }
+ //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
+ //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
+ if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
+ ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ } else {
+ //midmap2涓病鏈夊搴旂殑浜у搧
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ }
+ }
+ }
+
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ //update by rentx 2021-01-29
+ // for(ConsumableorderdetailsInfo bss : MidMap.values()){
+ for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
+ //update by rentx 2021-01-29
+ bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsSelectRecords.add(bss);
+ }
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test11111' + consumableorderdetailsSelected.size()));
+ //return;
+
+ Integer ishosnum = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
+ //ass.sortBy = sortOrderAsc;
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ cdc1.Shipment_Count__c = cdc1.Consumable_count__c;
+ if (ass.prod.Id == cdc1.Consumable_Product__c) {
+ ass.check = true;
+ ass.orderdetails1 = cdc1;
+ }
+ }
+ if (ass.hospitalSpecialOffer == true) {
+ ishosnum = ishosnum + 1;
+ }
+ }
+ if (ishosnum > 0) {
+ hasHosPro = true;
+ } else {
+ hasHosPro = false;
+ }
+
+ consumableorderdetailsSelectRecords.sort();
+ //add by rentx
+ noOfRecords = consumableorderdetailsSelectRecords.size();
+ //add by rentx
+ System.debug('makepagerecords2');
+ makepagerecords();
+ consumablearriveproductdetailsSelected = [
+ SELECT
+ Id,
+ Name,
+ Intra_Trade_List_RMB__c,
+ Asset_Model_No__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__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,
+ Delivery_List_RMB__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ //add by rentx start
+ hospitalSpecialOffer__c
+ //add by rentx end
+ FROM Consumable_order_details2__c
+ WHERE
+ Consumable_order_minor__c = :coc.Arrive_Order__c
+ AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Dealer_Arrive__c = TRUE
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
+ if (
+ consumablearriveproductdetailsSelected[i].hospitalSpecialOffer__c &&
+ HosProMap.containsKey(consumablearriveproductdetailsSelected[i].Consumable_product__c)
+ ) {
+ coc.OutPattern__c = true;
+ }
+ consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
+ }
+ }
+ } else {
+ // 鏇存柊銆�
+ SummonsFlag = 'visible';
+ // update start by vivek 2019-7-15 add 鈥淣oConfirmedPrice__c鈥� in select
+ consumableInvoiceRecords = [
+ SELECT Id, Name, Invoice_Date__c, NoConfirmedPrice__c, Invoice_total_amount__c, Invoice_status__c
+ FROM Consumable_order__c
+ WHERE
+ Id IN (SELECT Invoice_Code_link__c FROM Consumable_order_LinkTable__c WHERE Outboundorder_Code_link__c = :ESetId)
+ AND Invoice_status__c != '鑽夋涓�'
+ ];
+
+ System.debug('coc ESetId = ' + ESetId);
+ System.debug('coc userWorkLocation = ' + userWorkLocation);
+ coc = [
+ SELECT
+ Id,
+ Name,
+ Summons_Order_type__c,
+ NoConfirmedPrice__c,
+ SummonsStatus_c__c,
+ Order_ForDealerText__c,
+ Dealer_Info__c,
+ Order_ForDealer__c,
+ Order_ForDealer__r.Name,
+ Order_ForDealerTextID__c,
+ Order_ForHospital__c,
+ SummonsForDirction__c,
+ Order_date__c,
+ Arrive_Order__c,
+ Order_status__c,
+ Shipment_total_amount__c,
+ Offers_Price__c,
+ Billed_Status__c,
+ ShipmentAccount__c,
+ Order_Dealer_Info__c,
+ Order_ForCustomerText__c,
+ ConInvoice_Code__c,
+ Onchange_order__c,
+ OutPattern__c
+ FROM Consumable_order__c
+ WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation AND Order_type__c = '浼犵エ'
+ ];
+ // update start by vivek 2019-7-15
+ if (getExistarrive()) {
+ arriveorder = coc.Arrive_Order__c;
+ }
+ // 鍒拌揣璁㈠崟鏉ョ殑鏃跺��
+ if (getExistarrive()) {
+ if (editAble) {
+ alertMessage = '鍒拌揣璁㈠崟鐩存帴鍑哄簱锛屽嚭搴撳崟鏄庣粏涓嶅彲缂栬緫';
+ }
+ if (coc.SummonsStatus_c__c == '宸叉彁浜�' || coc.SummonsStatus_c__c == '鎵瑰噯') {
+ system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
+ saveBtnDisabled = true;
+ SorderBtnDisabled = true;
+ EditDelCommitBtnDisabled = false;
+ }
+ //鍖婚櫌浜岀骇缁忛攢鍟嗗垎绫�
+ Integer io = 0;
+ while (io < Dealerelationship.size()) {
+ if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
+ SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
+ coc.Order_ForDealer__c = null;
+ io = io + Dealerelationship.size();
+ }
+ io++;
+ }
+
+ Integer ik = 0;
+ while (ik < AgencyHospitalLink.size()) {
+ if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
+ HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
+ HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
+ coc.Order_ForHospital__c = null;
+ ik = ik + AgencyHospitalLink.size();
+ }
+ ik++;
+ }
+ //鍑哄簱鍗曟槑缁�1鍙栧緱
+ consumableorderdetailsSelected = [
+ SELECT
+ Id,
+ Dealer_Custom_Price__c,
+ Delivery_List_RMB__c,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__r.SFDA_Status__c,
+ Name,
+ Consumable_order__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Shipment_Count__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Shipment_amount__c,
+ //Unitprice_To_agency__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Invoiced_Procount__c,
+ RrturnPro_count__c,
+ InvoiceProNot_count__c,
+ Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
+ Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
+ isOutPattern__c
+ FROM Consumable_orderdetails__c
+ WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
+
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ sumPrice += cdc1.Shipment_amount__c;
+ orderzaikuId.add(cdc1.Consumable_Product__c);
+ //add by rentx 2021-2-26
+ String tempId = cdc1.Consumable_product__c;
+ if (cdc1.isOutPattern__c) {
+ cocMap.put(tempId + 'ishos', cdc1);
+ } else {
+ cocMap.put(tempId + 'nothos', cdc1);
+ }
+ //add by rentx 2021-2-26
+ }
+ String msoql = makeSoqlorderdet();
+ product2Selected = Database.query(msoql);
+ size = product2Selected.size();
+ initStandardController(msoql);
+
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+ //update by rentx 2021-01-29
+ /*for(Integer i = 0 ; i< CountDel.size();i++){
+ //鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
+ if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
+ Jstage.allnumber = Jstage.allnumber+1 ;
+ if(CountDel[i].Box_Piece__c == '鐩�'){
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ }else if(CountDel[i].Box_Piece__c == '涓�'){
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap.put(CountDel[i].Consumable_Product__c, Jstage);
+ }
+ }*/
+
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ String str = '';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ str = 'isHos';
+ } else {
+ str = 'notHos';
+ }
+ //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
+ //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
+ if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
+ ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ } else {
+ //midmap2涓病鏈夊搴旂殑浜у搧
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ }
+ }
+ }
+ //update by rentx 2021-01-29
+ consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ //update by rentx 2021-01-29
+ // for(ConsumableorderdetailsInfo bss : MidMap.values()){
+ for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
+ //update by rentx 2021-01-29
+
+ //if(bss.allnumber > 0){
+ //bss.UnitpriceToagency = bss.orderdetails1.Unitprice_To_agency__c == null || bss.orderdetails1.Unitprice_To_agency__c == 0 ? '' :bss.orderdetails1.Unitprice_To_agency__c.format();
+ bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+
+ //update by rentx 2021-2-26 start
+ if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
+ consumableorderdetailsSelectRecords.add(bss);
+ } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
+ consumableorderdetailsSelectRecords.add(bss);
+ }
+ //update by rentx 2021-2-26 end
+ // consumableorderdetailsSelectRecords.add(bss);
+ //}
+ }
+ Integer ishosnum = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ //update by rentx 2012-3-1 start
+ // if(ass.prod.Id == cdc1.Consumable_Product__c){
+ // ass.check = true;
+ // ass.orderdetails1 = cdc1;
+ // }
+ if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
+ ass.check = true;
+ ass.orderdetails1 = cdc1;
+ }
+ //update by rentx 2012-3-1 end
+ }
+ if (ass.hospitalSpecialOffer == true) {
+ ishosnum = ishosnum + 1;
+ }
+ }
+ if (ishosnum > 0) {
+ hasHosPro = true;
+ } else {
+ hasHosPro = false;
+ }
+
+ //add by rentx
+ noOfRecords = consumableorderdetailsSelectRecords.size();
+ //add by rentx
+ System.debug('makepagerecords3');
+ makepagerecords();
+ //listCut();
+ // 娑堣�楀搧鏄庣粏2銈掑彇寰�
+ consumableorderdetails2RecordsList = [
+ SELECT
+ Id,
+ Name,
+ SerialLotNo__c,
+ Consumable_Product__r.Name__c,
+ TracingCode__c,
+ Sterilization_limit__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Return_date__c,
+ Invoice_Date__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ //add by rentx start
+ hospitalSpecialOffer__c
+ //add by rentx end
+ FROM Consumable_order_details2__c
+ WHERE Consumable_ZS_order__c = :ESetId
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
+ consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
+ }
+ //浜у搧鏄庣粏鍙栧緱
+ consumablearriveproductdetailsSelected = [
+ SELECT
+ Id,
+ Delivery_List_RMB__c,
+ Consumable_Product__r.Name__c,
+ Name,
+ Consumable_Product__r.SFDA_Status__c,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Sterilization_limit__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ //add by rentx start
+ hospitalSpecialOffer__c
+ //add by rentx end
+ FROM Consumable_order_details2__c
+ WHERE Consumable_ZS_order__c = :ESetId
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
+ consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
+ }
+ } else {
+ // 涓嶆槸鍒拌揣璁㈠崟鏉ョ殑鏃跺��
+ if (coc.SummonsStatus_c__c == '宸叉彁浜�' || coc.SummonsStatus_c__c == '鎵瑰噯') {
+ system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
+ saveBtnDisabled = true;
+ SorderBtnDisabled = true;
+ EditDelCommitBtnDisabled = false;
+ }
+ //鍖婚櫌浜岀骇缁忛攢鍟嗗垎绫�
+ Integer io = 0;
+ while (io < Dealerelationship.size()) {
+ if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
+ SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
+ coc.Order_ForDealer__c = null;
+ io = io + Dealerelationship.size();
+ }
+ io++;
+ }
+ Integer ik = 0;
+ while (ik < AgencyHospitalLink.size()) {
+ if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
+ HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
+ HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
+ coc.Order_ForHospital__c = null;
+ ik = ik + AgencyHospitalLink.size();
+ }
+ ik++;
+ }
+ // 娑堣�楀搧鏄庣粏1銈掑彇寰�
+ consumableorderdetailsSelected = [
+ SELECT
+ Id,
+ Dealer_Custom_Price__c,
+ Delivery_List_RMB__c,
+ Consumable_Product__r.Name__c,
+ Consumable_Product__r.SFDA_Status__c,
+ Name,
+ Consumable_order__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Shipment_Count__c,
+ Consumable_Product__r.Intra_Trade_List_RMB__c,
+ Consumable_Product__r.Asset_Model_No__c,
+ Shipment_amount__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ Invoiced_Procount__c,
+ RrturnPro_count__c,
+ //Unitprice_To_agency__c,
+ InvoiceProNot_count__c,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
+ Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
+ isOutPattern__c
+ FROM Consumable_orderdetails__c
+ WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
+ ORDER BY Name
+ ];
+ //add by rentx 202-2-26
+ Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
+
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ sumPrice += cdc1.Shipment_amount__c;
+ orderzaikuId.add(cdc1.Consumable_Product__c);
+ //add by rentx 2021-2-26
+ String tempId = cdc1.Consumable_product__c;
+ if (cdc1.isOutPattern__c) {
+ cocMap.put(tempId + 'ishos', cdc1);
+ } else {
+ cocMap.put(tempId + 'nothos', cdc1);
+ }
+ //add by rentx 2021-2-26
+ }
+
+ String msoql = makeSoqlorderdet();
+ product2Selected = Database.query(msoql);
+ size = product2Selected.size();
+ initStandardController(msoql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ String str = '';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ str = 'isHos';
+ } else {
+ str = 'notHos';
+ }
+ //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
+ //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
+ if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
+ ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ } else {
+ //midmap2涓病鏈夊搴旂殑浜у搧
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ }
+ }
+ }
+
+ //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機onsumableorderdetailsRecords
+ //update by rentx 2021-01-29
+ // for(ConsumableorderdetailsInfo bss : MidMap.values()){
+ for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
+ //update by rentx 2021-01-29
+
+ //if(bss.allnumber>0){
+ bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+
+ //update by rentx 2021-2-26 start
+ if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
+ consumableorderdetailsSelectRecords.add(bss);
+ } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
+ consumableorderdetailsSelectRecords.add(bss);
+ }
+ // consumableorderdetailsSelectRecords.add(bss);
+ //}
+ }
+ // return null;
+ Integer ishosnum = 0;
+ for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
+ //ass.sortBy = sortOrderAsc;
+ for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
+ //update by rentx 2012-3-1 start
+ // if(ass.prod.Id == cdc1.Consumable_Product__c){
+ // ass.check = true;
+ // ass.orderdetails1 = cdc1;
+ // }
+ if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
+ ass.check = true;
+ ass.orderdetails1 = cdc1;
+ }
+ //update by rentx 2012-3-1 end
+ }
+
+ if (ass.hospitalSpecialOffer == true) {
+ ishosnum = ishosnum + 1;
+ }
+ }
+
+ if (ishosnum > 0) {
+ hasHosPro = true;
+ } else {
+ hasHosPro = false;
+ }
+
+ consumableorderdetailsSelectRecords.sort();
+ //add by rentx
+ noOfRecords = consumableorderdetailsSelectRecords.size();
+ //add by rentx
+ System.debug('makepagerecords4');
+ makepagerecords();
+
+ // 娑堣�楀搧鏄庣粏2銈掑彇寰�
+ consumableorderdetails2RecordsList = [
+ SELECT
+ Id,
+ Name,
+ SerialLotNo__c,
+ Consumable_Product__r.Name__c,
+ TracingCode__c,
+ Sterilization_limit__c,
+ Consumable_Product__c,
+ Consumable_Product__r.Name,
+ Consumable_Product__r.Category3__c,
+ Consumable_Product__r.Category4__c,
+ Consumable_Product__r.Category5__c,
+ Return_date__c,
+ Invoice_Date__c,
+ Box_Piece__c,
+ ProductPacking_list_manual__c,
+ //add by rentx start
+ hospitalSpecialOffer__c
+ //add by rentx end
+
+ FROM Consumable_order_details2__c
+ WHERE Consumable_ZS_order__c = :ESetId
+ ORDER BY Name
+ ];
+ for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
+ consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
+ }
+ }
+ }
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test++++++' + SecondDealer));
+ if (SecondDealer == null || SecondDealer == '') {
+ provinceOpts.add(new SelectOption('', '-鏃�-'));
+ provinceOptsMap.put('', '-鏃�-');
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ provinceOpts.add(
+ new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
+ );
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
+ }
+ } else {
+ provinceOpts.add(new SelectOption('', '-鏃�-'));
+ provinceOptsMap.put('', '-鏃�-');
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ if (Dealerelationship[i].Dealer_subordinate__c == SecondDealer) {
+ provinceOpts.add(
+ new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
+ );
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
+ }
+ }
+ for (Integer i = 0; i < Dealerelationship.size(); i++) {
+ if (Dealerelationship[i].Dealer_subordinate__c != SecondDealer) {
+ provinceOpts.add(
+ new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
+ );
+ provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
+ }
+ }
+ }
+
+ Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe();
+ cansee = dfr.isAccessible();
+ Schema.DescribeFieldResult dealerPrice = Consumable_orderdetails__c.Dealer_Custom_Price__c.getDescribe();
+ dealerPricesee = dealerPrice.isAccessible();
+ // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
+ // makeMessage();
+ //闄勪欢
+ attachmentinfo = [SELECT Id, Name, OwnerId FROM Attachment WHERE parentid = :ESetId];
+ if (attachmentinfo.size() > 0) {
+ for (Integer i = 0; i < attachmentinfo.size(); i++) {
+ attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
+ }
+ }
+ AggregateResult[] categoryList = [
+ SELECT Count(id), Category3_text__c c3c
+ FROM Product2__c
+ WHERE Category3_text__c != NULL
+ GROUP BY Category3_text__c
+ ];
+
+ categoryOptionList = new List<SelectOption>();
+ categoryOptionList.add(new SelectOption('', '-鏃�-'));
+ categoryOptionMap = new Map<String, String>();
+ categoryOptionMap.put('', '-鏃�-');
+ for (AggregateResult category3Search : categoryList) {
+ String deliverycnt = String.valueOf(category3Search.get('c3c'));
+ categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
+ categoryOptionMap.put(deliverycnt, deliverycnt);
+ }
+
+ category4OptionList = new List<SelectOption>();
+ category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4OptionMap = new Map<String, String>();
+ category4OptionMap.put('', '-鏃�-');
+ /*for(AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ category4OptionList.add(new SelectOption(deliverycnt4,deliverycnt4));
+ }*/
+
+ category5OptionList = new List<SelectOption>();
+ category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5OptionMap = new Map<String, String>();
+ category5OptionMap.put('', '-鏃�-');
+
+ //鍒嗛〉
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ totalCount = pageRecords.size();
+ System.debug('pageToken = ' + pageToken);
+ System.debug('pageSize = ' + pageSize);
+ System.debug('totalCount = ' + totalCount);
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ System.debug('paginatedAccounts.nextPageToken = ' + paginatedAccounts.nextPageToken);
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ Integer startIdx;
+ Integer endIdx;
+ startIdx = pageToken;
+ endIdx = pageToken + pageSize;
+ List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
+ if (endIdx > pageRecords.size()) {
+ endIdx = pageRecords.size();
+ }
+ for (Integer i = startIdx; i < endIdx; i++) {
+ pageRecordsTemp.add(pageRecords.get(i));
+ }
+
+ Boolean Existarrive = (coc.Arrive_Order__c != null);
+ String ConsumableOut_report = System.Label.ConsumableOut_report;
+ System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords);
+
+ data.put('paginatedAccounts', paginatedAccounts);
+ data.put('ConsumableOut_report', ConsumableOut_report);
+ data.put('accountid', accountid);
+ data.put('consumableproductdetailsRecords', consumableproductdetailsRecords);
+ data.put('agencyProType', agencyProType);
+ data.put('accountName', accountName);
+ data.put('userWorkLocation', userWorkLocation);
+ data.put('categoryOptionMap', categoryOptionMap);
+ data.put('category4OptionMap', category4OptionMap);
+ data.put('category5OptionMap', category5OptionMap);
+ data.put('outOutPatternOptionMap', outOutPatternOptionMap);
+ data.put('hasHosPro', hasHosPro);
+ data.put('Existarrive', Existarrive);
+ data.put('sumPrice', sumPrice);
+ data.put('HospitalName', HospitalName);
+ data.put('provinceOptsMap', provinceOptsMap);
+ data.put('SummonsFlag', SummonsFlag);
+ data.put('EditDelCommitBtnDisabled', EditDelCommitBtnDisabled);
+ data.put('EditAble', EditAble);
+ data.put('coc', coc);
+ data.put('pageRecords', pageRecordsTemp);
+ data.put('arriveorder', arriveorder);
+ data.put('consumableorderdetails2Count', consumableorderdetails2Count);
+ data.put('consumableorderdetails2Records', consumableorderdetails2Records);
+ data.put('HospitalInfo', HospitalInfo);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ // } catch (Exception e) {
+ // return new ResponseBodyLWC('Error',500, e.getMessage(), '');
+ // }
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC categoryAllload(String category3Lwc) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ category3 = category3Lwc;
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ category4OptionList = new List<SelectOption>();
+ category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4OptionMap = new Map<String, String>();
+ category4OptionMap.put('', '-鏃�-');
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ category4OptionMap.put(deliverycnt4, deliverycnt4);
+ }
+
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+
+ category5OptionList = new List<SelectOption>();
+ category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5OptionMap = new Map<String, String>();
+ category5OptionMap.put('', '-鏃�-');
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ category5OptionMap.put(deliverycnt5, deliverycnt5);
+ }
+ data.put('category4OptionMap', category4OptionMap);
+ data.put('category5OptionMap', category5OptionMap);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC categoryload(String category3Lwc, String category4Lwc) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ category3 = category3Lwc;
+ category4 = category4Lwc;
+ AggregateResult[] category4List = [
+ SELECT Count(id), Category4_text__c c4c
+ FROM Product2__c
+ WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
+ GROUP BY Category4_text__c
+ ];
+ category4OptionList = new List<SelectOption>();
+ category4OptionList.add(new SelectOption('', '-鏃�-'));
+ category4OptionMap = new Map<String, String>();
+ category4OptionMap.put('', '-鏃�-');
+ for (AggregateResult category4Search : category4List) {
+ String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+ category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+ category4OptionMap.put(deliverycnt4, deliverycnt4);
+ }
+
+ AggregateResult[] category5List = [
+ SELECT Count(id), Category5_text__c c5c
+ FROM Product2__c
+ WHERE Category3_text__c = :category3 AND Category4_text__c = :category4 AND Category5_text__c != NULL
+ GROUP BY Category5_text__c
+ ];
+
+ category5OptionList = new List<SelectOption>();
+ category5OptionList.add(new SelectOption('', '-鏃�-'));
+ category5OptionMap = new Map<String, String>();
+ category5OptionMap.put('', '-鏃�-');
+ for (AggregateResult category5Search : category5List) {
+ String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+ category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+ category5OptionMap.put(deliverycnt5, deliverycnt5);
+ }
+ data.put('category4OptionMap', category4OptionMap);
+ data.put('category5OptionMap', category5OptionMap);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // 妫�绱�
+ @AuraEnabled
+ public static ResponseBodyLWC searchConsumableorderdetails(
+ String agencyProTypeLwc,
+ String accountNameLwc,
+ String userWorkLocationLwc,
+ String outOutPattern,
+ String category1,
+ String category3,
+ String category4,
+ String category5,
+ Boolean editAbleLwc,
+ List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc,
+ List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc,
+ String arriveorderLwc,
+ Integer pageSizeLWC,
+ Integer pageTokenLWC
+ ) {
+ consumableproductdetailsRecords = consumableproductdetailsRecordsLwc;
+ pageRecordsLwc = pageRecordsLwcLwc;
+ System.debug('pageRecordsLwc = ' + pageRecordsLwc);
+ arriveorder = arriveorderLwc;
+ accountName = accountNameLwc;
+ userWorkLocation = userWorkLocationLwc;
+ agencyProType = agencyProTypeLwc;
+ product2Selected = new List<Product2__c>();
+ pagesize = pageSizeLWC;
+ pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
+ addSize = 0;
+ addData = new List<ConsumableorderdetailsInfo>();
+ System.debug('start addData = ' + addData);
+ System.debug('accountName = ' + accountName);
+ System.debug('userWorkLocation = ' + userWorkLocation);
+ String sqlagencyProType = '%' + agencyProTypeLwc + '%';
+ List<AggregateResult> orderdetailCount = [
+ SELECT count(id), Consumable_Product__c cpc, Box_Piece__c
+ FROM Consumable_order_details2__c
+ WHERE
+ Dealer_Arrive__c = TRUE
+ AND Dealer_Shipment__c = FALSE
+ AND Dealer_Saled__c = FALSE
+ AND Lose_Flag__c = FALSE
+ AND Cancellation_Flag__c = FALSE
+ AND Bar_Code__c != NULL
+ AND Isoverdue__c = 1
+ AND Product_Type__c LIKE :sqlagencyProType
+ AND Dealer_Info_text__c = :accountNameLwc
+ AND Arrive_Owner_Work_Location__c = :userWorkLocationLwc
+ GROUP BY Consumable_Product__c, Box_Piece__c
+ ];
+ for (AggregateResult orderdetail : orderdetailCount) {
+ zaikuId.add(String.valueOf(orderdetail.get('cpc')));
+ }
+ editAble = editAbleLwc;
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ SearchDone = 'SearchDone';
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+ //update by rentx 2021-01-29
+ Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>();
+ String countdelSoql = 'SELECT Id,Bar_Code__c,Name,Inventory_date__c,Consumable_Product__c,Consumable_Product__r.Asset_Model_No__c,Recordtypeid,Box_Piece__c,ProductPacking_list_manual__c,hospitalSpecialOffer__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 != null AND Isoverdue__c = 1 AND Arrive_Owner_Work_Location__c = :userWorkLocation AND Dealer_Info_text__c = :accountName ';
+ if (String.isNotBlank(outOutPattern) && outOutPattern.equals('ishos')) {
+ countdelSoql += ' AND hospitalSpecialOffer__c = true';
+ } else if (String.isNotBlank(outOutPattern) && outOutPattern.equals('nothos')) {
+ countdelSoql += ' AND hospitalSpecialOffer__c = false';
+ }
+ System.debug('countdelSoql = ' + countdelSoql);
+ List<Consumable_order_details2__c> CountDel = Database.query(countdelSoql);
+ System.debug('CountDel = ' + CountDel);
+ //update by rentx 2021-01-29
+
+ consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+ //consumableorderdetailsSelectRecords = reSet;
+ String soql = makeSoql(category1, category3, category4, category5);
+ size = Integer.valueOf(System.Label.orderdetLimitsize);
+ initStandardController(soql);
+ System.debug('soql = ' + soql);
+ product2Selected = Database.query(soql);
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
+ }
+
+ for (Integer i = 0; i < CountDel.size(); i++) {
+ String str = '';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ str = 'isHos';
+ } else {
+ str = 'notHos';
+ }
+ System.debug('MidMap = ' + MidMap);
+ //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
+ if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
+ //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
+ if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
+ ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ } else {
+ //midmap2涓病鏈夊搴旂殑浜у搧
+ ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
+ Jstage.allnumber = Jstage.allnumber + 1;
+ if (CountDel[i].Box_Piece__c == '鐩�') {
+ Jstage.Boxnumber = Jstage.Boxnumber + 1;
+ } else if (CountDel[i].Box_Piece__c == '涓�') {
+ Jstage.Piecenumber = Jstage.Piecenumber + 1;
+ }
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ } else {
+ Jstage.hospitalSpecialOffer = false;
+ }
+ if (HosProMap.containsKey(Jstage.Prod.Id)) {
+ Jstage.hosPro = true;
+ }
+ //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+ }
+ }
+ }
+ Integer ishosnum = 0;
+ System.debug('MidMap2 = ' + MidMap2);
+ for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
+ if (selectedIdMap.containsKey(bss.Prod.id)) {
+ continue;
+ } else {
+ bss.sortBy = false;
+ bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ consumableorderdetailsSelectRecords.add(bss);
+
+ if (bss.hospitalSpecialOffer == true) {
+ ishosnum = ishosnum + 1;
+ }
+ }
+ }
+ if (ishosnum > 0) {
+ hasHosPro = true;
+ } else {
+ hasHosPro = false;
+ }
+
+ consumableorderdetailsSelectRecords.sort();
+ makepagerecordsLwc();
+ //鍒嗛〉
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ totalCount = pageRecords.size();
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+
+ System.debug('addSize = ' + addSize);
+ Integer startIdx;
+ Integer endIdx;
+ startIdx = pageToken;
+ endIdx = pageToken + pageSize;
+ List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
+ if (endIdx > pageRecords.size()) {
+ endIdx = pageRecords.size();
+ }
+
+ System.debug('addData.size() = ' + addData.size());
+ for (ConsumableorderdetailsInfo ci : addData) {
+ pageRecordsTemp.add(ci);
+ }
+ System.debug('startIdx = ' + startIdx);
+ System.debug('endIdx = ' + endIdx);
+ System.debug('skipData = ' + skipData);
+ System.debug('pageRecords = ' + pageRecords.size());
+ String hos = '';
+ for (Integer i = startIdx; i < endIdx; i++) {
+ System.debug('skipData.get(pageRecords.get(i).Prod.Id) = ' + skipData.get(pageRecords.get(i).Prod.Id));
+ if (pageRecords.get(i).hospitalSpecialOffer == true) {
+ hos = 'ishos';
+ } else {
+ hos = 'nothos';
+ }
+ if (skipData.get(pageRecords.get(i).Prod.Id + hos) == null) {
+ pageRecordsTemp.add(pageRecords.get(i));
+ }
+ }
+
+ System.debug('pageRecordsTemp = ' + pageRecordsTemp.size());
+ data.put('paginatedAccounts', paginatedAccounts);
+ data.put('pageRecords', pageRecordsTemp);
+ data.put('SearchDone', SearchDone);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ private static String makeSoql(String CateName, String Category3, String Category4, String Category5) {
+ String sqlTail1 = '(\'';
+ for (Integer i = 0; i < zaikuId.size(); i++) {
+ if (zaikuId[i] != null) {
+ if (i < zaikuId.size() - 1) {
+ sqlTail1 += zaikuId[i] + '\',\'';
+ } else {
+ sqlTail1 += zaikuId[i];
+ }
+ }
+ }
+ sqlTail1 += '\')';
+ String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c ';
+ soql += ' WHERE Id in' + sqlTail1;
+ if (!String.isBlank(CateName)) {
+ soql +=
+ ' AND (Name__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\' or Asset_Model_No__c like \'%' +
+ String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+ '%\')';
+ }
+ if (!String.isBlank(Category3)) {
+ soql += ' AND Category3__c = \'' + Category3 + '\'';
+ }
+ if (!String.isBlank(Category4)) {
+ soql += ' AND Category4__c = \'' + Category4 + '\'';
+ }
+ if (!String.isBlank(Category5)) {
+ soql += ' AND Category5__c = \'' + Category5 + '\'';
+ }
+ return soql;
+ }
+
+ public static String makeSoqlorderdet() {
+ String sqlTail = '(\'';
+ for (Integer i = 0; i < orderzaikuId.size(); i++) {
+ if (i < orderzaikuId.size() - 1) {
+ sqlTail += orderzaikuId[i] + '\',\'';
+ } else {
+ sqlTail += orderzaikuId[i];
+ }
+ }
+ sqlTail += '\')';
+ String msoql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c ';
+ msoql += ' WHERE Id in' + sqlTail;
+ return msoql;
+ }
+
+ public static String makeSoqlinventory() {
+ String sqlTail = '(\'';
+ for (Integer i = 0; i < zaikuId.size(); i++) {
+ if (zaikuId[i] != null) {
+ if (i < zaikuId.size() - 1) {
+ sqlTail += zaikuId[i] + '\',\'';
+ } else {
+ sqlTail += zaikuId[i];
+ }
+ }
+ }
+ sqlTail += '\')';
+ String msoql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c FROM Product2__c ';
+ msoql += ' WHERE Id in' + sqlTail;
+ return msoql;
+ }
+
+ public static void initStandardController(String soql) {
+ // init standard controller
+ System.debug('soql =' + soql);
+ System.debug('initStandardController star');
+ //setCon = new ApexPages.StandardSetController(Database.getQueryLocator(soql));
+ // sets the number of records in each page set
+ //setCon.setPageSize(size);
+ System.debug('initStandardController end');
+ }
+
+ public static List<ConsumableorderdetailsInfo> makepagerecords() {
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ System.debug('zhj1');
+ //鍙栧嚭閫夋嫨鐨勪骇鍝�
+ if (pageRecords != null) {
+ System.debug('zhj2');
+ for (ConsumableorderdetailsInfo ass : pageRecords) {
+ if (ass.check == true) {
+ if (ass.hospitalSpecialOffer == true) {
+ selectedIdMap.put(ass.Prod.Id + 'ishos', ass.Prod.Id);
+ } else {
+ selectedIdMap.put(ass.Prod.Id + 'nothos', ass.Prod.Id);
+ }
+ reSet.add(ass);
+ }
+ }
+ }
+ System.debug('zhj3');
+ pageRecords = new List<ConsumableorderdetailsInfo>();
+ System.debug('reSet.size() = ' + reSet.size());
+ if (editAble && String.isBlank(arriveorder)) {
+ pageRecords = reSet;
+ }
+ //Integer pagestartNo = (setCon.getPageNumber() * size)-size;
+ //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1);
+ Integer addNo = 0;
+ //update by rentx 2021-2-26 start
+ System.debug('consumableorderdetailsSelectRecords.size() = ' + consumableorderdetailsSelectRecords.size());
+ for (ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords) {
+ Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
+ if (
+ (info.hospitalSpecialOffer && selectedIdMap.containsKey(info.Prod.Id + 'ishos')) ||
+ (info.hospitalSpecialOffer == false && selectedIdMap.containsKey(info.Prod.Id + 'nothos'))
+ ) {
+ addNo++;
+ } else {
+ if (info.check == false) {
+ info.orderdetails1 = orderdetails1;
+ }
+ pageRecords.add(info);
+ addNo++;
+ }
+ }
+ System.debug('pageRecords 2 = ' + pageRecords);
+ System.debug('zhj5');
+ System.debug('pageRecords = ' + pageRecords);
+ return pageRecords;
+ }
+
+ public static List<ConsumableorderdetailsInfo> makepagerecordsLwc() {
+ List<ConsumableorderdetailsInfoLwc> reSetLwc = new List<ConsumableorderdetailsInfoLwc>();
+ Map<String, String> selectedIdMap = new Map<String, String>();
+ skipData = new Map<String, String>();
+ System.debug('makepagerecordsLwc pageRecordsLwc = ' + pageRecordsLwc);
+ //鍙栧嚭閫夋嫨鐨勪骇鍝�
+ if (pageRecordsLwc != null) {
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ System.debug('ass.check = ' + ass.check);
+ if (ass.check == true) {
+ if (ass.hospitalSpecialOffer == true) {
+ selectedIdMap.put(ass.Prod.Id + 'ishos', ass.Prod.Id);
+ skipData.put(ass.Prod.Id + 'ishos', ass.Prod.Id);
+ } else {
+ selectedIdMap.put(ass.Prod.Id + 'nothos', ass.Prod.Id);
+ skipData.put(ass.Prod.Id + 'nothos', ass.Prod.Id);
+ }
+ reSetLwc.add(ass);
+ }
+ }
+ }
+ System.debug('selectedIdMap = ' + selectedIdMap);
+ pageRecords = new List<ConsumableorderdetailsInfo>();
+ if (editAble && String.isBlank(arriveorder)) {
+ List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
+ System.debug('reSetLwc = ' + reSetLwc);
+ for (ConsumableorderdetailsInfoLwc assLwc : reSetLwc) {
+ ConsumableorderdetailsInfo ci = new ConsumableorderdetailsInfo();
+ ci.check = assLwc.check;
+ ci.oldCheck = assLwc.oldCheck;
+ ci.orderdetails1 = assLwc.orderdetails1;
+ ci.orderdetails2 = assLwc.orderdetails2;
+ ci.Prod = assLwc.Prod;
+ ci.Boxnumber = assLwc.Boxnumber;
+ ci.Piecenumber = assLwc.Piecenumber;
+ ci.allnumber = assLwc.allnumber;
+ ci.oldConsumableCount = assLwc.oldConsumableCount;
+ ci.canSelect = assLwc.canSelect;
+ ci.sortBy = assLwc.sortBy;
+ ci.packinglist = assLwc.packinglist;
+ ci.approbation_No = assLwc.approbation_No;
+ ci.expiration_Date = assLwc.expiration_Date;
+ ci.boxorpiecein = assLwc.boxorpiecein;
+ ci.boxorpiece = assLwc.boxorpiece;
+ ci.boxorpieceMap = assLwc.boxorpieceMap;
+ ci.concc = assLwc.concc;
+ ci.BoxPiece = assLwc.BoxPiece;
+ ci.hospitalSpecialOffer = assLwc.hospitalSpecialOffer;
+ ci.hosPro = assLwc.hosPro;
+ reSet.add(ci);
+ }
+ pageRecords = reSet;
+ System.debug('reSet = ' + reSet);
+ addData = reSet.clone();
+ System.debug('addData = reSet = ' + addData);
+ }
+ //Integer pagestartNo = (setCon.getPageNumber() * size)-size;
+ //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1);
+ Integer addNo = 0;
+ //update by rentx 2021-2-26 start
+ System.debug('consumableorderdetailsSelectRecords.size() = ' + consumableorderdetailsSelectRecords.size());
+ for (ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords) {
+ Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
+ if (
+ (info.hospitalSpecialOffer && selectedIdMap.containsKey(info.Prod.Id + 'ishos')) ||
+ (info.hospitalSpecialOffer == false && selectedIdMap.containsKey(info.Prod.Id + 'nothos'))
+ ) {
+ System.debug('鍘绘帀鐨刬d : ' + info.Prod.Id);
+ addNo++;
+ addSize++;
+ } else {
+ if (info.check == false) {
+ info.orderdetails1 = orderdetails1;
+ }
+ pageRecords.add(info);
+ addNo++;
+ }
+ }
+ System.debug('pageRecords.size() = ' + pageRecords.size());
+ System.debug('end addData = ' + addData);
+ return pageRecords;
+ }
+
+ // 淇濆瓨鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC save(
+ Consumable_order__c cocLwc,
+ String hospitalInfoLwc,
+ String hospitalNameLwc,
+ String secondaryDistributorLwc,
+ List<ConsumableorderdetailsInfoLwc> pageRecordsLwc,
+ String accountidLwc,
+ String ESetIdLwc,
+ List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc,
+ String agencyProTypeLwc,
+ String userWorkLocationLwc
+ ) {
+ coc = cocLwc;
+ HospitalInfo = hospitalInfoLwc;
+ HospitalName = hospitalNameLwc;
+ SecondDealer = secondaryDistributorLwc;
+ pageRecordsLwc = pageRecordsLwc;
+ accountid = accountidLwc;
+ consumableproductdetailsRecords = consumableproductdetailsRecordsLwc;
+ ESetId = ESetIdLwc;
+ agencyProType = agencyProTypeLwc;
+ userWorkLocation = userWorkLocationLwc;
+
+ System.debug('coc = ' + coc);
+ System.debug('HospitalInfo = ' + HospitalInfo);
+ System.debug('HospitalName = ' + HospitalName);
+ System.debug('SecondDealer = ' + SecondDealer);
+ System.debug('pageRecordsLwc = ' + pageRecordsLwc);
+ System.debug('accountid = ' + accountid);
+ System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords);
+ System.debug('ESetId = ' + ESetId);
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ //璁㈠崟淇℃伅纭
+ if (coc.SummonsForDirction__c == '' || coc.SummonsForDirction__c == null) {
+ // coc.SummonsForDirction__c.addError('璇疯緭鍏ユ寚绀哄崟鐩殑');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ユ寚绀哄崟鐩殑', '');
+ } else if (coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌') {
+ if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
+ // coc.addError('璇疯緭鍏ュ尰闄�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄�', '');
+ }
+ if (String.isBlank(coc.Order_ForCustomerText__c)) {
+ // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
+ } else if (String.isNotBlank(SecondDealer) || String.isNotBlank(coc.Order_ForDealerText__c)) {
+ // coc.addError('涓嶉渶瑕佷簩绾х粡閿�鍟嗗拰缁忛攢鍟�(褰曞叆)淇℃伅' );
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佷簩绾х粡閿�鍟嗗拰缁忛攢鍟�(褰曞叆)淇℃伅', '');
+ }
+ } else if (coc.SummonsForDirction__c == '鍖婚櫌璇曠敤') {
+ if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
+ // coc.addError('璇疯緭鍏ュ尰闄�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄�', '');
+ }
+ if (String.isBlank(coc.Order_ForCustomerText__c)) {
+ // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
+ }
+ } else if (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�') {
+ if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) {
+ // coc.addError('蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)', '');
+ }
+ if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
+ // coc.addError('璇疯緭鍏ュ尰闄�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄�', '');
+ }
+ if (String.isBlank(coc.Order_ForCustomerText__c)) {
+ // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹�', '');
+ }
+ } else if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
+ if (String.isNotBlank(HospitalInfo) || String.isNotBlank(HospitalName)) {
+ // coc.addError('涓嶉渶瑕佽緭鍏ュ尰闄�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佽緭鍏ュ尰闄�', '');
+ }
+ if (String.isNotBlank(coc.Order_ForCustomerText__c)) {
+ // coc.Order_ForCustomerText__c.addError('涓嶉渶瑕佽緭鍏ョ瀹�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佽緭鍏ョ瀹�', '');
+ }
+ if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) {
+ // coc.addError('蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)', '');
+ }
+ }
+
+ Integer isHos = 0;
+
+ Integer FLG = 0;
+ Integer Count = 0;
+ for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) {
+ FLG = FLG + 1;
+ if (CheckCount.check == false) {
+ Count = Count + 1;
+ } else {
+ //add by rentx
+ if (CheckCount.hospitalSpecialOffer) {
+ isHos = isHos + 1;
+ }
+ //add by rentx
+ }
+ }
+ if (Count == FLG) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇烽�夋嫨鎵�闇�娑堣�楀搧'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇烽�夋嫨鎵�闇�娑堣�楀搧', '');
+ }
+ // gzw 娉ㄩ噴 鍒ゆ柇鎻愬墠 20210308
+ //checkOutPattern();
+ //鏍规嵁鐢ㄦ埛閫変腑鐨勪骇鍝佺粰 鍑哄簱鍗曚笂鐨勬槸鍚﹀尰闄㈢壒浠峰嚭搴撳瓧娈佃祴鍊�
+ Integer isHosCheckOutPattern = 0;
+ for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) {
+ if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) {
+ isHosCheckOutPattern = isHosCheckOutPattern + 1;
+ }
+ }
+ if (isHosCheckOutPattern > 0) {
+ coc.OutPattern__c = true;
+ } else {
+ coc.OutPattern__c = false;
+ }
+
+ // add by rentx 2021-3-10 start
+ //鐗逛环鍖婚櫌鍑哄簱闈炴湰鍖婚櫌缁存姢鐨勭壒浠峰晢鍝佹椂,鎶ラ敊 闈炵壒浠峰尰闄㈠嚭搴撶淮鎶ゅ湪鍖婚櫌鐗逛环鍏崇郴琛ㄧ殑浜у搧鏃� 鎶ラ敊
+ if (coc.SummonsForDirction__c != '浜掔浉璋冭揣') {
+ //闈炵壒浠峰尰闄㈠嚭搴撶壒浠蜂骇鍝佹椂 鎶ラ敊(褰撳墠缁忛攢鍟嗕笅娌℃湁鐗逛环鍖婚櫌闄ゅ)
+ List<hospitalprice__c> hopList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid];
+ //缁忛攢鍟嗗搴斿尰闄笅鐨勬墍鏈夌壒浠蜂骇鍝�
+ Map<String, String> proMap = new Map<String, String>();
+ //缁忛攢鍟嗕笅鐨勬墍鏈夌壒浠蜂骇鍝�
+ Map<String, String> allProMap = new Map<String, String>();
+
+ if (hopList != null && hopList.size() > 0) {
+ Boolean flag = false;
+ if (HospitalInfo != null && HospitalInfo != '') {
+ for (hospitalprice__c hp : hopList) {
+ allProMap.put(hp.product__c, '');
+ //濡傛灉褰撳墠 鍖婚櫌鐗逛环鍏崇郴涓殑鍖婚櫌瀵瑰簲鍑哄簱鍗曚笂鍑哄簱鐨勫尰闄�,鍒欐斁浜у搧id鍒癿ap
+ if (hp.hospital__c == HospitalInfo) {
+ flag = true;
+ proMap.put(hp.product__c, '');
+ }
+ }
+ }
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.check == true) {
+ //鍒ゆ柇閫変腑鐨勫尰闄㈢壒浠蜂骇鍝�
+ if (ass.hospitalSpecialOffer == true) {
+ //鐢ㄦ埛閫変腑浜嗗綋鍓嶅尰闄笅鐨勭壒浠蜂骇鍝�
+ if (proMap.containsKey(ass.Prod.Id)) {
+ continue;
+ //鐢ㄦ埛閫変腑浜嗘病鏈夌淮鎶ょ壒浠峰尰闄㈢殑鐗逛环浜у搧
+ } else if (!allProMap.containsKey(ass.Prod.Id)) {
+ continue;
+ } else {
+ //鐢ㄦ埛閫変腑闈炲綋鍓嶅尰闄㈢淮鎶ょ殑鐗逛环浜у搧
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '褰撳墠鍖婚櫌娌℃湁缁存姢 娑堣�楀搧:'+ ass.Prod.Name__c +' 鐨勭壒浠�'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '褰撳墠鍖婚櫌娌℃湁缁存姢 娑堣�楀搧:' + ass.Prod.Name__c + '鐨勭壒浠�', '');
+ }
+ } //闈炲尰闄㈢壒浠蜂骇鍝佸彲浠ュ嚭搴撶粰浠绘剰鍖婚櫌,鎵�浠ヤ笉闇�瑕佸垽鏂�
+ }
+ }
+ }
+ } else {
+ //濡傛灉鏄簰鐩歌皟璐�,鍒ゆ柇 缁忛攢鍟�(褰曞叆) 鏄惁缁存姢浜� 褰撳墠閫変腑鐨勭壒浠蜂骇鍝�
+ List<hospitalprice__c> hopList = [
+ SELECT id, hospital__c, product__c
+ FROM hospitalprice__c
+ WHERE account__c = :coc.Order_ForDealerTextID__c
+ ];
+ Map<Id, String> proMap = new Map<Id, String>();
+ if (hopList != null && hopList.size() > 0) {
+ for (hospitalprice__c hpc : hopList) {
+ proMap.put(hpc.product__c, '');
+ }
+
+ String proStr = '';
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.check == true) {
+ if (ass.hospitalSpecialOffer == true) {
+ if (!proMap.containsKey(ass.Prod.Id)) {
+ proStr += ass.Prod.Name__c + ',';
+ }
+ }
+ }
+ }
+ if (proStr != '') {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '缁忛攢鍟�:'+coc.Order_ForDealerText__c +' 娌℃湁娑堣�楀搧:'+proStr.substring(0,proStr.length()-1) + ' 鐨勭壒浠�'));
+ // return null;
+ return new ResponseBodyLWC(
+ 'Error',
+ 500,
+ '缁忛攢鍟�:' +
+ coc.Order_ForDealerText__c +
+ ' 娌℃湁娑堣�楀搧:' +
+ proStr.substring(0, proStr.length() - 1) +
+ ' 鐨勭壒浠�',
+ ''
+ );
+ }
+ }
+ }
+
+ // checkOutPattern();
+ Consumable_order__c p = new Consumable_order__c();
+ List<Consumable_orderdetails__c> Ins = new List<Consumable_orderdetails__c>();
+ List<Consumable_order_details2__c> InsProduct = new List<Consumable_order_details2__c>();
+ Savepoint sp = Database.setSavepoint();
+ // try {
+ //鏂板缓璁㈠崟鏃�
+ if (String.isEmpty(ESetId)) {
+ p.Name = '*';
+ p.Order_type__c = '浼犵エ';
+ p.Order_ProType__c = agencyProType;
+ if (coc.SummonsStatus_c__c == null || String.isBlank(coc.SummonsStatus_c__c))
+ coc.SummonsStatus_c__c = '鑽夋涓�';
+ // update strat by vivek 2019-7-12
+ p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c;
+ // update end by vivek 2019-7-12
+ p.SummonsStatus_c__c = coc.SummonsStatus_c__c;
+ if (coc.Arrive_Order__c != null) {
+ p.Arrive_Order__c = coc.Arrive_Order__c;
+ }
+ p.Offers_Price__c = coc.Offers_Price__c;
+ p.Dealer_Info__c = accountid;
+ if (String.isBlank(SecondDealer)) {
+ p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+ p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ } else {
+ p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+ p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ p.Order_ForDealer__c = SecondDealer;
+ }
+ P.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+ P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c;
+ p.Order_date__c = coc.Order_date__c;
+ p.SummonsForDirction__c = coc.SummonsForDirction__c;
+ p.RecordTypeid = System.Label.RT_ConOrder_Outboundorder;
+ // update start by vivek 2019-7-15
+ p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c;
+ // update end by vivek 2019-7-15
+ //add by rentx
+ p.OutPattern__c = coc.OutPattern__c;
+ //add by rentx
+ //Map<String,String> ProductNewMap = new Map<String, String>();
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.check == true) {
+ if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
+ // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)', '');
+ }
+ if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '鍖婚櫌璇曠敤') {
+ // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)', '');
+ }
+ if (
+ ass.orderdetails1.Delivery_List_RMB__c == 0 &&
+ (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
+ coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌')
+ ) {
+ // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)', '');
+ }
+ if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) {
+ // ass.orderdetails1.Shipment_Count__c.addError('璇疯緭鍏ュ嚭璐ф暟閲�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐ф暟閲�', '');
+ }
+
+ if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') {
+ // ass.orderdetails1.Box_Piece__c.addError('璇疯緭鍏ュ崟浣�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ崟浣�', '');
+ }
+ if (ass.orderdetails1.Box_Piece__c == '鐩�') {
+ if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) {
+ //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
+ if (ass.oldCheck == false) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+ } else {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC(
+ 'Error',
+ 500,
+ '娑堣�楀搧' +
+ ass.orderdetails1.Consumable_Product__r.Name__c +
+ '搴撳瓨涓嶈冻',
+ ''
+ );
+ }
+ }
+ } else if (ass.orderdetails1.Box_Piece__c == '涓�') {
+ if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) {
+ //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
+ if (ass.oldCheck == false) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+ } else {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC(
+ 'Error',
+ 500,
+ '娑堣�楀搧' +
+ ass.orderdetails1.Consumable_Product__r.Name__c +
+ '搴撳瓨涓嶈冻',
+ ''
+ );
+ }
+ }
+ }
+ }
+ }
+ insert p;
+ ESetId = p.id;
+ List<Consumable_order__c> detailName = new List<Consumable_order__c>();
+ detailName = [SELECT id, Name FROM Consumable_order__c WHERE id = :ESetId];
+ Integer i = 1;
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.check == true) {
+ Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
+ String str = string.valueOf(i);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ InsAfterDel.Name = detailName[0].name + '-' + str;
+ InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c;
+ InsAfterDel.Consumable_order__c = p.id;
+ InsAfterDel.Consumable_Product__c = ass.Prod.id;
+ InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
+ InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
+ // TODO 榛樿 鐩� 锛岄渶瑕佷慨姝�
+ InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c;
+ InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c;
+ //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
+ InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
+ InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ //add by rentx 2021-2-26 start
+ InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer;
+ //add by rentx 2021-2-26 end
+ i++;
+ Ins.add(InsAfterDel);
+ }
+ }
+ // 濡傛灉 鍑哄簱鍗� 鍜� OCM鍙戣揣Header杩� 鐨勮瘽锛屽彂璐х殑Detail2 Copy鍒� 鍑哄簱鍗曠殑Detail2閲�
+ if (getExistarrive()) {
+ for (ConsumableorderdetailsInfo ass : consumableproductdetailsRecords) {
+ //BlockForP;
+ Consumable_order_details2__c InsProductDet = new Consumable_order_details2__c();
+ InsProductDet.Id = ass.orderdetails2.Id;
+ InsProductDet.Consumable_ZS_order__c = p.id;
+ i++;
+ InsProduct.add(InsProductDet);
+ }
+ }
+ if (Ins.size() > 0) {
+ insert Ins;
+ }
+ if (InsProduct.size() > 0) {
+ //ControllerUtil.updateOrderDetailsSatus(InsProduct);
+ update InsProduct;
+ }
+ } else if (ESetId != null || ESetId.length() > 0) {
+ //淇敼涔嬪悗 淇濆瓨璁㈠崟
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ // update start by vivek 2019-7-15 add "NoConfirmedPrice__c" in select
+ cocinfo = [
+ SELECT Id, Name, SummonsStatus_c__c, NoConfirmedPrice__c, Dealer_Info__c, Order_ForHospital__c, SummonsForDirction__c
+ FROM Consumable_order__c
+ WHERE Id = :ESetId
+ ];
+ // update end by vivek 2019-7-15
+ if (cocinfo.size() > 0) {
+ p = cocinfo[0];
+ }
+ p.Name = coc.Name;
+ p.Dealer_Info__c = accountid;
+ p.Order_ProType__c = agencyProType;
+ if (String.isEmpty(SecondDealer)) {
+ p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+ p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ System.debug('SecondDealer = ' + SecondDealer);
+ p.Order_ForDealer__c = null;
+ } else {
+ p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+ p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+ p.Order_ForDealer__c = SecondDealer;
+ }
+ P.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+ P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c;
+ p.Order_date__c = coc.Order_date__c;
+ p.SummonsForDirction__c = coc.SummonsForDirction__c;
+ //add by rentx
+ p.OutPattern__c = coc.OutPattern__c;
+ // update start by vivek 2019-7-15
+ if (p.SummonsStatus_c__c == '浠锋牸鏈畾') {
+ p.NoConfirmedPrice__c = false;
+ p.SummonsStatus_c__c = '宸插畬鎴�';
+ } else {
+ p.SummonsStatus_c__c = '鑽夋涓�';
+ }
+ // p.SummonsStatus_c__c = '鑽夋涓�';
+ // update end by vivek 2019-7-15
+ Integer i = 1;
+ //Map<String,String> ProductOldMap = new Map<String, String>();
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.check == true) {
+ if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
+ // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)', '');
+ }
+ Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
+ if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '鍖婚櫌璇曠敤') {
+ // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)', '');
+ }
+ if (
+ ass.orderdetails1.Delivery_List_RMB__c == 0 &&
+ (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
+ coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌')
+ ) {
+ // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)', '');
+ }
+ if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') {
+ // ass.orderdetails1.Box_Piece__c.addError('璇疯緭鍏ュ崟浣�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ崟浣�', '');
+ }
+ if (ass.orderdetails1.Box_Piece__c == '鐩�') {
+ if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) {
+ //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
+ if (ass.oldCheck == false) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+ } else {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC(
+ 'Error',
+ 500,
+ '娑堣�楀搧' +
+ ass.orderdetails1.Consumable_Product__r.Name__c +
+ '搴撳瓨涓嶈冻',
+ ''
+ );
+ }
+ }
+ } else if (ass.orderdetails1.Box_Piece__c == '涓�') {
+ if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) {
+ if (ass.oldCheck == false) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+ } else {
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+ return new ResponseBodyLWC(
+ 'Error',
+ 500,
+ '娑堣�楀搧' +
+ ass.orderdetails1.Consumable_Product__r.Name__c +
+ '搴撳瓨涓嶈冻',
+ ''
+ );
+ }
+ }
+ }
+ if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) {
+ // ass.orderdetails1.Shipment_Count__c.addError('璇疯緭鍏ュ嚭璐ф暟閲�');
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐ф暟閲�', '');
+ } else {
+ String str = string.valueOf(i);
+ if (str.length() == 1) {
+ str = '0' + str;
+ }
+ InsAfterDel.Name = p.name + '-' + str;
+ InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c;
+ InsAfterDel.Consumable_order__c = ESetId;
+ InsAfterDel.Consumable_Product__c = ass.Prod.id;
+ InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
+ InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
+ InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c;
+ InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c;
+ //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
+ InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
+ InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+ //add by rentx 2021-2-26 start
+ InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer;
+ //add by rentx 2021-2-26 end
+ i++;
+ Ins.add(InsAfterDel);
+ }
+ }
+ }
+ update p;
+ List<Consumable_orderdetails__c> qs = new List<Consumable_orderdetails__c>();
+ qs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId];
+ if (qs.size() > 0) {
+ delete qs;
+ }
+ if (Ins.size() > 0) {
+ insert Ins;
+ }
+ }
+ // }catch (Exception ex) {
+ // Database.rollback(sp);
+ // // ApexPages.addMessages(ex);
+ // // return null;
+ // //return new ResponseBodyLWC('Error',500, ex.getMessage(), '');
+ // return new ResponseBodyLWC('Error',500, JSON.serialize(ex), '');
+ // }
+ data.put('ESetId', ESetId);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ public static void checkOutPattern() {
+ //鏍规嵁鐢ㄦ埛閫変腑鐨勪骇鍝佺粰 鍑哄簱鍗曚笂鐨勬槸鍚﹀尰闄㈢壒浠峰嚭搴撳瓧娈佃祴鍊�
+ Integer isHos = 0;
+ for (ConsumableorderdetailsInfo CheckCount : pageRecords) {
+ if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) {
+ ishos = ishos + 1;
+ }
+ }
+ if (isHos > 0) {
+ coc.OutPattern__c = true;
+ } else {
+ coc.OutPattern__c = false;
+ }
+ }
+
+ //鎵撳嵃PDF
+ @AuraEnabled
+ public static ResponseBodyLWC PraseToPDF(Consumable_order__c cocLwc, String ESetId) {
+ System.debug('cocLwc = ' + cocLwc);
+ System.debug('ESetId = ' + ESetId);
+ coc = cocLwc;
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ if (coc.SummonsStatus_c__c == '鎵瑰噯') {
+ Consumable_order__c P = new Consumable_order__c();
+ List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+ // update start by vivek 2019-7-15 add 鈥淣oConfirmedPrice__c鈥� in select
+ cocinfo = [
+ SELECT
+ Id,
+ Name,
+ SummonsStatus_c__c,
+ NoConfirmedPrice__c,
+ Dealer_Info__c,
+ Order_ForHospital__c,
+ SummonsForDirction__c,
+ Billed_Status__c
+ FROM Consumable_order__c
+ WHERE Id = :ESetId
+ ];
+ // update end by vivek 2019-7-15
+ if (cocinfo.size() > 0) {
+ p = cocinfo[0];
+ }
+ p.SummonsStatus_c__c = '鍑哄簱鍗曞凡鎵撳嵃';
+ update p;
+ }
+ data.put('ESetId', ESetId);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ //鏌ユ壘缁忛攢鍟�
+ @AuraEnabled(cacheable=true scope='global')
+ public static List<LookupSearchResult> search(String searchTerm) {
+ System.debug('searchTerm = ' + searchTerm);
+ String nameCondition = '';
+ nameCondition += '%' + String.escapeSingleQuotes(searchTerm.replaceAll('%', '\\%')) + '%';
+ List<Account> accs = new List<Account>();
+ System.debug('nameCondition = ' + nameCondition);
+ //鏌ヨ鏉′欢淇敼
+ //绛涢�夊垽鏂潯浠讹細褰撳墠璐㈠勾鐨�4/1 ~ 绗簩骞寸殑6/30 聽& ET or ENG绫诲瀷 & 褰撳墠鐢ㄦ埛绫诲瀷
+ //1 and 2
+ //1. Integer year 2022/4/1 ~ 2023/6/30
+ //寮�濮嬫棩鏈� + 缁撴潫鏃ユ湡
+ //Contract_Decide_Start_Date__c>=寮�濮嬫棩鏈� and Contract_Decide_End_Date__c<缁撴潫鏃ユ湡
+ //2. 娣诲姞缁忛攢鍟嗗厑閿�绫诲瀷锛欵T缁忛攢鍟嗗崗璁紱ENG鑰楁潗缁忛攢鍟嗗崗璁�
+ //鍙栧綋鍓嶇敤鎴风殑绫诲瀷锛屽鏋滅敤鎴风被鍨嬫槸ET,ET缁忛攢鍟嗗崗璁� = true
+ // Date today = Date.today();
+ // Integer thisYear = today.year();
+ // Integer nextYear = today.year() + 1;
+ // Date thisDatetime = Date.newInstance(thisYear, 4, 1);
+ // Date nextDatetime = Date.newInstance(nextYear, 6, 30);
+ // System.debug('thisDatetime = ' + thisDatetime);
+ // System.debug('nextDatetime = ' + nextDatetime);
+
+ // User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()];
+ // System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
+ // System.debug('UserProTypecTemp = ' + UserProTypecTemp);
+ // System.debug('UserProTypecTemp.UserPro_Type__c = ' + UserProTypecTemp.UserPro_Type__c);
+ // if (UserProTypecTemp.UserPro_Type__c == 'ENG') {
+ // accs = [
+ // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
+ // FROM Account
+ // WHERE
+ // // Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
+ // // AND
+ // Name LIKE :nameCondition
+ // AND RecordType.DeveloperName = 'AgencyContract'
+ // AND Contract_Decide_Start_Date__c >= :thisDatetime
+ // AND Contract_Decide_End_Date__c <= :nextDatetime
+ // AND ENG_Dealer__c = true
+ // ORDER BY Name
+ // LIMIT 49
+ // ];
+ // }
+ // if (UserProTypecTemp.UserPro_Type__c == 'ET') {
+ // accs = [
+ // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
+ // FROM Account
+ // WHERE
+ // // Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
+ // // AND
+ // Name LIKE :nameCondition
+ // AND RecordType.DeveloperName = 'AgencyContract'
+ // AND Contract_Decide_Start_Date__c >= :thisDatetime
+ // AND Contract_Decide_End_Date__c <= :nextDatetime
+ // AND ET_SP_Dealer__c = true
+ // ORDER BY Name
+ // LIMIT 49
+ // ];
+ // }
+
+
+ Date today = Date.today();
+ //Date today = Date.newInstance(2023, 3, 1);
+ Integer thisMonth = today.month();
+ System.debug('thisMonth = ' + thisMonth);
+
+ Integer lastYear = today.year() - 1;
+ Integer thisYear = today.year();
+ Integer nextYear = today.year() + 1;
+
+ Date lastDatetime = Date.newInstance(lastYear, 4, 1);
+ Date thisDatetime = Date.newInstance(thisYear, 4, 1);
+ Date thisDatetime2 = Date.newInstance(thisYear, 7, 1);
+ Date nextDatetime = Date.newInstance(nextYear, 7, 1);
+ System.debug('lastDatetime = ' + lastDatetime);
+ System.debug('thisDatetime = ' + thisDatetime);
+ System.debug('thisDatetime2 = ' + thisDatetime2);
+ System.debug('nextDatetime = ' + nextDatetime);
+ System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
+ User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()];
+
+ String sql = 'SELECT id, Parentid FROM Account WHERE Parent.Name LIKE :nameCondition ';
+ if(thisMonth < 4){
+ sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :thisDatetime2 ';
+ }else if(thisMonth >= 4 && thisMonth <= 6){
+ sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
+ }else{
+ sql += 'AND Contract_Decide_Start_Date__c >= :thisDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
+ }
+ if (UserProTypecTemp.UserPro_Type__c == 'ENG') {
+ sql += 'AND ENG_Dealer__c = true';
+ }
+ if (UserProTypecTemp.UserPro_Type__c == 'ET') {
+ sql += 'AND ET_SP_Dealer__c = true';
+ }
+ System.debug('sql = ' + sql);
+ accs = Database.query(sql);
+ // 鐢ㄤ簬淇濆瓨鐗圭害缁忛攢鍟嗗尮閰嶅埌鐨勫叾鐖剁被鐨刬d
+ Set<String> pids = new Set<String>();
+ for (Account acc : accs) {
+ pids.add(acc.Parentid);
+ }
+
+ accs = [
+ SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
+ FROM Account
+ WHERE
+ (Id IN :pids
+ OR (Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
+ AND Name LIKE :nameCondition))
+ AND RecordType.DeveloperName = 'Agency'
+ ORDER BY Name
+ LIMIT 49
+ ];
+
+ // accs = [
+ // SELECT id, Parentid
+ // FROM Account
+ // WHERE
+ // Parent.Name LIKE :nameCondition
+ // AND Contract_Decide_Start_Date__c <= :Date.Today()
+ // AND Contract_Decide_End_Date__c >= :Date.Today()
+ // ];
+
+ // 鐢ㄤ簬淇濆瓨鐗圭害缁忛攢鍟嗗尮閰嶅埌鐨勫叾鐖剁被鐨刬d
+ // Set<String> pids = new Set<String>();
+ // for (Account acc : accs) {
+ // pids.add(acc.Parentid);
+ // }
+ // accs = [
+ // SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
+ // FROM Account
+ // WHERE
+ // (Id IN :pids
+ // OR (Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
+ // AND Name LIKE :nameCondition))
+ // AND RecordType.DeveloperName = 'Agency'
+ // AND Is_Active__c != '鐒″姽'
+ // ORDER BY Name
+ // LIMIT 5
+ // ];
+ System.debug('accs = ' + accs);
+ List<LookupSearchResult> results = new List<LookupSearchResult>();
+ String accountIcon = 'standard:account';
+ for (Account account : accs) {
+ String subtitle = account.BillingCity == null ? 'Account' : 'Account 鈥� ' + account.BillingCity;
+ results.add(new LookupSearchResult(account.Id, 'Account', accountIcon, account.Name, subtitle));
+ }
+ results.sort();
+ System.debug('results = ' + results);
+ return results;
+ }
+
+ //淇濆瓨闄勪欢
+ @AuraEnabled
+ public static String saveFile(Id recordId, String fileName, String base64Data) {
+ base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
+ ContentVersion cv = new ContentVersion();
+ cv.Title = fileName;
+ cv.PathOnClient = '/' + fileName;
+ cv.FirstPublishLocationId = recordId;
+ cv.VersionData = EncodingUtil.base64Decode(base64Data);
+ cv.IsMajorVersion = true;
+ insert cv;
+ return cv.Id;
+ }
+
+ //鑾峰彇闄勪欢
+ @AuraEnabled
+ public static ResponseBodyLWC getFiles(Id recordId) {
+ System.debug('getFiles recordId = ' + recordId);
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ List<ContentVersion> cvList = [
+ SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate, ContentDocumentId
+ FROM ContentVersion
+ WHERE FirstPublishLocationId = :recordId
+ ];
+ data.put('cvList', cvList);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ //璺宠浆鍑鸿揣/閿�鍞�
+ @AuraEnabled
+ public static ResponseBodyLWC GoodsDelivery(
+ Consumable_order__c cocLwc,
+ String ESetId,
+ List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc
+ ) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ coc = cocLwc;
+ ESetId = ESetId;
+ pageRecordsLwc = pageRecordsLwcLwc;
+ if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
+ List<Account> accList = [
+ SELECT Id
+ FROM Account
+ WHERE Name = :coc.Order_ForDealerText__c AND RecordType.DeveloperName = 'Agency'
+ ];
+ if (accList.size() < 1) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇疯緭鍏ヤ簩绾х粡閿�鍟嗗叏绉帮紒'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ヤ簩绾х粡閿�鍟嗗叏绉帮紒', '');
+ }
+ }
+ if (coc.SummonsStatus_c__c == '鎵瑰噯') {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇峰厛鎵撳嵃鎸囩ず鍗曪紒'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '璇峰厛鎵撳嵃鎸囩ず鍗曪紒', '');
+ }
+ for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+ if (ass.orderdetails1.Shipment_Count__c > ass.allnumber) {
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+ // return null;
+ return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻', '');
+ }
+ }
+ data.put('ESetid', ESetid);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ //鍒犻櫎鎸夐挳
+ @AuraEnabled
+ public static ResponseBodyLWC DelConsumable(String ESetId) {
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+
+ ESetId = ESetId;
+
+ Savepoint sp = Database.setSavepoint();
+ try {
+ List<Consumable_order__c> qs = new List<Consumable_order__c>();
+ List<Consumable_orderdetails__c> Dqs = new List<Consumable_orderdetails__c>();
+ Dqs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId];
+ qs = [SELECT Id FROM Consumable_order__c WHERE Id = :ESetId];
+ if (Dqs.size() > 0 || qs.size() > 0) {
+ delete Dqs;
+ delete qs;
+ }
+ } catch (Exception e) {
+ Database.rollback(sp);
+ System.debug(e.getMessage() + e.getLineNumber());
+ return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
+ }
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ // Data Bean
+ class ConsumableorderdetailsInfo implements Comparable {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Boolean oldCheck { get; set; }
+ @AuraEnabled
+ public Consumable_Orderdetails__c orderdetails1 { get; set; }
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Decimal Boxnumber { get; set; }
+ @AuraEnabled
+ public Decimal Piecenumber { get; set; }
+ @AuraEnabled
+ public Decimal allnumber { get; set; }
+ @AuraEnabled
+ public Decimal oldConsumableCount { get; set; }
+ @AuraEnabled
+ public Boolean canSelect { get; set; }
+ @AuraEnabled
+ public Boolean sortBy { get; set; }
+ @AuraEnabled
+ public Integer packinglist { get; set; }
+ @AuraEnabled
+ public String approbation_No { get; set; }
+ @AuraEnabled
+ public Date expiration_Date { get; set; }
+ @AuraEnabled
+ public String boxorpiecein { get; set; }
+
+ public List<SelectOption> boxorpiece { get; set; }
+ @AuraEnabled
+ public Map<String, String> boxorpieceMap { get; set; }
+ @AuraEnabled
+ public Attachment concc { get; set; }
+ @AuraEnabled
+ public String BoxPiece { get; set; }
+ @AuraEnabled
+ public Boolean hospitalSpecialOffer { get; set; }
+ @AuraEnabled
+ public Boolean hosPro { get; set; }
+
+ public ConsumableorderdetailsInfo() {
+ }
+
+ public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
+ check = true;
+ oldCheck = true;
+ orderdetails1 = e;
+ orderdetails2 = new Consumable_order_details2__c();
+ Prod = e.Consumable_Product__r;
+ oldConsumableCount = e.Shipment_Count__c;
+ canSelect = true;
+ allnumber = 0;
+ Boxnumber = 0;
+ Piecenumber = 0;
+ BoxPiece = e.Box_Piece__c;
+ boxorpiece = new List<SelectOption>();
+ boxorpiece.add(new SelectOption('鐩�', '鐩�'));
+ boxorpiece.add(new SelectOption('涓�', '涓�'));
+
+ boxorpieceMap = new Map<String, String>();
+ boxorpieceMap.put('鐩�', '鐩�');
+ boxorpieceMap.put('涓�', '涓�');
+ hospitalSpecialOffer = false;
+ hosPro = false;
+ }
+
+ // 娑堣�楀搧鍙戣揣鏄庣粏
+ public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
+ check = true;
+ oldCheck = true;
+ orderdetails1 = new Consumable_Orderdetails__c();
+ orderdetails2 = e;
+ Prod = e.Consumable_Product__r;
+ canSelect = true;
+ allnumber = 0;
+ Boxnumber = 0;
+ Piecenumber = 0;
+ //boxorpiece = new List<SelectOption>();
+ //boxorpiece.add(new SelectOption('鐩�', '鐩�'));
+ //boxorpiece.add(new SelectOption('涓�', '涓�'));
+ hospitalSpecialOffer = false;
+ hosPro = false;
+ }
+
+ //闄勪欢
+ public ConsumableorderdetailsInfo(Attachment e) {
+ concc = e;
+ hospitalSpecialOffer = false;
+ hosPro = false;
+ }
+
+ public ConsumableorderdetailsInfo(Product2__c e) {
+ check = false;
+ oldCheck = false;
+ orderdetails1 = new Consumable_Orderdetails__c();
+ orderdetails2 = new Consumable_order_details2__c();
+ Prod = e;
+ //oldConsumableCount = null;
+ canSelect = true;
+ allnumber = 0;
+ Boxnumber = 0;
+ Piecenumber = 0;
+ orderdetails1.Box_Piece__c = '鐩�';
+ boxorpiece = new List<SelectOption>();
+ boxorpiece.add(new SelectOption('鐩�', '鐩�'));
+ boxorpiece.add(new SelectOption('涓�', '涓�'));
+
+ boxorpieceMap = new Map<String, String>();
+ boxorpieceMap.put('鐩�', '鐩�');
+ boxorpieceMap.put('涓�', '涓�');
+ hospitalSpecialOffer = false;
+ hosPro = false;
+ }
+
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ ConsumableorderdetailsInfo compareToorderdetails1 = (ConsumableorderdetailsInfo) compareTo;
+ Integer returnValue = 0;
+ if (sortBy == false) {
+ if (Boxnumber > compareToorderdetails1.Boxnumber) {
+ returnValue = -1;
+ } else if (Boxnumber < compareToorderdetails1.Boxnumber) {
+ returnValue = 1;
+ }
+ return returnValue;
+ } else {
+ if (Boxnumber > compareToorderdetails1.Boxnumber) {
+ returnValue = 1;
+ } else if (Boxnumber < compareToorderdetails1.Boxnumber) {
+ returnValue = -1;
+ }
+ return returnValue;
+ }
+ }
+ }
+
+ class ConsumableorderdetailsInfoLwc {
+ @AuraEnabled
+ public Boolean check { get; set; }
+ @AuraEnabled
+ public Boolean oldCheck { get; set; }
+ @AuraEnabled
+ public Consumable_Orderdetails__c orderdetails1 { get; set; }
+ @AuraEnabled
+ public Consumable_order_details2__c orderdetails2 { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Decimal Boxnumber { get; set; }
+ @AuraEnabled
+ public Decimal Piecenumber { get; set; }
+ @AuraEnabled
+ public Decimal allnumber { get; set; }
+ @AuraEnabled
+ public Decimal oldConsumableCount { get; set; }
+ @AuraEnabled
+ public Boolean canSelect { get; set; }
+ @AuraEnabled
+ public Boolean sortBy { get; set; }
+ @AuraEnabled
+ public Integer packinglist { get; set; }
+ @AuraEnabled
+ public String approbation_No { get; set; }
+ @AuraEnabled
+ public Date expiration_Date { get; set; }
+ @AuraEnabled
+ public String boxorpiecein { get; set; }
+ public List<SelectOption> boxorpiece { get; set; }
+ @AuraEnabled
+ public Map<String, String> boxorpieceMap { get; set; }
+ @AuraEnabled
+ public Attachment concc { get; set; }
+ @AuraEnabled
+ public String BoxPiece { get; set; }
+ @AuraEnabled
+ public Boolean hospitalSpecialOffer { get; set; }
+ @AuraEnabled
+ public Boolean hosPro { get; set; }
+ @AuraEnabled
+ public List<Map<String, String>> unitOptions { get; set; }
+ @AuraEnabled
+ public String unitValue { get; set; }
+ @AuraEnabled
+ public Integer shipmentNumber { get; set; }
+ @AuraEnabled
+ public Decimal shippingUnitPrice { get; set; }
+ @AuraEnabled
+ public String recordId { get; set; }
+ @AuraEnabled
+ public String Id { get; set; }
+ @AuraEnabled
+ public String Name { get; set; }
+ @AuraEnabled
+ public String Category3 { get; set; }
+ @AuraEnabled
+ public String Category4 { get; set; }
+ @AuraEnabled
+ public String Category5 { get; set; }
+ }
+
+ //鍒嗛〉Bean
+ public class PaginatedAccounts {
+ @AuraEnabled
+ public Integer nextPageToken;
+ @AuraEnabled
+ public Integer pageNumber { get; set; }
+ @AuraEnabled
+ public Integer totalRecords { get; set; }
+ @AuraEnabled
+ public Integer recordStart { get; set; }
+ @AuraEnabled
+ public Integer recordEnd { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSummonsCreatController.cls-meta.xml b/force-app/main/default/classes/LexSummonsCreatController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexSummonsCreatController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexTopPageController.cls b/force-app/main/default/classes/LexTopPageController.cls
new file mode 100644
index 0000000..aab986b
--- /dev/null
+++ b/force-app/main/default/classes/LexTopPageController.cls
@@ -0,0 +1,744 @@
+public without sharing class LexTopPageController {
+ //缁忛攢鍟嗕俊鎭�
+ public static account accountInfo;
+ /*****************鐢婚潰琛ㄧずBean******************/
+ public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords =new List<ConsumableorderdetailsInfo>();
+ public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+ //page
+ public static Integer pagesize { get; set; }
+ public static Integer pageToken { get; set; }
+ public static String sortField { get; set; }
+ public static String sortOrder { get; set; }
+ public static Integer totalcount { get; set; }
+ // public static Integer pagesize = Integer.valueof(system.label.orderdetLimitsize);
+ // public static Integer totalcount;
+ // public static Integer pagecount;
+ // public static Integer currentpage = 0;
+ // public static Boolean hasPrevious;
+ // public static Boolean hasNext;
+ public static List<ConsumableorderdetailsInfo> pageRecords;
+ public static String soql {get;set;}
+ // 姹囨�讳娇鐢�
+ public static Integer Total_num;
+ public static Integer OrderNumber_arrived;
+ public static Integer Delivery_detail_count;
+ public static Integer OrderNumber_notarrive;
+ public static Integer More_than_seven_days;
+ //鎺掑簭浣跨敤
+ // public static String sortKey;
+ // public static String preSortKey;
+ // public static Boolean sortOrderAsc;
+ // public static String[] sortOrder;
+ /*****************涓�鍛ㄦ湭鍒拌揣璁㈠崟涓�瑙堝搴攕tart******************/
+ // 璁㈠崟 瀛楁鏍囩
+ public static List<String> title;
+ // 璁㈠崟 瀛楁鍚�
+ public static List<String> column;
+ public static List<List<String>> columns;
+ // 鐢婚潰鏄剧ず鏁版嵁
+ public static List<Consumable_order__c> raesList;
+ /*****************涓�鍛ㄦ湭鍒拌揣璁㈠崟涓�瑙堝搴攅nd******************/
+ //鎺掑簭浣跨敤
+ private static String[] orderby = new String[]{ 'Product2__c.Name__c'};
+ //浜у搧涓婁笅闄�
+ public static String[] proLimitAndDate =new String[]{};
+ public static String product_Limit;
+ //搴撳瓨浜у搧鏈�鏃╂湁鏁堟湡闄�
+ private static Map<String,Date> productkucun = new Map<String,Date>();
+ //娑堣垂鏈熼檺灏忎簬涓�骞寸殑浜у搧
+ public static List<ConsumableorderdetailsInfo> overlimitdateorderdetails = new List<ConsumableorderdetailsInfo>();
+ public static String accountid;
+ public static String accountName;
+ public static List<String> orderDetZaikuList = new List<String>();
+ // 鐧诲綍鑰呭伐浣滃湴
+ private static String userWorkLocation;
+ // 鏈埌璐ц鍗曚俊鎭紙瓒呰繃涓�鍛級鏄剧ず鎺у埗
+ public static Boolean over_view {
+ get {
+ return raesList.size() > 0 ? true : false;
+ }
+ }
+ // 浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧 鏄剧ず鎺у埗
+ public static Boolean overlimit {
+ get {
+ return overlimitdateorderdetails.size() > 0 ? true : false;
+ }
+ }
+ //鐢ㄦ埛浜у搧鍖哄垎
+ public static String userPro_Type;
+ public static String userPro_Typestr = null;
+ public static Boolean EngFlag = false;
+ public static Boolean ETFlag = false;
+ public static Boolean hasHos;
+
+ @AuraEnabled
+ public static Results initAgency(){
+ Results results = new Results();
+ results.isNoteStay = LexUtility.getIsNoteStay();
+ try {
+ User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()];
+ accountid = useracc.accountid;
+ List<Account> accList = new List<Account>();
+ accList = [SELECT Name,Ban_On_Use_Reason__c,Deposit_Price__c,
+ Medical_Equipment_Num__c,Medical_Equipment_Expiration_Date__c,
+ Ban_On_Use_Date__c,Tax_Practice_No__c,Tax_Practice_Expiration_Date__c,
+ Business_Authorization_No__c,Business_Paper_Expiration_Date__c,
+ Credit_Check_No__c,Dealer_discount__c,
+ Phone,Address_Together__c,Is_Active_Formula__c,
+ Management_Code__c,Sales_Shop_Class__c,Postal_Code__c,
+ Fax,Address__c,Deposit_Receipt_Finished__c,
+ Deposit_Receipt_Completion_Day__c,
+ Product_Limit_Date__c,
+ Product_Limit_DateENG__c
+ FROM account WHERE id =:accountid];
+ if(accList.size() == 1){
+ accountInfo = accList[0];
+ }else{
+ results.result = 'Fail';
+ results.errorMsg = '鏈幏鍙栧埌缁忛攢鍟嗕俊鎭�';
+ return results;
+ }
+ results.result = 'Success';
+ results.accountInfo = accountInfo;
+ }catch(Exception e){
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber()+'---'+e.getMessage();
+ }
+ return results;
+ }
+
+ @AuraEnabled
+ public static Results initPage(Integer pageSizeLWC,Integer pageTokenLWC){
+ pageSize = pageSizeLWC;
+ pageToken = pageTokenLWC;
+ Results results = new Results();
+ results.isNoteStay = LexUtility.getIsNoteStay();
+ try {
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+ overlimitdateorderdetails = new List<ConsumableorderdetailsInfo>();
+ //page
+ // pagesize = Integer.valueof(system.label.orderdetLimitsize);
+ // currentpage = 0;
+
+ User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()];
+ // String uid = '0051000000E7Pv9AAF';
+ // User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:uid];
+ accountid = useracc.accountid;
+ userWorkLocation = useracc.Work_Location__c;
+ userPro_Type = useracc.UserPro_Type__c;
+ if(String.isBlank(userPro_Type)){
+ userPro_Type = 'ET';
+ }
+ userPro_Typestr = '%' + userPro_Type + '%';
+ if(userPro_Type == 'ENG'){
+ EngFlag = true;
+ }else{
+ ETFlag = true;
+ }
+ //缁忛攢鍟喡峰熀鏈俊鎭幏鍙�
+ List<Account> accList = new List<Account>();
+ accList = [SELECT Name,Ban_On_Use_Reason__c,Deposit_Price__c,
+ Medical_Equipment_Num__c,Medical_Equipment_Expiration_Date__c,
+ Ban_On_Use_Date__c,Tax_Practice_No__c,Tax_Practice_Expiration_Date__c,
+ Business_Authorization_No__c,Business_Paper_Expiration_Date__c,
+ Credit_Check_No__c,Dealer_discount__c,
+ Phone,Address_Together__c,Is_Active_Formula__c,
+ Management_Code__c,Sales_Shop_Class__c,Postal_Code__c,
+ Fax,Address__c,Deposit_Receipt_Finished__c,
+ Deposit_Receipt_Completion_Day__c,
+ Product_Limit_Date__c,
+ Product_Limit_DateENG__c
+ FROM account WHERE id =:accountid];
+ if(accList.size() == 1){
+ accountInfo = accList[0];
+ }else{
+ results.result = 'Fail';
+ results.errorMsg = '鏈幏鍙栧埌缁忛攢鍟嗕俊鎭�';
+ return results;
+ }
+ accountName = accountInfo.Name;
+ if(EngFlag){
+ product_Limit = accountInfo.Product_Limit_DateENG__c;
+ }else if(ETFlag){
+ product_Limit = accountInfo.Product_Limit_Date__c;
+ }
+ if(product_Limit != null && product_Limit !=''){
+ proLimitAndDate = product_Limit.split(',');
+ }
+ List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
+ //搴撳瓨鏄庣粏鍙栧緱
+ orderDetZaikuList = new List<String>();
+ List<AggregateResult> orderDetZaiku = [SELECT count(Id),
+ Consumable_Product__c
+ FROM Consumable_order_details2__c
+ WHERE Dealer_Arrive__c = true
+ AND Dealer_Shipment__c = false
+ AND Dealer_Saled__c = false
+ AND Lose_Flag__c = false
+ AND Dealer_Returned__c = false
+ AND Cancellation_Flag__c = false
+ AND Bar_Code__c !=null
+ AND Product_Type__c like : userPro_Typestr
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ group by Consumable_Product__c];
+ for(AggregateResult zaikuId : orderDetZaiku){
+ orderDetZaikuList.add(String.valueOf(zaikuId.get('Consumable_Product__c')));
+ }
+ Map<String,Product2__c> MidMap = new Map<String,Product2__c>();
+ List<Product2__c> product2Selected = [SELECT Id, Name,
+ Name__c,
+ Asset_Model_No__c,
+ Category3__c,
+ Category4__c,
+ Category5__c,
+ SFDA_Status__c,
+ Product2__r.SFDA_Approbation_No__c,
+ Product2__r.SFDA_Expiration_Date__c,
+ Product2__r.Packing_list_manual__c
+ FROM Product2__c
+ WHERE Id in :orderDetZaikuList
+ ];
+
+ for (Integer i = 0; i < product2Selected.size(); i++) {
+ MidMap.put(product2Selected[i].Id, product2Selected[i]);
+ }
+ //杩斿搧搴撳瓨缁熻
+ List<Consumable_order_details2__c> CountDel = [SELECT Id,
+ Bar_Code__c,
+ Name,
+ Inventory_date__c,
+ Consumable_Product__c,
+ Recordtypeid,
+ Guarantee_period_for_products__c,
+ Isoverdue__c,
+ Box_Piece__c,
+ hospitalSpecialOffer__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 Cancellation_Flag__c = false
+ AND Bar_Code__c !=null
+ AND Product_Type__c like : userPro_Typestr
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation];
+ Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
+ Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
+ Map<String,ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
+ Map<String,ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
+ for(Integer i = 0 ; i< CountDel.size();i++){
+ //鐒跺悗寰幆CountDel鍋欱ox鍜宲iece2涓猰ap
+ if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '鐩�'){
+ String tex = 'A';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ tex = 'B';
+ }
+ if(newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex)){
+ ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex).clone();
+ Jstage.allnumber = Jstage.allnumber+1 ;
+ if(CountDel[i].Isoverdue__c == 1){
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
+ }else{
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
+ Jstage.allnumber = Jstage.allnumber+1 ;
+ if(CountDel[i].Isoverdue__c == 1){
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
+ }else{
+ Jstage.hospitalSpecialOffer = false;
+ newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
+ }
+ }
+ }else if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '涓�'){
+ String tex = 'A';
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ tex = 'B';
+ }
+ if(newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex )){
+ ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex).clone();
+ Jstage.allnumber = Jstage.allnumber+1 ;
+ if(CountDel[i].Isoverdue__c == 1){
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
+ }else{
+ ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
+ Jstage.allnumber = Jstage.allnumber+1 ;
+ if(CountDel[i].Isoverdue__c == 1){
+ Jstage.limitCount = Jstage.limitCount + 1;
+ }
+ Jstage.BoxPiece = CountDel[i].Box_Piece__c;
+ if (CountDel[i].hospitalSpecialOffer__c) {
+ Jstage.hospitalSpecialOffer = true;
+ newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex, Jstage);
+ }else{
+ Jstage.hospitalSpecialOffer = false;
+ newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex, Jstage);
+ }
+ }
+ }
+ //濡傛灉鏄� 鍖婚櫌鐗逛环鍒涘缓鐨勬槑缁�2 鍒�
+ }
+ consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+ List<ConsumableorderdetailsInfo> newHosMidBoxList = new List<ConsumableorderdetailsInfo>();
+ //鎶夿oxmap閲岀殑鍊间粠鏂拌祴缁檅oxRecords
+ for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){
+ if(bss.allnumber>0){
+ bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ bss.overlimitCount = bss.allnumber - bss.limitCount;
+ boxRecords.add(bss);
+ }
+ }
+ boxRecords.sort();
+ for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
+ if(bss.allnumber>0){
+ bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
+ bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
+ bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
+ bss.overlimitCount = bss.allnumber - bss.limitCount;
+ }
+ }
+ //鎺掑簭搴旇鏄� 闈炲尰闄㈢壒浠风殑鐩�,鍖婚櫌鐗逛环鐨勭洅,闈炲尰闄㈢壒浠风殑涓�,鍖婚櫌鐗逛环鐨勪釜
+ //add by rentx 2020-11-27 鍏堝垽鏂尰闄㈢壒浠风殑鐩� 鍜� 涓�
+ //2020-11-27 鏃� 浜� rentx 娉ㄩ噴 start
+ String temp = 'A';
+ for(ConsumableorderdetailsInfo bss : boxRecords){
+ consumableorderdetailsRecords.add(bss);
+ //璇ヤ骇鍝佹槸鍖婚櫌鐗逛环浜у搧
+ if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'涓狟')) {
+ if (newMidPieceMap.get(bss.Prod.Id+'涓狟').hospitalSpecialOffer) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'涓狟'));
+ newMidPieceMap.remove(bss.Prod.Id+'涓狟');
+ }
+ }
+
+ if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'涓狝')) {
+ // if (newMidPieceMap.get(bss.Prod.Id+'涓狝')) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'涓狝'));
+ newMidPieceMap.remove(bss.Prod.Id+'涓狝');
+ // }
+ }
+ }
+
+ for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
+ if (newMidPieceMap.containsKey(bss.Prod.Id+'涓狟')) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狟'));
+ }
+ }
+ for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
+ if (newMidPieceMap.containsKey(bss.Prod.Id+'涓狝')) {
+ consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狝'));
+ }
+ }
+ // consumableorderdetailsRecords.addAll(newMidPieceMap.values());
+ //2020-11-27 鏃� 浜� rentx 娉ㄩ噴 end
+ // consumableorderdetailsRecords.addAll(newMidPieceMap.values());
+ //2020-11-27 鏃� 浜� rentx 娉ㄩ噴 end
+
+ notarriveorder();
+ productLimtAndDate();
+ datelimitSearch();
+ //add by rentx
+ Integer ishos = 0;
+ for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){
+ if(productkucun.get(bss.Prod.Id) != null){
+ bss.guaranteeperiod = productkucun.get(bss.Prod.Id);
+ }
+ //add by rentx 2021-3-10 start
+ if (bss.hospitalSpecialOffer) {
+ ishos = ishos+1;
+ }
+
+ }
+ if (ishos > 0) {
+ hasHos = true;
+ }else{
+ hasHos = false;
+ }
+ //add by rentx 2021-3-10 end
+ //consumableorderdetailsRecords.sort();
+ //list鍒嗗壊
+ //listCut();
+ // sortKey = '0';
+ // preSortKey = '0';
+ // sortOrderAsc = false;
+ // sortOrder = new String[1];
+ // sortOrder = new String[]{' ', '鈫�'};
+ //鎬讳欢鏁�
+ totalCount = consumableorderdetailsRecords.size();
+ //椤垫暟
+ // pagecount=(totalcount + pagesize - 1) / pagesize;
+ //鏄剧ず绗竴椤�
+ // moveToFirst();
+ makeCurrentPageRecords();
+ //鍒嗛〉
+ PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+ System.debug('pageToken==>'+ pageToken);
+ System.debug('pageSize===>'+ pageSize);
+
+ paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+ paginatedAccounts.recordStart = pageToken + 1;
+ paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+ Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+ System.debug('paginatedAccounts.recordStart'+ paginatedAccounts.recordStart);
+ System.debug('paginatedAccounts.pageNumber'+ paginatedAccounts.pageNumber);
+ System.debug('paginatedAccounts.nextPageToken===>'+paginatedAccounts.nextPageToken);
+ System.debug('recordEnd'+ recordEnd);
+
+ paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+ paginatedAccounts.totalRecords = totalCount;
+ //end
+ System.debug('PaginatedAccounts===>'+PaginatedAccounts);
+
+ //璧嬪�煎洖浼�
+ results.result = 'Success';
+ results.title = title;
+ results.raesList = raesList;
+ results.columns = columns;
+ results.over_view = over_view;
+ results.overlimit = overlimit;
+ results.hasHos = hasHos;
+ results.overlimitdateorderdetails = overlimitdateorderdetails;
+ results.accountInfo = accountInfo;
+ results.pageRecords = pageRecords;
+ results.product_Limit = product_Limit;
+ results.totalNum = Total_num;
+ results.orderNumberArrived = OrderNumber_arrived;
+ results.deliveryDetailCount = Delivery_detail_count;
+ results.orderNumberNotarrive = OrderNumber_notarrive;
+ results.moreThanSevenDays = More_than_seven_days;
+ //add by WangXueqin 2023/05/05
+ results.userPro_Type = userPro_Type;
+ results.paginatedAccounts = paginatedAccounts;
+ } catch (Exception e) {
+ results.result = 'Fail';
+ results.errorMsg = e.getLineNumber()+'---'+e.getMessage();
+ }
+ return results;
+ }
+
+ //瓒呰繃涓�鍛ㄦ湭鍒拌揣璁㈠崟
+ public static void notarriveorder(){
+ //over_view = false;
+ Date orderdate = Date.today().addDays(-7);
+
+ List<Consumable_order_details2__c> orderdetails = [SELECT Id,Name,Consumable_order_minor__c
+ FROM Consumable_order_details2__c
+ WHERE Deliver_date__c < :orderdate
+ and Consumable_order_minor__c !=null
+ and Dealer_Info_text__c = :accountName
+ AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+ AND Dealer_Arrive__c = false
+ ];
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO , 'userPro_Type鈥斺�斺�斺�斺�斺��' + userPro_Type));
+ Map<String, String> notarriveorderMap = new Map<String, String>();
+ List<String> notarriveorderid = new List<String>();
+ for(Integer i = 0; i < orderdetails.size(); i++){
+ if(notarriveorderMap.containsKey(orderdetails[i].Consumable_order_minor__c)){
+ continue;
+ }else{
+ notarriveorderMap.put(orderdetails[i].Consumable_order_minor__c, orderdetails[i].Consumable_order_minor__c);
+ //notarriveorderid.add('\'' + orderdetails[i].Consumable_order_minor__c +'\'');
+ notarriveorderid.add(orderdetails[i].Consumable_order_minor__c);
+ }
+ }
+ // 鑾峰緱璁㈠崟涓�瑙�
+ Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap();
+ Schema.FieldSet fs = fsMap.get('arrive_view');
+ // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
+ List<FieldSetMember> fsmList = fs.getFields();
+ // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
+ title = new List<String>();
+ column = new List<String>();
+ columns = new List<List<String>>();
+ for (FieldSetMember fsm : fsmList) {
+ title.add(fsm.getLabel());
+ column.add(fsm.getFieldPath());
+ columns.add(fsm.getFieldPath().split('\\.'));
+ }
+ system.debug('columns=====================>'+columns);
+ // 鑾峰緱鏄剧ず鏁版嵁
+ raesList = new List<Consumable_order__c>();
+ String soql = 'select Id';
+ for (String s : column) {
+ soql += ',' + s;
+ }
+ soql += ' from Consumable_order__c where Order_type__c = \''+'璁㈠崟'+'\' and recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\' and Delivery_detail_count__c > 0 and showFalseNotshowTrue__c = false ';
+ soql += ' and Order_ProType__c = \'' + userPro_Type + '\' ' ;
+ soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+
+ if(notarriveorderid.size() < 1){
+ soql +=' AND Id = null ';
+ }else{
+ String sqlTail = '(\'';
+ for(Integer i = 0 ; i< notarriveorderid.size();i++){
+ if(i<notarriveorderid.size()-1){
+ sqlTail += notarriveorderid[i]+'\',\'';
+ }else{
+ sqlTail += notarriveorderid[i]+'\')';
+ }
+ }
+ //over_view = true;
+ soql +=' AND Id in ' + sqlTail;
+ }
+ system.debug('soql_____11111__' + soql);
+ raesList = Database.query(soql);
+ // update end by vivek2020-01-15
+ Total_num = 0;
+ OrderNumber_arrived = 0;
+ Delivery_detail_count = 0;
+ OrderNumber_notarrive = 0;
+ More_than_seven_days = 0;
+ for(Consumable_order__c conorder :raesList){
+ Total_num += (Integer)conorder.Total_num__c;
+ OrderNumber_arrived += (Integer)conorder.OrderNumber_arrived__c;
+ Delivery_detail_count += (Integer)conorder.Delivery_detail_count__c;
+ OrderNumber_notarrive += (Integer)conorder.OrderNumber_notarrive__c;
+ More_than_seven_days += (Integer)conorder.More_than_seven_days__c;
+ }
+ // update end by vivek2020-01-15
+ }
+
+ public static void productLimtAndDate(){
+ String nowName = null, nowRightAsstModelNo = null;
+ Map<String,String> productLimt = new Map<String,String>();
+ for(Integer i = 0; i < proLimitAndDate.size(); i++){
+ nowName = proLimitAndDate[i];
+ if( nowName.indexOf( '|') >= 0) {
+ nowRightAsstModelNo = nowName.subString( 0, nowName.indexOf( '|'));
+ nowName = nowName.subString( nowName.indexOf( '|')+1);
+ }
+ productLimt.put(nowRightAsstModelNo, nowName);
+ }
+ for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
+ if(productLimt.containsKey(ass.Prod.Asset_Model_No__c)){
+ ass.lowerlimit = decimal.valueOf(productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf( '|')));
+ ass.upperlimit = decimal.valueOf(productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf( '|')+1));
+ }
+ }
+ }
+
+ public static void datelimitSearch(){
+ Set<String> barcodekucun = new Set<String>();
+ //--------UpdateStart-----XHL--------------20180929-------------
+ List<Consumable_order_details2__c> orderkucun = [SELECT Id,Bar_Code__c, Name,Consumable_Product__c,
+ Recordtypeid,Guarantee_period_for_products__c,
+ Sterilization_limit__c,Box_Piece__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 !=null
+ AND Product_Type__c like :userPro_Typestr
+ AND Dealer_Info_text__c = :accountName
+ AND Arrive_Owner_Work_Location__c = :userWorkLocation
+ ORDER BY Consumable_Product__c, Sterilization_limit__c asc ];
+ //--------UpdateEnd-----XHL--------------20180929-------------
+ for(Integer i = 0 ; i< orderkucun.size();i++){
+ if(productkucun.containsKey(orderkucun[i].Consumable_Product__c)){
+ continue;
+ }else{
+ productkucun.put(orderkucun[i].Consumable_Product__c, orderkucun[i].Sterilization_limit__c);
+ }
+ }
+ barcodekucun.clear();
+ for(Integer i = 0 ; i< orderkucun.size();i++){
+ if(orderkucun[i].Sterilization_limit__c < Date.today().addYears(1)){
+ if(barcodekucun.contains(orderkucun[i].Bar_Code__c)){
+ continue;
+ }else{
+ barcodekucun.add(orderkucun[i].Bar_Code__c);
+ }
+ }
+ }
+ List<AggregateResult> overlimitdatedetails = [SELECT Asset_Model_No__c prodName ,
+ Box_Piece__c BoxPiece,count(id) countid
+ FROM Consumable_order_details2__c
+ WHERE Bar_Code__c in :barcodekucun
+ AND Dealer_Arrive__c = true
+ AND Dealer_Shipment__c = false
+ AND Dealer_Saled__c = false
+ AND Dealer_Returned__c = false
+ AND Lose_Flag__c = false
+ GROUP BY Asset_Model_No__c,Box_Piece__c
+ ORDER BY Asset_Model_No__c,Box_Piece__c];
+ for(Integer i = 0 ; i< overlimitdatedetails.size();i++){
+ overlimitdateorderdetails.add(new ConsumableorderdetailsInfo(overlimitdatedetails[i]));
+ }
+ }
+
+ //棣栭〉
+ // public static void moveToFirst(){
+ // if(currentpage == 1) return;
+ // currentpage = 1;
+ // canMove();
+ // }
+
+ //鍒ゆ柇鏄惁鍙炕椤�
+ // public static void canMove(){
+ // hasPrevious = false;
+ // hasNext = false;
+ // if(pagecount > 1 && currentpage > 1) hasPrevious = true;
+ // if(pagecount > 1 && currentpage < pagecount) hasNext = true;
+ // }
+
+ //缂栬緫褰撳墠椤靛唴瀹�
+ public static void makeCurrentPageRecords(){
+ Integer startIdx;
+ Integer endIdx;
+ pageRecords = new List<ConsumableorderdetailsInfo>();
+ startIdx = pageToken;
+ endIdx = pageToken + pageSize;
+ if (endIdx > consumableorderdetailsRecords.size()) {
+ endIdx = consumableorderdetailsRecords.size();
+ }
+ for (Integer i = startIdx; i < endIdx; i++) {
+ pageRecords.add(consumableorderdetailsRecords.get(i));
+ }
+ }
+ //鍒嗛〉Bean
+ public class PaginatedAccounts {
+ @AuraEnabled
+ public Integer nextPageToken;
+ @AuraEnabled
+ public Integer pageNumber { get; set; }
+ @AuraEnabled
+ public Integer totalRecords { get; set; }
+ @AuraEnabled
+ public Integer recordStart { get; set; }
+ @AuraEnabled
+ public Integer recordEnd { get; set; }
+ }
+
+ // Data Bean
+ public class ConsumableorderdetailsInfo implements Comparable {
+ //public Boolean check { get; set; }
+ //public Boolean oldCheck { get; set; }
+ @AuraEnabled
+ public Consumable_order_details2__c esd { get; set; }
+ @AuraEnabled
+ public Product2__c Prod { get; set; }
+ @AuraEnabled
+ public Decimal allnumber { get; set; }
+ @AuraEnabled
+ public Decimal oldConsumableCount { get; set; }
+ @AuraEnabled
+ public Integer packing_list { get; set; }
+ @AuraEnabled
+ public Date expiration_Date { get; set; }
+ @AuraEnabled
+ public String approbation_No { get; set; }
+ @AuraEnabled
+ public Decimal upperlimit { get; set; }
+ @AuraEnabled
+ public Decimal lowerlimit { get; set; }
+ @AuraEnabled
+ public Date guaranteeperiod { get; set; }
+ @AuraEnabled
+ public Decimal countid { get; set; }
+ @AuraEnabled
+ public String prodName { get; set; }
+ @AuraEnabled
+ public Decimal limitCount { get; set; }
+ @AuraEnabled
+ public Decimal overlimitCount { get; set; }
+ @AuraEnabled
+ public String BoxPiece { get; set; }
+ @AuraEnabled
+ public Boolean hospitalSpecialOffer { get; set ;}
+
+ public ConsumableorderdetailsInfo(Product2__c e) {
+ //check = false;
+ //oldCheck = false;
+ esd = new Consumable_order_details2__c();
+ Prod = e;
+ oldConsumableCount = null;
+ allnumber = 0;
+ limitCount = 0;
+ overlimitCount = 0;
+
+ }
+
+ public ConsumableorderdetailsInfo(AggregateResult e) {
+ countid =Integer.valueOf(e.get('countid'));
+ prodName = String.valueOf(e.get('prodname'));
+ BoxPiece = String.valueOf(e.get('BoxPiece'));
+ }
+
+ // 鎺掑簭
+ public Integer compareTo(Object compareTo) {
+ ConsumableorderdetailsInfo compareToesd =(ConsumableorderdetailsInfo)compareTo;
+ Integer returnValue = 0;
+ if (allnumber > compareToesd.allnumber) {
+ returnValue = -1;
+ } else if (allnumber < compareToesd.allnumber) {
+ returnValue = 1;
+ }
+ return returnValue;
+ }
+ }
+
+ public class Results {
+ @AuraEnabled
+ public String result;
+ @AuraEnabled
+ public String errorMsg;
+ @AuraEnabled
+ public List<String> title;
+ @AuraEnabled
+ public List<Consumable_order__c> raesList;
+ @AuraEnabled
+ public List<List<String>> columns;
+ @AuraEnabled
+ public Boolean over_view;
+ @AuraEnabled
+ public Boolean overlimit;
+ @AuraEnabled
+ public Boolean hasHos;
+ @AuraEnabled
+ public List<ConsumableorderdetailsInfo> overlimitdateorderdetails;
+ @AuraEnabled
+ public Account accountInfo;
+ @AuraEnabled
+ public List<ConsumableorderdetailsInfo> pageRecords;
+ @AuraEnabled
+ public String product_Limit;
+ @AuraEnabled
+ public Integer totalNum;
+ @AuraEnabled
+ public Integer orderNumberArrived;
+ @AuraEnabled
+ public Integer deliveryDetailCount;
+ @AuraEnabled
+ public Integer orderNumberNotarrive;
+ @AuraEnabled
+ public Integer moreThanSevenDays;
+ @AuraEnabled
+ public Boolean isNoteStay;
+ //add by WangXueqin 2023/05/05
+ @AuraEnabled
+ public String userPro_Type;
+ @AuraEnabled
+ public List<ConsumableorderdetailsInfo> pageCodeRecords;
+ @AuraEnabled
+ public PaginatedAccounts paginatedAccounts;
+
+
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexTopPageController.cls-meta.xml b/force-app/main/default/classes/LexTopPageController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexTopPageController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexUpAccountProLimit.cls b/force-app/main/default/classes/LexUpAccountProLimit.cls
new file mode 100644
index 0000000..c7288c6
--- /dev/null
+++ b/force-app/main/default/classes/LexUpAccountProLimit.cls
@@ -0,0 +1,143 @@
+public without sharing class LexUpAccountProLimit {
+ @AuraEnabled
+ public static ResponseBodyLWC upAccount(String accountId,String productLimit,String userPro_Type){
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String,object> data = new Map<String,object>();
+ res.entity = data;
+
+ //--------AddStart-----XHL--------------20180929-------------
+ Boolean EngFlag = false;
+ Boolean ETFlag = false;
+ String userPro_Typestr = null;
+ if(String.isBlank(userPro_Type)){
+ userPro_Type = 'ET';
+ }
+ if(userPro_Type == 'ENG'){
+ EngFlag = true;
+ }else{
+ ETFlag = true;
+ }
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type));
+ //ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type));
+ userPro_Typestr = '%' + userPro_Type + '%';
+ //--------AddEnd-----XHL--------------20180929-------------
+ system.debug('userPro_Type' + userPro_Type);
+ String checkResoultstr = checkResoult(productLimit);
+ system.debug('checkResoultstr====>'+checkResoultstr);
+ if(String.isNotBlank(checkResoultstr)){
+ return new ResponseBodyLWC('Error',500,''+checkResoultstr+'', '');
+ // return checkResoultstr;
+ }
+ //String[] proidList =new String[]{};
+ String[] proList =new String[]{};
+ String[] pro_List =new String[]{};
+ List<Account> acc = [
+ SELECT
+ Id,
+ Name,
+ Product_Limit_Date__c
+ FROM
+ Account
+ WHERE
+ Id = : accountId
+ FOR UPDATE
+ ];
+ if(null == acc || acc.size() == 0) {
+ // return '娌℃湁缁忛攢鍟嗭細' + accountId + '鐨勬暟鎹��';
+ return new ResponseBodyLWC('Error',500,'娌℃湁缁忛攢鍟嗭細' + accountId + '鐨勬暟鎹�', '');
+ }
+ //proidList = acc[0].view_product__c.split(',');
+ //--------UpdateStart-----XHL--------------20180929-------------
+ String sql = '';
+ List<Product2__c> roduct2List = [SELECT Asset_Model_No__c
+ FROM Product2__c
+ WHERE Product_Type__c like :userPro_Typestr limit 10000];//Add Limit by Li Jun 20230601, need to remove limit later
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'roduct2List:'+ roduct2List));
+ //sql = 'SELECT Asset_Model_No__c '
+ // + ' FROM Product2__c '
+ // + ' WHERE Pro2_Dealer_Object__c = true';
+ //if(EngFlag){
+ // sql += ' AND Pro2_Dealer_ENG__c =' + EngFlag ;
+ //}else if(ETFlag){
+ // sql += ' AND Pro2_Dealer_Object__c = ' + ETFlag;
+ //}
+ //system.debug('sqlZZZZZZ' + sql);
+ //List<Product2__c> roduct2List = Database.query(sql);
+ //--------UpdateEnd-----XHL--------------20180929-------------
+ Map<String, String> productMap = new Map<String, String>();
+ proList = productLimit.split(',');
+ system.debug('productLimitDDDDD' + productLimit);
+ system.debug('proListFFFFF' + proList);
+ if(proList.size() > 0 && String.isNotEmpty(proList[0])){
+ for(Integer i = 0; i < proList.size(); i++){
+ pro_List.add(proList[i].subString(0,proList[i].indexOf( '|')));
+ }
+ }
+ if(roduct2List.size() > 0){
+ for(Product2__c pro2 :roduct2List){
+ productMap.put(pro2.Asset_Model_No__c, pro2.Asset_Model_No__c);
+ }
+ }
+ for(Integer i = 0; i < pro_List.size(); i++){
+ if(!productMap.containsKey(pro_List[i])){
+ // return '缁忛攢鍟嗘病鏈� ' + pro_List[i] + ' 鐨勪骇鍝佷笂闄愯瀹氭潈闄愶紝鎴栦骇鍝佷笉瀛樺湪锛�';
+ return new ResponseBodyLWC('Error',500,'缁忛攢鍟嗘病鏈� ' + pro_List[i] + ' 鐨勪骇鍝佷笂闄愯瀹氭潈闄愶紝鎴栦骇鍝佷笉瀛樺湪', '');
+ }
+ }
+ String productLimitDa = '';
+ for(String str : productLimit.split(',')){
+
+ if(str != null && str != ''){
+ productLimitDa += ',' + str;
+ }
+ }
+ Savepoint sp = Database.setSavepoint();
+ try{
+ Account accinfo = new Account();
+ accinfo.Id = accountId;
+ if(EngFlag){
+ accinfo.Product_Limit_DateENG__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1);
+ }else if(ETFlag){
+ accinfo.Product_Limit_Date__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1);
+ }
+
+ UPDATE accinfo;
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ // return '';
+ }catch(DmlException de){
+ Database.rollback(sp);
+ throw de;
+ }
+ }
+ public static String checkResoult (String productLimit){
+ String[] proLimit = productLimit.split(',');
+ String nowName = null, nowRightAsstModelNo = null;
+ List<String> asstModelNo = new List<String>();
+ Map<String,String> asstModelNoMap = new Map<String,String>();
+ List<String> asstModelNoCount = new List<String>();
+ for(Integer i = 0; i < proLimit.size(); i++){
+ nowName = proLimit[i];
+ if( nowName.indexOf( '|') >= 0) {
+ nowRightAsstModelNo = nowName.subString( 0, nowName.indexOf( '|'));
+ }
+ asstModelNo.add(nowRightAsstModelNo);
+ }
+
+ for(Integer i = 0; i < asstModelNo.size(); i++){
+ if(asstModelNoMap.containsKey(asstModelNo[i])){
+ asstModelNoCount.add(asstModelNo[i]);
+ }else{
+ asstModelNoMap.put(asstModelNo[i], asstModelNo[i]);
+ }
+ }
+ if(asstModelNoCount.size() > 0){
+ return '浜у搧锛�' + asstModelNoCount + '鐨勬暟鎹噸澶�';
+ // return new ResponseBodyLWC('Error',500,'浜у搧锛�' + asstModelNoCount + '鐨勬暟鎹噸澶嶃��', '');
+ }else{
+ return '';
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexUpAccountProLimit.cls-meta.xml b/force-app/main/default/classes/LexUpAccountProLimit.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexUpAccountProLimit.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexUtility.cls b/force-app/main/default/classes/LexUtility.cls
new file mode 100644
index 0000000..56d6ae7
--- /dev/null
+++ b/force-app/main/default/classes/LexUtility.cls
@@ -0,0 +1,14 @@
+public without sharing class LexUtility {
+
+ //鏌ヨ鏄惁涓�鐩存樉绀烘彁绀�
+ public static Boolean getIsNoteStay(){
+ NoteStay__c noteStay = NoteStay__c.getInstance('NoteStay');
+ return noteStay.IsStay__c;
+ }
+
+ //鏌ヨ璁稿彲璇佹彁閱掑ぉ鏁�
+ public static Integer getLicenceReminderDays(){
+ LicenceReminderDate__c days = LicenceReminderDate__c.getInstance('180Days');
+ return days.ReminderDays__c.intValue();
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexUtility.cls-meta.xml b/force-app/main/default/classes/LexUtility.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LexUtility.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LookupSearchResult.cls b/force-app/main/default/classes/LookupSearchResult.cls
index b8252ef..3fb0548 100644
--- a/force-app/main/default/classes/LookupSearchResult.cls
+++ b/force-app/main/default/classes/LookupSearchResult.cls
@@ -2,16 +2,24 @@
* Class used to serialize a single Lookup search result item
* The Lookup controller returns a List<LookupSearchResult> when sending search result back to Lightning
*/
-public class LookupSearchResult implements Comparable {
- private Id id;
- private String sObjectType;
- private String icon;
- private String title;
- private String subtitle;
+public virtual class LookupSearchResult implements Comparable {
+ protected String id;
+ protected String sObjectType;
+ protected String icon;
+ protected String title;
+ protected String subtitle;
-
+ protected LookupSearchResult() {
+ }
- public LookupSearchResult(Id id, String sObjectType, String icon, String title, String subtitle) {
+ /**
+ * @param id the lookup entry identifier (generally a record ID)
+ * @param sObjectType Optional - The sObject type of the selected record. This value is not used for lookup rendering. It's passed back to the selection handler in case you search on multiple object types.
+ * @param icon Optional - A qualified SLDS icon name taken from https://www.lightningdesignsystem.com/icons. It defaults to standard:default.
+ * @param title Required - The label of the lookup entry
+ * @param subtitle Optional - A subtitle that is displayed under the lookup entry label
+ */
+ public LookupSearchResult(String id, String sObjectType, String icon, String title, String subtitle) {
this.id = id;
this.sObjectType = sObjectType;
this.icon = icon;
@@ -20,7 +28,7 @@
}
@AuraEnabled
- public Id getId() {
+ public String getId() {
return id;
}
diff --git a/force-app/main/default/classes/LookupSearchResult.cls-meta.xml b/force-app/main/default/classes/LookupSearchResult.cls-meta.xml
index d75b058..754ecb1 100644
--- a/force-app/main/default/classes/LookupSearchResult.cls-meta.xml
+++ b/force-app/main/default/classes/LookupSearchResult.cls-meta.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
- <apiVersion>51.0</apiVersion>
+ <apiVersion>57.0</apiVersion>
<status>Active</status>
</ApexClass>
diff --git a/force-app/main/default/classes/lexSearchAgencyHospitalController.cls b/force-app/main/default/classes/lexSearchAgencyHospitalController.cls
new file mode 100644
index 0000000..b244fc7
--- /dev/null
+++ b/force-app/main/default/classes/lexSearchAgencyHospitalController.cls
@@ -0,0 +1,58 @@
+public without sharing class lexSearchAgencyHospitalController {
+ //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
+ public static String agencyProType {get;set;}
+ public static String searchName {get;set;}
+ private static String accountid = null;
+ @AuraEnabled
+ public static List<Account> at {get;set;}
+
+
+ @AuraEnabled
+ public static ResponseBodyLWC init(String ctype){
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ User useracc = [SELECT accountid,UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId() ];
+ accountid = Useracc.accountid;
+ agencyProType = Useracc.UserPro_Type__c;
+ if(String.isBlank(Useracc.UserPro_Type__c)){
+ agencyProType = 'ET';
+ }
+ String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name FROM Account';
+ soql += ' where id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c = \'' + accountid + '\' AND Hosptial_Type__c like \'%' + String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) + '%\')' ;
+ soql += ' order by Name desc limit 100';
+ at = Database.query(soql);
+ data.put('at',at);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ @AuraEnabled
+ public static ResponseBodyLWC serContact(String searchName,String ctype){
+ ResponseBodyLWC res = new ResponseBodyLWC();
+ Map<String, object> data = new Map<String, object>();
+ res.entity = data;
+ User useracc = [SELECT accountid,UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId() ];
+ accountid = Useracc.accountid;
+ at = Database.query(makeSoql(searchName,accountid,ctype));
+ data.put('at',at);
+ res.status = 'Success';
+ res.code = 200;
+ System.debug('res = ' + res);
+ return res;
+ }
+
+ private static String makeSoql(String searchName,String accountid,String ctype){
+
+ String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name FROM Account';
+ soql += ' where id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c = \'' + accountid + '\' AND Hosptial_Type__c like \'%' + String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) + '%\')' ;
+ if(String.isNotBlank(searchName)){
+ soql += ' AND Name like \'%' + String.escapeSingleQuotes(searchName.replaceAll('%', '\\%')) + '%\'';
+ }
+ soql += ' order by Name desc limit 100';
+ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'soql' + soql));
+ return soql;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/lexSearchAgencyHospitalController.cls-meta.xml b/force-app/main/default/classes/lexSearchAgencyHospitalController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/lexSearchAgencyHospitalController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/labels/CustomLabels.labels-meta.xml b/force-app/main/default/labels/CustomLabels.labels-meta.xml
new file mode 100644
index 0000000..d4cd83a
--- /dev/null
+++ b/force-app/main/default/labels/CustomLabels.labels-meta.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata">
+ <labels>
+ <fullName>LexArrivegsDetailsPageHelpText</fullName>
+ <language>zh_CN</language>
+ <protected>false</protected>
+ <shortDescription>LexArrivegsDetailsPageHelpText</shortDescription>
+ <value>褰撻�夋嫨娑堣�楀搧璁㈠崟鍏ュ簱鏃讹紝鏄剧ず鍚嶇О</value>
+ </labels>
+ <labels>
+ <fullName>LexConInvoiceViewReport</fullName>
+ <language>zh_CN</language>
+ <protected>false</protected>
+ <shortDescription>鍙戠エ鏄剧ず鏄庣粏</shortDescription>
+ <value>00O6D000000UPzaUAG</value>
+ </labels>
+ <labels>
+ <fullName>View_Weekly_Report</fullName>
+ <language>zh_CN</language>
+ <protected>false</protected>
+ <shortDescription>鏌ョ湅鍛ㄦ姤娲诲姩</shortDescription>
+ <value>00O6D000000UPzZUAW</value>
+ </labels>
+ <labels>
+ <fullName>invoiceStart</fullName>
+ <language>zh_CN</language>
+ <protected>false</protected>
+ <shortDescription>鍙戠エ瀵硅薄鍓�3浣嶆暟鍊�</shortDescription>
+ <value>a2K</value>
+ </labels>
+</CustomLabels>
diff --git a/force-app/main/default/lwc/boxorpieceType/boxorpieceType.html b/force-app/main/default/lwc/boxorpieceType/boxorpieceType.html
new file mode 100644
index 0000000..d693bae
--- /dev/null
+++ b/force-app/main/default/lwc/boxorpieceType/boxorpieceType.html
@@ -0,0 +1,10 @@
+<template>
+ <lightning-combobox
+ name="progress"
+ label="Status"
+ value={value}
+ placeholder="璇烽�夋嫨鍗曚綅"
+ options={options}
+ onchange={handleChange} >
+ </lightning-combobox>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/boxorpieceType/boxorpieceType.js b/force-app/main/default/lwc/boxorpieceType/boxorpieceType.js
new file mode 100644
index 0000000..6e88773
--- /dev/null
+++ b/force-app/main/default/lwc/boxorpieceType/boxorpieceType.js
@@ -0,0 +1,21 @@
+import { LightningElement,api } from 'lwc';
+
+export default class BoxorpieceType extends LightningElement {
+ value = '鐩�';
+ @api customValueA;
+
+ get options() {
+ return [
+ { label: '鐩�', value: '鐩�' },
+ { label: '涓�', value: '涓�' }
+ ];
+ }
+
+ connectedCallback(){
+ console.log('enter BoxorpieceType')
+ }
+
+ handleChange(event) {
+ this.value = event.detail.value;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/boxorpieceType/boxorpieceType.js-meta.xml b/force-app/main/default/lwc/boxorpieceType/boxorpieceType.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/boxorpieceType/boxorpieceType.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/commonToast/commonToast.html b/force-app/main/default/lwc/commonToast/commonToast.html
new file mode 100644
index 0000000..f367b87
--- /dev/null
+++ b/force-app/main/default/lwc/commonToast/commonToast.html
@@ -0,0 +1,22 @@
+<template>
+ <template if:true={showToastBar}>
+ <div class="slds-notify_container">
+ <div class={outerClass} role="status">
+ <span class="slds-assistive-text">{type}</span>
+ <span class={innerClass} title={message}>
+ <lightning-icon icon-name={getIconName} alternative-text="icon" styleclass="slds-icon slds-icon_small" variant="inverse" size="small"></lightning-icon>
+ </span>
+ <div class="slds-notify__content">
+ <h2 class="slds-text-heading_small">
+ <lightning-formatted-rich-text value={message}>
+ </lightning-formatted-rich-text>
+ </h2>
+ </div>
+
+ <div class="slds-notify__close">
+ <lightning-button-icon icon-name="utility:close" size="small" variant="border-filled" class="slds-button slds-button_icon slds-button_icon-inverse" alternative-text="next" onclick={closeModel} ></lightning-button-icon>
+ </div>
+ </div>
+ </div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/commonToast/commonToast.js b/force-app/main/default/lwc/commonToast/commonToast.js
new file mode 100644
index 0000000..5da6e8e
--- /dev/null
+++ b/force-app/main/default/lwc/commonToast/commonToast.js
@@ -0,0 +1,44 @@
+import { LightningElement,track,api} from 'lwc';
+
+export default class CommonToast extends LightningElement {
+ @track type='success';
+ @track message;
+ @track messageIsHtml=false;
+ @track showToastBar = false;
+ @api autoCloseTime = 5000;
+ @track icon='';
+
+ @api
+ showToast(type, message,icon,time) {
+ this.type = type;
+ this.message = message;
+ this.icon=icon;
+ this.autoCloseTime=time;
+ this.showToastBar = true;
+ setTimeout(() => {
+ this.closeModel();
+ }, this.autoCloseTime);
+ }
+
+ closeModel() {
+ this.showToastBar = false;
+ this.type = '';
+ this.message = '';
+ }
+
+ get getIconName() {
+ if(this.icon)
+ {
+ return this.icon;
+ }
+ return 'utility:' + this.type.toLowerCase();
+ }
+
+ get innerClass() {
+ return 'slds-icon_container slds-icon-utility-' + this.type.toLowerCase() + ' slds-m-right_small slds-no-flex slds-align-top';
+ }
+
+ get outerClass() {
+ return 'slds-notify slds-notify_toast slds-theme_' + this.type.toLowerCase();
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/commonToast/commonToast.js-meta.xml b/force-app/main/default/lwc/commonToast/commonToast.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/commonToast/commonToast.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.html b/force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.html
new file mode 100644
index 0000000..27e0f69
--- /dev/null
+++ b/force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.html
@@ -0,0 +1,3 @@
+<template>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js b/force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js
new file mode 100644
index 0000000..fbef290
--- /dev/null
+++ b/force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js
@@ -0,0 +1,11 @@
+import { LightningElement } from 'lwc';
+import boxorpieceType from './templates/boxorpieceType';
+
+export default class CustomLightningDatatable extends LightningElement {
+ static customTypes = {
+ boxorpieceType: {
+ template: boxorpieceType,
+ typeAttributes: ['customValueA']
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js-meta.xml b/force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customLightningDatatable/templates/boxorpieceType.html b/force-app/main/default/lwc/customLightningDatatable/templates/boxorpieceType.html
new file mode 100644
index 0000000..8e1a0ae
--- /dev/null
+++ b/force-app/main/default/lwc/customLightningDatatable/templates/boxorpieceType.html
@@ -0,0 +1,4 @@
+<template>
+ <c-boxorpiece-type
+ custom-value-a={typeAttributes.customValueA}></c-boxorpiece-type>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.html b/force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.html
new file mode 100644
index 0000000..baae6dd
--- /dev/null
+++ b/force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.html
@@ -0,0 +1,5 @@
+<template>
+ <lightning-input step="0" type="number" name="count" label="鍑鸿揣鏁伴噺"
+ variant="label-hidden" onchange={outboundCountBlur} data-field="shipmentNumber" value={count}
+ min="0" disabled={isDisable} style="min-width: 150px;"></lightning-input>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js b/force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js
new file mode 100644
index 0000000..ef28c10
--- /dev/null
+++ b/force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js
@@ -0,0 +1,29 @@
+import { LightningElement,api } from 'lwc';
+
+export default class CustomOutboundCountComp extends LightningElement {
+ @api isDisable;
+ @api recordId;
+ @api count;
+
+
+ connectedCallback(){
+ console.log('enter CustomOutboundCountComp');
+ console.log('isDisable = ' + this.isDisable);
+ console.log('recordId = ' + this.recordId);
+ console.log('count = ' + this.count);
+ }
+
+ outboundCountBlur(event){
+ console.log('outboundCountBlur')
+ this.count = event.target.value;
+
+ this.dispatchEvent(new CustomEvent('outboundcount', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: { count: this.count, recordId: this.recordId }
+ }
+ }));
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js-meta.xml b/force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customOutputGood/customOutputGood.html b/force-app/main/default/lwc/customOutputGood/customOutputGood.html
new file mode 100644
index 0000000..0277ba5
--- /dev/null
+++ b/force-app/main/default/lwc/customOutputGood/customOutputGood.html
@@ -0,0 +1,24 @@
+<template>
+ <template if:true={showTitle}>
+ <template if:true={showLink}>
+ <p style="height: 10px;"></p>
+ <a style="margin-left: 10px;margin-top: 10px;margin-bottom: 10px;" onclick={clickLink}><lightning-formatted-text value={outputValue}></lightning-formatted-text></a>
+ <p style="height: 10px;"></p>
+ </template>
+ <template if:false={showLink}>
+ <div style="margin-left: 10px;margin-top: 10px;margin-bottom: 10px;font-size:16px;color:#696969;">
+ <lightning-formatted-text value={outputValue}></lightning-formatted-text>
+ </div>
+ </template>
+ </template>
+ <template if:false={showTitle}>
+ <div style="text-align: right;">
+ <template if:true={showLink}>
+ <a style="margin-left: 10px;margin-right: 10px;" onclick={clickLink}><lightning-formatted-number value={outputValue}></lightning-formatted-number></a>
+ </template>
+ <template if:false={showLink}>
+ <lightning-formatted-number style="margin-left: 10px;margin-right: 10px;" value={outputValue}></lightning-formatted-number>
+ </template>
+ </div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customOutputGood/customOutputGood.js b/force-app/main/default/lwc/customOutputGood/customOutputGood.js
new file mode 100644
index 0000000..643c9ce
--- /dev/null
+++ b/force-app/main/default/lwc/customOutputGood/customOutputGood.js
@@ -0,0 +1,42 @@
+import { LightningElement,api,track } from 'lwc';
+
+export default class CustomOutputGood extends LightningElement {
+ @api outputValue;
+ @api outputType;
+ @api recordId;
+
+ get showTitle(){
+ if(this.outputType == 'Title'){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ get showLink(){
+ if(this.outputType == 'Title'){
+ if(this.outputValue == '璁㈠崟鏄庣粏姹囨��' || this.outputValue == '寰呮搷浣滃叆搴撹鍗曟眹鎬�'){
+ return false;
+ }else{
+ return true
+ }
+ }else{
+ if(this.outputValue == 0 || this.outputValue == '0' || this.outputValue == ''){
+ return false;
+ }else{
+ return true;
+ }
+ }
+ }
+
+ clickLink(event){
+ this.dispatchEvent(new CustomEvent('clicklink', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: { value: this.outputValue, type: this.outputType, recordId:this.recordId}
+ }
+ }));
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customOutputGood/customOutputGood.js-meta.xml b/force-app/main/default/lwc/customOutputGood/customOutputGood.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/customOutputGood/customOutputGood.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.html b/force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.html
new file mode 100644
index 0000000..70cde91
--- /dev/null
+++ b/force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.html
@@ -0,0 +1,10 @@
+<template>
+ <lightning-input
+ name="shipmentAmount"
+ label="shipmentAmount"
+ variant="label-hidden"
+ value={shipmentAmount}
+ read-only style="margin-left: 10px;">
+
+ </lightning-input>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.js b/force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.js
new file mode 100644
index 0000000..6822093
--- /dev/null
+++ b/force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.js
@@ -0,0 +1,9 @@
+import { LightningElement,api } from 'lwc';
+
+export default class CustomShipmentAmountComp extends LightningElement {
+ @api shipmentAmount;
+
+ connectedCallback(){
+ console.log('杩涘叆 CustomShipmentAmountComp shipmentAmount = ' + this.shipmentAmount);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.js-meta.xml b/force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.css b/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.html b/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.html
new file mode 100644
index 0000000..b3bbda8
--- /dev/null
+++ b/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.html
@@ -0,0 +1,8 @@
+<template>
+ <lightning-input style="border:1px solid red" step="0" type="number" name="shipmentNumber" label="鍑鸿揣鏁伴噺"
+ variant="label-hidden" onchange={dataChange} data-field="shipmentNumber" value={shipmentNumber}
+ onblur={shipmentNumberBlur} min="0" class="inputFont"></lightning-input>
+ <!-- <lightning-input style="border:1px solid red" name="shipmentNumber" label="鍑鸿揣鏁伴噺"
+ variant="label-hidden" onchange={dataChange} data-field="shipmentNumber" value={shipmentNumber}
+ onblur={shipmentNumberBlur}></lightning-input> -->
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js b/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js
new file mode 100644
index 0000000..4b9be8d
--- /dev/null
+++ b/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js
@@ -0,0 +1,24 @@
+import { LightningElement,api,track } from 'lwc';
+
+export default class CustomShipmentNumberComp extends LightningElement {
+ @api recordId;
+ @api shipmentNumber;
+
+ connectedCallback(){
+ console.log('shipmentNumber = ' + this.shipmentNumber);
+ }
+
+ shipmentNumberBlur(event){
+ console.log('shipmentNumberBlur')
+ this.shipmentNumber = event.target.value;
+
+ this.dispatchEvent(new CustomEvent('shipmentnumber', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: { shipmentnumber: this.shipmentNumber, recordId: this.recordId }
+ }
+ }));
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js-meta.xml b/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.css b/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.html b/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.html
new file mode 100644
index 0000000..87b0a65
--- /dev/null
+++ b/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.html
@@ -0,0 +1,5 @@
+<template>
+ <lightning-input style="border:1px solid red" step="0.01" type="number" name="shipmentUnitPrice"
+ label="deliveryOrderNo" variant="label-hidden" data-field="shipmentUnitPrice" value={shippingUnitPrice}
+ onblur={shipmentUnitPriceBlur} class="inputFont"></lightning-input>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js b/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js
new file mode 100644
index 0000000..6e1f1e7
--- /dev/null
+++ b/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js
@@ -0,0 +1,24 @@
+import { LightningElement,api,track } from 'lwc';
+
+export default class CustomShippingUnitPriceComp extends LightningElement {
+ @api recordId;
+ @api shippingUnitPrice;
+
+ connectedCallback(){
+ console.log('shippingUnitPrice = ' + this.shippingUnitPrice);
+ }
+
+ shipmentUnitPriceBlur(event){
+ console.log('shipmentUnitPriceBlur')
+ this.shippingUnitPrice = event.target.value;
+
+ this.dispatchEvent(new CustomEvent('shipmentunitprice', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: { shipmentunitprice: this.shippingUnitPrice, recordId: this.recordId }
+ }
+ }));
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js-meta.xml b/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customUnitComp/customUnitComp.css b/force-app/main/default/lwc/customUnitComp/customUnitComp.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/customUnitComp/customUnitComp.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customUnitComp/customUnitComp.html b/force-app/main/default/lwc/customUnitComp/customUnitComp.html
new file mode 100644
index 0000000..b898306
--- /dev/null
+++ b/force-app/main/default/lwc/customUnitComp/customUnitComp.html
@@ -0,0 +1,22 @@
+<!-- sldsValidatorIgnore -->
+<!-- sldsValidatorIgnore -->
+<template>
+ <!-- <select id="citySel" class="selectUnit" onchange={handleDataChange} data-field="selectUnit">
+ <template for:each={unitOptions} for:item="uo">
+ <option value={uo.value} key={uo.value}>{uo.label}</option>
+ </template>
+ </select> -->
+ <div class="picklist-container">
+ <lightning-combobox
+ name="selectUnit"
+ label="unit"
+ value={unitValue}
+ variant="label-hidden"
+ onchange={handleDataChange}
+ data-field="selectUnit"
+ options={unitOptions}
+ class="inputFont"
+ disabled={isDisabled}
+ ></lightning-combobox>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customUnitComp/customUnitComp.js b/force-app/main/default/lwc/customUnitComp/customUnitComp.js
new file mode 100644
index 0000000..4592b6c
--- /dev/null
+++ b/force-app/main/default/lwc/customUnitComp/customUnitComp.js
@@ -0,0 +1,27 @@
+import { LightningElement,api } from 'lwc';
+
+export default class CustomUnitComp extends LightningElement {
+ @api unitValue;
+ @api unitOptions;
+ @api recordId;
+ @api isDisabled;
+
+ connectedCallback(){
+ if(this.isDisabled == null){
+ this.isDisabled = false;
+ }
+ }
+
+ handleDataChange(event){
+ console.log('unitValue = ' + event.target.value);
+ this.unitValue = event.target.value;
+ this.dispatchEvent(new CustomEvent('unitchange', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: { unitValue: this.unitValue, recordId: this.recordId }
+ }
+ }));
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customUnitComp/customUnitComp.js-meta.xml b/force-app/main/default/lwc/customUnitComp/customUnitComp.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/customUnitComp/customUnitComp.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.html b/force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.html
new file mode 100644
index 0000000..a4c23fb
--- /dev/null
+++ b/force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.html
@@ -0,0 +1,8 @@
+<template>
+ <template if:true={isShowButton}>
+ <lightning-button label="鏌ョ湅鍛ㄦ姤娲诲姩" title="鍛ㄦ姤" onclick={toWeeklyReport} class="slds-m-left_x-small"></lightning-button>
+ </template>
+ <template if:false={isShowButton}>
+ <p style="text-align: center;">...</p>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js b/force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js
new file mode 100644
index 0000000..9c1404f
--- /dev/null
+++ b/force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js
@@ -0,0 +1,33 @@
+import { LightningElement, api, track } from 'lwc';
+import { NavigationMixin } from "lightning/navigation";
+import View_Weekly_Report from '@salesforce/label/c.View_Weekly_Report';
+
+const customLabel = {
+ View_Weekly_Report
+}
+export default class CustomWeeklyReportComp extends NavigationMixin(LightningElement) {
+ @track label = customLabel;
+
+ @api recordId;
+ @api hospitalName;
+ @api isShowButton;
+
+ connectedCallback() {
+ console.log('CustomWeeklyReportComp recordId = ' + this.recordId);
+ console.log('CustomWeeklyReportComp hospitalName = ' + this.hospitalName);
+ }
+
+ toWeeklyReport() {
+ console.log('鍘绘姤琛�');
+ let reportFilters = '[{"operator":"equals","value":"' + this.hospitalName + '","column":"Agency_Report__c.Hospital__c"}]';
+ let reportUrl = this.label.View_Weekly_Report;
+ console.log('reportUrl = ' + reportUrl);
+ let url = "/report/" + reportUrl + "?reportFilters=" + encodeURIComponent(reportFilters);
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js-meta.xml b/force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.html b/force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.html
new file mode 100644
index 0000000..0440d2c
--- /dev/null
+++ b/force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.html
@@ -0,0 +1 @@
+<template> </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.js b/force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.js
new file mode 100644
index 0000000..cac85fe
--- /dev/null
+++ b/force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.js
@@ -0,0 +1,11 @@
+import LightningDatatable from 'lightning/datatable';
+import navigateToRecordTemplate from './navigateToRecordTemplate.html';
+
+export default class DatatableWithCustomTypes extends LightningDatatable {
+ static customTypes = {
+ navigateToRecord: {
+ template: navigateToRecordTemplate,
+ typeAttributes: ['label']
+ }
+ };
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.js-meta.xml b/force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.js-meta.xml
new file mode 100644
index 0000000..b9a3113
--- /dev/null
+++ b/force-app/main/default/lwc/datatableWithCustomTypes/datatableWithCustomTypes.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>54.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/datatableWithCustomTypes/navigateToRecordTemplate.html b/force-app/main/default/lwc/datatableWithCustomTypes/navigateToRecordTemplate.html
new file mode 100644
index 0000000..396e2f8
--- /dev/null
+++ b/force-app/main/default/lwc/datatableWithCustomTypes/navigateToRecordTemplate.html
@@ -0,0 +1,8 @@
+<template>
+ <c-navigate-to-record
+ data-navigation="enable"
+ record-id={value}
+ label={typeAttributes.label}
+ >
+ </c-navigate-to-record>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.css b/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.css
new file mode 100644
index 0000000..8e8eb4c
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.css
@@ -0,0 +1,17 @@
+lightning-output-field {
+ pointer-events: none;
+ --lwc-colorTextLabel:#696969;
+ --lwc-inputStaticFontSize: 16px;
+ --lwc-formLabelFontSize: 16px;
+ --lwc-brandTextLink: black;
+ --lwc-spacingXxSmall:0px;
+}
+
+/* lightning-output-field>a {
+ color: black;
+} */
+
+body{
+ /* --lwc-fontFamily:sans-serif; */
+ font-family: sans-serif;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.html b/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.html
new file mode 100644
index 0000000..f0f4700
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.html
@@ -0,0 +1,109 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <template if:true={showPage}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>缁忛攢鍟嗕俊鎭�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+ <lightning-accordion allow-multiple-sections-open active-section-name={activeSections}>
+ <lightning-record-view-form record-id={accountId} object-api-name="Account">
+ <lightning-accordion-section label="缁忛攢鍟嗚缁嗕俊鎭�" name="A">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Management_Code__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Name"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Ban_On_Use_Date__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Ban_On_Use_Reason__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Dealer_discount__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Sales_Shop_Class__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Deposit_Receipt_Finished__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Deposit_Receipt_Completion_Day__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ </lightning-layout>
+ </lightning-accordion-section>
+ <lightning-accordion-section label="钀ヤ笟璁稿彲璇佷功鐘跺喌" name="B">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Business_Authorization_No__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Business_Paper_Expiration_Date__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Tax_Practice_No__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Tax_Practice_Expiration_Date__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Medical_Equipment_Num__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Medical_Equipment_Expiration_Date__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ </lightning-layout>
+ </lightning-accordion-section>
+ <lightning-accordion-section label="鍦板潃淇℃伅" name="C">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Postal_Code__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Phone"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Address_Together__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-output-field field-name="Fax"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="1"></lightning-layout-item>
+ </lightning-layout>
+ </lightning-accordion-section>
+ </lightning-record-view-form>
+ </lightning-accordion>
+ </div>
+ </div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js b/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js
new file mode 100644
index 0000000..0d8ae06
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js
@@ -0,0 +1,70 @@
+import { LightningElement,track } from 'lwc';
+import initAgency from '@salesforce/apex/LexTopPageController.initAgency';
+
+export default class LexAgencyInfo extends LightningElement {
+ @track showSpinner = true;
+ @track showPage = false;
+ @track accountInfo;
+ @track accountId;
+ @track activeSections = ['A', 'B', 'C'];
+ //鏄惁涓�鐩存樉绀烘彁绀�
+ @track isNoteStay = true;
+
+ connectedCallback() {
+ this.init();
+ }
+
+ init() {
+ this.showSpinner = true;
+ initAgency()
+ .then(result => {
+ this.showPage = true;
+ this.isNoteStay = result.isNoteStay;
+ if (result.result == 'Success') {
+ this.accountInfo = result.accountInfo;
+ this.accountId = result.accountInfo.Id;
+ this.showSpinner = false;
+ } else {
+ this.showSpinner = false;
+ console.log("Error:" + result.errorMsg);
+ this.showMyToast('鍒濆鍖栭〉闈㈠け璐�', result.errorMsg, 'error');
+ }
+ })
+ .catch(error => {
+ this.showSpinner = false;
+ console.log("Error:" + error);
+ this.showMyToast('鍒濆鍖栭〉闈㈠け璐�', JSON.stringify(error), 'error');
+ })
+ }
+
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').
+ showToast(variant,content,iconName,10000);
+ // var mode;
+ // if(this.isNoteStay){
+ // mode ='sticky';
+ // }else{
+ // mode = 'dismissable';
+ // }
+ // const evt = new ShowToastEvent({
+ // title: title,
+ // message: message,
+ // variant: variant,
+ // mode: mode
+ // });
+ // this.dispatchEvent(evt);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js-meta.xml b/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.html b/force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.html
new file mode 100644
index 0000000..1080fb3
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.html
@@ -0,0 +1,12 @@
+<template>
+ <template if:true={isShowInputField}>
+ <lightning-record-edit-form object-api-name="Agency_Opportunity__c">
+ <lightning-input-field field-name={fieldName} variant="label-hidden" value={inputValue} onchange={inputChange}></lightning-input-field>
+ </lightning-record-edit-form>
+ </template>
+ <template if:false={isShowInputField}>
+ <lightning-record-view-form record-id={recordId} object-api-name="Agency_Opportunity__c">
+ <lightning-output-field variant="label-hidden" field-name={fieldName}></lightning-output-field>
+ </lightning-record-view-form>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js b/force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js
new file mode 100644
index 0000000..bce7edd
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js
@@ -0,0 +1,29 @@
+import { LightningElement,api } from 'lwc';
+
+export default class LexAgencyOppCusCell extends LightningElement {
+ @api recordId;
+ @api fieldName;
+ @api inputValue;
+ @api showType;
+
+ get isShowInputField(){
+ if(this.showType == 'inputField'){
+ return true;
+ }else {
+ return false;
+ }
+ }
+
+ inputChange(event){
+ this.inputValue = event.detail.value;
+
+ this.dispatchEvent(new CustomEvent('inputchange', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: {recordId:this.recordId,fieldName:this.fieldName,inputValue:this.inputValue,showType:this.showType}
+ }
+ }));
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js-meta.xml b/force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js-meta.xml
new file mode 100644
index 0000000..3fe0e73
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>57.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.css b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html
new file mode 100644
index 0000000..5dc2f11
--- /dev/null
+++ b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html
@@ -0,0 +1,102 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <template if:true={showPage}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
+ <div style="padding:10px;">
+ <!-- 鎸夐挳 -->
+ <!-- <lightning-button style="margin: 5px;" label="鍏ュ簱" onclick={orderArrive}></lightning-button>
+ <lightning-button style="margin: 5px;" label="杩斿搧" onclick={orderReturn}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;margin-right: 150px;" label="鍏ュ簱" onclick={orderArrive}>鍏ュ簱</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="杩斿搧" onclick={orderReturn}>杩斿搧</button>
+ <p style="height: 10px;"></p>
+ <!-- 妫�绱㈡潯浠� -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>妫�绱㈡潯浠�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>妫�绱㈡潯浠�</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <table>
+ <tbody>
+ <tr>
+ <td style="width: 10px;"></td>
+ <td style="width: 120px;">
+ <div style="color:#696969;font-size:16px;text-align: left;">娑堣�楀搧璁㈠崟鍚嶇О</div>
+ </td>
+ <td>
+ <lightning-input class="inputFont" type="text" variant="label-hidden" label="娑堣�楀搧璁㈠崟鍚嶇О" value={category1} onchange={category1Change}></lightning-input>
+ </td>
+ <td style="width: 30px;"></td>
+ <td style="width: 108px;">
+ <div style="color:#696969;font-size:16px;text-align: left;">鏈�鏂板彂璐ф棩鏈�</div>
+ </td>
+ <td>
+ <lightning-input class="inputFont" type="date" variant="label-hidden" label="鏈�鏂板彂璐ф棩鏈�" value={cate2} onchange={cate2Change}></lightning-input>
+ </td>
+ <td style="width: 30px;"></td>
+ <td>
+ <!-- <lightning-button style="margin-left: 10px;margin-right: 5px;" label="鎼滅储" onclick={search}></lightning-button>
+ <lightning-button style="margin-left: 5px;margin-right: 5px;" label="娓呯┖" onclick={clear}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="height:32px;margin-right: 30px;" label="鎼滅储" onclick={search}>鎼滅储</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="height:32px;" label="娓呯┖" onclick={clear}>娓呯┖</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <!-- 璁㈠崟鏄庣粏 -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>璁㈠崟鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>璁㈠崟鏄庣粏</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <!-- <lightning-datatable hide-checkbox-column key-field="id" columns={colms} data={raesList}></lightning-datatable> -->
+ <c-lex-custom-lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="Id" data={raesList} columns={colms} onclicklink={clickLick}></c-lex-custom-lightning-datatable>
+ </div>
+ </div>
+ </div>
+ </div>
+ </template>
+ <!-- 璁㈠崟鍚勭鏁伴噺淇℃伅寮圭獥 -->
+ <template if:true={showPop}>
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small" style="border: 1px solid #D4D4D4;">
+ <div class="slds-modal__container">
+ <header class="slds-modal__header" style="background-color: #F3F3F3;">
+ <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closePop}>
+ <lightning-icon icon-name="utility:close"
+ alternative-text="close"
+ variant="inverse"
+ size="small" ></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">{popTitle}</h2>
+ </header>
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1" style="border: 1px solid #F3F3F3;">
+ <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="prodModel" columns={colms2} data={recordList}></lightning-datatable>
+ </div>
+ <footer class="slds-modal__footer">
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="鍏抽棴" onclick={closePop}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="margin-left: 10px;" variant="neutral" label="鍏抽棴" onclick={closePop}>鍏抽棴</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js
new file mode 100644
index 0000000..5208da6
--- /dev/null
+++ b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js
@@ -0,0 +1,417 @@
+import { LightningElement,wire,api,track } from 'lwc';
+import { CurrentPageReference } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+import init from '@salesforce/apex/LexArriveGoodsMainController.init';
+import searchConsumableorderdetails from '@salesforce/apex/LexArriveGoodsMainController.searchConsumableorderdetails';
+import initTotalNum from '@salesforce/apex/LexConsumableGoodsInfo.initTotalNum';
+import initArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initArrDet';
+import initArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll';
+import initDeliveryDet from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet';
+import initDeliveryDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll';
+import initNotArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet';
+import initNotArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll';
+import initMoreThan7 from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7';
+import initMoreThan7All from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All';
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+export default class LexArriveGoodsMain extends NavigationMixin(LightningElement) {
+ //椤甸潰鍩虹鍙橀噺
+ @track agencyProType;
+ @track category1;
+ @track cate2;
+ // @track eSetId;
+ @track accountId;
+ @track title = [];
+ @track raesList = [];
+ @track recordList = [];
+ @track userWorkLocation;
+ @track totalNum;
+ @track orderNumberArrived;
+ @track deliveryDetailCount;
+ @track orderNumberNotarrive;
+ @track moreThanSevenDays;
+ @track showSpinner = true;
+ @track showPage = false;
+ @track showPop = false;
+ @track popTitle;
+ stylesLoaded = false;
+ //鏄惁涓�鐩存樉绀烘彁绀�
+ @track isNoteStay = true;
+
+ @track colms = [
+ // {label:'娑堣�楀搧璁㈠崟鍚嶇О',fieldName:'Name'},
+ // {label:'璁㈠崟鎬绘暟',fieldName:'Total_num__c'},
+ // {label:'宸插埌璐ф暟閲�',fieldName:'OrderNumber_arrived__c'},
+ // {label:'寰呯郴缁熸搷浣滃叆搴撴暟閲�',fieldName:'Delivery_detail_count__c'},
+ // {label:'杩樻病鍙戣揣鏁伴噺',fieldName:'OrderNumber_notarrive__c'},
+ // {label:'鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�',fieldName:'More_than_seven_days__c'},
+ {label:'娑堣�楀搧璁㈠崟鍚嶇О',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "Name" },
+ type: 'Title',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true,initialWidth:200},
+ {label:'SAP鍚堝悓鍙�',fieldName:'ContractNo__c',hideDefaultActions: true},
+ {label:'璁㈠崟鎬绘暟',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "Total_num__c" },
+ type: 'TotalNum',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true, initialWidth: 100},
+ {label:'宸插埌璐ф暟閲�',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "OrderNumber_arrived__c" },
+ type: 'ArrDet',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true, initialWidth: 110},
+ {label:'寰呯郴缁熸搷浣滃叆搴撴暟閲�',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "Delivery_detail_count__c" },
+ type: 'DeliveryDet',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true, initialWidth: 180},
+ {label:'杩樻病鍙戣揣鏁伴噺',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "OrderNumber_notarrive__c" },
+ type: 'NotArrDet',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true, initialWidth: 120},
+ {label:'鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "More_than_seven_days__c" },
+ type: 'MoreThan7',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true, initialWidth: 180},
+ {label:'鏈�鏂板彂璐ф棩鏈�',fieldName:'Shipment_date__c',hideDefaultActions: true, initialWidth: 140},
+ {label:'棣栨鍙戣揣鏃ユ湡',fieldName:'First_Delivery__c',hideDefaultActions: true, initialWidth: 140}
+ ];
+
+ @track colms2 = [
+ {label:'浜у搧鍨嬪彿',fieldName:'prodModel',hideDefaultActions: true},
+ {label:'鏁伴噺',fieldName:'recordCount',hideDefaultActions: true,initialWidth: 100}
+ ];
+
+ //鑾峰彇鍙傛暟
+ // @wire(CurrentPageReference)
+ // getStateParameters(currentPageReference) {
+ // console.log('CurrentPageReference');
+ // if (currentPageReference) {
+ // this.eSetId = currentPageReference.state?.ESetid;
+ // }
+ // }
+
+ renderedCallback(){
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+ //鍒濆鍖�
+ connectedCallback(){
+ init()
+ .then(result=>{
+ this.isNoteStay = result.isNoteStay;
+ if(result.result == 'Success'){
+ this.agencyProType = result.agencyProType;
+ this.accountId = result.accountId;
+ this.title = result.title;
+ this.userWorkLocation = result.userWorkLocation;
+ this.totalNum = result.totalNum;
+ this.orderNumberArrived = result.orderNumberArrived;
+ this.deliveryDetailCount = result.deliveryDetailCount;
+ this.orderNumberNotarrive = result.orderNumberNotarrive;
+ this.moreThanSevenDays = result.moreThanSevenDays;
+ this.raesList = result.raesList;
+ this.raesList.push({Id:'1',Name:'璁㈠崟鏄庣粏姹囨��',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays});
+ this.showSpinner = false;
+ this.showPage = true;
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍒濆鍖栭〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //鐐瑰嚮閾炬帴
+ clickLick(event){
+ var outputValue = event.detail.data.value;
+ var outputType = event.detail.data.type;
+ var recordId = event.detail.data.recordId;
+ console.log("click:"+outputValue+"---"+outputType+"---"+recordId);
+ if(outputType == 'Title'){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexarrivegoods?ESetId='+recordId
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else if(outputType == 'TotalNum'){
+ this.popTitle = '鎵�鏈変骇鍝佷竴瑙�';
+ initTotalNum({ordId:recordId, type:'all'})
+ .then(result=>{
+ if(result.result == 'Success'){
+ // this.recordList = result.recordList;
+ var dataStr = JSON.stringify(result.recordList);
+ this.recordList = JSON.parse(dataStr);
+ console.log('data:'+JSON.stringify(this.recordList));
+ this.showPop = true;
+ }else{
+ this.showMyToast('鍔犺浇鎵�鏈変骇鍝佷竴瑙堥〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ }else if(outputType == 'ArrDet'){
+ if(recordId == '1'){
+ this.popTitle = '鎵�鏈夊凡鍒拌揣浜у搧涓�瑙�';
+ initArrDetAll({type:'all'})
+ .then(result=>{
+ if(result.result == 'Success'){
+ // this.recordList = result.recordList;
+ var dataStr = JSON.stringify(result.recordList);
+ this.recordList = JSON.parse(dataStr);
+ console.log('data:'+JSON.stringify(this.recordList));
+ this.showPop = true;
+ }else{
+ this.showMyToast('鍔犺浇鎵�鏈夊凡鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ }else{
+ this.popTitle = '宸插埌璐т骇鍝佷竴瑙�';
+ initArrDet({orderId:recordId})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.recordList = result.recordList;
+ console.log('data:'+JSON.stringify(this.recordList));
+ this.showPop = true;
+ }else{
+ this.showMyToast('鍔犺浇宸插埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ }
+ }else if(outputType == 'DeliveryDet'){
+ if(recordId == '1'){
+ this.popTitle = '鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙�';
+ initDeliveryDetAll({type:'all'})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.recordList = result.recordList;
+ console.log('data:'+JSON.stringify(this.recordList));
+ this.showPop = true;
+ }else{
+ this.showMyToast('鍔犺浇鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ }else{
+ this.popTitle = '鏈埌璐т骇鍝佷竴瑙�';
+ initDeliveryDet({orderId:recordId})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.recordList = result.recordList;
+ console.log('data:'+JSON.stringify(this.recordList));
+ this.showPop = true;
+ }else{
+ this.showMyToast('鍔犺浇鏈埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ }
+ }else if(outputType == 'NotArrDet'){
+ if(recordId == '1'){
+ this.popTitle = '鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙�';
+ initNotArrDetAll({type:'all'})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.recordList = result.recordList;
+ console.log('data:'+JSON.stringify(this.recordList));
+ this.showPop = true;
+ }else{
+ this.showMyToast('鍔犺浇鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙堥〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ }else{
+ this.popTitle = '杩樻病鍙戣揣鏁伴噺';
+ initNotArrDet({orderId:recordId})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.recordList = result.recordList;
+ console.log('data:'+JSON.stringify(this.recordList));
+ this.showPop = true;
+ }else{
+ this.showMyToast('鍔犺浇杩樻病鍙戣揣鏁伴噺椤甸潰澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ }else if(outputType == 'MoreThan7'){
+ if(recordId == '1'){
+ this.popTitle = '鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟';
+ initMoreThan7All({type:'all'})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.recordList = result.recordList;
+ console.log('data:'+JSON.stringify(this.recordList));
+ this.showPop = true;
+ }else{
+ this.showMyToast('鍔犺浇鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟椤甸潰澶辫触',result.errorMsg,'error');
+ }
+ })
+ }else{
+ this.popTitle = '鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�';
+ initMoreThan7({orderId:recordId})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.recordList = result.recordList;
+ console.log('data:'+JSON.stringify(this.recordList));
+ this.showPop = true;
+ }else{
+ this.showMyToast('鍔犺浇鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁伴〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ }
+ }
+ }
+
+ //鍏抽棴寮圭獥
+ closePop(){
+ this.showPop = false;
+ }
+
+ //娑堣�楀搧璁㈠崟鍚嶇О鍙樻洿
+ category1Change(event){
+ this.category1 = event.detail.value;
+ }
+
+ //鏈�鏂板彂璐ф棩鏈熷彉鏇�
+ cate2Change(event){
+ this.cate2 = event.detail.value;
+ }
+
+ //妫�绱�
+ search(){
+ this.showSpinner = true;
+ searchConsumableorderdetails({
+ category1Str:this.category1,
+ cate2Str:this.cate2,
+ accountidStr:this.accountId,
+ userWorkLocationStr:this.userWorkLocation,
+ agencyProTypeStr:this.agencyProType})
+ .then(result=>{
+ this.showSpinner = false;
+ if(result.result == 'Success'){
+ this.raesList = result.raesList;
+ this.raesList.push({Id:'1',Name:'璁㈠崟鏄庣粏姹囨��',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays});
+ if(this.raesList.length > 1){
+ var count = this.raesList.length - 1;
+ this.showMyToast('鎼滅储鎴愬姛','鍏辨悳绱㈠埌'+count+'鏉℃暟鎹�','success');
+ }else{
+ this.showMyToast('鏈悳绱㈠埌鏁版嵁','','error');
+ }
+ }else{
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //娓呯┖鎼滅储妗�
+ clear(){
+ this.showSpinner = true;
+ this.category1 = '';
+ this.cate2 = null;
+ searchConsumableorderdetails({
+ category1Str:this.category1,
+ cate2Str:this.cate2,
+ accountidStr:this.accountId,
+ userWorkLocationStr:this.userWorkLocation,
+ agencyProTypeStr:this.agencyProType})
+ .then(result=>{
+ this.showSpinner = false;
+ if(result.result == 'Success'){
+ this.raesList = result.raesList;
+ this.raesList.push({Id:'1',Name:'璁㈠崟鏄庣粏姹囨��',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays});
+ if(this.raesList.length > 1){
+ var count = this.raesList.length - 1;
+ this.showMyToast('鎼滅储鎴愬姛','鍏辨悳绱㈠埌'+count+'鏉℃暟鎹�','success');
+ }else{
+ this.showMyToast('鏈悳绱㈠埌鏁版嵁','','error');
+ }
+ }else{
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //鍏ュ簱
+ orderArrive(){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexarrivegoods?ArrType=Arr'
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ //杩斿搧
+ orderReturn(){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexarrivegoods?ArrType=ReG'
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').
+ showToast(variant,content,iconName,10000);
+ // var mode;
+ // if(this.isNoteStay){
+ // mode ='sticky';
+ // }else{
+ // mode = 'dismissable';
+ // }
+ // const evt = new ShowToastEvent({
+ // title: title,
+ // message: message,
+ // variant: variant,
+ // mode: mode
+ // });
+ // this.dispatchEvent(evt);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js-meta.xml b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.css b/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.html b/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.html
new file mode 100644
index 0000000..55e52c6
--- /dev/null
+++ b/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.html
@@ -0,0 +1,90 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <template if:true={showPage}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍒拌揣</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>鍒拌揣</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <!-- 鎸夐挳 -->
+ <!-- <lightning-button style="margin: 5px;" label="鍑哄簱" onclick={proSale} disabled={arrivetoorder}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="鍑哄簱" onclick={proSale} disabled={arrivetoorder}>鍑哄簱</button>
+ <p style="height: 10px;"></p>
+ <!-- 鍒拌揣璁㈠崟淇℃伅 -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍒拌揣璁㈠崟淇℃伅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>鍒拌揣璁㈠崟淇℃伅</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <table>
+ <tbody>
+ <tr>
+ <td style="width:10px;"></td>
+ <td style="width:140px;">
+ <div style="color:#696969;font-size:16px;">鍒拌揣璁㈠崟鍚嶇О</div>
+ </td>
+ <td style="width:200px;">
+ <lightning-formatted-text style="font-size: 16px;" value={coc.Name}></lightning-formatted-text>
+ </td>
+ <td style="width:30px;"></td>
+ <td style="width:140px;">
+ <div style="color:#696969;font-size:16px;">鏈鍏ュ簱浜у搧閲戦</div>
+ </td>
+ <td style="width:100px;">
+ <lightning-formatted-number style="font-size: 16px;" value={coc.Arrive_total_amount__c} minimum-fraction-digits="2"></lightning-formatted-number>
+ </td>
+ <td></td>
+ </tr>
+ <tr style="height: 20px;"></tr>
+ <tr>
+ <td style="width:10px;"></td>
+ <td style="width:120px;">
+ <div style="color:#696969;font-size:16px;">娑堣�楀搧璁㈠崟鍚嶇О<lightning-helptext style="--lwc-spacingXxSmall:0px;" content={label.helpText}></lightning-helptext></div>
+ </td>
+ <td style="width:200px;">
+ <lightning-formatted-text style="font-size: 16px;" value={coc.arriveOrder}></lightning-formatted-text>
+ <!-- <lightning-formatted-text value={coc.Arrive_Order__r.Name}></lightning-formatted-text> -->
+ </td>
+ <td></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <!-- 鍦ㄥ簱鍟嗗搧搴撳瓨涓�瑙� -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍦ㄥ簱鍟嗗搧搴撳瓨涓�瑙�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>鍦ㄥ簱鍟嗗搧搴撳瓨涓�瑙�</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="recordId" columns={colms} data={consumableorderdetailsRecords}></lightning-datatable>
+ </div>
+ </div>
+ </div>
+ </div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js b/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js
new file mode 100644
index 0000000..c3e3de9
--- /dev/null
+++ b/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js
@@ -0,0 +1,168 @@
+import { LightningElement,wire,track } from 'lwc';
+import { CurrentPageReference } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+import init from '@salesforce/apex/LexArriveGsDetailsController.init';
+import proSale from '@salesforce/apex/LexArriveGsDetailsController.proSale';
+import helpText from '@salesforce/label/c.LexArrivegsDetailsPageHelpText';
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+export default class LexArriveGsDetails extends NavigationMixin(LightningElement) {
+
+ @track eSetId;
+ @track showSpinner = true;
+ @track showPage = false;
+ @track accountid;
+ @track orderallcount;
+ @track consumableorderdetailsCount;
+ @track arrivetoorder = false;
+ @track coc;
+ @track consumableorderdetailsRecords = [];
+ stylesLoaded = false;
+ //鏄惁涓�鐩存樉绀烘彁绀�
+ @track isNoteStay = true;
+ @track colms = [
+ {label:'娑堣�楀搧鍚嶇О' , fieldName:'prodName', hideDefaultActions: true,wrapText:true},
+ {label:'瑙勬牸' , fieldName:'packing_list', hideDefaultActions: true,wrapText:true,initialWidth:50,cellAttributes: { alignment: "right" }},
+ {label:'CFDA鐘舵��' , fieldName:'statusCFDA', hideDefaultActions: true,wrapText:true,initialWidth:100},
+ {label:'娉ㄥ唽璇佺紪鐮佸彿' , fieldName:'approbation_No', hideDefaultActions: true,wrapText:true,initialWidth:125},
+ {label:'娉ㄥ唽璇佹晥鏈�' , fieldName:'expiration_DateStr', hideDefaultActions: true,wrapText:true,initialWidth:115},
+ {label:'浣跨敤鏈熼檺' , fieldName:'Sterilization_limitStr', hideDefaultActions: true,wrapText:true,initialWidth:115},
+ {label:'BarCode' , fieldName:'barCode', hideDefaultActions: true,initialWidth:250},
+ {label:'閲囪喘鍗曚环' ,type:'number',fieldName:'intraTradeList', hideDefaultActions: true,wrapText:true,initialWidth:120,typeAttributes:{minimumFractionDigits: 2},cellAttributes: { alignment: "right" }}
+ ];
+ label = {helpText};
+
+ // 鑾峰彇鍙傛暟
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ if (currentPageReference) {
+ this.eSetId = currentPageReference.state?.EsetId;
+ }
+ console.log('CurrentPageReference:'+this.eSetId);
+ }
+
+ renderedCallback(){
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+ //鍒濆鍖�
+ connectedCallback(){
+ init({eSetIdStr : this.eSetId})
+ .then(result=>{
+ this.showPage = true;
+ this.isNoteStay = result.isNoteStay;
+ if(result.result == 'Success'){
+ this.coc = result.coc;
+ if(this.coc.Arrive_Order__c != null && this.coc.Arrive_Order__c != ''){
+ this.coc['arriveOrder'] = this.coc.Arrive_Order__r.Name;
+ }
+ console.log('this.coc:'+JSON.stringify(this.coc));
+ this.accountid = result.accountid;
+ this.orderallcount = result.orderallcount;
+ this.arrivetoorder = result.arrivetoorder;
+ this.consumableorderdetailsCount = result.consumableorderdetailsCount;
+ this.consumableorderdetailsRecords = result.consumableorderdetailsRecords;
+ for(var i in this.consumableorderdetailsRecords){
+ if(this.consumableorderdetailsRecords[i].esd != null){
+ this.consumableorderdetailsRecords[i]['recordId'] = this.consumableorderdetailsRecords[i].esd.Id;
+ if(this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != null && this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != ''){
+ this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].esd.Consumable_Product__r.Name__c;
+ }
+ // this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].prodName;
+ this.consumableorderdetailsRecords[i]['barCode'] = this.consumableorderdetailsRecords[i].esd.Bar_Code__c;
+ this.consumableorderdetailsRecords[i]['intraTradeList'] = this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c;
+ console.log("Intra_Trade_List_RMB__c:"+this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c);
+ }
+ if(this.consumableorderdetailsRecords[i].Prod != null){
+ this.consumableorderdetailsRecords[i]['statusCFDA'] = this.consumableorderdetailsRecords[i].Prod.SFDA_Status__c;
+ }
+ }
+ this.showSpinner = false;
+ }else {
+ this.showSpinner = false;
+ console.log("error:"+result.errorMsg);
+ this.showMyToast('鍒濆鍖栧け璐�',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ this.showSpinner = false;
+ this.showPage = true;
+ console.log("error:"+error);
+ this.showMyToast('鍒濆鍖栧け璐�',error,'error');
+ })
+ }
+
+ proSale(){
+ this.showSpinner = true;
+ proSale({
+ cocStr : JSON.stringify(this.coc),
+ orderallcountParm : this.orderallcount,
+ consumableorderdetailsCountParm : this.consumableorderdetailsCount
+ })
+ .then(result=>{
+ if(result.result == 'Success'){
+ var url = result.url;
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: url
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else {
+ this.showSpinner = false;
+ console.log("error:"+error);
+ this.showMyToast('鍑哄簱澶辫触',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ this.showPage = true;
+ this.showSpinner = false;
+ console.log("error:"+error);
+ this.showMyToast('鍑哄簱澶辫触',error,'error');
+ })
+ }
+
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').
+ showToast(variant,content,iconName,10000);
+ // var mode;
+ // if(this.isNoteStay){
+ // mode ='sticky';
+ // }else{
+ // mode = 'dismissable';
+ // }
+ // const evt = new ShowToastEvent({
+ // title: title,
+ // message: message,
+ // variant: variant,
+ // mode: mode
+ // });
+ // this.dispatchEvent(evt);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js-meta.xml b/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.css b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html
new file mode 100644
index 0000000..3b10fa5
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html
@@ -0,0 +1,131 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;">
+
+ <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <div>
+ <!-- <p style="font-size: 18px;"><strong>鍙栨秷鎷嗙洅</strong></p> -->
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍙栨秷鎷嗙洅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ <div style="padding:10px;">
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <!-- <lightning-button variant="brand" class='lexstyle' style="margin-left:10px;" label="鍙栨秷鎷嗙洅纭" title="鍙栨秷鎷嗙洅纭" onclick={saveConfirm}></lightning-button></td> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin-left:10px;margin-top:12px;margin-bottom:12px;" label="鍙栨秷鎷嗙洅纭" onclick={saveConfirm}>鍙栨秷鎷嗙洅纭</button>
+ </div>
+ </div>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:5px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 16px">
+ <strong>BarCode褰曞叆</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+
+ <!-- <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> -->
+ <table>
+ <colgroup>
+ <col width="160px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="90px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="85px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ </colgroup>
+ <tbody>
+ <tr>
+ <td></td>
+ <td align="right" class="searchName">BarCode</td>
+ <td style="width:600px"><lightning-textarea class="inputFont" name="BarCode" label=""
+ onchange={handleChange}></lightning-textarea></td>
+ <td align="right"></td>
+ <td></td>
+ <td style="width: 200px;">
+ <button style="margin-top:14px;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="鑾峰彇鏄庣粏" onclick={getDetails}>鑾峰彇鏄庣粏</button>
+ <!-- <lightning-button variant="brand" class='lexstyle' label="鑾峰彇鏄庣粏" title="鑾峰彇鏄庣粏" onclick={getDetails}
+ ></lightning-button> -->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <!-- </div> -->
+ </div>
+
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍙栨秷鎷嗙洅鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+
+ <!-- <div style="height: 300px;"> -->
+ <!-- <template if:true={showTable}> -->
+ <c-lex-custom-lightning-datatable key-field="prodid" data={data} columns={columns}
+ onrowselection={getSelectedRows} hide-checkbox-column="true"
+ selected-rows={selectedRows} class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ <!-- </template> -->
+ <!-- </div> -->
+
+ </div>
+ </div>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:10px">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <table>
+ <tr>
+ <td>
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>閿欒鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div style="padding:10px;">
+ <lightning-datatable
+ key-field="id" data={errorDetail} columns={column}
+ onrowselection={getSelectedRows} hide-checkbox-column="true"
+ selected-rows={selectedRows} class="wrapped-header-datatable">
+ </lightning-datatable>
+
+
+ </div>
+ </div>
+ </div>
+
+
+
+ </div>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js
new file mode 100644
index 0000000..52d3451
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js
@@ -0,0 +1,242 @@
+import { LightningElement, wire, api, track } from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import oninit from "@salesforce/apex/LexCancelRemoveBoxController.init";
+import searchDeatail from "@salesforce/apex/LexCancelRemoveBoxController.searchConsumableorderdetails"
+import saveConfirm from '@salesforce/apex/LexCancelRemoveBoxController.cancelRemoveBoxConfirm';
+
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+const columns = [
+ {
+ label: '娑堣�楀搧鍚嶇О',
+ fieldName: 'Name__c',
+ hideDefaultActions: true,
+ wrapText:true
+ // initialWidth: 350,
+
+ },
+ {
+ label: '瑙勬牸',
+ fieldName: 'ProductPacking_list_manual__c',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+ initialWidth: 50,
+
+ },
+ {
+ label: 'CFDA鐘舵��',
+ fieldName: 'CFDA_Status__c',
+ hideDefaultActions: true,
+ initialWidth: 200,
+
+ },
+ {
+ label: '娉ㄥ唽璇佺紪鐮佸彿',
+ fieldName: 'Report_Product_Approbation__c',
+ hideDefaultActions: true,
+ initialWidth: 200,
+ },
+ {
+ label: '娉ㄥ唽璇佹晥鏈�',
+ fieldName: 'Report_Product_Expiration__c',
+ hideDefaultActions: true,
+ // initialWidth: 250,
+ },
+ {
+ label: 'BarCode',
+ fieldName: 'Bar_Code__c',
+ hideDefaultActions: true,
+ initialWidth: 400,
+ }
+ ];
+
+ const column = [
+ {
+ label: '娑堣�楀搧鍚嶇О',
+ fieldName: 'Name__c',
+ hideDefaultActions: true,
+
+ },
+ {
+ label: 'BarCode',
+ fieldName: 'Bar_Code__c',
+ hideDefaultActions: true,
+
+ }
+ ,
+ {
+ label: '閿欒鍘熷洜',
+ fieldName: 'ErrorReason',
+ hideDefaultActions: true,
+ }
+ ];
+
+
+export default class LexCancelRemoveBox extends LightningElement {
+ columns = columns;
+ column = column;
+ @track selectedRows = [];
+ @track data = [];
+ @track errorDetail = [];
+
+ // 鏄剧ず
+ @track showTable = false
+ @track showSpinner = false;
+
+ //鏁版嵁鏋勬垚
+ @track accountName
+ @track userWorkLocation
+ @track agencyProType
+ @track barcode = ''
+ @track saveFLGbln = false
+ @track dataSize = 0;
+
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+
+
+
+ connectedCallback() {
+ console.log('鍒濆鍖�');
+ // this.showTable = false;
+ oninit().then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result =' + JSON.stringify(result));
+ if (result.status = 'Success') {
+ console.log('result');
+ this.agencyProType = result.entity.agencyProType;
+ this.userWorkLocation = result.entity.userWorkLocation;
+ this.accountName = result.entity.accountName;
+ // this.data = JSON.parse(result.entity.codPageRecords);
+ // this.showTable = true;
+ } else {
+ this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error');
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+ }
+
+ //褰曞叆
+ getDetails() {
+ this.showSpinner = true;
+ searchDeatail({
+ accountName: this.accountName,
+ userWorkLocation: this.userWorkLocation,
+ agencyProType: this.agencyProType,
+ barcode: this.barcode
+ }).then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result =' + JSON.stringify(result));
+ if (result.status == 'Success') {
+ console.log('鎴愬姛');
+ this.data = JSON.parse(result.entity.ConsumableorderdetailsRecordsdummy);
+ this.errorDetail = JSON.parse(result.entity.ConsumableorderdetailsRecordserror);
+ this.dataSize = result.entity.dataSize;
+ for (let i in this.data) {
+ this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
+ this.data[i]['ProductPacking_list_manual__c'] = this.data[i].esd.ProductPacking_list_manual__c;
+ this.data[i]['CFDA_Status__c'] = this.data[i].esd.CFDA_Status__c;
+ this.data[i]['Report_Product_Approbation__c'] = this.data[i].esd.Report_Product_Approbation__c;
+ this.data[i]['Report_Product_Expiration__c'] = this.data[i].esd.Report_Product_Expiration__c;
+ this.data[i]['Bar_Code__c'] = this.data[i].esd.Bar_Code__c;
+ }
+ // this.showTable = true;
+ for (let i in this.errorDetail) {
+ this.errorDetail[i]['Name__c'] = this.errorDetail[i].Prod.Name__c;
+ this.errorDetail[i]['Bar_Code__c'] = this.errorDetail[i].esd.Bar_Code__c;
+ this.errorDetail[i]['ErrorReason'] = this.errorDetail[i].ErrorReason;
+ }
+ // this.showTables = true;
+ this.showSpinner = false;
+ } else{
+ this.showMyToast('鑾峰彇澶辫触',result.msg,'error');
+ this.showSpinner = false;
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+
+ }
+ //鑾峰彇褰撳墠杈撳叆鍊�
+ handleChange(event) {
+ let value = event.detail.value;
+ console.log('value' + value);
+ this.barcode = value;
+ console.log('this.barcode' + this.barcode);
+ }
+
+
+ saveConfirm() {
+ let msg = "纭鍙栨秷鎷嗙洅鍚�";
+ if (this.dataSize>0) {
+ if (confirm(msg) == true) {
+ this.CancelRemoveBox();
+ }
+ } else {
+ this.CancelRemoveBox();
+ }
+ }
+ CancelRemoveBox(){
+ this.showSpinner = true;
+ saveConfirm({
+ saveConsumableorderdetailsRecordsdummy: JSON.stringify(this.data),
+ accountName: this.accountName,
+ userWorkLocation: this.userWorkLocation,
+ agencyProType: this.agencyProType
+ }).then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result淇濆瓨 = ' + JSON.stringify(result));
+ if (result.status == 'Success') {
+ this.saveFLGbln = result.entity.saveFLGbln;
+ // this.showSpinner = false;
+ if(this.saveFLGbln){
+ this.showMyToast(result.msg,'','success');
+ this.showSpinner = false;
+
+
+ }
+ } else {
+ this.showMyToast('鍙栨秷鎷嗙洅澶辫触',result.msg,'error');
+ this.showSpinner = false;
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+
+ }
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
+ }
+
+
+
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js-meta.xml b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js-meta.xml
new file mode 100644
index 0000000..b932443
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.css b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.css
new file mode 100644
index 0000000..6742585
--- /dev/null
+++ b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.css
@@ -0,0 +1,45 @@
+@import 'c/lexCssUtility';
+
+.outerBorderCss {
+ border: 1px solid #D4D4D4;
+ border-radius: 5px;
+ border-top: 3px solid #565959;
+}
+
+.borderCss {
+ border: 1px solid #D4D4D4;
+ border-radius: 5px;
+ margin-bottom: 7px;
+ border-top: 3px solid #565959;
+}
+
+.headerDorderCss {
+ border-top: 1px solid #565959;
+ border-bottom: 1px solid #D4D4D4;
+ padding: 3px;
+}
+
+.centerCss {
+ text-align: center;
+}
+
+.centerCss .left {
+ margin-left: 100px;
+}
+
+.datatable {
+ max-height: 400px !important;
+}
+
+.tableColumn {
+ margin-top: 5px !important;
+ overflow-x: auto;
+}
+
+:host {
+ --lwc-inputStaticFontSize: 16px;
+ --lwc-formLabelFontSize: 16px;
+}
+.fontWeight{
+ font-size:16px;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html
new file mode 100644
index 0000000..dd1a7c4
--- /dev/null
+++ b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html
@@ -0,0 +1,855 @@
+<!-- sldsValidatorIgnore -->
+<!-- sldsValidatorIgnore -->
+<template>
+ <c-common-toast></c-common-toast>
+ <template if:true={isShowSpinner}>
+ <lightning-spinner alternative-text="Loading" size="large"></lightning-spinner>
+ </template>
+
+
+ <template if:false={isDetailsShow}>
+ <template if:false={isConInvoiceList}>
+ <!-- 鎼滅储瀹㈡埛鍚� -->
+ <template if:true={isModalOpen}>
+ <!-- Modal/Popup Box LWC starts here -->
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true"
+ aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
+ <div class="slds-modal__container">
+ <!-- Modal/Popup Box LWC header here -->
+ <header class="slds-modal__header">
+ <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
+ title="Close" onclick={closeModal}>
+ <lightning-icon icon-name="utility:close" alternative-text="close" variant="inverse"
+ size="small"></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">
+ 缁忛攢鍟嗗尰闄㈡绱�
+ </h2>
+ </header>
+ <!-- Modal/Popup Box LWC body starts here -->
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
+ <lightning-layout>
+ <lightning-layout-item flexibility="auto" padding="around-small">
+ <lightning-input type="text" label="鍖婚櫌鍚嶇О" onchange={dataChange}
+ data-field="searchHospitalName" value={searchHospitalName}
+ variant="label-inline" class="inputFont"></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item flexibility="auto" padding="around-small"
+ style="padding-top: 16px;">
+ <!-- <lightning-button label="妫�绱�" onclick={searchHospital}></lightning-button> -->
+ <button class="slds-button slds-button_neutral" onclick={searchHospital}
+ title="searchHospital" style="font-size: 16px;">
+ 妫�绱�
+ </button>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <div class="tableColumn">
+ <lightning-layout class="datatable" style="height: 250px;">
+ <lightning-datatable class="datatabel slds-border_top wrapped-header-datatable"
+ key-field="id" data={hospitalList} columns={hospitalColumns}
+ hide-checkbox-column="true" onrowaction={searchHandleRowAction}>
+ </lightning-datatable>
+ </lightning-layout>
+ </div>
+ </div>
+ <!-- Modal/Popup Box LWC footer starts here -->
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral" onclick={closeModal} title="Cancel"
+ style="font-size: 16px;">
+ 鍏抽棴
+ </button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+ <div class="outerBorderCss">
+ <div style="padding:5px;">
+
+ <div class="borderCss">
+ <div style="padding:10px;">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <template if:false={EditAble}>
+ <lightning-layout>
+ <lightning-layout-item size="12">
+ <div class="slds-m-top_small slds-m-bottom_medium">
+ <!-- <lightning-layout-item size="3">
+ <lightning-input label="" name="涓婁紶闄勪欢" onchange={handleFilesChange}
+ type="file" accept={acceptedType}
+ disabled={isDisabledReopen}></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="3">
+ <span class="slds-form-element__label" data-form-label></span>
+ </br>
+ <lightning-button label="淇濆瓨闄勪欢" style="margin-top: 20px"
+ onclick={saveAttachmentJs}
+ disabled={isDisabledReopen}></lightning-button>
+ </lightning-layout-item> -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="12">
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={SetEditAbleJs} disabled={isDisabledEdit}
+ style="width: 150px;">缂栬緫</button>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
+ onclick={approvalJs} disabled={isDisabledEdit}
+ style="width: 150px;">鎻愪氦</button>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
+ onclick={openReportJs} disabled={isOpenReportDisabled}
+ style="width: 150px;">鏄剧ず鏄庣粏</button>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
+ onclick={reopenJs} disabled={isDisabledReopen}
+ style="width: 150px;">浣滃簾閲嶅紑</button>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
+ onclick={deleteButtonJs} disabled={isDisabledDelete}
+ style="width: 150px;">鍒犻櫎</button>
+
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
+ disabled={isDisabledReopen} onclick={uploadOrder}
+ style="width: 150px;">涓婁紶闄勪欢</button>
+
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
+ onclick={saveAttachmentJs} disabled={isDisabledReopen}
+ style="width: 150px;">淇濆瓨闄勪欢</button>
+ </lightning-layout-item>
+ <!-- <lightning-layout-item size="2">
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ disabled={isDisabledReopen}
+ onclick={uploadOrder} style="width: 150px;">涓婁紶闄勪欢</button>
+ </lightning-layout-item>
+ <lightning-layout-item size="2">
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={saveAttachmentJs}
+ disabled={isDisabledReopen} style="margin-left: -50px;width: 150px;">淇濆瓨闄勪欢</button>
+ </lightning-layout-item> -->
+ </lightning-layout>
+
+ </div>
+ </lightning-layout-item>
+ </lightning-layout>
+ </template>
+
+ <!-- 涓婁紶闄勪欢寮圭獥 -->
+ <template if:true={showAttPop}>
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-02"
+ aria-modal="true" aria-describedby="modal-content-id-2"
+ class="slds-modal slds-fade-in-open slds-modal_small"
+ style="border: 1px solid #D4D4D4;">
+ <template if:true={showPopSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <div class="slds-modal__container">
+ <header class="slds-modal__header" style="background-color: #F3F3F3;">
+ <button style=""
+ class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
+ title="Close" onclick={closePop}>
+ <lightning-icon icon-name="utility:close" alternative-text="close"
+ variant="inverse" size="small"></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-02"
+ class="slds-text-heading_medium slds-hyphenate">涓婁紶闄勪欢</h2>
+ </header>
+ <div class="slds-modal__content slds-p-around_medium searchName"
+ id="modal-content-id-2" style="border: 1px solid #F3F3F3;">
+ <div class="slds-m-top_medium slds-m-bottom_x-large">
+ <div class="slds-p-around_medium lgc-bg">
+ <lightning-input type="file" label="闄勪欢涓婁紶"
+ accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
+ onchange={attChange}></lightning-input>
+ </div>
+ <p class="fontWeight">宸查�夋嫨鏂囦欢锛歿fileName}
+
+ <template if:true={attDelBtn}>
+ <a onclick={removeAtt}>绉婚櫎</a>
+ </template>
+ </p>
+ </div>
+ </div>
+ <footer class="slds-modal__footer">
+ <lightning-button style="margin-left: 10px;" variant="neutral"
+ label="鍙栨秷" onclick={closePop}></lightning-button>
+ <lightning-button style="margin-left: 10px;" variant="neutral"
+ label="涓婁紶" onclick={handleFilesChange}></lightning-button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+
+ <template if:true={EditAble}>
+ <lightning-layout>
+ <lightning-layout-item size="1" padding="around-small"></lightning-layout-item>
+ <lightning-layout-item size="2" padding="around-small"></lightning-layout-item>
+ <lightning-layout-item padding="around-small">
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={SaveJs}>纭畾</button>
+ </lightning-layout-item>
+ </lightning-layout>
+ </template>
+
+ <!-- <lightning-layout>
+ <lightning-layout-item size="3"></lightning-layout-item>
+ <template if:true={EditAble}>
+ <lightning-layout-item size="1" padding="around-small">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" onclick={SaveJs}>纭畾</button>
+ </lightning-layout-item>
+ </template>
+
+ <template if:false={EditAble}>
+ <lightning-layout-item size="1" padding="around-small">
+ <lightning-button label=" 缂栬緫 " onclick={SetEditAbleJs}
+ disabled={isDisabledEdit}></lightning-button>
+ </lightning-layout-item>
+ <lightning-layout-item size="1" padding="around-small">
+ <lightning-button label=" 鎻愪氦 " onclick={approvalJs}
+ disabled={isDisabledEdit}></lightning-button>
+ </lightning-layout-item>
+ <lightning-layout-item size="1" padding="around-small">
+ <lightning-button label="鏄剧ず鏄庣粏" onclick={openReportJs}
+ disabled={isOpenReportDisabled}></lightning-button>
+ </lightning-layout-item>
+ <lightning-layout-item size="1" padding="around-small">
+ <lightning-button label="浣滃簾閲嶅紑" onclick={reopenJs}
+ disabled={isDisabledReopen}></lightning-button>
+ </lightning-layout-item>
+ <lightning-layout-item size="1" padding="around-small">
+ <lightning-button label=" 鍒犻櫎 " onclick={deleteButtonJs}
+ disabled={isDisabledDelete}></lightning-button>
+ </lightning-layout-item>
+ </template>
+
+ </lightning-layout> -->
+
+ </div>
+ </div>
+ </div>
+
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍙戠エ淇℃伅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:7px;">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <!--鍙戠エ淇℃伅 鏄剧ず鐢� -->
+ <template if:false={isEditInvoice}>
+ <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
+ onload={handleLoad2}>
+ <!-- 鍙戠エ鍙� 鐘舵�� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field field-name="Name"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Invoice_status__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 鍙戠エ鏃ユ湡 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Invoice_Date__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 浜岀骇缁忛攢鍟� -->
+ <template if:true={isShowSecondaryDistributor}>
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Order_Dealer_Info__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </template>
+
+ <!-- 瀹㈡埛鍚� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field field-name="ShipmentAccount__c"
+ class="hideHelpText"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 绉戝 鍙戠エ绁ㄩ潰閲戦 -->
+ <lightning-layout multiple-rows="true" style="height:35.5px">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Order_ForCustomerText__c"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item size="4" class="readOnly">
+ <lightning-input label="鍙戠エ绁ㄩ潰閲戦(鍏�)" value={sumPrice} read-only
+ variant="label-inline"></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 澶囨敞 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Invoice_Note__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 鍙戠エ闄勪欢 鏄庣粏闄勪欢 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Invoice_attachment__c"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Invoicedet_attachment__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 闄勪欢棰勮 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="11">
+ <lightning-card class="attListTitle" variant="Narrow" title="闄勪欢鍒楄〃"
+ icon-name="utility:attach">
+
+ <lightning-layout slot="footer" multiple-rows="true">
+ <template for:each={fileData} for:item="item" for:index="index">
+ <lightning-layout-item padding="around-none" size="2"
+ key={item.recordId}
+ style="text-align: left;padding:5px">
+ <lightning-icon title={item.Title}
+ style="margin-left: 20px;" icon-name="doctype:gform"
+ alternative-text={item.Title}
+ size="large"></lightning-icon><br />
+ <span title={item.Title}>
+ {item.fileName}
+ </span>
+ <p>
+ <!-- <a data-fileid ={item.documentId} onclick={previweAtt}> -->
+ <a href={item.attUrl} target="_blank">
+ 棰勮
+ </a> 路
+ <a href={item.downloadUrl}>
+ 涓嬭浇
+ </a> 路
+ <a data-fileid={item.recordId} onclick={deleteAtt}>
+ 鍒犻櫎
+ </a>
+ </p>
+ <!-- <p>{item.updateDate} 路 {item.ownerName}</p> -->
+ </lightning-layout-item>
+ </template>
+ </lightning-layout>
+ </lightning-card>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-record-edit-form>
+ </template>
+ <!--鍙戠エ淇℃伅 缂栬緫鐢� -->
+ <template if:true={isEditInvoice}>
+ <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
+ onload={handleLoad2}>
+ <!-- 鍙戠エ鍙� 鐘舵�� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-input label="鍙戠エ鍙�" value={OrderCode} data-field="OrderCode"
+ onchange={dataChange} variant="label-inline" required
+ class="inputFont"></lightning-input>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Invoice_status__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 鍙戠エ鏃ユ湡 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-input type="date" label="鍙戠エ鏃ユ湡" variant="label-inline"
+ value={InvoiceDate} onchange={invoiceDateChange} required
+ class="inputFont"></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 瀹㈡埛鍚� 浜岀骇缁忛攢鍟� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <div
+ class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
+ <lightning-icon size="x-small"
+ class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default hideHelpText"
+ icon-name="utility:search"></lightning-icon>
+ <lightning-input type="text" name="HospitalName" label="瀹㈡埛鍚�"
+ value={HospitalName} variant="label-inline"
+ onclick={searchHospitalNameModal} data-field="HospitalName"
+ onchange={clearAgencyI} class="inputFont"></lightning-input>
+ </div>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-combobox data-field="secondaryDistributor"
+ name="secondaryDistributor" label="浜岀骇缁忛攢鍟�"
+ value={secondaryDistributor} placeholder="璇烽�夋嫨..."
+ options={provinceOptsMap} variant="label-inline"
+ onchange={dataChange} class="inputFont"></lightning-combobox>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 绉戝 缁忛攢鍟�(褰曞叆) -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-input-field onchange={dataChange}
+ data-field="ForCustomerText" value={ForCustomerText}
+ field-name="Order_ForCustomerText__c"
+ class="inputFont"></lightning-input-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Order_ForDealerText__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 澶囨敞 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-input-field onchange={dataChange} data-field="InvoiceNote"
+ value={InvoiceNote} field-name="Invoice_Note__c"
+ class="inputFont"></lightning-input-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ </lightning-record-edit-form>
+ </template>
+ </div>
+ </div>
+ </div>
+ <!-- 鍑哄簱鍗曚竴瑙� -->
+ <div class="borderCss">
+ <div class="headerDorderCss">
+
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗曚竴瑙�</strong>
+ </p>
+ </lightning-layout-item>
+ <lightning-layout-item size="2" padding="around-small">
+ </lightning-layout-item>
+ <template if:false={hideCheckbox}>
+ <lightning-layout-item padding="around-small">
+ <!-- <lightning-button label=" 妫�绱� "
+ onclick={InvoiceorderSearchJs}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
+ onclick={InvoiceorderSearchJs}>妫�绱�</button>
+ </lightning-layout-item>
+ </template>
+
+ </lightning-layout>
+ </div>
+
+ <!-- <template if:false={hideCheckbox}>
+ <div style="padding: 10px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-layout>
+ <lightning-layout-item size="5" padding="around-small">
+ </lightning-layout-item>
+ <lightning-layout-item padding="around-small">
+ <lightning-button label="妫�绱�"
+ onclick={InvoiceorderSearchJs}></lightning-button>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ </template> -->
+
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-datatable key-field="Id" data={outboundData} columns={outboundColumns}
+ hide-checkbox-column={hideCheckbox} onrowselection={getSelectedRows}
+ selected-rows={selectedRows} class="wrapped-header-datatable" data-field="outbound">
+ </lightning-datatable>
+ <lightning-datatable key-field="id" data={outboundDataSumPrice}
+ columns={outboundColumns} hide-checkbox-column hide-table-header
+ class="wrapped-header-datatable">
+ </lightning-datatable>
+ </div>
+ </div>
+ </div>
+ <!-- 鍙戠エ鏄庣粏 -->
+ <template if:true={done}>
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍙戠エ鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-datatable key-field="id" data={invoiceOrderdetail1Recoeds}
+ columns={invoiceDetailsColumns} hide-checkbox-column
+ class="wrapped-header-datatable">
+ </lightning-datatable>
+ </div>
+ </div>
+ </div>
+ </template>
+ <!-- 涓婁紶闄勪欢 -->
+ <!-- <template if:false={EditAble}>
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item size="1" padding="around-small">
+ <p style="font-size: 16px">
+ <strong>闄勪欢</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-card title="">
+ <lightning-layout multiple-rows="true" style="margin-top: -20px">
+ <lightning-layout-item size="3">
+ <lightning-input label="" name="涓婁紶闄勪欢" onchange={handleFilesChange}
+ type="file" accept={acceptedType}
+ disabled={isDisabledReopen}></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="3">
+ <span class="slds-form-element__label" data-form-label></span>
+ </br>
+ <lightning-button label="淇濆瓨闄勪欢" style="margin-top: 20px"
+ onclick={saveAttachmentJs}
+ disabled={isDisabledReopen}></lightning-button>
+ </lightning-layout-item>
+ </lightning-layout>
+ <template if:true={showLoadingSpinner}>
+ <lightning-spinner alternative-text="Uploading now"></lightning-spinner>
+ </template>
+ <footer style="margin-top: 20px">
+ <c-lex-custom-lightning-datatable key-field="Id" data={fileData}
+ columns={fileColumns} ontypechange={handleTypeChange}
+ hide-checkbox-column onclickicon={deleteAtt}
+ class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ </footer>
+ </lightning-card>
+ </div>
+ </div>
+ </div>
+ </template> -->
+ </div>
+ </div>
+ </template>
+
+ <template if:true={isConInvoiceList}>
+ <div class="outerBorderCss">
+ <div style="padding:5px;">
+ <!-- 鏂板缓鍙戠エ -->
+ <div class="borderCss">
+ <div style="padding:15px;">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <!-- <lightning-button label="鏂板缓鍙戠エ" onclick={newInvoiceJs}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={newInvoiceJs}>鏂板缓鍙戠エ</button>
+ </div>
+ </div>
+ </div>
+
+ <!-- 妫�绱㈡潯浠� -->
+ <div class="borderCss" style="margin-top: 5px;">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>妫�绱㈡潯浠�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 15px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+
+ <lightning-layout multiple-rows>
+ <lightning-layout-item flexibility="auto">
+ <div class="slds-text-align_center">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label ">鍑哄簱鏃� 浠�</div>
+ <lightning-input type="date" variant="label-hidden" label="鍑哄簱鏃� 浠�"
+ onchange={dataChange} data-field="deliveryFromDate"
+ value={deliveryFromDate} class="inputFont"></lightning-input>
+ </div>
+
+ </br>
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label ">    鍒�
+ </div>
+ <lightning-input type="date" variant="label-hidden" label="鍒�"
+ onchange={dataChange} data-field="deliveryToDate"
+ value={deliveryToDate} class="inputFont"></lightning-input>
+ </div>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item flexibility="auto">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label ">鍙戠エ鍙�</div>
+ <lightning-input variant="label-hidden" label="鍙戠エ鍙�" onchange={dataChange}
+ data-field="category1" value={category1}
+ class="inputFont"></lightning-input>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item flexibility="auto">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label ">瀹㈡埛鍚�</div>
+ <lightning-input variant="label-hidden" label="瀹㈡埛鍚�" onchange={dataChange}
+ data-field="category2" value={category2}
+ class="inputFont"></lightning-input>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item flexibility="auto">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label ">鐘舵��</div>
+ <lightning-combobox data-field="invoiceStatus" name="invoiceStatus"
+ label="鐘舵��" value={invoiceStatusValue} placeholder="璇烽�夋嫨..."
+ options={Options} variant="label-hidden" onchange={dataChange}
+ style="min-width: 100px;" class="inputFont"></lightning-combobox>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item flexibility="auto">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <!-- <lightning-button label="妫�绱�"
+ onclick={invoiceCodeSearchJs}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
+ onclick={invoiceCodeSearchJs}>妫�绱�</button>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item flexibility="auto">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <!-- <lightning-button label="娓呯┖" onclick={ClearJs}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
+ onclick={ClearJs}>娓呯┖</button>
+ </div>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ </div>
+ </div>
+ </div>
+
+ <!-- 鍙戠エ涓�瑙� -->
+ <div class="borderCss" style="margin-top: 5px;">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍙戠エ涓�瑙�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-datatable key-field="id" data={invoiceData} columns={invoiceColumns}
+ hide-checkbox-column="true" class="wrapped-header-datatable">
+ </lightning-datatable>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </template>
+ </template>
+
+ <template if:true={isDetailsShow}>
+ <div class="outerBorderCss">
+ <div style="padding:5px;">
+ <!-- 纭畾 -->
+ <div class="borderCss">
+ <div style="padding:10px;">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <!-- <lightning-button label="纭畾" onclick={detailsSaveJs}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={detailsSaveJs}>纭畾</button>
+ </div>
+ </div>
+ </div>
+
+ <!-- 鍙戠エ淇℃伅 -->
+ <div class="borderCss" style="margin-top: 5px;">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍙戠エ淇℃伅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-record-edit-form object-api-name="Consumable_order__c"
+ record-id={detailsInvoiceId} onload={handleLoad2}>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2"></lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="Name"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2"></lightning-layout-item>
+ <lightning-layout-item size="4" class="hehe-layoutItem">
+ <lightning-output-field field-name="ShipmentAccount__c"
+ class="hideHelpText"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2"></lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-output-field
+ field-name="Order_ForCustomerText__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-record-edit-form>
+ </div>
+ </div>
+ </div>
+
+ <!-- 鍑哄簱鍗� -->
+ <div class="borderCss" style="margin-top: 5px;">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={detailsCocId}>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2"></lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="Name"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2"></lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="Outbound_Date__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-record-edit-form>
+ </div>
+ </div>
+ </div>
+
+ <!-- 鍑哄簱鍗曟槑缁� -->
+ <div class="borderCss" style="margin-top: 5px;">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗曟槑缁�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <!-- <lightning-datatable class="datatabel slds-border_top" key-field="id"
+ data={detaisData} columns={detailsColumns}>
+ </lightning-datatable> -->
+ <c-lex-custom-lightning-datatable key-field="Id" data={detailsData} columns={detailsColumns}
+ onunitchange={handleUnitChange} onshipmentnumber={handleShipmentNumber}
+ onrowselection={detailsGetSelectedRows} selected-rows={detailsSelectedRows}
+ style="word-wrap:break-word; word-break:break-all; " class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ <lightning-datatable class="datatabel slds-border_top wrapped-header-datatable"
+ key-field="id" data={invoiceAllpriceData} columns={detailsColumns} hide-checkbox-column
+ hide-table-header>
+ </lightning-datatable>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </template>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
new file mode 100644
index 0000000..0c4122c
--- /dev/null
+++ b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
@@ -0,0 +1,1764 @@
+import { LightningElement, api, track, wire } from 'lwc';
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import init from "@salesforce/apex/LexConInvoiceViewController.init";
+import save from "@salesforce/apex/LexConInvoiceViewController.save";
+import saveFile from "@salesforce/apex/LexConInvoiceViewController.saveFile";
+import saveAttachment from "@salesforce/apex/LexConInvoiceViewController.saveAttachment";
+import InvoiceorderSearch from "@salesforce/apex/LexConInvoiceViewController.InvoiceorderSearch";
+import deleteButton from "@salesforce/apex/LexConInvoiceViewController.deleteButton";
+import approval from "@salesforce/apex/LexConInvoiceViewController.approval";
+import conInvoiceListInit from "@salesforce/apex/LexConInvoiceList.init";
+import invoiceCodeSearch from "@salesforce/apex/LexConInvoiceList.invoiceCodeSearch";
+import hospitalInit from "@salesforce/apex/lexSearchAgencyHospitalController.init";
+import serContact from "@salesforce/apex/lexSearchAgencyHospitalController.serContact";
+import detailsInit from "@salesforce/apex/LexConInvoicedetailsController.init";
+import detailsSave from "@salesforce/apex/LexConInvoicedetailsController.save";
+import deleteAtt from '@salesforce/apex/LexConsumableController.deleteAtt';
+import { NavigationMixin } from "lightning/navigation";
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+import LexConInvoiceViewReport from '@salesforce/label/c.LexConInvoiceViewReport';
+
+const hospitalColumns = [
+ {
+ label: "鍖婚櫌鍚嶇О",
+ fieldName: "Name",
+ initialWidth: 400,
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "鐪佷唤",
+ fieldName: "stateMasterName",
+ hideDefaultActions: true,
+ },
+ {
+ label: "閫夋嫨",
+ fieldName: "Id1",
+ type: "button",
+ hideDefaultActions: true,
+ typeAttributes: {
+ label: "閫夋嫨",
+ name: "Id2",
+ size: 1,
+ },
+ },
+];
+const invoiceDetailsColumns = [
+ {
+ label: "鍑哄簱鏃ユ湡",
+ fieldName: "esdetProductOutDate",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "鍑哄簱鍗曠紪鐮�",
+ fieldName: "esdetInvoicedet1ODlinkName",
+ wrapText: true,
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "浜у搧鍨嬪彿",
+ fieldName: "esdetAssetModelNo",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 400,
+ },
+ {
+ label: "鍗曚綅",
+ fieldName: "esdetInvoiceUnit",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 50,
+ },
+ {
+ label: "鍙戠エ鍗曚环",
+ fieldName: "esdetInvoiceUnitprice",
+ hideDefaultActions: true,
+ wrapText: true,
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ },
+ {
+ label: "鍙戠エ鏁伴噺",
+ fieldName: "esdetInvoicedCount",
+ cellAttributes: { alignment: 'right' },
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "鍙戠エ绁ㄩ潰閲戦(鍏�)",
+ fieldName: "esdetInvoicedProCostRMB",
+ hideDefaultActions: true,
+ wrapText: true,
+ cellAttributes: { alignment: 'right' },
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ },
+];
+const invoiceColumns = [
+ {
+ label: "鍙戠エ鏃ユ湡",
+ fieldName: "Invoice_Date__c",
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: "鍙戠エ鍙�",
+ type: 'url',
+ fieldName: "NameUrl",
+ typeAttributes: {
+ label: { fieldName: "Name" },
+ },
+ hideDefaultActions: true,
+ },
+ {
+ label: "瀹㈡埛鍚�",
+ fieldName: "ShipmentAccount__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "鍙戠エ鐘舵��",
+ fieldName: "Invoice_status__c",
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: "鍙戠エ璐﹂潰閲戦(鍏�)",
+ fieldName: "Invoice_total_amount__c",
+ hideDefaultActions: true,
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ initialWidth: 180
+ },
+ {
+ label: "鍙戠エ闄勪欢",
+ fieldName: "Invoice_attachment__c",
+ type: 'boolean',
+ hideDefaultActions: true,
+ initialWidth: 120
+ },
+ {
+ label: "鍙戠エ鏄庣粏闄勪欢",
+ fieldName: "Invoicedet_attachment__c",
+ type: 'boolean',
+ hideDefaultActions: true,
+ initialWidth: 120
+ },
+];
+const detailsColumns = [
+ {
+ label: "浜у搧鍨嬪彿",
+ fieldName: "esdAssetModelNo",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "瑙勬牸",
+ fieldName: "packingListManual",
+ hideDefaultActions: true,
+ initialWidth: 30
+ },
+ {
+ label: "鍑鸿揣鍗曚环(鍏�)",
+ fieldName: "esdDeliveryListRMB",
+ hideDefaultActions: true,
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ },
+ {
+ label: "鍑鸿揣鏁伴噺",
+ fieldName: "esdShipmentCount",
+ hideDefaultActions: true,
+ },
+ {
+ label: "杩斿搧鏁伴噺",
+ fieldName: "esdRrturnProCount",
+ hideDefaultActions: true,
+ },
+ {
+ label: "鍑哄簱鍗曚綅",
+ fieldName: "esdBoxPiece",
+ hideDefaultActions: true,
+ },
+ {
+ label: "宸插彂绁ㄦ暟閲�",
+ fieldName: "esdInvoicedProcount",
+ hideDefaultActions: true,
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ },
+ {
+ label: "杩樻病鍙戠エ鏁伴噺",
+ fieldName: "esdInvoiceProNotCount",
+ hideDefaultActions: true,
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ },
+ {
+ label: "寮�绁ㄥ崟浣�",
+ hideDefaultActions: true,
+ type: "customUnit",
+ typeAttributes: {
+ unitValue: { fieldName: "unitValue" },
+ unitOptions: { fieldName: "unitOptions" },
+ recordId: { fieldName: "recordId" },
+ isDisabled: { fieldName: "isDisabled" },
+ },
+ },
+ {
+ label: "鍙戠エ鍗曚环",
+ fieldName: "esdInvoiceUnitprice",
+ hideDefaultActions: true,
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ initialWidth: 130
+ },
+ {
+ label: "鍙戠エ鏁伴噺",
+ //fieldName: "invoiceCount",
+ hideDefaultActions: true,
+ type: "customShipment",
+ cellAttributes: { alignment: 'right' },
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ shipmentNumber: { fieldName: "shipmentNumber" },
+ },
+ },
+ {
+ label: "鍙戠エ绁ㄩ潰閲戦(鍏�)",
+ cellAttributes: { alignment: 'right' },
+ fieldName: "invoiceAllprice",
+ hideDefaultActions: true,
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ },
+]
+const customLabel = {
+ LexConInvoiceViewReport
+}
+export default class LexConInvoiceView extends NavigationMixin(LightningElement) {
+
+ @track label=customLabel;
+ invoiceColumns = invoiceColumns;
+ detailsColumns = detailsColumns;
+ @track outboundColumns = [
+ {
+ label: "鍑哄簱鏃ユ湡",
+ fieldName: "esdOutboundDate",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "鍑哄簱鍗曠紪鐮�",
+ fieldName: "esdNameUrl",
+ type: 'url',
+ typeAttributes: {
+ label: { fieldName: "esdName" },
+ target: "_blank",
+ },
+ hideDefaultActions: true,
+ wrapText: true,
+ }
+ ]
+ @track outboundData = [];
+ @track outboundDataSumPrice = [];
+ @track invoiceData = [];
+ @track invoiceAllpriceData = [];
+ @track detailsSelectedRows = [];
+ @track showAttPop = false;
+
+ @track invoiceId = '';
+ @track orderId = '';
+ @track userWorkLocation = '';
+ @track deliveryId = '';
+ @track cocId = '';
+ @track statusEdit = '';
+ @track coc = {};
+ @track EditAble = false;
+ @track isChange = false;
+ @track sumPrice = 0.00;
+ @track OrderCode = '';
+ @track ExistOutbound = false;
+ @track reopen = '';
+ @track invoiceOrderRecoedschange = [];
+ @track isNew = '';
+ @track outOrderStringListLwc = [];
+ @track outordercountMapLwc = {};
+ @track selectedRows = [];
+ @track detailsInvoiceId = '';
+ @track detailsCocId = '';
+ @track detailsData = [];
+ @track invoiceAllprice = 0.00;
+ //鐘舵��
+ @track invoiceStatusValue = '';
+ @track invoiceStatusOptions = [];
+ get Options() {
+ return this.invoiceStatusOptions;
+ }
+ //鍑哄簱浠�
+ @track deliveryFromDate = '';
+ //鍑哄簱鍒�
+ @track deliveryToDate = '';
+ //鍙戠エ鍙�
+ @track category1 = '';
+ //瀹㈡埛鍚�
+ @track category2 = '';
+ @track ConInvoiceListAccountId = '';
+ @track ConInvoiceListUserWorkLocation = '';
+ @track ConInvoiceListAgencyProType = '';
+
+ //浜岀骇缁忛攢鍟�
+ @track provinceOptsMap = [];
+ @track secondaryDistributor = '';
+ //瀹㈡埛鍚�
+ @track isModalOpen = false;
+ @track HospitalName = "";
+ @track HospitalInfo = "";
+ @track searchHospitalName = "";
+ @track isDisabledHospitalName = false;
+ @track agencyProType = '';
+ @track accountid = '';
+ @track hospitalList = [];
+ hospitalColumns = hospitalColumns;
+ //鍙戠エ鏃ユ湡
+ @track InvoiceDate = '';
+ //绉戝
+ @track ForCustomerText = '';
+ //澶囨敞
+ @track InvoiceNote = '';
+
+ //鍙戠エ鏄庣粏
+ @track invoiceOrderdetail1Recoeds = [];
+ invoiceDetailsColumns = invoiceDetailsColumns;
+
+ //鏄剧ず
+ @track isShowSecondaryDistributor = false;
+ @track isEditInvoice = false;
+ @track isShowSpinner = true;
+ @track hideCheckbox = true;
+ @track done = false;
+ @track isConInvoiceList = true;
+ @track isDetailsShow = false;
+
+ //disable
+ @track isDisabledEdit = false;
+ @track isDisabledReopen = false;
+ @track isDisabledDelete = false;
+ @track isDisabledAttachment = false;
+ @track isOpenReportDisabled = true;
+
+ //鏂囦欢涓婁紶
+ @track showLoadingSpinner = false;
+ @track UploadFile = "Upload File";
+ @track fileName = "";
+ @track fileData = [];
+ @track fileColumns = [
+ {
+ label: "鏍囬",
+ fieldName: "url",
+ type: "url",
+ typeAttributes: { label: { fieldName: "Title" }, target: "_blank" },
+ hideDefaultActions: true,
+ },
+ {
+ label: "鍒涘缓浜�",
+ type: "url",
+ fieldName: "CreatedByNameUrl",
+ typeAttributes: { label: { fieldName: "CreatedByName" }, target: "_blank" },
+ hideDefaultActions: true,
+ },
+ {
+ label: "涓婁紶鏃ユ湡",
+ type: 'date',
+ typeAttributes: {
+ year: "numeric",
+ month: "long",
+ day: "2-digit",
+ hour: "2-digit",
+ minute: "2-digit"
+ },
+ fieldName: "CreatedDate",
+ hideDefaultActions: true,
+ },
+ {
+ label: "闄勪欢绫诲瀷",
+ type: "customAttachmentType",
+ typeAttributes: {
+ typeValue: { fieldName: "typeValue" },
+ typeOptions: { fieldName: "typeOptions" },
+ recordId: { fieldName: "recordId" },
+ isDisabledAttachment: { fieldName: "isDisabledAttachment" },
+ },
+ hideDefaultActions: true,
+ },
+ {
+ label: '',
+ type: 'tableCellIcon',
+ typeAttributes: {
+ iconName: 'utility:delete',
+ recordId: {
+ fieldName: 'Id'
+ }
+ },
+ initialWidth: 50,
+ hideDefaultActions: true
+ },
+ ];
+ filesUploaded = [];
+ fileContents;
+ fileReader;
+ content;
+ MAX_FILE_SIZE = 1500000;
+
+ stylesLoaded = false;
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+ //鑾峰彇閾炬帴鍙傛暟
+ getQueryString(name) {
+ console.log("getQueryString name " + name);
+ let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+ let r = window.location.search.substr(1).match(reg);
+ if (r != null) {
+ return decodeURIComponent(r[2]);
+ }
+ return null;
+ }
+
+ connectedCallback() {
+ this.init();
+ }
+
+ init() {
+ this.isShowSpinner = true;
+ this.deliveryId = this.getQueryString("deliveryId");
+ this.deliveryId = this.deliveryId == null ? "" : this.deliveryId;
+ this.invoiceId = this.getQueryString("invoiceId");
+ this.invoiceId = this.invoiceId == null ? "" : this.invoiceId;
+ this.orderId = this.getQueryString("orderId");
+ this.orderId = this.orderId == null ? "" : this.orderId;
+ this.statusEdit = this.getQueryString("KeyWords");
+ this.statusEdit = this.statusEdit == null ? "" : this.statusEdit;
+ this.reopen = this.getQueryString("reopen");
+ this.reopen = this.reopen == null ? "" : this.reopen;
+ this.isNew = this.getQueryString("isNew");
+ this.isNew = this.isNew == null ? "" : this.isNew;
+ console.log('this.deliveryId = ' + this.deliveryId + ' this.invoiceId = ' + this.invoiceId + ' this.statusEdit = ' + this.statusEdit);
+ if (this.invoiceId != '' && this.orderId != '') {
+ //杩涘叆coninvoiceDetails
+ detailsInit({
+ orderIdLwc: this.orderId,
+ invoiceIdLwc: this.invoiceId
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ if (r.status == "Success") {
+ this.detailsInvoiceId = r.entity.invoicecode.Id;
+ this.detailsCocId = r.entity.coc.Id;
+ this.detailsData = r.entity.consumableorderdetails1Records;
+ for (var i in this.detailsData) {
+ this.detailsData[i]['Id'] = this.detailsData[i].esd.Id;
+
+ this.detailsData[i]['esdAssetModelNo'] = this.detailsData[i].esd.Asset_Model_No__c;
+ this.detailsData[i]['packingListManual'] = this.detailsData[i].Packing_list_manual;
+ this.detailsData[i]['esdDeliveryListRMB'] = this.detailsData[i].esd.Delivery_List_RMB__c;
+ this.detailsData[i]['esdShipmentCount'] = this.detailsData[i].esd.Shipment_Count__c;
+ this.detailsData[i]['esdRrturnProCount'] = this.detailsData[i].esd.RrturnPro_count__c;
+ this.detailsData[i]['esdBoxPiece'] = this.detailsData[i].esd.Box_Piece__c;
+
+ this.detailsData[i]['esdInvoicedProcount'] = this.detailsData[i].esd.Invoiced_Procount__c;
+ this.detailsData[i]['esdInvoiceProNotCount'] = this.detailsData[i].esd.InvoiceProNot_count__c;
+ //寮�绁ㄥ崟浣�
+ //this.detailsData[i].esd.Box_Piece__c
+ //this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Invoice_Unit__c;
+ this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Box_Piece__c;
+ console.log('unitValue = ' + this.detailsData[i]['unitValue']);
+ this.detailsData[i]['recordId'] = this.detailsData[i].esd.Id;
+ //disabled="{!IF(records.esd.Box_Piece__c =='涓�' || (records.esd.Box_Piece__c =='鐩�' && records.Packing_list_manual ==1),true,false)}"
+ //this.detailsData[i]['isDisabled'] = (this.detailsData[i].esd.Box_Piece__c == '涓�' || (this.detailsData[i].esd.Box_Piece__c =='鐩�' && this.detailsData[i].Packing_list_manual ==1)) ? true:false;
+ this.detailsData[i]['isDisabled'] = true;
+ let unitOptions = [];
+ for (var key in this.detailsData[i].Invoice_UnitOptsMap) {
+ let unitOption = {};
+ unitOption["label"] = this.detailsData[i].Invoice_UnitOptsMap[key];
+ unitOption["value"] = key;
+ unitOptions.push(unitOption);
+ }
+ this.detailsData[i]["unitOptions"] = unitOptions;
+ this.detailsData[i]['esdInvoiceUnitprice'] = this.detailsData[i].esd.Invoice_Unitprice__c;
+ //鍙戠エ鏁伴噺
+ this.detailsData[i]['shipmentNumber'] = this.detailsData[i].invoiceCount;
+ this.detailsData[i]['invoiceAllprice'] = this.detailsData[i].invoiceAllprice;
+
+ if (this.detailsData[i].check) {
+ this.detailsSelectedRows.push(this.detailsData[i]['Id']);
+ this.invoiceAllprice += this.detailsData[i]['invoiceAllprice'];
+ }
+ }
+
+ console.log('this.detailsData = ' + JSON.stringify(this.detailsData));
+
+ let lastInvoiceAllprice = {
+ invoiceAllprice: this.invoiceAllprice
+ }
+ this.invoiceAllpriceData.push(lastInvoiceAllprice);
+ console.log('this.invoiceAllpriceData = ' + JSON.stringify(this.invoiceAllpriceData))
+
+ this.isShowSpinner = false;
+ this.isDetailsShow = true;
+ } else {
+ this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ this.isShowSpinner = false;
+ console.log("error = " + JSON.stringify(error));
+ });
+ } else if (this.deliveryId == '' && this.invoiceId == '' && this.isNew == '') {
+ console.log('conInvoiceListInit');
+ conInvoiceListInit().then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("conInvoiceListInit r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.ConInvoiceListAccountId = r.entity.accountid;
+ this.ConInvoiceListUserWorkLocation = r.entity.userWorkLocation;
+
+ this.ConInvoiceListAgencyProType = r.entity.agencyProType;
+ if (this.ConInvoiceListAgencyProType != 'ET')
+ this.isOpenReportDisabled = false;
+ this.invoiceData = r.entity.raesList;
+ for (var i in this.invoiceData) {
+ this.invoiceData[i]['NameUrl'] = '/lexconinvoiceview?invoiceId=' + this.invoiceData[i].Id;
+ }
+ console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
+ for (var key in r.entity.statusMap) {
+ let object = {};
+ object["label"] = key;
+ object["value"] = r.entity.statusMap[key];
+ this.invoiceStatusOptions.push(object);
+ }
+ this.invoiceStatusOptions = [...this.invoiceStatusOptions];
+ console.log("this.invoiceStatusOptions = " + JSON.stringify(this.invoiceStatusOptions));
+ this.isShowSpinner = false;
+ } else {
+ this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ });
+
+ } else {
+ console.log('init');
+ this.isConInvoiceList = false;
+ init({
+ invoiceId: this.invoiceId,
+ statusEdit: this.statusEdit,
+ deliveryId: this.deliveryId
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.coc = r.entity.coc;
+ this.cocId = this.coc.Id;
+ this.EditAble = r.entity.EditAble;
+ this.isChange = r.entity.isChange;
+ this.ExistOutbound = r.entity.ExistOutbound;
+ this.outboundData = r.entity.invoiceOrderRecoeds;
+ console.log('this.outboundData = ' + JSON.stringify(this.outboundData))
+ this.done = r.entity.done;
+ this.accountid = r.entity.accountid;
+ this.userWorkLocation = r.entity.userWorkLocation;
+ this.outOrderStringListLwc = r.entity.outOrderStringList;
+ this.outordercountMapLwc = r.entity.outordercountMap;
+ this.invoiceOrderRecoedschange = r.entity.invoiceOrderRecoedschange;
+ this.isDisabledEdit = (this.coc.Invoice_status__c == '鎻愪氦' || this.coc.Invoice_status__c == '宸插畬鎴�') ? true : false;
+ this.isDisabledReopen = this.coc.Invoice_status__c == '鎻愪氦' ? false : true;
+ this.isDisabledDelete = this.coc.Invoice_status__c == '鑽夋涓�' ? false : true;
+ this.isDisabledAttachment = this.coc.Invoice_status__c == '宸插畬鎴�' ? true : false;
+ this.OrderCode = this.coc.Name;
+ this.InvoiceDate = this.coc.Invoice_Date__c;
+
+ for (var i in this.outboundData) {
+ this.outboundData[i].Id = this.outboundData[i].esd.Id;
+ if (this.outboundData[i].check)
+ this.selectedRows.push(this.outboundData[i].esd.Id);
+ }
+ this.selectedRows = [...this.selectedRows];
+ console.log('r.entity.attachmentRecoeds = ' + JSON.stringify(r.entity.attachmentRecoeds))
+ if (!this.EditAble) {
+ //闄勪欢鏄剧ず
+ this.showLoadingSpinner = true;
+ this.fileData = r.entity.attachmentRecoeds;
+ for (var i in this.fileData) {
+ this.fileData[i]["Id"] = this.fileData[i].cvInfo.Id;
+ this.fileData[i]["recordId"] = this.fileData[i].cvInfo.Id;
+ this.fileData[i]["url"] = "/" + this.fileData[i].cvInfo.Id;
+ this.fileData[i]["Title"] = this.fileData[i].cvInfo.Title;
+ this.fileData[i]["CreatedByName"] = this.fileData[i].cvInfo.Owner.Name;
+ this.fileData[i]["CreatedByNameUrl"] = "/" + this.fileData[i].cvInfo.OwnerId;;
+ this.fileData[i]["CreatedDate"] = this.fileData[i].cvInfo.CreatedDate;
+ this.fileData[i]["attUrl"] = '/' + this.fileData[i].cvInfo.Id;
+ this.fileData[i]['downloadUrl'] = '/sfc/servlet.shepherd/document/download/' + this.fileData[i].cvInfo.ContentDocumentId + '?operationContext=S1';
+ if (this.isDisabledAttachment) {
+ console.log('杩涘叆this.isDisabledAttachment')
+ this.fileData[i]["isDisabledAttachment"] = true;
+ }
+ let typeOptions = [];
+ for (var key in this.fileData[i].mailSelectOptsMap) {
+ let typeOption = {};
+ typeOption["label"] = this.fileData[i].mailSelectOptsMap[key];
+ typeOption["value"] = key;
+ typeOptions.push(typeOption);
+ }
+ this.fileData[i]["typeValue"] = this.fileData[i].mailSelectOptsin == null ? typeOptions[0].value : this.fileData[i].mailSelectOptsin;
+ this.fileData[i]["typeOptions"] = typeOptions;
+ this.fileData[i]["mailSelectOptsin"] = this.fileData[i].mailSelectOptsin == null ? typeOptions[0].value : this.fileData[i].mailSelectOptsin;
+ }
+ console.log('this.fileData = ' + JSON.stringify(this.fileData))
+ }
+
+ //鍙戠エ鏄庣粏
+ this.invoiceOrderdetail1Recoeds = r.entity.invoiceOrderdetail1Recoeds;
+ for (var i in this.invoiceOrderdetail1Recoeds) {
+ this.invoiceOrderdetail1Recoeds[i]['esdetProductOutDate'] = this.invoiceOrderdetail1Recoeds[i].esdet.Product_OutDate__c;
+ this.invoiceOrderdetail1Recoeds[i]['esdetInvoicedet1ODlinkName'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoicedet1_OD_link__r.Name;
+ this.invoiceOrderdetail1Recoeds[i]['esdetAssetModelNo'] = this.invoiceOrderdetail1Recoeds[i].esdet.Asset_Model_No__c;
+ this.invoiceOrderdetail1Recoeds[i]['esdetInvoiceUnit'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unit__c;
+ this.invoiceOrderdetail1Recoeds[i]['esdetInvoiceUnitprice'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unitprice__c;
+ this.invoiceOrderdetail1Recoeds[i]['esdetInvoicedCount'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoiced_Count__c;
+ this.invoiceOrderdetail1Recoeds[i]['esdetInvoicedProCostRMB'] = this.invoiceOrderdetail1Recoeds[i].esdet.InvoicedProCost_RMB__c;
+ }
+ //瀹㈡埛鍚�
+ this.HospitalName = r.entity.HospitalName;
+ this.HospitalInfo = r.entity.HospitalInfo;
+ this.agencyProType = r.entity.agencyProType;
+ if (this.agencyProType != 'ET')
+ this.isOpenReportDisabled = false;
+ //绉戝
+ this.ForCustomerText = this.coc.Order_ForCustomerText__c;
+ //澶囨敞
+ this.InvoiceNote = this.coc.Invoice_Note__c;
+ //浜岀骇缁忛攢鍟�
+ for (var key in r.entity.provinceOptsMap) {
+ let object = {};
+ object["label"] = r.entity.provinceOptsMap[key];
+ object["value"] = key;
+ this.provinceOptsMap.push(object);
+ }
+ //鍑鸿揣涓�瑙坈olumns
+
+
+ if (this.EditAble) {
+ let object1 = {
+ label: '瀹㈡埛鍚�',
+ fieldName: "hospitalName",
+ hideDefaultActions: true,
+ };
+ let object2 = {
+ label: '鍑鸿揣閲戦(鍏�)',
+ fieldName: "shipmentAmount",
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ hideDefaultActions: true,
+ };
+ let object3 = {
+ label: '杩斿搧閲戦(鍏�)',
+ fieldName: "returnAmount",
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ hideDefaultActions: true,
+ };
+ this.outboundColumns.push(object1)
+ this.outboundColumns.push(object2)
+ this.outboundColumns.push(object3)
+ }
+ let object4 = {
+ label: '鏈彂绁ㄩ噾棰�(鍏�)',
+ fieldName: "uninvoicedAmount",
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ hideDefaultActions: true,
+ };
+ this.outboundColumns.push(object4)
+
+ //鍑鸿揣涓�瑙圖ata
+ let index = 0;
+ for (var i in this.outboundData) {
+ this.outboundData[i]['esdOutboundDate'] = this.outboundData[i].esd.Outbound_Date__c;
+ this.outboundData[i]['esdNameUrl'] = '/s/lexsummonscreat?ESetid=' + this.outboundData[i].esd.Id;
+ this.outboundData[i]['esdName'] = this.outboundData[i].esd.Name;
+ if (this.EditAble) {
+ this.outboundData[i]['hospitalName'] = this.outboundData[i].esd.ShipmentAccount__c;
+ this.outboundData[i]['shipmentAmount'] = this.outboundData[i].esd.Shipment_total_amount__c;
+ this.outboundData[i]['returnAmount'] = this.outboundData[i].esd.RrturnPro_total_amount__c;
+ }
+ this.outboundData[i]['uninvoicedAmount'] = this.outboundData[i].esd.InvoiceNotPro_money__c;
+ this.outboundData[i]['invoiceFaceAmount'] = this.keepTwoDecimalStr(this.outboundData[i].needInvoiceCount);
+ if (!(this.outboundData[i].esd.Billed_Status__c == '鍏ㄩ儴寮�绁�' || this.EditAble || this.coc.Invoice_status__c != '鑽夋涓�')) {
+ console.log('杩涘叆 if')
+ let url = "/lexconinvoiceview?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
+ this.outboundData[i]['invoiceFaceAmountUrl'] = url;
+ if (index == 0) {
+ let object5 = {
+ label: '鍙戠エ绁ㄩ潰閲戦(鍏�)',
+ cellAttributes: { alignment: 'right' },
+ type: 'url',
+ fieldName: "invoiceFaceAmountUrl",
+ typeAttributes: {
+ label: { fieldName: "invoiceFaceAmount" },
+ //target: "_blank",
+ },
+ hideDefaultActions: true,
+ };
+ this.outboundColumns.push(object5)
+ index++;
+ }
+ } else {
+ console.log('杩涘叆 else')
+ if (index == 0) {
+ let object5 = {
+ label: '鍙戠エ绁ㄩ潰閲戦(鍏�)',
+ cellAttributes: { alignment: 'right' },
+ fieldName: "invoiceFaceAmount",
+ hideDefaultActions: true,
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ };
+ this.outboundColumns.push(object5)
+ index++;
+ }
+ }
+ //璁$畻鍙戠エ绁ㄩ潰閲戦
+ this.sumPrice += this.outboundData[i].needInvoiceCount;
+ }
+
+ //鍥涜垗浜斿叆
+ //this.sumPrice = this.sumPrice.toFixed(2);
+ //濡傛灉涓嶅洓鑸嶄簲鍏�
+ console.log('start keepTwoDecimalStr')
+ this.sumPrice = this.keepTwoDecimalStr(this.sumPrice);
+ console.log('end keepTwoDecimalStr = ' + this.sumPrice)
+ //鍔犳渶鍚庝竴琛屾樉绀洪噾棰�
+ if (this.EditAble) {
+ let lastOutboundData = {
+ invoiceFaceAmount: this.sumPrice
+ }
+ this.outboundDataSumPrice.push(lastOutboundData);
+ }
+ this.outboundColumns = [...this.outboundColumns];
+
+
+ this.isEditInvoice = !(!this.EditAble || this.isChange);
+ if (this.coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�')
+ this.isShowSecondaryDistributor = true;
+ if (this.deliveryId == '' && !this.ExistOutbound && this.EditAble)
+ this.hideCheckbox = false;
+ this.isShowSpinner = false;
+ this.showLoadingSpinner = false;
+ } else {
+ this.showMyToast('澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ });
+ }
+
+ }
+
+
+ //涓婁紶閰嶇疆鍗�
+ uploadOrder(event) {
+ this.showAttPop = true;
+ }
+
+ //鍏抽棴闄勪欢寮圭獥
+ closePop() {
+ this.showAttPop = false;
+ this.filesUploaded = [];
+ this.fileName = null;
+ }
+
+ //闄勪欢change浜嬩欢
+ attChange(event) {
+ if (event.target.files.length > 0) {
+ this.filesUploaded = event.target.files;
+ this.fileName = event.target.files[0].name;
+ console.log('this.fileName:' + this.fileName);
+ }
+ }
+
+ //绉婚櫎闄勪欢
+ removeAtt() {
+ this.filesUploaded = [];
+ this.fileName = '';
+ }
+
+ keepTwoDecimalStr(num) {
+ const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
+ let s = result.toString();
+ let rs = s.indexOf('.');
+ if (rs < 0) {
+ rs = s.length;
+ s += '.';
+ }
+ while (s.length <= rs + 2) {
+ s += '0';
+ }
+ return s;
+ };
+
+ dataChange(event) {
+ let fieldName = event.target.getAttribute("data-field");
+ let value = event.detail.value;
+ console.log("fieldName = " + fieldName + " value = " + value);
+ switch (fieldName) {
+ case "OrderCode":
+ this.OrderCode = value;
+ this.coc['Name'] = value;
+ break;
+ case "ForCustomerText":
+ this.ForCustomerText = value;
+ this.coc['Order_ForCustomerText__c'] = value;
+ break;
+ case "InvoiceDate":
+ this.InvoiceDate = value;
+ this.coc['Invoice_Date__c'] = value;
+ break;
+ case "secondaryDistributor":
+ this.secondaryDistributor = value;
+ break;
+ case "deliveryFromDate":
+ this.deliveryFromDate = value;
+ break;
+ case "deliveryToDate":
+ this.deliveryToDate = value;
+ break;
+ case "category1":
+ this.category1 = value;
+ break;
+ case "category2":
+ this.category2 = value;
+ break;
+ case "invoiceStatus":
+ this.invoiceStatusValue = value;
+ break;
+ case "searchHospitalName":
+ this.searchHospitalName = value;
+ break;
+ case "InvoiceNote":
+ this.InvoiceNote = value;
+ this.coc['Invoice_Note__c'] = value;
+ break;
+ }
+ }
+
+ invoiceDateChange(event) {
+ this.InvoiceDate = event.detail.value;
+ this.coc['Invoice_Date__c'] = event.detail.value;
+ console.log('this.InvoiceDate = ' + this.InvoiceDate);
+ }
+
+ //鎼滅储瀹㈡埛鍚�
+ searchHospitalNameModal() {
+ console.log("searchHospitalNameModal");
+ hospitalInit({
+ ctype: this.agencyProType,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ if (r.status == "Success") {
+ this.hospitalList = r.entity.at;
+ for (var i in this.hospitalList) {
+ this.hospitalList[i]["stateMasterName"] = this.hospitalList[i].State_Master__r.Name;
+ }
+ console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
+ this.isModalOpen = true;
+ }
+ });
+ }
+
+ searchHospital() {
+ console.log("this.searchHospitalName = " + this.searchHospitalName);
+ serContact({
+ searchName: this.searchHospitalName,
+ ctype: this.agencyProType,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ if (r.status == "Success") {
+ this.hospitalList = r.entity.at;
+ for (var i in this.hospitalList) {
+ this.hospitalList[i]["stateMasterName"] =
+ this.hospitalList[i].State_Master__r.Name;
+ }
+ console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
+ }
+ });
+ }
+
+ //閫夋嫨瀹㈡埛鍚�
+ searchHandleRowAction(event) {
+ console.log("searchHandleRowAction");
+ let row = event.detail.row;
+ this.HospitalInfo = row.Id;
+ this.HospitalName = row.Name;
+ console.log("this.HospitalInfo = " + this.HospitalInfo + " this.HospitalName = " + this.HospitalName);
+ this.isModalOpen = false;
+ }
+
+ //褰撳鎴峰悕鏄┖鏃躲�傚鎴穒d涔熷彉涓虹┖
+ clearAgencyI(event) {
+ this.HospitalName = event.target.value;
+ if (this.HospitalName == "" || this.HospitalName == null) {
+ this.HospitalInfo = "";
+ }
+ console.log("this.HospitalName = " + this.HospitalName);
+ console.log("this.HospitalInfo = " + this.HospitalInfo);
+ }
+
+ closeModal() {
+ this.isModalOpen = false;
+ }
+
+ SaveJs() {
+ this.isShowSpinner = true;
+ let cloneData = this.outboundData
+
+ debugger
+ const selectedRows = this.template.querySelector("[data-field='outbound']").getSelectedRows();
+ console.log('selectedRows = ' + JSON.stringify(selectedRows));
+
+ for (var i in cloneData) {
+ let b = false;
+ for (var j in selectedRows) {
+ if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
+ b = true;
+ cloneData[i].check = true;
+ }
+ }
+ if(!b){
+ cloneData[i].check = false;
+ }
+ delete cloneData[i].esdOutboundDate;
+ delete cloneData[i].esdNameUrl;
+ delete cloneData[i].esdName;
+ delete cloneData[i].hospitalName;
+ delete cloneData[i].shipmentAmount;
+ delete cloneData[i].returnAmount;
+ delete cloneData[i].uninvoicedAmount;
+ delete cloneData[i].invoiceFaceAmount;
+ delete cloneData[i].invoiceFaceAmountUrl;
+ }
+
+ console.log('this.coc = ' + JSON.stringify(this.coc));
+ console.log('this.HospitalName = ' + this.HospitalName);
+ console.log('this.HospitalInfo = ' + this.HospitalInfo);
+ console.log('this.secondaryDistributor = ' + this.secondaryDistributor);
+ console.log('this.outboundData = ' + JSON.stringify(cloneData));
+ console.log('this.deliveryId = ' + this.deliveryId);
+ console.log('this.invoiceId = ' + this.invoiceId);
+ console.log('this.accountid = ' + this.accountid);
+ console.log('this.agencyProType = ' + this.agencyProType);
+ console.log('this.reopen = ' + this.reopen);
+ console.log('this.invoiceOrderRecoedschangeLwc = ' + JSON.stringify(this.invoiceOrderRecoedschange));
+ save({
+ cocLwc: this.coc,
+ HospitalNameLwc: this.HospitalName,
+ HospitalInfoLwc: this.HospitalInfo,
+ SecondDealerLwc: this.secondaryDistributor,
+ invoiceOrderRecoedsLwc: JSON.stringify(cloneData),
+ deliveryIdLwc: this.deliveryId,
+ invoiceIdLwc: this.invoiceId,
+ accountidLwc: this.accountid,
+ agencyProTypeLwc: this.agencyProType,
+ reopenLwc: this.reopen,
+ invoiceOrderRecoedschangeLwc: JSON.stringify(this.invoiceOrderRecoedschange)
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success" && r.msg == '') {
+ this.isShowSpinner = false;
+ console.log('save success');
+ let url = "/lexconinvoiceview?invoiceId=" + r.entity.invoiceId;
+ console.log('url = ' + url);
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ } else {
+ this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ });
+ }
+
+ //涓婁紶闄勪欢锛岀洿鎺ュ氨淇濆瓨濂斤紝鐒跺悗灞曠ず
+ handleFilesChange(event) {
+ console.log("handleFilesChange");
+ this.handleSave();
+ // if (event.target.files.length > 0) {
+ // this.filesUploaded = event.target.files;
+ // this.fileName = event.target.files[0].name;
+ // this.handleSave();
+ // }
+ }
+
+ handleSave() {
+ this.isShowSpinner = true;
+ console.log("saveFile");
+ if (this.filesUploaded.length > 0) {
+ this.file = this.filesUploaded[0];
+ if (this.file.size > this.MAX_FILE_SIZE) {
+ this.showMyToast('淇濆瓨澶辫触', '鏂囦欢杩囧ぇ', 'Error');
+ return;
+ }
+ this.showLoadingSpinner = true;
+ this.fileReader = new FileReader();
+
+ this.fileReader.onloadend = () => {
+ this.fileContents = this.fileReader.result;
+ let base64 = "base64,";
+ this.content = this.fileContents.indexOf(base64) + base64.length;
+ this.fileContents = this.fileContents.substring(this.content);
+ this.saveToFile();
+ };
+ this.fileReader.readAsDataURL(this.file);
+ } else {
+ this.fileName = "閫夋嫨涓�涓枃浠朵笂浼�";
+ }
+ }
+
+ saveToFile() {
+ console.log("saveToFile");
+ console.log("invoiceId = " + this.invoiceId);
+ console.log("fileName = " + this.fileName);
+ console.log("base64Data = " + encodeURIComponent(this.fileContents));
+ saveFile({
+ recordId: this.invoiceId,
+ fileName: this.fileName,
+ base64Data: encodeURIComponent(this.fileContents),
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r != '') {
+ this.showLoadingSpinner = false;
+ this.showMyToast('闄勪欢涓婁紶鎴愬姛', '', 'Success');
+ this.closePop();
+ this.init();
+ } else {
+ this.showMyToast('涓婁紶澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + error.message);
+ this.showMyToast('閿欒', '涓婁紶澶辫触', 'Error');
+ });
+ }
+
+
+ handleTypeChange(event) {
+ console.log("handleTypeChange");
+ const typeDetail = event.detail;
+ console.log("typeDetail = " + JSON.stringify(typeDetail));
+ for (var i in this.fileData) {
+ if (this.fileData[i].recordId == typeDetail.data.recordId) {
+ this.fileData[i].typeValue = typeDetail.data.typeValue;
+ this.fileData[i].mailSelectOptsin = typeDetail.data.typeValue;
+ }
+ }
+ console.log("this.fileData = " + JSON.stringify(this.fileData));
+ }
+
+ newInvoiceJs() {
+ let url = "/lexconinvoiceview?isNew=yes";
+ console.log('url = ' + url);
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ }
+
+ saveAttachmentJs() {
+ this.showLoadingSpinner = true;
+ let cloneData = this.fileData
+ for (var i in cloneData) {
+ delete cloneData[i].Id;
+ delete cloneData[i].recordId;
+ delete cloneData[i].url;
+ delete cloneData[i].Title;
+ delete cloneData[i].CreatedByName;
+ delete cloneData[i].CreatedByNameUrl;
+ delete cloneData[i].CreatedDate;
+ delete cloneData[i].typeValue;
+ delete cloneData[i].typeOptions;
+ delete cloneData[i].mailSelectOptsMap;
+ }
+ console.log('cloneData = ' + JSON.stringify(cloneData));
+ saveAttachment({
+ attachmentRecoedsLwc: JSON.stringify(cloneData),
+ invoiceId: this.invoiceId
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.showLoadingSpinner = false;
+ this.isShowSpinner = true;
+ // const event = new ShowToastEvent({
+ // title: 'Success',
+ // variant: 'Success',
+ // message: '淇濆瓨鎴愬姛',
+ // });
+ // this.dispatchEvent(event);
+ this.showMyToast('闄勪欢淇濆瓨鎴愬姛', '', 'Success');
+ //this.init();
+ setTimeout(function () {
+ //1绉掑悗鎵ц鍒锋柊
+ window.location.reload();
+ }, 2000); //鍗曚綅鏄绉�
+ // let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
+ // console.log('url = ' + url);
+ // this[NavigationMixin.Navigate]({
+ // type: "standard__webPage",
+ // attributes: {
+ // url: url,
+ // },
+ // });
+ } else {
+ this.showMyToast('涓婁紶澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + error.message);
+ this.showMyToast('閿欒', '涓婁紶澶辫触', 'Error');
+ });
+ }
+
+ invoiceCodeSearchJs() {
+ this.isShowSpinner = true;
+ invoiceCodeSearch({
+ orderDateLwc: this.deliveryFromDate == null ? null : new Date(this.deliveryFromDate),
+ deliverDateLwc: this.deliveryToDate == null ? null : new Date(this.deliveryToDate),
+ invoiceStatusLwc: this.invoiceStatusValue,
+ category1Lwc: this.category1,
+ category2Lwc: this.category2,
+ accountidLwc: this.ConInvoiceListAccountId,
+ userWorkLocationLwc: this.ConInvoiceListUserWorkLocation,
+ agencyProTypeLwc: this.ConInvoiceListAgencyProType,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.invoiceData = r.entity.raesList;
+ for (var i in this.invoiceData) {
+ this.invoiceData[i]['NameUrl'] = '/lexconinvoiceview?invoiceId=' + this.invoiceData[i].Id;
+ }
+ console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
+ this.isShowSpinner = false;
+ if (r.entity.raesListSize > 0) {
+ this.showMyToast('鎼滅储鎴愬姛', '鍏辨绱㈠埌' + r.entity.raesListSize + '涓彂绁�', 'Success');
+ } else {
+ this.showMyToast('鎼滅储澶辫触', '娌℃湁鎼滅储鍒扮浉鍏冲彂绁�', 'Error');
+ }
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + error.message);
+ this.showMyToast('閿欒', '鎼滅储澶辫触', 'Error');
+ });
+ }
+
+ ClearJs() {
+ this.deliveryFromDate = '';
+ this.deliveryToDate = '';
+ this.category1 = '';
+ this.category2 = '';
+ this.invoiceStatusValue = '';
+ this.isShowSpinner = true;
+ conInvoiceListInit().then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("conInvoiceListInit r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.invoiceData = r.entity.raesList;
+ for (var i in this.invoiceData) {
+ this.invoiceData[i]['NameUrl'] = '/lexconinvoiceview?invoiceId=' + this.invoiceData[i].Id;
+ }
+ console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
+ this.isShowSpinner = false;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ });
+ }
+
+ InvoiceorderSearchJs() {
+ this.isShowSpinner = true;
+
+ debugger
+ let cloneData = this.outboundData
+ const selectedRows = this.template.querySelector("[data-field='outbound']").getSelectedRows();
+ console.log('selectedRows ' + JSON.stringify(selectedRows));
+ for (var i in cloneData) {
+ let b = false;
+ for (var j in selectedRows) {
+ if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
+ b = true;
+ cloneData[i].check = true;
+ }
+ }
+ if(!b){
+ cloneData[i].check = false;
+ }
+ delete cloneData[i].esdOutboundDate;
+ delete cloneData[i].esdNameUrl;
+ delete cloneData[i].esdName;
+ delete cloneData[i].hospitalName;
+ delete cloneData[i].shipmentAmount;
+ delete cloneData[i].returnAmount;
+ delete cloneData[i].uninvoicedAmount;
+ delete cloneData[i].invoiceFaceAmount;
+ delete cloneData[i].invoiceFaceAmountUrl;
+ }
+
+ console.log('this.coc = ' + JSON.stringify(this.coc));
+ console.log('this.invoiceId = ' + this.invoiceId);
+ console.log('this.accountid = ' + this.accountid);
+ console.log('this.userWorkLocation = ' + this.userWorkLocation);
+ console.log('this.agencyProType = ' + this.agencyProType);
+ console.log('this.HospitalInfo = ' + this.HospitalInfo);
+ console.log('SecondDealer = ' + this.secondaryDistributor);
+ console.log('invoiceOrderRecoedsLwc = ' + JSON.stringify(cloneData));
+
+ InvoiceorderSearch({
+ cocLwc: this.coc,
+ invoiceIdLwc: this.invoiceId,
+ accountidLwc: this.accountid,
+ userWorkLocationLwc: this.userWorkLocation,
+ agencyProTypeLwc: this.agencyProType,
+ HospitalInfoLwc: this.HospitalInfo,
+ SecondDealerLwc: this.secondaryDistributor,
+ invoiceOrderRecoedsLwc: JSON.stringify(cloneData),
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.outboundData = r.entity.invoiceOrderRecoeds;
+ console.log('this.outboundData = ' + JSON.stringify(this.outboundData));
+ let index = 0;
+ this.selectedRows = [];
+ for (var i in this.outboundData) {
+
+ if(this.outboundData[i].check)
+ this.selectedRows.push(this.outboundData[i].esd.Id)
+ this.outboundData[i].Id = this.outboundData[i].esd.Id;
+ this.outboundData[i]['esdOutboundDate'] = this.outboundData[i].esd.Outbound_Date__c;
+ this.outboundData[i]['esdNameUrl'] = '/s/lexsummonscreat?ESetid=' + this.outboundData[i].esd.Id;
+ this.outboundData[i]['esdName'] = this.outboundData[i].esd.Name;
+ if (this.EditAble) {
+ this.outboundData[i]['hospitalName'] = this.outboundData[i].esd.ShipmentAccount__c;
+ this.outboundData[i]['shipmentAmount'] = this.outboundData[i].esd.Shipment_total_amount__c;
+ this.outboundData[i]['returnAmount'] = this.outboundData[i].esd.RrturnPro_total_amount__c;
+ }
+ this.outboundData[i]['uninvoicedAmount'] = this.outboundData[i].esd.InvoiceNotPro_money__c;
+ this.outboundData[i]['invoiceFaceAmount'] = this.outboundData[i].needInvoiceCount;
+ if (!(this.outboundData[i].esd.Billed_Status__c == '鍏ㄩ儴寮�绁�' || this.EditAble || this.coc.Invoice_status__c != '鑽夋涓�')) {
+ //let url = "/ConInvoicedetails?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
+ let url = "/s/lexconinvoiceview?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
+ this.outboundData[i]['invoiceFaceAmountUrl'] = url;
+
+ if (index == 0) {
+ let object5 = {
+ label: '鍙戠エ绁ㄩ潰閲戦(鍏�)',
+ cellAttributes: { alignment: 'right' },
+ type: 'url',
+ fieldName: "invoiceFaceAmountUrl",
+ typeAttributes: {
+ label: { fieldName: "invoiceFaceAmount" },
+ target: "_blank",
+ },
+ hideDefaultActions: true,
+ };
+ this.outboundColumns.push(object5)
+ index++;
+ }
+ } else {
+ if (index == 0) {
+ let object5 = {
+ label: '鍙戠エ绁ㄩ潰閲戦(鍏�)',
+ cellAttributes: { alignment: 'right' },
+ fieldName: "invoiceFaceAmount",
+ hideDefaultActions: true,
+ };
+ this.outboundColumns.push(object5)
+ index++;
+ }
+ }
+ //璁$畻鍙戠エ绁ㄩ潰閲戦
+ this.sumPrice += this.outboundData[i].needInvoiceCount;
+ }
+ console.log('this.selectedRows = ' + JSON.stringify(this.selectedRows))
+ this.isShowSpinner = false;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + error.message);
+ this.showMyToast('閿欒', '鎼滅储澶辫触', 'Error');
+ });
+ }
+
+ getSelectedRows(event) {
+ // console.log("getSelectedRows ");
+ // for (var i in this.outboundData) {
+ // this.outboundData[i].check = false;
+ // }
+ // const selectedRows = event.detail.selectedRows;
+ // for (var i in this.outboundData) {
+ // for (var j in selectedRows) {
+ // if (this.outboundData[i].esd.Id == selectedRows[j].esd.Id) {
+ // //this.outboundData[i].check = !this.outboundData[i].check;
+ // this.outboundData[i].check = true;
+ // }
+ // }
+ // }
+ // console.log('this.outboundData = ' + JSON.stringify(this.outboundData));
+ }
+
+ deleteButtonJs() {
+ this.isShowSpinner = true;
+ deleteButton({
+ cocLwc: this.coc,
+ invoiceIdLwc: this.invoiceId,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.isShowSpinner = false
+ let url = "/lexconinvoiceview";
+ console.log('url = ' + url);
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ } else {
+ this.showMyToast('鍒犻櫎澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + error.message);
+ });
+ }
+
+ SetEditAbleJs() {
+ let statusEditAbleJs = 'Redirect';
+ let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId + '&KeyWords=' + statusEditAbleJs;
+ console.log('url = ' + url);
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ }
+
+ approvalJs() {
+ this.isShowSpinner = true;
+ approval({
+ outOrderStringListLwc: this.outOrderStringListLwc,
+ outordercountMapLwc: this.outordercountMapLwc,
+ invoiceIdLwc: this.invoiceId
+
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.isShowSpinner = false
+ let url = "/s/lexconinvoiceview?invoiceId=" + this.invoiceId;
+ console.log('url = ' + url);
+ window.open(url, '_self');
+ // this[NavigationMixin.Navigate]({
+ // type: "standard__webPage",
+ // attributes: {
+ // url: url,
+ // },
+ // });
+ } else {
+ this.showMyToast('閿欒', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + error.message);
+ });
+ }
+
+ openReportJs() {
+ console.log("openReportJs");
+ let reportUrl = this.label.LexConInvoiceViewReport;
+ let reportFilters = '[{"operator":"equals","value":"' + this.OrderCode + '","column":"FK_NAME"}]';
+ console.log('reportUrl = ' + reportUrl);
+ let url = "/report/"+ reportUrl +"?reportFilters=" + encodeURIComponent(reportFilters);
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ }
+
+ reopenJs() {
+ // statusEdit = 'Redirect';
+ // PageReference ref = new Pagereference('/ConInvoiceView?invoiceId=' + invoiceId + '&reopen=isreopen' + '&KeyWords=' + statusEdit);
+ let statusEditAbleJs = 'Redirect';
+ let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId + '&reopen=isreopen' + '&KeyWords=' + statusEditAbleJs;
+ console.log('url = ' + url);
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ }
+
+ showMyToast(title, message, variant) {
+ this.isShowSpinner = false;
+ this.showLoadingSpinner = false;
+ this.showAttPop = false;
+ this.filesUploaded = [];
+ this.fileName = null;
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if (variant.toLowerCase() == 'success') {
+ iconName = 'utility:check';
+ } else {
+ iconName = 'utility:error';
+ }
+ if (message != '') {
+ content = '<h2><strong>' + title + '<strong/></h2><h5>' + message + '</h5>';
+ } else {
+ content = '<h2><strong>' + title + '<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').showToast(variant, content, iconName, 10000);
+ }
+
+ handleLoad() {
+ console.log('handleLoad')
+ try {
+ const style = document.createElement('style');
+ style.innerText = '.hehe-layoutItem .slds-button__icon {display: none;}';
+ this.template.querySelector('.hideHelpText').appendChild(style);
+
+ const style2 = document.createElement('style');
+ style2.innerText = '.hehe-layoutItem .slds-form-element__label {padding : 0px}';
+ this.template.querySelector('.hideHelpText').appendChild(style2);
+
+ const style3 = document.createElement('style');
+ style3.innerText = '.readOnly .slds-form-element__label {padding-top: 7px;}';
+ this.template.querySelector('.hideHelpText').appendChild(style3);
+ } catch (error) {
+ console.log(error);
+ }
+ }
+
+ keepTwoDecimalStr(num) {
+ const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
+ let s = result.toString();
+ let rs = s.indexOf('.');
+ if (rs < 0) {
+ rs = s.length;
+ s += '.';
+ }
+ while (s.length <= rs + 2) {
+ s += '0';
+ }
+ return s;
+ };
+
+ handleLoad2() {
+ console.log('handleLoad2')
+ try {
+ const style = document.createElement('style');
+ style.innerText = '.hehe-layoutItem .slds-button__icon {display: none;}';
+ this.template.querySelector('.hideHelpText').appendChild(style);
+
+ const style2 = document.createElement('style');
+ style2.innerText = '.hehe-layoutItem .slds-form-element__label {padding : 0px}';
+ this.template.querySelector('.hideHelpText').appendChild(style2);
+ } catch (error) {
+ console.log(error);
+ }
+ }
+
+ handleUnitChange(event) {
+ console.log("handleUnitChange");
+ this.invoiceAllpriceData[0].invoiceAllprice = 0.00;
+ const unitDetail = event.detail;
+ console.log("unitDetail = " + JSON.stringify(unitDetail));
+ for (var i in this.detailsData) {
+ if (this.detailsData[i].recordId == unitDetail.data.recordId) {
+ this.detailsData[i].unitValue = unitDetail.data.unitValue;
+ this.detailsData[i].esd.Invoice_Unit__c = unitDetail.data.unitValue;
+ if (this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) == -1)
+ this.detailsSelectedRows.push(this.detailsData[i].recordId);
+ }
+ }
+ this.detailsSelectedRows = [...this.detailsSelectedRows];
+
+
+ console.log('this.detailsSelectedRows = ' + JSON.stringify(this.detailsSelectedRows))
+ for (var i in this.detailsData) {
+ this.detailsData[i].invoiceAllprice = 0.00;
+ for (var j in this.detailsSelectedRows) {
+ console.log('this.detailsData[i].Id = ' + this.detailsData[i].Id);
+ console.log('this.detailsSelectedRows[j] = ' + this.detailsSelectedRows[j]);
+ if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
+ this.detailsData[i].invoiceAllprice = this.amend(this.detailsData[i].shipmentNumber, this.detailsData[i].esdInvoiceUnitprice, '*');
+ console.log('this.detailsData[i].invoiceAllprice = ' + this.detailsData[i].invoiceAllprice);
+ }
+ }
+ this.invoiceAllpriceData[0].invoiceAllprice = this.amend(this.invoiceAllpriceData[0].invoiceAllprice, this.detailsData[i].invoiceAllprice, '+');
+ }
+ this.detailsData = [...this.detailsData];
+ this.invoiceAllpriceData = [...this.invoiceAllpriceData];
+ }
+
+ handleShipmentNumber(event) {
+ console.log("handleShipmentNumber");
+ this.invoiceAllpriceData[0].invoiceAllprice = 0.00;
+ const numberDetail = event.detail;
+ console.log('numberDetail = ' + JSON.stringify(numberDetail))
+ if (numberDetail.data.shipmentnumber == 0) {
+ if (this.detailsSelectedRows.indexOf(numberDetail.data.recordId) != -1) {
+ this.detailsSelectedRows.splice(this.detailsSelectedRows.indexOf(numberDetail.data.recordId), 1);
+ }
+ }
+ console.log("start this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows));
+ console.log("numberDetail = " + JSON.stringify(numberDetail));
+ for (var i in this.detailsData) {
+ if (this.detailsData[i].recordId == numberDetail.data.recordId) {
+ this.detailsData[i].shipmentNumber = Number(numberDetail.data.shipmentnumber);
+ this.detailsData[i].invoiceCount = Number(numberDetail.data.shipmentnumber);
+ if (this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) == -1 && numberDetail.data.shipmentnumber != 0)
+ this.detailsSelectedRows.push(this.detailsData[i].recordId);
+ }
+ }
+
+ console.log("end this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows));
+ this.detailsSelectedRows = [...this.detailsSelectedRows];
+
+
+ console.log('this.detailsSelectedRows = ' + JSON.stringify(this.detailsSelectedRows));
+ for (var i in this.detailsData) {
+ this.detailsData[i].invoiceAllprice = 0.00;
+ for (var j in this.detailsSelectedRows) {
+ console.log('this.detailsData[i].Id = ' + this.detailsData[i].Id);
+ console.log('this.detailsSelectedRows[j] = ' + this.detailsSelectedRows[j]);
+ if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
+ this.detailsData[i].invoiceAllprice = this.amend(this.detailsData[i].shipmentNumber, this.detailsData[i].esdInvoiceUnitprice, '*');
+ console.log('this.detailsData[i].invoiceAllprice = ' + this.detailsData[i].invoiceAllprice);
+ }
+ }
+ this.invoiceAllpriceData[0].invoiceAllprice = this.amend(this.invoiceAllpriceData[0].invoiceAllprice, this.detailsData[i].invoiceAllprice, '+');
+ }
+ this.detailsData = [...this.detailsData];
+ this.invoiceAllpriceData = [...this.invoiceAllpriceData];
+ }
+
+ detailsGetSelectedRows(event) {
+ console.log("detailsGetSelectedRows ");
+ this.invoiceAllpriceData[0].invoiceAllprice = 0.00;
+ let selectedRows = event.detail.selectedRows;
+ for (var i in this.detailsData) {
+ this.detailsData[i].invoiceAllprice = 0.00;
+ for (var j in selectedRows) {
+ if (this.detailsData[i].Id == selectedRows[j].esd.Id) {
+ this.detailsData[i].invoiceAllprice = this.amend(this.detailsData[i].shipmentNumber, this.detailsData[i].esdInvoiceUnitprice, '*');
+ console.log('this.detailsData[i].invoiceAllprice = ' + this.detailsData[i].invoiceAllprice);
+ }
+ }
+ this.invoiceAllpriceData[0].invoiceAllprice = this.amend(this.invoiceAllpriceData[0].invoiceAllprice, this.detailsData[i].invoiceAllprice, '+');
+ console.log('this.invoiceAllpriceData[0].invoiceAllprice = ' + this.invoiceAllpriceData[0].invoiceAllprice);
+ }
+ console.log('start this.detailsData = ' + JSON.stringify(this.detailsData));
+ this.detailsData = [...this.detailsData];
+ console.log('end this.detailsData = ' + JSON.stringify(this.detailsData));
+ this.invoiceAllpriceData = [...this.invoiceAllpriceData];
+ }
+
+ ComputePrice(index, number, price) {
+ console.log("index = " + index);
+ console.log("number = " + number);
+ console.log("price = " + price);
+ let shipmentAmount = this.amend(number, price, "*");
+ console.log("shipmentAmount = " + shipmentAmount);
+ let sumPrice = 0.0;
+ this.data[index].shipmentAmount = shipmentAmount;
+ for (var i in this.data) {
+ if (this.data[i].shipmentAmount) sumPrice += this.data[i].shipmentAmount;
+ }
+ this.sumPrice = sumPrice + "鍏�";
+ //瀛樹笅閫夋嫨琛岋紝涓嶄細琚竻绌�
+ if (this.selectedRows.indexOf(this.data[index].Id) == -1)
+ this.selectedRows.push(this.data[index].Id);
+ this.data = [...this.data];
+ this.selectedRows = [...this.selectedRows]
+ console.log("this.selectedRows = " + JSON.stringify(this.selectedRows));
+ console.log("this.data = " + JSON.stringify(this.data));
+ }
+
+ detailsSaveJs() {
+ this.isShowSpinner = true;
+ let cloneData = this.detailsData;
+
+ let selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+ console.log('selectedRows = ' + JSON.stringify(selectedRows));
+
+ for (var i in cloneData) {
+ delete cloneData[i].Id;
+ delete cloneData[i].esdAssetModelNo;
+ delete cloneData[i].packingListManual;
+ delete cloneData[i].esdDeliveryListRMB;
+ delete cloneData[i].esdShipmentCount;
+ delete cloneData[i].esdRrturnProCount;
+ delete cloneData[i].esdBoxPiece;
+ delete cloneData[i].esdInvoicedProcount;
+ delete cloneData[i].esdInvoiceProNotCount;
+ delete cloneData[i].unitValue;
+ delete cloneData[i].recordId;
+ delete cloneData[i].unitOptions;
+ delete cloneData[i].esdInvoiceUnitprice;
+ delete cloneData[i].shipmentNumber;
+ delete cloneData[i].invoiceAllprice;
+ for (var j in selectedRows) {
+ if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
+ cloneData[i]['check'] = true;
+ }
+ }
+ }
+ console.log('cloneData = ' + JSON.stringify(cloneData));
+
+
+
+ detailsSave({
+ consumableorderdetails1RecordsLwc: JSON.stringify(cloneData),
+ invoiceIdLwc: this.invoiceId,
+ orderIdLwc: this.orderId
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ } else {
+ this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + error.message);
+ });
+ }
+
+ //num1 num2浼犲叆涓や釜鍊� symbol +-*/绗﹀彿
+ amend(num1, num2, symbol) {
+ var str1 = num1.toString(),
+ str2 = num2.toString(),
+ result,
+ str1Length,
+ str2Length;
+ //瑙e喅鏁存暟娌℃湁灏忔暟鐐规柟娉�
+ try {
+ str1Length = str1.split(".")[1].length;
+ } catch (error) {
+ str1Length = 0;
+ }
+ try {
+ str2Length = str2.split(".")[1].length;
+ } catch (error) {
+ str2Length = 0;
+ }
+ var step = Math.pow(10, Math.max(str1Length, str2Length));
+ switch (symbol) {
+ case "+":
+ result = (num1 * step + num2 * step) / step;
+ break;
+ case "-":
+ result = (num1 * step - num2 * step) / step;
+ break;
+ case "*":
+ result = (num1 * step * (num2 * step)) / step / step;
+ break;
+ case "/":
+ result = (num1 * step) / (num2 * step);
+ break;
+ default:
+ break;
+ }
+ return result;
+ }
+
+ //鍒犻櫎闄勪欢
+ deleteAtt(event) {
+ this.isShowSpinner = true;
+ //var recordId = event.detail.data.recordId;
+ var recordId = event.target.getAttribute("data-fileid");
+ console.log('attid:' + recordId);
+ deleteAtt({
+ contentVersionId: recordId
+ }).then(result => {
+ if (result.result == 'Success') {
+ this.showMyToast('鍒犻櫎鎴愬姛', '', 'Success');
+ if (this.fileData.length == 1)
+ window.location.reload();
+ else
+ this.init();
+ } else {
+ this.showMyToast('鍒犻櫎澶辫触', result.errorMsg, 'Error');
+ }
+ }).catch(error => {
+ this.showMyToast('閿欒', '鍒犻櫎澶辫触', 'Error');
+ })
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js-meta.xml b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.css b/force-app/main/default/lwc/lexConsumable/lexConsumable.css
new file mode 100644
index 0000000..18c7c04
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.css
@@ -0,0 +1,23 @@
+@import 'c/lexCssUtility';
+
+.showContract {
+ pointer-events: none;
+ --lwc-brandTextLink: black;
+}
+
+.attListTitle{
+ --lwc-fontSize5 : 16px;
+}
+
+lightning-output-field {
+ --lwc-colorTextLabel:#696969;
+ --lwc-inputStaticFontSize: 16px;
+ --lwc-formLabelFontSize: 16px;
+ --lwc-brandTextLink: black;
+ --lwc-spacingXxSmall:0px;
+}
+
+.fileUpload {
+ font-size: 16px;
+ --lwc-formLabelFontSize:16px;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.html b/force-app/main/default/lwc/lexConsumable/lexConsumable.html
new file mode 100644
index 0000000..4564898
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.html
@@ -0,0 +1,483 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <template if:true={showPage}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
+ <div style="padding:10px;">
+ <!-- 鎸夐挳 -->
+ <template if:true={showEditBtn}>
+ <!-- <lightning-button style="margin: 5px;" label="缂栬緫" disabled={disabledEditBtn} onclick={editOrder}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" disabled={disabledEditBtn} onclick={editOrder}>缂栬緫</button>
+ </template>
+ <template if:true={showPrintSheetBtn}>
+ <!-- <lightning-button style="margin: 5px;" label="鎵撳嵃閰嶇疆鍗�" onclick={printOrder}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="鎵撳嵃閰嶇疆鍗�" onclick={printOrder}>鎵撳嵃閰嶇疆鍗�</button>
+ </template>
+ <template if:true={showUploadSheetBtn}>
+ <!-- <lightning-button style="margin: 5px;" label="涓婁紶閰嶇疆鍗�" disabled={disabledUploadSheetBtn} onclick={uploadOrder}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="涓婁紶閰嶇疆鍗�" disabled={disabledUploadSheetBtn} onclick={uploadOrder}>涓婁紶閰嶇疆鍗�</button>
+ </template>
+ <template if:true={showSubOrderbtn}>
+ <!-- <lightning-button style="margin: 5px;" label="鎻愪氦璁㈠崟" disabled={disabledSubOrderbtn} onclick={submitOrder}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="鎻愪氦璁㈠崟" disabled={disabledSubOrderbtn} onclick={submitOrder}>鎻愪氦璁㈠崟</button>
+ </template>
+ <template if:true={showSaveOrderbtn1}>
+ <!-- <lightning-button style="margin: 5px;" label="淇濆瓨璁㈠崟" onclick={saveOrder}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="淇濆瓨璁㈠崟" onclick={saveOrder}>淇濆瓨璁㈠崟</button>
+ </template>
+ <template if:true={showSaveOrderbtn2}>
+ <!-- <lightning-button style="margin: 5px;" label="淇濆瓨璁㈠崟" onclick={orderCopy}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="淇濆瓨璁㈠崟" onclick={orderCopy}>淇濆瓨璁㈠崟</button>
+ </template>
+ <template if:true={showDeleteBtn}>
+ <!-- <lightning-button style="margin: 5px;" label="鍒犻櫎" disabled={disabledDeleteBtn} onclick={deleteOrder}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="鍒犻櫎" disabled={disabledDeleteBtn} onclick={deleteOrder}>鍒犻櫎</button>
+ </template>
+ <!-- <template if:true={showOfferPriceInputBtn}>
+ <lightning-button style="margin: 5px;" label="鐗逛环閲戦褰曞叆" disabled={disabledOfferPriceInputBtn} onclick={inputOfferPrice}></lightning-button>
+ <lightning-button style="margin: 5px;" label="鐗逛环閲戦褰曞叆" disabled={disabledOfferPriceInputBtn} onclick={inputOfferPrice}></lightning-button>
+ </template> -->
+ <template if:true={showReapplyBtn}>
+ <!-- <lightning-button style="margin: 5px;" label="鍐嶇敵璇�" onclick={reapplyOrder}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="鍐嶇敵璇�" onclick={reapplyOrder}>鍐嶇敵璇�</button>
+ </template>
+ <p style="height: 10px;"></p>
+ <!-- 璁㈠崟淇℃伅 -->
+ <template if:false={editAble}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>璁㈠崟淇℃伅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>璁㈠崟淇℃伅</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <lightning-record-view-form record-id={cocId} object-api-name="Consumable_order__c">
+ <table style="width: 100%;">
+ <tbody>
+ <tr>
+ <td style="width: 10%"></td>
+ <td style="width: 40%;"><lightning-output-field class="outputfont" field-name="Name"></lightning-output-field></td>
+ <td style="width: 40%;"><lightning-output-field field-name="Order_status__c"></lightning-output-field></td>
+ <td style="width: 10%"></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <template if:false={editAble}>
+ <lightning-output-field field-name="Total_amount__c"></lightning-output-field>
+ </template>
+ </td>
+ <td>
+ <!-- <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label"><lightning-formatted-text value={contractLabel}></lightning-formatted-text> </div>
+ <lightning-formatted-text value={contractName}></lightning-formatted-text>
+ </div> -->
+ <!-- style="pointer-events: none;" -->
+ <lightning-output-field class="showContract" field-name="Order_effective_contact__c" ></lightning-output-field>
+ </td>
+ <!-- <td>鍚堝悓锛�<lightning-formatted-text value={coc.Order_effective_contact__r.Name}></lightning-formatted-text></td> -->
+ <td></td>
+ </tr>
+ <tr>
+ <td></td>
+ <!-- <td>
+ <template if:false={edoffersPrice}>
+ <lightning-output-field id="sumPrice_buttom1" field-name="Offers_Price__c"></lightning-output-field>
+ </template>
+ <template if:true={edoffersPrice}>
+ <lightning-input label="鐗逛环鎬婚噾棰�" variant="label-inline" id="sumPrice_buttom2" value={coc.Offers_Price__c} onchange={offerPriceChange}></lightning-input>
+ </template>
+ </td> -->
+ <td>
+ <template if:true={showAttUploadDate}>
+ <lightning-output-field field-name="Consumable_pdf_insert_day__c"></lightning-output-field>
+ </template>
+ </td>
+ <td></td>
+ </tr>
+ <!-- <tr>
+ <td></td>
+ <td>
+ <template if:true={showAttUploadDate}>
+ <lightning-output-field field-name="Consumable_pdf_insert_day__c"></lightning-output-field>
+ </template>
+ </td>
+ <td></td>
+ <td></td>
+ </tr> -->
+ <tr>
+ <td></td>
+ <td>
+ <template if:true={showOrderDate}>
+ <lightning-output-field field-name="Order_date__c"></lightning-output-field>
+ </template>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td colspan="2">
+ <lightning-card class="attListTitle" variant="Narrow" title="闄勪欢鍒楄〃" icon-name="utility:attach">
+ <lightning-layout slot="footer" multiple-rows="true">
+ <template for:each={attachmentRecoeds} for:item="item" for:index="index">
+ <lightning-layout-item padding="around-none" size="2" key={item.recordId} style="text-align: left;padding:5px">
+ <lightning-icon title={item.fileFullName} style="margin-left: 20px;" icon-name="doctype:gform" alternative-text={item.fileFullName} size="large"></lightning-icon><br/>
+ <span title={item.fileFullName}>
+ {item.fileName}
+ </span>
+ <p>
+ <!-- <a data-fileid ={item.documentId} onclick={previweAtt}> -->
+ <a href={item.attUrl} target="_blank">
+ 棰勮
+ </a> 路
+ <a href={item.downloadUrl}>
+ 涓嬭浇
+ </a> 路
+ <a data-fileid ={item.recordId} onclick={deleteAtt}>
+ 鍒犻櫎
+ </a>
+ </p>
+ <!-- <p>{item.updateDate} 路 {item.ownerName}</p> -->
+ </lightning-layout-item>
+ </template>
+ </lightning-layout>
+ </lightning-card>
+ </td>
+ <td></td>
+ </tr>
+ </tbody>
+ </table>
+ </lightning-record-view-form>
+ </div>
+ </div>
+ </template>
+ <!-- searchBlock -->
+ <template if:true={editAble}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="padding:10px;">
+ <table>
+ <tbody>
+ <tr>
+ <td style="width: 90px;">
+ <div style="color:#696969;font-size:16px;"><span style="color: red;">* </span>鍚堝悓</div>
+ </td>
+ <td style="width:300px;">
+ <div class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
+ <lightning-icon size="x-small" class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default" icon-name="utility:search" ></lightning-icon>
+ <lightning-input class="inputFont" variant="label-hidden" label="鍚堝悓" placeholder="璇烽�夋嫨鍚堝悓" value={contractName} onchange={changeCon} onclick={showSearchCon}></lightning-input>
+ </div>
+ </td>
+ <td style="width: 30px;"></td>
+ <td style="width:66px;">
+ <template if:true={showHospital}>
+ <div style="color:#696969;font-size:16px;"><span style="color: red;">* </span>鍖婚櫌</div>
+ </template>
+ </td>
+ <td colspan="4" style="padding-bottom:5px;padding-top:5px;">
+ <template if:true={showHospital}>
+ <div class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
+ <lightning-icon size="x-small" class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default" icon-name="utility:search" ></lightning-icon>
+ <lightning-input class="inputFont" variant="label-hidden" label="鍖婚櫌" placeholder="璇烽�夋嫨鍖婚櫌" value={hospitalName} onclick={showSearchHos} onchange={changeHos}></lightning-input>
+ </div>
+ </template>
+ </td>
+ <!-- <td style="width: 30px;"></td>
+ <td style="width: 66px;"></td>
+ <td style="width:150px;"></td> -->
+ <td style="width: 30px;"></td>
+ <td style="width: 66px;"></td>
+ <td style="width:140px;"></td>
+ <td style="width: 30px;"></td>
+ <td></td>
+ </tr>
+ <tr style="height: 10px;"></tr>
+ <!-- <tr>
+ <td><div style="color:#696969;font-size:14px;"><span style="color: red;">* </span>鍚堝悓</div></td>
+ <td style="padding-bottom:5px;padding-top:5px;">
+ <div class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
+ <lightning-icon size="x-small" class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default" icon-name="utility:search" ></lightning-icon>
+ <lightning-input variant="label-hidden" label="鍚堝悓" placeholder="璇烽�夋嫨鍚堝悓" value={contractName} onchange={changeCon} onclick={showSearchCon}></lightning-input>
+ </div>
+ </td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr> -->
+ <tr>
+ <td>
+ <div style="color:#696969;font-size:16px;">娑堣�楀搧鍚嶇О</div>
+ </td>
+ <td>
+ <lightning-input class="inputFont" variant="label-hidden" label="娑堣�楀搧鍚嶇О" value={category1} onchange={category1Change}></lightning-input>
+ </td>
+ <td></td>
+ <td>
+ <div style="color:#696969;font-size:16px;">绗�3鍒嗙被</div>
+ </td>
+ <td style="width:140px;">
+ <lightning-combobox class="inputFont" variant="label-hidden" label="绗�3鍒嗙被" value={category3} options={category3Option} onchange={category3Change}></lightning-combobox>
+ </td>
+ <td style="width:30px;"></td>
+ <td style="width:66px;">
+ <div style="color:#696969;font-size:16px;">绗�4鍒嗙被</div>
+ </td>
+ <td style="width:140px;">
+ <lightning-combobox class="inputFont" variant="label-hidden" label="绗�4鍒嗙被" value={category4} options={category4Option} onchange={category4Change}></lightning-combobox>
+ </td>
+ <td></td>
+ <td>
+ <div style="color:#696969;font-size:16px;">绗�5鍒嗙被</div>
+ </td>
+ <td>
+ <lightning-combobox class="inputFont" variant="label-hidden" label="绗�5鍒嗙被" value={category5} options={category5Option} onchange={category5Change}></lightning-combobox>
+ </td>
+ <td></td>
+ <td>
+ <!-- <lightning-button style="margin-right: 10px;margin-left: 15px;" label="娑堣�楀搧鎼滅储" onclick={searchProduct}></lightning-button>
+ <lightning-button label="娓呯┖" onclick={clear}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="width:130px;height:32px;margin-right: 10px;" label="娑堣�楀搧鎼滅储" onclick={searchProduct}>娑堣�楀搧鎼滅储</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="width:80px;height:32px;" label="娓呯┖" onclick={clear}>娓呯┖</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </template>
+ <!-- 璀﹀憡鎻愰啋 -->
+ <template if:true={hasWarning}>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;color:#ff6a00;font-size:17px;">
+ <lightning-icon style="margin: 3px;" icon-name="utility:warning" size="small"></lightning-icon>
+ <strong> 璀﹀憡</strong>
+ </div>
+ <template for:each={warningMsgs} for:item="msg">
+ <p key={msg} style="color:#ff6a00;padding-left:7px;font-size:16px;margin-bottom:7px;"> 銉� {msg}</p>
+ </template>
+ </div>
+ </template>
+ <!-- 鎶ラ敊鎻愰啋 -->
+ <template if:true={hasError}>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;color:red;font-size:17px;">
+ <lightning-icon style="margin: 3px;" icon-name="utility:error" size="small"></lightning-icon>
+ <strong> 閿欒</strong>
+ </div>
+ <template for:each={errorMsgs} for:item="msg">
+ <p key={msg} style="color:red;padding-left:7px;font-size:16px;margin-bottom:7px;"> 銉� {msg}</p>
+ </template>
+ </div>
+ </template>
+ <!-- 娑堣�楀搧鏄庣粏 -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>娑堣�楀搧鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>娑堣�楀搧鏄庣粏</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <template if:true={editAble}>
+ <c-lex-custom-lightning-datatable class="wrapped-header-datatable" key-field="recordId" data={currentRecord} columns={cols}
+ selected-rows={selectRows} onrowselection={checkRows} onchangevalue={conCountChange} onvalueblur={conCountBlur}
+ default-sort-direction="asc" sorted-direction={sortDirection} sorted-by={sortedBy} onsort={onHandleSort}></c-lex-custom-lightning-datatable>
+ <c-paginator onprevious={prePageClick} onnext={nextPageClick}
+ onpageschange={pageSizeChange} onfirst={goFirstPage} onlast={goLastPage}
+ page-size-options={pageSizeOptions} previous-button-disabled={previousButtonDisabled}
+ next-button-disabled={nextButtonDisabled} record-start={recordStart}
+ record-end={recordEnd} total-records={totalRecords}></c-paginator>
+ </template>
+ <template if:false={editAble}>
+ <c-lex-custom-lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="recordId" data={consumableorderdetailsRecordsview} columns={cols}></c-lex-custom-lightning-datatable>
+ <c-paginator onprevious={prePageClick} onnext={nextPageClick}
+ onpageschange={pageSizeChange} onfirst={goFirstPage} onlast={goLastPage}
+ page-size-options={pageSizeOptions} previous-button-disabled={previousButtonDisabled}
+ next-button-disabled={nextButtonDisabled} record-start={recordStart}
+ record-end={recordEnd} total-records={totalRecords}></c-paginator>
+ </template>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- 闄勪欢 -->
+ <!-- <template if:false={editAble}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-top:10px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 16px">
+ <strong>闄勪欢</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+ <c-lex-custom-lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="recordId" columns={attCols} data={attachmentRecoeds} onclickicon={deleteAtt}></c-lex-custom-lightning-datatable>
+ </div>
+ </div>
+ </template> -->
+ <!-- 涓婁紶闄勪欢寮圭獥 -->
+ <template if:true={showAttPop}>
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small" style="border: 1px solid #D4D4D4;">
+ <template if:true={showPopSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <div class="slds-modal__container">
+ <header class="slds-modal__header" style="background-color: #F3F3F3;">
+ <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closePop}>
+ <lightning-icon icon-name="utility:close"
+ alternative-text="close"
+ variant="inverse"
+ size="small" ></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">涓婁紶閰嶇疆鍗�</h2>
+ </header>
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1" style="border: 1px solid #F3F3F3;">
+ <div class="slds-m-top_medium slds-m-bottom_x-large">
+ <div class="slds-p-around_medium lgc-bg">
+ <lightning-input class="fileUpload" type="file" label="闄勪欢涓婁紶" accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf" onchange={attChange}></lightning-input>
+ </div>
+ <p style="font-size: 16px;">宸查�夋嫨鏂囦欢锛歿fileName}
+ <template if:true={attDelBtn}>
+ <a onclick={removeAtt}>绉婚櫎</a>
+ </template>
+ </p>
+ </div>
+ </div>
+ <footer class="slds-modal__footer">
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="鍙栨秷" onclick={closePop}></lightning-button>
+ <lightning-button style="margin-left: 10px;" variant="neutral" label="涓婁紶" onclick={uploadAtt}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="margin-left: 10px;" variant="neutral" label="鍙栨秷" onclick={closePop}>鍙栨秷</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="margin-left: 10px;" variant="neutral" label="涓婁紶" onclick={uploadAtt}>涓婁紶</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+ <!-- 鎼滅储鍖婚櫌 -->
+ <template if:true={showAttHosPop}>
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_medium" style="border: 1px solid #D4D4D4;">
+ <div class="slds-modal__container">
+ <header class="slds-modal__header" style="background-color: #F3F3F3;">
+ <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeHospitalPop}>
+ <lightning-icon icon-name="utility:close"
+ alternative-text="close"
+ variant="inverse"
+ size="small" ></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-02" class="slds-text-heading_medium slds-hyphenate">缁忛攢鍟嗗尰闄㈡绱�</h2>
+ </header>
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2" style="border: 1px solid #F3F3F3;">
+ <table style="width: 100%;">
+ <tbody>
+ <tr>
+ <td style="width: 74px;"><div style="color:#696969;font-size:16px;text-align: left;">鍖婚櫌鍚嶇О</div></td>
+ <td style="width: 60%;"><lightning-input class="inputFont" label="鍖婚櫌鍚嶇О" variant="label-hidden" placeholder="璇疯緭鍏ュ尰闄㈠悕绉�" value={searchNameHos} onchange={searchNameHosChange}></lightning-input></td>
+ <td style="width: 10px;"></td>
+ <td><button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="height: 32px;" label="鎼滅储" onclick={searchHos}>鎼滅储</button></td>
+ </tr>
+ </tbody>
+ </table>
+ <p style="height: 20px;"></p>
+ <!-- <p>宸查�夋嫨鍖婚櫌锛歿chooseHospital}</p> -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鎼滅储缁撴灉</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>鎼滅储缁撴灉</strong></p> -->
+ </div>
+ <div class="myTable" style="padding:10px;">
+ <lightning-datatable class="wrapped-header-datatable" key-field="id" hide-checkbox-column="true" data={hospitalList} columns={hosCols} onrowaction={chooseHos}></lightning-datatable>
+ </div>
+ </div>
+ </div>
+ <footer class="slds-modal__footer">
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="鍙栨秷" onclick={closeHospitalPop}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" label="鍙栨秷" onclick={closeHospitalPop}>鍙栨秷</button>
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="纭" onclick={confirmHospital}></lightning-button> -->
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+ <!-- 鎼滅储鍚堝悓 -->
+ <template if:true={showConPop}>
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_medium" style="border: 1px solid #D4D4D4;">
+ <div class="slds-modal__container">
+ <header class="slds-modal__header" style="background-color: #F3F3F3;">
+ <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeContractPop}>
+ <lightning-icon icon-name="utility:close"
+ alternative-text="close"
+ variant="inverse"
+ size="small" ></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-03" class="slds-text-heading_medium slds-hyphenate">鍚堝悓妫�绱�</h2>
+ </header>
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-3" style="border: 1px solid #F3F3F3;">
+ <table style="width: 100%;">
+ <tbody>
+ <tr>
+ <td style="width: 74px;"><div style="color:#696969;font-size:16px;text-align: left;">鍚堝悓鍚嶇О</div></td>
+ <td style="width: 60%;"><lightning-input class="inputFont" label="鍚堝悓鍚嶇О" variant="label-hidden" placeholder="璇疯緭鍏ュ悎鍚屽悕绉�" value={searchNameCon} onchange={searchNameConChange}></lightning-input></td>
+ <td style="width: 10px;"></td>
+ <td><button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="height: 32px;" label="鎼滅储" onclick={searchCon}>鎼滅储</button></td>
+ <!-- <td><lightning-button label="鎼滅储" onclick={searchCon}></lightning-button></td> -->
+ </tr>
+ </tbody>
+ </table>
+ <p style="height: 10px;"></p>
+ <!-- <p>宸查�夋嫨鍚堝悓锛歿chooseContract}</p> -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鎼滅储缁撴灉</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:20px;">
+ <lightning-datatable class="wrapped-header-datatable" key-field="id" hide-checkbox-column="true" data={contractList} columns={conCols} onrowaction={chooseCon}></lightning-datatable>
+ </div>
+ </div>
+ </div>
+ <footer class="slds-modal__footer">
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="鍙栨秷" onclick={closeContractPop}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" label="鍙栨秷" onclick={closeContractPop}>鍙栨秷</button>
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="纭" onclick={confirmContract}></lightning-button> -->
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.js b/force-app/main/default/lwc/lexConsumable/lexConsumable.js
new file mode 100644
index 0000000..1bc8cee
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.js
@@ -0,0 +1,1388 @@
+import { LightningElement,wire,api,track } from 'lwc';
+import { CurrentPageReference } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+import initPage from '@salesforce/apex/LexConsumableController.init';
+import categoryAllload from '@salesforce/apex/LexConsumableController.categoryAllload';
+import categoryload from '@salesforce/apex/LexConsumableController.categoryload';
+import searchConsumableorderdetails from '@salesforce/apex/LexConsumableController.searchConsumableorderdetails';
+import searchorderdetails from '@salesforce/apex/LexConsumableController.searchorderdetails';
+import save from '@salesforce/apex/LexConsumableController.save';
+import ordrCopy from '@salesforce/apex/LexConsumableController.ordrCopy';
+import setEditAble from '@salesforce/apex/LexConsumableController.setEditAble';
+import backOrder from '@salesforce/apex/LexConsumableController.backOrder';
+import delConsumable from '@salesforce/apex/LexConsumableController.delConsumable';
+import sorder from '@salesforce/apex/LexConsumableController.sorder';
+import filesUpload from '@salesforce/apex/LexConsumableController.filesUpload';
+import initHospital from '@salesforce/apex/LexSearchHospitalController.init';
+import searchHospital from '@salesforce/apex/LexSearchHospitalController.searchHospital';
+import initContract from '@salesforce/apex/LexSearchContractController.init';
+import searchContract from '@salesforce/apex/LexSearchContractController.searchContract';
+import deleteAtt from '@salesforce/apex/LexConsumableController.deleteAtt';
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+export default class LexConsumable extends NavigationMixin(LightningElement) {
+
+ //椤甸潰鍩虹鏁版嵁
+ @track editAble;
+ @track pageType;
+ @track esetId;
+ @track keyWords;
+ @track coc;
+ @track cocId;
+ @track userWorkLocation;
+ @track accountName;
+ @track accountid;
+ @track specialCampaign = false;
+ @track dealerProductId = [];
+ @track category1;
+ @track category3 = '';
+ @track category4 = '';
+ @track category5 = '';
+ @track category_Goods;
+ @track category3Option = [];
+ @track category4Option = [];
+ @track category5Option = [];
+ @track consumableorderdetailsRecordsview = [];
+ @track currentRecord = [];//鍒嗛〉
+ @track selectRows = [];
+ @track attachmentRecoeds = [];
+ @track contactDealer = [];
+ @track proLimitAndDate = [];
+ @track agencyProType;
+ @track agencyProType1;
+ @track OSHFLG = false;
+ @track bargainPrice;
+ @track showOrderDate = false;
+ @track showAttUploadDate = false;
+ @track edoffersPrice = false;
+ @track editDelCommitBtnDisabled = false;
+ @track showEditBtn = false;
+ @track disabledEditBtn = false;
+ @track showPrintSheetBtn = false;
+ @track showUploadSheetBtn = false;
+ @track disabledUploadSheetBtn = false;
+ @track showSubOrderbtn = false;
+ @track disabledSubOrderbtn = false;
+ @track showSaveOrderbtn1 = false;
+ @track showSaveOrderbtn2 = false;
+ @track showDeleteBtn = false;
+ @track disabledDeleteBtn = false;
+ @track showOfferPriceInputBtn = false;
+ @track disabledOfferPriceInputBtn = false;
+ @track showReapplyBtn = false;
+ @track showHospital = false;
+ @track showPage = false;
+ @track cansee = false;
+ @track showSpinner = true;
+ @track showPopSpinner = false;
+ stylesLoaded = false;
+ //鏄惁涓�鐩存樉绀烘彁绀�
+ @track isNoteStay = true;
+ //鎺掑簭鐩稿叧
+ @track sortDirection = 'asc';
+ @track sortedBy;
+ //鍒嗛〉
+ @track currentPage = 1;
+ @track pageSize = 10;
+ // @track totalPage = 0;
+ @track pageSizeOptions = [10, 25, 50, 100];
+ @track recordStart = 0;
+ @track recordEnd = 0;
+ //鎶ラ敊鎻愰啋
+ // @track hasError = false;
+ @track errorMsgs = [];
+ // @track hasWarning = false;
+ @track warningMsgs = [];
+ //闄勪欢涓婁紶
+ @track showAttPop = false;
+ @track filesUploaded = [];
+ @track fileName;
+ file;
+ fileContents;
+ fileReader;
+ content;
+ //鍖婚櫌鎼滅储
+ @track showAttHosPop = false;
+ @track hospitalList = [];
+ @track searchNameHos;
+ @track chooseHospital;
+ @track chooseHospitalId;
+ @track hospitalId;
+ @track hospitalName;
+ @track tempidHp;
+ @track hosCols = [
+ // {label:'鍖婚櫌鍚嶇О',fieldName:'Name',type:'button',typeAttributes:{label:{fieldName:'Name'},variant:'base'}},
+ {label:'',type:'button',typeAttributes:{label:'閫夋嫨'},initialWidth:90,hideDefaultActions: true,wrapText:true},
+ {label:'鍖婚櫌鍚嶇О',fieldName:'Name',initialWidth:380,wrapText:true,hideDefaultActions: true},
+ {label:'鐪佷唤',fieldName:'StateMaster',initialWidth:80,hideDefaultActions: true,wrapText:true},
+ {label:'鍦板潃',fieldName:'Address__c',hideDefaultActions: true,wrapText:true}
+ ];
+ //鍚堝悓鎼滅储
+ @track contractLabel;
+ @track showConPop = false;
+ @track contractList = [];
+ @track searchNameCon;
+ @track chooseContract;
+ @track chooseContractId;
+ @track contractId;
+ @track contractName;
+ @track tempidPp;
+ @track conCols = [
+ {label:'',type:'button',typeAttributes:{label:'閫夋嫨'},initialWidth:90,hideDefaultActions: true,wrapText:true},
+ {label:'鍚堝悓鍚嶇О',fieldName:'Name',wrapText:true,hideDefaultActions: true},
+ {label:'鐪佷唤',fieldName:'StateMaster',initialWidth:80,hideDefaultActions: true,wrapText:true},
+ {label:'鐢宠閿�鍞',fieldName:'Sales_Section__c',initialWidth:160,hideDefaultActions: true,wrapText:true},
+ {label:'鍏佽鎶ヤ环鏈熼棿(寮�濮嬫棩)',fieldName:'Contract_Decide_Start_Date__c',initialWidth:175,hideDefaultActions: true,wrapText:true},
+ {label:'鍏佽鎶ヤ环鏈熼棿(缁撴潫鏃�)',fieldName:'Contract_Decide_End_Date__c',initialWidth:175,hideDefaultActions: true,wrapText:true}
+ ];
+
+ //娑堣�楀搧鏁版嵁col
+ get cols(){
+ var cols = [];
+ cols.push({label:'娑堣�楀搧鍚嶇О',fieldName:'prodName',wrapText:true,hideDefaultActions: true,sortable: true});
+ cols.push({label:'瑙勬牸',fieldName:'packing_list',wrapText:true,hideDefaultActions: true,initialWidth:50,cellAttributes: { alignment: "right" }});
+ cols.push({label:'CFDA鐘舵��',fieldName:'prodSFDAStatus',wrapText:true,hideDefaultActions: true,initialWidth:97});
+ cols.push({label:'娉ㄥ唽璇佺紪鐮佸彿',fieldName:'approbation_No',wrapText:true,hideDefaultActions: true,initialWidth:120});
+ cols.push({label:'娉ㄥ唽璇佹晥鏈�',fieldName:'expiration_Date',wrapText:true,hideDefaultActions: true,initialWidth:105});
+ cols.push({label:'绗�3鍒嗙被',fieldName:'prodCategory3',wrapText:true,hideDefaultActions: true,initialWidth:78,sortable: true});
+ cols.push({label:'绗�4鍒嗙被',fieldName:'prodCategory4',wrapText:true,hideDefaultActions: true,initialWidth:107,sortable: true});
+ cols.push({label:'绗�5鍒嗙被',fieldName:'prodCategory5',wrapText:true,hideDefaultActions: true,initialWidth:80,sortable: true});
+ if(this.cansee){
+ cols.push({label:'鏍囧噯鍗曚环',type:'number',typeAttributes:{minimumFractionDigits: 2},fieldName:'prodIntraTradeList',hideDefaultActions: true,initialWidth:80});
+ }
+ if(this.editAble){
+ cols.push(
+ {label:'閲囪喘鏁伴噺',
+ type: "customTableInput",typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "consumableCount" },
+ upperLimit: { fieldName: "upperlimit" },
+ lowerLimit: { fieldName: "lowerlimit" },
+ allnumber: { fieldName: "allnumber" },
+ valueType: 'Number'
+ },
+ hideDefaultActions: true,initialWidth:80});
+ }else{
+ cols.push({label:'閲囪喘鏁伴噺',fieldName:'consumableCount',hideDefaultActions: true,initialWidth:80,cellAttributes: { alignment: "right" }});
+ }
+ cols.push({label:'鍦ㄥ簱鏁颁笅闄�',fieldName:'lowerlimit',hideDefaultActions: true,initialWidth:100,cellAttributes: { alignment: "right" }});
+ cols.push({label:'鍦ㄥ簱鏁颁笂闄�',fieldName:'upperlimit',hideDefaultActions: true,initialWidth:100,cellAttributes: { alignment: "right" }});
+ // cols.push({label:'鏈夋晥鏈熷簱瀛�(鐩�)',fieldName:'allnumber',hideDefaultActions: true,initialWidth:105,sortable: true});
+ cols.push(
+ {label:'鏈夋晥鏈熷簱瀛�(鐩�)',
+ type: "customInventoryColor",
+ typeAttributes: {
+ value: { fieldName: "allnumber" },
+ upperlimit: { fieldName: "upperlimit" },
+ lowerlimit: { fieldName: "lowerlimit" },
+ boxPrice: '鐩�'
+ },
+ hideDefaultActions: true,initialWidth:126});
+ cols.push({label:'鏈夋晥鏈熷簱瀛�(涓�)',fieldName:'allnumber_piece',hideDefaultActions: true,initialWidth:126,cellAttributes: { alignment: "right" }});
+ return cols;
+ }
+
+ //闄勪欢cols
+ @track attCols = [
+ {label:'鏍囬',fieldName:'attUrl',type:'url',typeAttributes:{label:{fieldName:'fileName'},target: "_blank"},hideDefaultActions: true},
+ {label:'鍒涘缓浜�',fieldName:'ownerUrl',type:'url',typeAttributes:{label:{fieldName:'ownerName'},target: "_blank"},hideDefaultActions: true},
+ {label:'涓婁紶鏃ユ湡',fieldName:'updateDate',hideDefaultActions: true},
+ {label:'',type:'tableCellIcon',typeAttributes:{iconName:'utility:delete',recordId:{fieldName : 'recordId'}},initialWidth:50,hideDefaultActions: true}
+ ];
+
+ //鍙栧緱鎵�鏈夎鍕鹃�夌殑浜у搧id
+ getAllChecked(){
+ this.selectRows = [];
+ for(var i in this.currentRecord){
+ if(this.currentRecord[i].check){
+ this.selectRows.push(this.currentRecord[i].recordId);
+ }
+ }
+ }
+
+ //鍕鹃�夋搷浣�
+ checkRows(event){
+ this.selectRows = [];
+ const selectedRows = event.detail.selectedRows;
+ for(var i in this.consumableorderdetailsRecordsview){
+ var count = 0;
+ for(var j in selectedRows){
+ if(this.consumableorderdetailsRecordsview[i].recordId == selectedRows[j].recordId){
+ count++
+ console.log("checkId:"+selectedRows[j].recordId+'---'+this.consumableorderdetailsRecordsview[i].prodName);
+ }
+ }
+ if(count == 0){
+ this.consumableorderdetailsRecordsview[i].check = false;
+ }else{
+ this.consumableorderdetailsRecordsview[i].check = true;
+ this.selectRows.push(this.consumableorderdetailsRecordsview[i].recordId);
+ }
+ }
+ for(var i in this.selectRows){
+ console.log("checkId1:"+this.selectRows[i]);
+ for(var i in this.currentRecord){
+ if(this.currentRecord[i].recordId == this.selectRows[i]){
+ console.log("currentRecord:"+this.selectRows[i]);
+ }
+ }
+ }
+ }
+
+ //閲囪喘鏁伴噺鑾峰彇
+ conCountChange(event){
+ var recordId = event.detail.data.recordId;
+ var conCount = event.detail.data.value;
+ console.log('countChange:'+recordId+'---'+conCount);
+ for(var i in this.consumableorderdetailsRecordsview){
+ if(this.consumableorderdetailsRecordsview[i].recordId == recordId){
+ this.consumableorderdetailsRecordsview[i].esd.Consumable_count__c = conCount;
+ this.consumableorderdetailsRecordsview[i].consumableCount = conCount;
+ if(conCount != null && conCount !=0 && conCount!=''){
+ this.consumableorderdetailsRecordsview[i].check = true;
+ }else{
+ this.consumableorderdetailsRecordsview[i].check = false;
+ }
+ }
+ }
+ this.getAllChecked();
+ for(var i in this.currentRecord){
+ if(this.currentRecord[i].recordId == recordId){
+ console.log("currentRecord1:"+this.currentRecord[i].esd.Consumable_count__c);
+ }
+ }
+ }
+
+ //閲囪喘鏁伴噺澶辩劍
+ conCountBlur(event){
+ var conCount = event.detail.data.value;
+ var allnumber = event.detail.data.allnumber;
+ var upperLimit = event.detail.data.upperLimit;
+ var lowerLimit = event.detail.data.lowerLimit;
+ console.log('limit:'+conCount+'---'+ allnumber+'---'+lowerLimit+'---'+allnumber);
+ if(upperLimit != null && lowerLimit != null && conCount != null && allnumber != null){
+ if(parseInt(allnumber) + parseInt(conCount) > upperLimit){
+ // window.alert("璇ヤ骇鍝佽璐暟閲忚秴鍑哄簱瀛樹笂闄愶紒");
+ this.showMyToast('璇ヤ骇鍝佽璐暟閲忚秴鍑哄簱瀛樹笂闄愶紒','','error');
+ }
+ if(parseInt(allnumber) + parseInt(conCount) < lowerLimit){
+ // window.alert("璇ヤ骇鍝佽璐暟閲忎綆浜庡簱瀛樹笅闄愶紒");
+ this.showMyToast('璇ヤ骇鍝佽璐暟閲忎綆浜庡簱瀛樹笅闄愶紒','','error');
+ }
+ }
+ }
+
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ console.log('CurrentPageReference');
+ if (currentPageReference) {
+ this.pageType = currentPageReference.state?.type;
+ this.esetId = currentPageReference.state?.ESetid;
+ this.keyWords = currentPageReference.state?.KeyWords;
+ console.log('type:'+this.pageType);
+ console.log('esetId:'+this.esetId);
+ console.log('keyWords:'+this.keyWords);
+ }
+ }
+
+ renderedCallback(){
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+ //椤甸潰鍒濆鍖�
+ connectedCallback(){
+ this.showSpinner = true;
+ initPage({type:this.pageType, esetId:this.esetId, keywordStr:this.keyWords})
+ .then(result=>{
+ this.isNoteStay = result.isNoteStay;
+ if(result.result == 'Success'){
+ this.editAble = result.editAble;
+ this.edoffersPrice = result.edoffersPrice;
+ this.cansee = result.cansee;
+ this.editDelCommitBtnDisabled = result.editDelCommitBtnDisabled;
+ this.category3Option = result.category3Option;
+ this.category4Option = result.category4Option;
+ this.category5Option = result.category5Option;
+ this.agencyProType = result.agencyProType;
+ this.agencyProType1 = result.agencyProType1;
+ this.OSHFLG = result.OSHFLG;
+ this.hospitalName = result.hospitalName;
+ this.contractName = result.contractName;
+ this.contractLabel = '缁忛攢鍟嗘湁鏁堝悎鍚�';
+ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
+ this.currentPage = 1;
+ this.showCurrentReocrd();
+ this.getAllChecked();
+ this.attachmentRecoeds = result.attachmentRecoeds;
+ console.log("attSize:"+this.attachmentRecoeds.length);
+ for(var i in this.attachmentRecoeds){
+ this.attachmentRecoeds[i]['recordId'] = this.attachmentRecoeds[i].Concc.Id;
+ this.attachmentRecoeds[i]['documentId'] = this.attachmentRecoeds[i].Concc.ContentDocumentId;
+ this.attachmentRecoeds[i]['fileFullName'] = this.attachmentRecoeds[i].Concc.Title;
+ var contractionName = this.attachmentRecoeds[i].Concc.Title;
+ // var contractionName = '闀挎枃浠堕暱鏂囦欢闀挎枃浠堕暱鏂囦欢';
+ if(contractionName.length > 25){
+ contractionName = contractionName.substr(0,21) + "...";
+ }
+ this.attachmentRecoeds[i]['fileName'] = contractionName;
+ this.attachmentRecoeds[i]['ownerName'] = this.attachmentRecoeds[i].Concc.Owner.Name;
+ this.attachmentRecoeds[i]['downloadUrl'] = '/sfc/servlet.shepherd/document/download/'+this.attachmentRecoeds[i].Concc.ContentDocumentId+'?operationContext=S1';
+ // var date = this.attachmentRecoeds[i].Concc.CreatedDate;
+ // var year = date.getFullYear();
+ // var month = date.getMonth();
+ // var day = date.getDay();
+ // console.log(year+'-'+month+'-'+day);
+ this.attachmentRecoeds[i]['updateDate'] = new Date(Date.parse(this.attachmentRecoeds[i].Concc.CreatedDate)).toLocaleString();
+ this.attachmentRecoeds[i]['attUrl'] = '/'+this.attachmentRecoeds[i].Concc.Id;
+ this.attachmentRecoeds[i]['ownerUrl'] = '/'+this.attachmentRecoeds[i].Concc.OwnerId;
+ }
+ this.errorMsgs = result.errorMsgList;
+ this.warningMsgs = result.warningMsgList;
+ this.userWorkLocation = result.userWorkLocation;
+ this.accountName = result.accountName;
+ this.accountid = result.accountid;
+ this.hospitalId = result.hospitalId;
+ this.contractId = result.contractId;
+ this.category_Goods = result.category_Goods;
+ this.specialCampaign = result.specialCampaign;
+ this.dealerProductId = result.dealerProductId;
+ this.contactDealer = result.contactDealer;
+ this.pageType = result.methodType;
+ this.proLimitAndDate = result.proLimitAndDate;
+ console.log("proLimitAndDate:"+JSON.stringify(this.proLimitAndDate));
+ this.coc = result.coc;
+ this.cocId = this.coc.Id;
+ if(this.pageType == 'hospitalorder' && this.agencyProType != 'ET'){
+ this.showHospital = true;
+ }
+ if(this.coc.Order_status__c == "宸叉彁浜�" || this.coc.Order_status__c == "鎵瑰噯"){
+ this.showOrderDate = true;
+ }
+ if(this.coc.Consumable_pdf_insert_day__c != null){
+ this.showAttUploadDate = true;
+ }
+ if(!(this.editAble || this.edoffersPrice)){
+ this.showEditBtn = true;
+ this.showOfferPriceInputBtn = true;
+ }
+ if(this.coc.Order_status__c == "宸叉彁浜�" || this.coc.Order_status__c == "鎵瑰噯" || this.coc.Order_status__c == "椹冲洖"){
+ this.disabledEditBtn = true;
+ this.disabledUploadSheetBtn = true;
+ this.disabledSubOrderbtn = true;
+ this.disabledDeleteBtn = true;
+ this.disabledOfferPriceInputBtn = true;
+ }
+ if(!(this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice)){
+ this.showPrintSheetBtn = true;
+ this.showUploadSheetBtn = true;
+ this.showSubOrderbtn = true;
+ this.showDeleteBtn = true;
+ }
+ if((this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice) && this.coc.Order_status__c != "椹冲洖"){
+ this.showSaveOrderbtn1 = true;
+ }
+ if(this.coc.Order_status__c == "椹冲洖" && this.editAble){
+ this.showSaveOrderbtn2 = true;
+ }
+ if(this.coc.Order_status__c == "椹冲洖" && !this.editAble){
+ this.showReapplyBtn = true;
+ }
+ this.showSpinner = false;
+ this.showPage = true;
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍒濆鍖栭〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ this.showSpinner = false;
+ console.log("error:"+error);
+ this.showMyToast('鍒濆鍖栭〉闈㈠け璐�',error,'error');
+ })
+ }
+
+ //鎺掑簭
+ onHandleSort(event){
+ //灏嗗凡缁忛�夊ソ浜嗙殑鏀惧埌鍓嶉潰锛屼笉杩涜鎺掑簭
+ console.log('sort');
+ if(this.editAble){
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.currentRecord];
+ cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ let index = 0;
+ let selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+ let selectedRowsIds = [];
+ for(var i in selectedRows){
+ selectedRowsIds.push(selectedRows[i].recordId);
+ }
+ console.log('selectedRowsIds = ' + JSON.stringify(selectedRowsIds));
+ for(var i = 0;i < cloneData.length ; i++){
+ if(selectedRowsIds.indexOf(cloneData[i].recordId) != -1){
+ if(i != 0){
+ let temp = cloneData[index];
+ cloneData[index] = cloneData[i];
+ cloneData[i] = temp;
+ }
+ index++;
+ }
+ }
+ this.currentRecord = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }else{
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.currentRecord];
+ cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ this.currentRecord = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+ }
+
+ sortBy(field, reverse, primer) {
+ const key = primer
+ ? function (x) {
+ return primer(x[field]);
+ }
+ : function (x) {
+ return x[field];
+ };
+
+ return function (a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
+ };
+ }
+
+ //鏄惁鏈夎鍛�
+ get hasWarning(){
+ if(this.warningMsgs == null || this.warningMsgs.length == 0){
+ return false;
+ }
+ if(this.warningMsgs.length > 0){
+ return true;
+ }
+ }
+
+ //鏄惁鏈夐敊璇�
+ get hasError(){
+ if(this.errorMsgs == null || this.errorMsgs.length == 0){
+ return false;
+ }
+ if(this.errorMsgs.length > 0){
+ return true;
+ }
+ }
+
+ //鐗逛环change浜嬩欢
+ offerPriceChange(event){
+ this.coc.Offers_Price__c = event.detail.value;
+ }
+
+ //娑堣�楀搧鍚嶇Оchange浜嬩欢
+ category1Change(event){
+ this.category1 = event.detail.value;
+ }
+
+ //绗笁鍒嗙被change浜嬩欢
+ category3Change(event){
+ this.showSpinner = true;
+ this.category3 = event.detail.value;
+ this.category4 = '';
+ this.category5 = '';
+ categoryAllload({agencyProTypeStr:this.agencyProType, category3Str:this.category3})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.category4Option = result.category4Option;
+ this.category5Option = result.category5Option;
+ this.showSpinner = false;
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍔犺浇鍒嗙被澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //绗洓鍒嗙被change浜嬩欢
+ category4Change(event){
+ this.showSpinner = true;
+ this.category4 = event.detail.value;
+ this.category5 = '';
+ categoryload({agencyProTypeStr:this.agencyProType, category3Str:this.category3, category4Str:this.category4})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.category4Option = result.category4Option;
+ this.category5Option = result.category5Option;
+ this.showSpinner = false;
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍔犺浇鍒嗙被澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //绗簲鍒嗙被change浜嬩欢
+ category5Change(event){
+ this.category5 = event.detail.value;
+ }
+
+ //鎼滅储浜у搧
+ searchProduct(event){
+ this.showSpinner = true;
+ searchConsumableorderdetails({userWorkLocationStr:this.userWorkLocation,
+ agencyProTypeStr:this.agencyProType,
+ accountNameStr:this.accountName,
+ accountIdStr:this.accountid,
+ contractIdStr:this.contractId,
+ hospitalIdStr:this.hospitalId,
+ category1Str:this.category1,
+ category3Str:this.category3,
+ category4Str:this.category4,
+ category5Str:this.category5,
+ category_GoodStr:this.category_Goods,
+ specialCampaignStr:this.specialCampaign,
+ dealerProductIdStr:JSON.stringify(this.dealerProductId),
+ methodTypeStr:this.pageType,
+ editAbleStr:this.editAble,
+ consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
+ proLimitAndDateList : this.proLimitAndDate
+ })
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
+ this.currentPage = 1;
+ this.currentRecord = [];
+ this.showCurrentReocrd();
+ this.getAllChecked();
+ this.showSpinner = false;
+ this.errorMsgs = result.errorMsgList;
+ this.warningMsgs = result.warningMsgList;
+ // this.hasError = result.hasError;
+ // this.hasWarning = result.hasWarning;
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ })
+ }
+
+ //娓呴櫎鎼滅储鏍�
+ clear(event){
+ this.category1 = '';
+ this.category3 = '';
+ this.category4 = '';
+ this.category5 = '';
+ this.showSpinner = true;
+ searchConsumableorderdetails({
+ userWorkLocationStr:this.userWorkLocation,
+ agencyProTypeStr:this.agencyProType,
+ accountNameStr:this.accountName,
+ accountIdStr:this.accountid,
+ contractIdStr:this.contractId,
+ hospitalIdStr:this.hospitalId,
+ category1Str:this.category1,
+ category3Str:this.category3,
+ category4Str:this.category4,
+ category5Str:this.category5,
+ category_GoodStr:this.category_Goods,
+ specialCampaignStr:this.specialCampaign,
+ dealerProductIdStr:JSON.stringify(this.dealerProductId),
+ methodTypeStr:this.pageType,
+ editAbleStr:this.editAble,
+ consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
+ proLimitAndDateList : this.proLimitAndDate
+ }).then(result=>{
+ if(result.result == 'Success'){
+ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
+ this.currentPage = 1;
+ this.currentRecord = [];
+ this.showCurrentReocrd();
+ this.getAllChecked();
+ this.showSpinner = false;
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ }
+ })
+ }
+
+ //閫夋嫨鎵�鏈�
+ checkAll(event){
+ for(let i=0, len=this.consumableorderdetailsRecordsview.length; i < len ;i++){
+ this.consumableorderdetailsRecordsview[i].check = event.target.checked;
+ }
+ }
+
+ //閫夋嫨
+ check(event){
+ let index = event.target.getAttribute("data-index");
+ this.consumableorderdetailsRecordsview[index].check = event.target.checked;
+ }
+
+ //閲囪喘鏁伴噺change浜嬩欢
+ // consumableCountChange(event){
+ // let index = event.target.getAttribute("data-index");
+ // var value = event.target.value;
+ // this.consumableorderdetailsRecordsview[index].esd.Consumable_count__c = value;
+ // if(isNaN(value)){
+ // value=0.00;
+ // }
+ // if(value != null && value !=0 && value!=''){
+ // this.consumableorderdetailsRecordsview[index].check = true;
+ // }else{
+ // this.consumableorderdetailsRecordsview[index].check = false;
+ // }
+ // }
+
+ //淇濆瓨璁㈠崟
+ saveOrder(event){
+ this.showSpinner = true;
+ console.log('start save');
+ save({
+ contractNameStr:this.contractName,
+ cocStr:JSON.stringify(this.coc),
+ agencyProTypeStr:this.agencyProType,
+ accountidStr:this.accountid,
+ consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
+ contactDealerStr:JSON.stringify(this.contactDealer),
+ methodTypeStr:this.pageType,
+ eSetIdStr:this.esetId,
+ hospitalIdStr : this.hospitalId,
+ contractIdStr : this.contractId,
+ agencyProType1Str : this.agencyProType1,
+ OSHFLGStr : this.OSHFLG
+ }).then(result=>{
+ this.showSpinner = false;
+ if(result.result == 'Success'){
+ this.esetId = result.eSetId;
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexconsumable?ESetid=' + this.esetId + '&type=' + this.pageType
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('淇濆瓨澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //淇濆瓨璁㈠崟锛堥┏鍥烇級
+ orderCopy(event){
+ this.showSpinner = true;
+ ordrCopy({
+ contractNameStr:this.contractName,
+ cocStr:JSON.stringify(this.coc),
+ agencyProTypeStr:this.agencyProType,
+ accountidStr:this.accountid,
+ consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
+ contactDealerStr:JSON.stringify(this.contactDealer),
+ methodTypeStr:this.pageType,
+ hospitalIdStr:this.hospitalId,
+ contractIdStr : this.contractId,
+ agencyProType1Str : this.agencyProType1,
+ OSHFLGStr : this.OSHFLG
+ }).then(result=>{
+ this.showSpinner = false;
+ if(result.result == 'Success'){
+ this.esetId = result.eSetId;
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexconsumable?ESetid=' + this.esetId + '&type=' + this.pageType
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('淇濆瓨澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //缂栬緫
+ editOrder(event){
+ setEditAble({eSetidStr:this.esetId})
+ .then(result=>{
+ if(result.result == 'Success'){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: result.url
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('缂栬緫澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //鎵撳嵃閰嶇疆鍗�
+ printOrder(event){
+ var site = window.location.origin;
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: site+'/consumable/PrintConsumblePDF?ESetid='+this.esetId
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ //涓婁紶閰嶇疆鍗�
+ uploadOrder(event){
+ this.showAttPop = true;
+ }
+
+ //鎻愪氦璁㈠崟
+ submitOrder(event){
+ sorder({eSetidStr:this.esetId,accountidStr:this.accountid})
+ .then(result=>{
+ if(result.result == 'Success'){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: result.url
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ this.errorMsgs = result.errorMsgList;
+ this.warningMsgs = result.warningMsgList;
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg.indexOf("璇蜂笂浼犺璐ч厤缃崟闄勪欢") != -1){
+ result.errorMsg = '璇蜂笂浼犺璐ч厤缃崟闄勪欢';
+ }
+ this.showMyToast('鎻愪氦澶辫触',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ })
+ }
+
+ //鍒犻櫎璁㈠崟
+ deleteOrder(event){
+ if(!window.confirm('鍒犻櫎鏄笉鍙仮澶嶇殑锛屼綘纭瑕佸垹闄ゅ悧锛�')){
+ return;
+ }
+ delConsumable({eSetidStr:this.esetId})
+ .then(result=>{
+ if(result.result == 'Success'){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: result.url
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍒犻櫎澶辫触',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //鐗逛环閲戦褰曞叆
+ inputOfferPrice(event){
+ this.edoffersPrice = true;
+ if(!(this.editAble || this.edoffersPrice)){
+ this.showEditBtn = true;
+ this.showOfferPriceInputBtn = true;
+ }else{
+ this.showEditBtn = false;
+ this.showOfferPriceInputBtn = false;
+ }
+ if(!(this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice)){
+ this.showPrintSheetBtn = true;
+ this.showUploadSheetBtn = true;
+ this.showSubOrderbtn = true;
+ this.showDeleteBtn = true;
+ }else{
+ this.showPrintSheetBtn = false;
+ this.showUploadSheetBtn = false;
+ this.showSubOrderbtn = false;
+ this.showDeleteBtn = false;
+ }
+ if((this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice) && this.coc.Order_status__c != "椹冲洖"){
+ this.showSaveOrderbtn1 = true;
+ }else{
+ this.showSaveOrderbtn1 = false;
+ }
+ }
+
+ //鍐嶇敵璇�
+ reapplyOrder(event){
+ backOrder({eSetidStr:this.esetId})
+ .then(result=>{
+ if(result.result == 'Success'){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: result.url
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍐嶇敵璇峰け璐�',result.errorMsg,'error');
+ }
+ })
+ }
+
+ //闄勪欢change浜嬩欢
+ attChange(event){
+ if(event.target.files.length > 0) {
+ this.filesUploaded = event.target.files;
+ this.fileName = event.target.files[0].name;
+ console.log('this.fileName:'+this.fileName);
+ }
+ }
+
+ //鏄惁鏄剧ず闄勪欢绉婚櫎
+ get attDelBtn(){
+ if(this.fileName != '' && this.fileName != null && this.fileName != '璇烽�夋嫨涓�涓枃浠朵笂浼�'){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ //鍏抽棴闄勪欢寮圭獥
+ closePop(){
+ this.showAttPop = false;
+ this.filesUploaded = [];
+ this.fileName = null;
+ }
+
+ //绉婚櫎闄勪欢
+ removeAtt(){
+ this.filesUploaded = [];
+ this.fileName = '';
+ }
+
+ //涓婁紶闄勪欢
+ uploadAtt(event){
+ if(this.filesUploaded.length > 0) {
+ this.file = this.filesUploaded[0];
+ if (this.file.size > this.MAX_FILE_SIZE) {
+ window.console.log('鏂囦欢杩囧ぇ');
+ return ;
+ }
+ this.fileReader= new FileReader();
+
+ this.fileReader.onloadend = (() => {
+ this.fileContents = this.fileReader.result;
+ let base64 = 'base64,';
+ this.content = this.fileContents.indexOf(base64) + base64.length;
+ this.fileContents = this.fileContents.substring(this.content);
+ this.saveToFile();
+ });
+ this.fileReader.readAsDataURL(this.file);
+ }
+ else {
+ this.fileName = '璇烽�夋嫨涓�涓枃浠朵笂浼�';
+ }
+ }
+
+ //璋冪敤涓婁紶闄勪欢鍚庡彴鏂规硶
+ saveToFile() {
+ this.showPopSpinner = true;
+ filesUpload({pId:this.esetId, fileName: this.file.name, base64Data: encodeURIComponent(this.fileContents)})
+ .then(result => {
+ this.showPopSpinner = false;
+ if(result.result == 'Success'){
+ this.closePop();
+ window.location.reload();
+ }else{
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('涓婁紶澶辫触',result.errorMsg,'error');
+ }
+ })
+ .catch(error => {
+ this.showPopSpinner = false;
+ this.showMyToast('涓婁紶澶辫触',error,'error');
+ });
+ }
+
+ //鍒犻櫎闄勪欢
+ deleteAtt(event){
+ this.showSpinner = true;
+ var recordId = event.target.getAttribute("data-fileid");
+ console.log('attid:'+recordId);
+ deleteAtt({contentVersionId : recordId})
+ .then(result=>{
+ this.showSpinner = false;
+ if(result.result == 'Success'){
+ window.location.reload();
+ }else{
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍒犻櫎澶辫触',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ this.showSpinner = false;
+ console.log("Error:"+error);
+ this.showMyToast('鍒犻櫎澶辫触',JSON.stringify(error),'error');
+ })
+ }
+
+ //棰勮闄勪欢
+ previweAtt(event){
+ var recordId = event.target.getAttribute("data-fileid");
+ console.log(recordId);
+ this[NavigationMixin.Navigate]({
+ type:'standard__namedPage',
+ attributes:{
+ pageName:'filePreview'
+ },
+ state:{
+ recordIds: recordId,
+ selectedRecordId: recordId
+ }
+ });
+ }
+
+ //鎵撳紑鎼滅储寮圭獥锛屽苟鍒濆鍖栧脊绐�
+ showSearchHos(event){
+ initHospital()
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.showAttHosPop = true;
+ this.hospitalList = result.attList;
+ for(var i in this.hospitalList){
+ if(this.hospitalList[i].State_Master__c){
+ this.hospitalList[i]['StateMaster'] = this.hospitalList[i].State_Master__r.Name;
+ }
+ }
+ }else{
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍒濆鍖栨绱㈠尰闄㈤〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鍒濆鍖栨绱㈠尰闄㈤〉闈㈠け璐�',error,'error');
+ })
+ }
+
+ //妫�绱㈠尰闄�
+ searchHos(event){
+ searchHospital({searchName:this.searchNameHos, accountId:this.accountid})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.hospitalList = result.attList;
+ for(var i in this.hospitalList){
+ if(this.hospitalList[i].State_Master__c){
+ this.hospitalList[i]['StateMaster'] = this.hospitalList[i].State_Master__r.Name;
+ }
+ }
+ }else{
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鎼滅储澶辫触',error,'error');
+ })
+ }
+
+ //鍖婚櫌鍚嶇Оchange
+ searchNameHosChange(event){
+ this.searchNameHos = event.detail.value;
+ }
+
+ //鍏抽棴寮圭獥
+ closeHospitalPop(){
+ this.showAttHosPop = false;
+ this.chooseHospital = '';
+ this.chooseHospitalId = '';
+ }
+
+ // //閫夋嫨鍖婚櫌
+ // chooseHos(event){
+ // var hosName = event.target.getAttribute("data-name");
+ // var hosid = event.target.getAttribute("data-hosid");
+ // console.log('hos:'+hosName+'---'+hosid);
+ // this.chooseHospital = hosName;
+ // this.chooseHospitalId = hosid;
+ // }
+
+ changeHos(event){
+ this.hospitalName = event.detail.value;
+ }
+
+ changeCon(event){
+ this.contractName = event.detail.value;
+ }
+
+ chooseHos(event){
+ const row = event.detail.row;
+ this.chooseHospitalId = row.Id;
+ this.chooseHospital = row.Name;
+ console.log('row.Id:'+row.Id);
+ console.log('row.Name:'+row.Name);
+ this.confirmHospital();
+ }
+
+ //纭閫夋嫨鍖婚櫌
+ confirmHospital(){
+ if(this.chooseHospital != '' && this.chooseHospital != null){
+ this.hospitalId = this.chooseHospitalId;
+ this.tempidHp = this.chooseHospitalId;
+ this.hospitalName = this.chooseHospital;
+ this.closeHospitalPop();
+ //娑堥櫎璀﹀憡
+ var arr = [];
+ for(var i in this.warningMsgs){
+ if(this.warningMsgs[i] != '璇烽�夋嫨鍖婚櫌'){
+ arr.push(this.warningMsgs[i]);
+ }
+ }
+ this.warningMsgs = arr;
+ if(this.tempidHp != 'tempId' && this.tempidHp != ''){
+ searchorderdetails({
+ methodTypeStr : this.pageType,
+ accountIdStr : this.accountid,
+ hospitalIdStr : this.hospitalId,
+ contractIdStr : this.contractId,
+ userWorkLocationStr : this.userWorkLocation,
+ accountNameStr : this.accountName,
+ proLimitAndDateList : this.proLimitAndDate,
+ editAbleStr : this.editAble
+ }).then(result=>{
+ if(result.result == 'Success'){
+ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
+ this.currentPage = 1;
+ this.currentRecord = [];
+ this.showCurrentReocrd();
+ this.getAllChecked();
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储浜у搧澶辫触',result.errorMsg,'error');
+ }
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鎼滅储浜у搧澶辫触',error,'error');
+ })
+ this.tempidHp = 'tempId';
+ }
+ }else{
+ this.showMyToast('璇烽�夋嫨鍖婚櫌','','error');
+ }
+ }
+
+ //鎵撳紑鍚堝悓妫�绱㈠脊绐楀苟鍒濆鍖�
+ showSearchCon(){
+ initContract({ctype:this.agencyProType1})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.showConPop = true;
+ this.contractList = result.attList;
+ for(var i in this.contractList){
+ if(this.contractList[i].State_Master__c){
+ this.contractList[i]['StateMaster'] = this.contractList[i].State_Master__r.Name;
+ }
+ }
+ }else{
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鍒濆鍖栨绱㈠悎鍚岄〉闈㈠け璐�',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鍒濆鍖栨绱㈠悎鍚岄〉闈㈠け璐�',error,'error');
+ })
+ }
+
+ //妫�绱㈠悎鍚�
+ searchCon(){
+ searchContract({searchName:this.searchNameCon, accountId:this.accountid, ctype:this.agencyProType1,OSHFLGStr : this.OSHFLG})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.contractList = result.attList;
+ for(var i in this.contractList){
+ if(this.contractList[i].State_Master__c){
+ this.contractList[i]['StateMaster'] = this.contractList[i].State_Master__r.Name;
+ }
+ }
+ }else{
+ console.log("Error:"+result.errorMsg);
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鎼滅储澶辫触',error,'error');
+ })
+ }
+
+ searchNameConChange(event){
+ this.searchNameCon = event.detail.value;
+ }
+
+ //鍏抽棴寮圭獥
+ closeContractPop(){
+ this.showConPop = false;
+ this.chooseContract = '';
+ this.chooseContractId = '';
+ }
+
+ //閫夋嫨鍚堝悓
+ // chooseCon(event){
+ // var conName = event.target.getAttribute("data-name");
+ // var conid = event.target.getAttribute("data-hosid");
+ // console.log('hos:'+conName+'---'+conid);
+ // this.chooseContract = conName;
+ // this.chooseContractId = conid;
+ // }
+
+ chooseCon(event){
+ const row = event.detail.row;
+ this.chooseContractId = row.Id;
+ this.chooseContract = row.Name;
+ console.log('row.Id:'+row.Id);
+ console.log('row.Name:'+row.Name);
+ this.confirmContract();
+ }
+
+ //纭閫夋嫨鍚堝悓
+ confirmContract(){
+ if(this.chooseContract != '' && this.chooseContract != null){
+ this.contractId = this.chooseContractId;
+ this.tempidPp = this.chooseContractId;
+ this.contractName = this.chooseContract;
+ this.closeContractPop();
+ if(this.tempidPp != 'tempId' && this.tempidPp != '' && this.contractId != '' && this.pageType == 'promotionorder'){
+ searchorderdetails({
+ methodTypeStr : this.pageType,
+ accountIdStr : this.accountid,
+ hospitalIdStr : this.hospitalId,
+ contractIdStr : this.contractId,
+ userWorkLocationStr : this.userWorkLocation,
+ accountNameStr : this.accountName,
+ proLimitAndDateList : this.proLimitAndDate,
+ editAbleStr : this.editAble
+ }).then(result=>{
+ if(result.result == 'Success'){
+ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
+ this.currentPage = 1;
+ this.currentRecord = [];
+ this.showCurrentReocrd();
+ this.getAllChecked();
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏虫暟鎹�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储浜у搧澶辫触',result.errorMsg,'error');
+ }
+ }
+ })
+ .catch(error=>{
+ console.log("Error:"+error);
+ this.showMyToast('鎼滅储浜у搧澶辫触',error,'error');
+ })
+ this.tempidPp = 'tempId';
+ }
+ }else{
+ this.showMyToast('璇烽�夋嫨鍚堝悓','','error');
+ }
+ }
+
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').
+ showToast(variant,content,iconName,10000);
+ // var mode;
+ // if(this.isNoteStay){
+ // mode ='sticky';
+ // }else{
+ // mode = 'dismissable';
+ // }
+ // const evt = new ShowToastEvent({
+ // title: title,
+ // message: message,
+ // variant: variant,
+ // mode: mode
+ // });
+ // this.dispatchEvent(evt);
+ }
+
+ //鍒嗛〉
+ showCurrentReocrd(){
+ var startIndex = 0;
+ var endIndex = 0;
+ console.log('len:'+this.consumableorderdetailsRecordsview.length);
+ if(this.consumableorderdetailsRecordsview != null && this.consumableorderdetailsRecordsview.length > 0){
+ var currentRecord = [];
+ var currentCount = 0;
+ var mu = this.consumableorderdetailsRecordsview.length % this.pageSize;
+ if(this.currentPage == this.totalPage){
+ if(mu != 0){
+ currentCount = mu;
+ }else{
+ currentCount = this.pageSize;
+ }
+ }else{
+ currentCount = this.pageSize;
+ }
+ console.log('this.totalPage:'+this.totalPage);
+ console.log('this.pageSize:'+this.pageSize);
+ console.log('mu:'+mu);
+ console.log('currentCount:'+currentCount);
+ startIndex = (this.currentPage - 1) * this.pageSize;
+ endIndex = parseInt(startIndex) + parseInt(currentCount) - 1;
+ console.log('startIndex:'+startIndex);
+ console.log('endIndex:'+endIndex);
+ if(this.editAble){
+ for(var i in this.currentRecord){
+ if(this.currentRecord[i].check){
+ currentRecord.push(this.currentRecord[i]);
+ }
+ }
+ }
+ for(var i = startIndex; i <= endIndex; i++){
+ var count = 0;
+ for(var j in this.currentRecord){
+ if(this.consumableorderdetailsRecordsview[i].recordId == this.currentRecord[j].recordId){
+ count++;
+ }
+ }
+ if(count == 0){
+ currentRecord.push(this.consumableorderdetailsRecordsview[i]);
+ }
+ }
+ this.recordStart = startIndex + 1;
+ this.recordEnd = endIndex + 1;
+ this.currentRecord = currentRecord;
+ }else{
+ this.currentPage = 0;
+ this.currentRecord = [];
+ }
+ }
+
+ get prePage(){
+ return this.currentPage - 1;
+ }
+
+ get nextPage(){
+ return this.currentPage + 1;
+ }
+
+ get totalPage(){
+ if(this.consumableorderdetailsRecordsview.length % this.pageSize == 0){
+ return Math.trunc(this.consumableorderdetailsRecordsview.length / this.pageSize);
+ }else{
+ return Math.trunc(this.consumableorderdetailsRecordsview.length / this.pageSize) + 1;
+ }
+ }
+
+ get totalRecords(){
+ return this.consumableorderdetailsRecordsview.length;
+ }
+
+ //绗竴椤�
+ goFirstPage(){
+ this.currentPage = 1;
+ this.showCurrentReocrd();
+ }
+
+ //鏈�鍚庝竴椤�
+ goLastPage(){
+ this.currentPage = this.totalPage;
+ this.showCurrentReocrd();
+ }
+
+ //涓婁竴椤�
+ prePageClick(){
+ this.currentPage = this.currentPage - 1;
+ this.showCurrentReocrd();
+ }
+
+ //涓嬩竴椤�
+ nextPageClick(){
+ this.currentPage = this.currentPage + 1;
+ this.showCurrentReocrd();
+ }
+
+ //page size change
+ pageSizeChange(event){
+ console.log('pagesize:'+event.detail);
+ this.pageSize = event.detail;
+ this.currentPage = 1;
+ this.currentRecord = [];
+ this.showCurrentReocrd();
+ }
+
+ //涓婁竴椤垫寜閽槸鍚isable
+ get previousButtonDisabled() {
+ return this.currentPage == 1 || this.currentPage == 0;
+ }
+
+ //涓嬩竴椤垫寜閽槸鍚isable
+ get nextButtonDisabled() {
+ return this.currentPage == this.totalPage;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.js-meta.xml b/force-app/main/default/lwc/lexConsumable/lexConsumable.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.css b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.css
new file mode 100644
index 0000000..c5f75f0
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.css
@@ -0,0 +1,23 @@
+@import 'c/lexCssUtility';
+.outerBorderCss{
+ border: 1px solid #D4D4D4;
+ border-radius : 5px;
+ border-top : 3px solid #565959;
+}
+.borderCss{
+ border: 1px solid #D4D4D4;
+ border-radius : 5px;
+ margin-bottom : 7px;
+ border-top : 3px solid #565959;
+}
+.headerDorderCss{
+ border-top: 1px solid #565959;
+ border-bottom: 1px solid #D4D4D4;
+ padding:3px;
+}
+.centerCss{
+ text-align: center;
+}
+.centerCss .left{
+ margin-left: 100px;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html
new file mode 100644
index 0000000..d0db616
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html
@@ -0,0 +1,384 @@
+<!-- sldsValidatorIgnore -->
+<!-- sldsValidatorIgnore -->
+<template>
+ <c-common-toast></c-common-toast>
+ <template if:true={isShowSpinner}>
+ <lightning-spinner alternative-text="Loading" size="large"></lightning-spinner>
+ </template>
+
+ <template if:false={isShowAccountInfo}>
+ <div class="outerBorderCss">
+ <div style="padding: 5px">
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small" size="2">
+ <lightning-icon icon-name="action:priority" alternative-text="priority" title="priority"
+ size="x-small" style="float: left;"></lightning-icon>
+ <p style="font-size: 18px; margin-left: 5px;float: left;">
+ <strong>閿�閲忓墠鍗�</strong>
+ </p>
+ </lightning-layout-item>
+ <lightning-layout-item size="7"></lightning-layout-item>
+ <lightning-layout-item padding="around-small" size="3">
+ <lightning-combobox name="progress" label="璐㈠勾" value={fiscalYearOption}
+ variant="label-hidden" options={fiscalYearOptions} onchange={dataChange}
+ data-field="fiscalYearOption" class="inputFont" style="
+ min-width: 250px;
+ max-width: 250px;
+ margin-left: 10px;
+ float: left;
+ "></lightning-combobox>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <!-- <lightning-datatable key-field="id" data={topAccountData} columns={topColumns} hide-checkbox-column
+ class="wrapped-header-datatable">
+ </lightning-datatable> -->
+
+ <c-lex-custom-lightning-datatable key-field="Id" data={topAccountData} columns={topColumns}
+ hide-checkbox-column style="word-wrap: break-word; word-break: break-all"
+ class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ </div>
+ </div>
+
+ <div class="borderCss">
+ <!-- <div style="padding: 15px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <div class="slds-m-top_small slds-m-bottom_medium">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <lightning-icon icon-name="standard:account" alternative-text="Account" title="瀹㈡埛"
+ size="small"></lightning-icon>
+ <lightning-combobox name="progress" label="瀹㈡埛" value={viewOption}
+ variant="label-hidden" options={listViewOptions} onchange={dataChange}
+ data-field="viewOption" style="
+ min-width: 250px;
+ max-width: 250px;
+ margin-left: 10px;
+ "></lightning-combobox>
+ </div>
+ </div>
+ </div>
+ </div> -->
+
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <!-- <lightning-icon icon-name="action:priority" alternative-text="priority" title="priority"
+ size="x-small" style="float: left;"></lightning-icon>
+ <p style="font-size: 18px; margin-left: 5px;float: left;">
+ <strong>閿�閲忓墠鍗�</strong>
+ </p> -->
+ <lightning-icon icon-name="standard:account" alternative-text="Account" title="瀹㈡埛"
+ size="small" style="float: left;margin-top:3px"></lightning-icon>
+ <lightning-combobox name="progress" label="瀹㈡埛" value={viewOption} variant="label-hidden"
+ options={listViewOptions} onchange={dataChange} data-field="viewOption"
+ class="inputFont" style="
+ min-width: 250px;
+ max-width: 250px;
+ margin-left: 10px;
+ float: left;
+ "></lightning-combobox>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+
+ <div class="borderCss">
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <div class="slds-m-top_small slds-m-bottom_medium">
+ <lightning-datatable key-field="id" data={pageRecords} columns={columns}
+ hide-checkbox-column default-sort-direction={defaultSortDirection}
+ sorted-direction={sortDirection} sorted-by={sortedBy} onsort={onHandleSort}
+ class="wrapped-header-datatable">
+ </lightning-datatable>
+ <c-paginator onprevious={handlePrevious} onnext={handleNext}
+ onpageschange={handlePageschange} onfirst={handleFirst} onlast={handleLast}
+ page-size-options={pageSizeOptions}
+ previous-button-disabled={previousButtonDisabled}
+ next-button-disabled={nextButtonDisabled} record-start={recordStart}
+ record-end={recordEnd} total-records={totalRecords}></c-paginator>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </template>
+
+ <template if:true={isShowAccountInfo}>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ 瀹㈡埛
+ <div></div>
+ <strong style="font-size: 20px">{accountDataInfo.name}</strong>
+ <p>
+ <lightning-formatted-url value="/lexconsumableaccount" label="杩斿洖鍒楄〃"></lightning-formatted-url>
+ </p>
+ </lightning-layout-item>
+ <lightning-layout-item size="9"></lightning-layout-item>
+ <lightning-layout-item size="1">
+ <p>
+ <lightning-formatted-url value={printUrl} label="鍙墦鍗拌鍥�"></lightning-formatted-url>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <div class="outerBorderCss" style="margin-top: 20px">
+ <div style="padding: 5px">
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 16px">
+ <strong>瀹㈡埛璇︾粏淇℃伅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 3px; border-bottom: 1px solid #dde4e9">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 16px">
+ <strong>瀹㈡埛淇℃伅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <div draggable="false">
+ <div class="slds-m-top_small slds-m-bottom_medium">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="瀹㈡埛鍚�" value={accountDataInfo.name}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ " class="adjustHeight"></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="瀹㈡埛鎵�鏈変汉" value={accountDataInfo.ownerName}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="鍒悕1" value={accountDataInfo.site}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="鏈夋晥/鏃犳晥" value={accountDataInfo.isActive}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="鍒悕2" value={accountDataInfo.aliasName2}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="绂佺敤鐞嗙敱" value={accountDataInfo.banOnUseReason}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="鏀垮簻绛夌礆" value={accountDataInfo.grade}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="鍖婚櫌鎵�灞炴�ц川"
+ value={accountDataInfo.attributeType} variant="label-inline" read-only
+ style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="OCSM鍒嗙被(鍖婚櫌)"
+ value={accountDataInfo.oCMCategory} variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="鍖婚櫌涓撲笟鍖哄垎"
+ value={accountDataInfo.specialityType} variant="label-inline" read-only
+ style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ </div>
+
+ <div style="padding: 3px; border-bottom: 1px solid #dde4e9">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 16px">
+ <strong>鍦板潃淇℃伅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <div draggable="false">
+ <div class="slds-m-top_small slds-m-bottom_medium">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="鐪�" value={accountDataInfo.stateMasterName}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="鐢佃瘽" value={accountDataInfo.phone}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="甯�" value={accountDataInfo.cityMasterName}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="鐢佃瘽2" value={accountDataInfo.phoneCall}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="鍘�/鍖�" value={accountDataInfo.town}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="浼犵湡" value={accountDataInfo.fax}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="琛楅亾" value={accountDataInfo.street}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="閭紪" value={accountDataInfo.postalCode}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="鍦板潃" value={accountDataInfo.address}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ </div>
+
+ <div style="padding: 3px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 16px">
+ <strong>绯荤粺淇℃伅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <div draggable="false">
+ <div class="slds-m-top_small slds-m-bottom_medium">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <lightning-input type="text" label="姣嶅叕鍙�" value={accountDataInfo.parentName}
+ variant="label-inline" read-only style="
+ border-bottom: 1px solid #dde4e9;
+ "></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
new file mode 100644
index 0000000..8687cd2
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
@@ -0,0 +1,718 @@
+import { LightningElement, wire, api, track } from "lwc";
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import init from "@salesforce/apex/LexConsumableAccountController.init";
+import changeFiscalYearView from "@salesforce/apex/LexConsumableAccountController.changeFiscalYearView";
+import changelistView from "@salesforce/apex/LexConsumableAccountController.changelistView";
+import accountInit from "@salesforce/apex/LexConsumableAccountInfoController.init";
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+const columns = [
+ {
+ label: "瀹㈡埛鍚�",
+ fieldName: "NameUrl",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 345,
+ sortable: true,
+ type: "url",
+ typeAttributes: {
+ label: {
+ fieldName: "Name",
+ },
+ },
+ },
+ {
+ label: "鐪�",
+ fieldName: "StateMasterUrl",
+ hideDefaultActions: true,
+ initialWidth: 80,
+ wrapText: true,
+ sortable: true,
+ type: "url",
+ typeAttributes: {
+ label: {
+ fieldName: "StateMasterName",
+ },
+ target: "_blank",
+ },
+ },
+ {
+ label: "閿�鍞湰閮ㄥ尰闄�",
+ fieldName: "Salesdepartment_HP__c",
+ initialWidth: 115,
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ },
+ {
+ label: "鍒涘缓鏃ユ湡",
+ fieldName: "CreatedDate",
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ type: "date",
+ typeAttributes: {
+ timeZone: "Asia/Shanghai",
+ day: "numeric",
+ month: "numeric",
+ year: "numeric",
+ },
+ initialWidth: 100,
+ },
+ {
+ label: "鏈夋晥/鏃犳晥",
+ fieldName: "Is_Active__c",
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ initialWidth: 91,
+ },
+ {
+ label: "瀹㈡埛璁板綍绫诲瀷",
+ fieldName: "RecordTypeName",
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ initialWidth: 130,
+ },
+ {
+ label: "鏀垮簻绛夌骇",
+ fieldName: "Grade__c",
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ initialWidth: 86,
+ },
+ {
+ label: "OCSM鍒嗙被(鍖婚櫌)",
+ fieldName: "OCM_Category__c",
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ initialWidth: 150,
+ },
+ {
+ label: "甯�",
+ fieldName: "CityMasterNameUrl",
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ type: "url",
+ typeAttributes: {
+ label: {
+ fieldName: "CityMasterName",
+ },
+ target: "_blank",
+ },
+ },
+ {
+ label: "鍘�/鍖�",
+ fieldName: "Town__c",
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ },
+ {
+ label: "瀹㈡埛鐢佃瘽",
+ fieldName: "Phone",
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ },
+];
+
+const topColumns = [
+ {
+ label: "瀹㈡埛鍚�",
+ fieldName: "NameUrl",
+ hideDefaultActions: true,
+ wrapText: true,
+ type: "url",
+ typeAttributes: {
+ label: {
+ fieldName: "Name",
+ },
+ },
+ },
+ {
+ label: "甯�",
+ fieldName: "CityMasterNameUrl",
+ hideDefaultActions: true,
+ wrapText: true,
+ type: "url",
+ typeAttributes: {
+ label: {
+ fieldName: "CityMasterName",
+ },
+ target: "_blank",
+ },
+ },
+ {
+ label: "鍘�/鍖�",
+ fieldName: "Town__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "閿�閲忓崰姣�",
+ fieldName: "proportion",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 100,
+ cellAttributes: { alignment: "right" },
+ },
+ {
+ label: "鎿嶄綔",
+ fieldName: "Town__c",
+ type: 'weeklyReport',
+ initialWidth: 150,
+ typeAttributes: {
+ recordId: { fieldName: "Id" },
+ hospitalName: { fieldName: "Name" },
+ isShowButton: { fieldName: "isShowButton" },
+ },
+ hideDefaultActions: true,
+ }
+];
+export default class LexConsumableAccount extends LightningElement {
+ columns = columns;
+ topColumns = topColumns;
+ @track isShowSpinner = true;
+ @track pageRecords = [];
+ @track accountId = "";
+ @track agencyProType = "";
+ @track agencyProTypestr = "";
+ @track listViewOptions = [
+ {
+ label: "01. 鍖婚櫌_Hospital",
+ value: "01. 鍖婚櫌_Hospital",
+ },
+ {
+ label: "61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌",
+ value: "61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌",
+ },
+ {
+ label: "62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌",
+ value: "62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌",
+ },
+ {
+ label: "63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�",
+ value: "63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�",
+ },
+ ];
+ @track viewOption = "01. 鍖婚櫌_Hospital";
+
+ @track isShowAccountInfo = false;
+ @track topAccountData = [];
+
+ //鍓嶇鎺掑簭
+ defaultSortDirection = "asc";
+ sortDirection = "asc";
+ sortedBy;
+
+ //鍒嗛〉start
+ @track sortBy = "";
+ @track pageSize = 10;
+ error;
+ records;
+ currentPageToken = 0;
+ nextPageToken = this.pageSize;
+ @track totalRecords = 0;
+ @track loader = false;
+ @track pageNumber = 1;
+ @track paginationVisibility = false;
+ @track totalPages = 1;
+ pageSizeOptions = [10, 25, 50, 100];
+ @track recordStart = 0;
+ @track recordEnd = 0;
+ //end
+
+ @track AccId = "";
+ @track printUrl = "";
+ @track accountDataInfo = {
+ name: "",
+ ownerName: "",
+ site: "",
+ isActive: "",
+ aliasName2: "",
+ banOnUseReason: "",
+ grade: "",
+ attributeType: "",
+ oCMCategory: "",
+ specialityType: "",
+ stateMasterName: "",
+ phone: "",
+ cityMasterName: "",
+ phoneCall: "",
+ town: "",
+ fax: "",
+ street: "",
+ postalCode: "",
+ address: "",
+ parentName: "",
+ };
+
+
+ stylesLoaded = false;
+
+ //璐㈠勾
+ @track fiscalYearOptions = [
+ { label: '鏈储骞�', value: 'thisYear' },
+ { label: '涓婁竴璐㈠勾', value: 'lastYear' },
+ { label: '涓婁竴璐㈠勾+鏈储骞�', value: 'allYear' },
+ ];
+ @track fiscalYearOption = 'thisYear';
+ @track topInfo = [];
+
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+ //鑾峰彇閾炬帴鍙傛暟
+ getQueryString(name) {
+ console.log("getQueryString name " + name);
+ let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+ let r = window.location.search.substr(1).match(reg);
+ if (r != null) {
+ return decodeURIComponent(r[2]);
+ }
+ return null;
+ }
+
+ connectedCallback() {
+ this.AccId = this.getQueryString("AccId");
+ this.AccId = this.AccId == null ? "" : this.AccId;
+ if (this.AccId != "") {
+ console.log("this.AccId = " + this.AccId);
+ accountInit({
+ accId: this.AccId,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.accountDataInfo.name = r.entity.obj.Name;
+ this.accountDataInfo.ownerName =
+ r.entity.obj.Owner == null ? "" : r.entity.obj.Owner.Name;
+ this.accountDataInfo.site = r.entity.obj.site;
+ this.accountDataInfo.isActive = r.entity.obj.Is_Active__c;
+ this.accountDataInfo.aliasName2 = r.entity.obj.Alias_Name2__c;
+ this.accountDataInfo.banOnUseReason =
+ r.entity.obj.Ban_On_Use_Reason__c;
+ this.accountDataInfo.grade = r.entity.obj.Grade__c;
+ this.accountDataInfo.attributeType = r.entity.obj.Attribute_Type__c;
+ this.accountDataInfo.oCMCategory = r.entity.obj.OCM_Category__c;
+ this.accountDataInfo.specialityType =
+ r.entity.obj.Speciality_Type__c;
+ this.accountDataInfo.stateMasterName =
+ r.entity.obj.State_Master__r == null
+ ? ""
+ : r.entity.obj.State_Master__r.Name;
+ this.accountDataInfo.phone = r.entity.obj.Phone;
+ this.accountDataInfo.cityMasterName =
+ r.entity.obj.City_Master__r == null
+ ? ""
+ : r.entity.obj.City_Master__r.Name;
+ this.accountDataInfo.phoneCall = r.entity.obj.PhoneCall__c;
+ this.accountDataInfo.town = r.entity.obj.Town__c;
+ this.accountDataInfo.fax = r.entity.obj.Fax;
+ this.accountDataInfo.street = r.entity.obj.Street__c;
+ this.accountDataInfo.postalCode = r.entity.obj.Postal_Code__c;
+ this.accountDataInfo.address = r.entity.obj.Address__c;
+ this.accountDataInfo.parentName =
+ r.entity.obj.Parent == null ? "" : r.entity.obj.Parent.Name;
+ console.log(
+ "this.accountDataInfo = " + JSON.stringify(this.accountDataInfo)
+ );
+ this.printUrl =
+ "/lexconsumableaccountinfoprint?AccId=" + this.AccId;
+ this.isShowAccountInfo = true;
+ this.isShowSpinner = false;
+ } else {
+ console.log("r = " + JSON.stringify(r));
+ this.showMyToast('Error', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ this.showMyToast('Error', '鍒濆鍖栧け璐�', 'Error');
+ });
+ } else {
+ init({
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken,
+ fiscalYear: this.fiscalYearOption
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ //鍒嗛〉
+ this.nextPageToken = r.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords = r.entity.paginatedAccounts.totalRecords;
+ this.recordStart = r.entity.paginatedAccounts.recordStart;
+ this.recordEnd = r.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(
+ r.entity.paginatedAccounts.totalRecords / this.pageSize
+ );
+ console.log("this.totalPages = " + this.totalPages);
+ this.paginationVisibility = this.totalPages > 1 ? true : false;
+
+ this.pageRecords = r.entity.pageRecords;
+ this.accountId = r.entity.accountId;
+ this.agencyProType = r.entity.agencyProType;
+ this.agencyProTypestr = r.entity.agencyProTypestr;
+ console.log("this.agencyProTypestr = " + this.agencyProTypestr);
+ for (var i in this.pageRecords) {
+ this.pageRecords[i]["NameUrl"] = "/lexconsumableaccount?AccId=" + this.pageRecords[i].Id;
+ this.pageRecords[i]["StateMasterName"] = this.pageRecords[i].State_Master__r.Name;
+ this.pageRecords[i]["StateMasterUrl"] = "/" + this.pageRecords[i].State_Master__c;
+ this.pageRecords[i]["CityMasterName"] = this.pageRecords[i].City_Master__r.Name;
+ this.pageRecords[i]["CityMasterNameUrl"] = "/" + this.pageRecords[i].City_Master__c;
+ this.pageRecords[i]["RecordTypeName"] = this.pageRecords[i].RecordType.Name;
+ }
+ console.log(
+ "this.listViewOptions = " + JSON.stringify(this.listViewOptions)
+ );
+
+ console.log('r.entity.topInfo = ' + JSON.stringify(r.entity.topInfo))
+ //top10瀹㈡埛
+ this.topInfo = r.entity.topInfo;
+ console.log("this.topInfo = " + JSON.stringify(this.topInfo));
+ this.topAccountData = this.topInfo.acList;
+ console.log(
+ "this.topAccountData = " + JSON.stringify(this.topAccountData)
+ );
+ console.log('9/3 = ' + this.keepTwoDecimalStr(this.amend(9, 3, '/').toFixed(2)));
+ let total = 100;
+ for (var i in this.topAccountData) {
+ console.log('i = ' + i);
+ this.topAccountData[i]["NameUrl"] = "/lexconsumableaccount?AccId=" + this.topAccountData[i].Id;
+ this.topAccountData[i]["StateMasterName"] = this.topAccountData[i].State_Master__r.Name;
+ this.topAccountData[i]["StateMasterUrl"] = "/" + this.topAccountData[i].State_Master__c;
+ this.topAccountData[i]["CityMasterName"] = this.topAccountData[i].City_Master__r.Name;
+ this.topAccountData[i]["CityMasterNameUrl"] = "/" + this.topAccountData[i].City_Master__c;
+ this.topAccountData[i]["RecordTypeName"] = this.topAccountData[i].RecordType.Name;
+ this.topAccountData[i]["isShowButton"] = true;
+ let number = this.keepTwoDecimalStr((this.amend(this.topInfo.deList[i], this.topInfo.saleAmount, '/') * 100).toFixed(2));
+ total -= number;
+ this.topAccountData[i]["proportion"] = number + '%';
+ }
+
+ // //鍏朵粬
+ if (total != 100) {
+ this.topAccountData.push({
+ Name: '...',
+ NameUrl: '/lexconsumableaccount',
+ proportion: total.toFixed(2) + '%',
+ CityMasterName: '...',
+ CityMasterNameUrl: '/lexconsumableaccount',
+ Town__c: '...',
+ isShowButton: false
+ })
+ } else {
+ let title = '';
+ for (var key in this.fiscalYearOptions) {
+ if (this.fiscalYearOption == this.fiscalYearOptions[key].value)
+ title = this.fiscalYearOptions[key].label;
+ }
+ this.showMyToast(title, '鏃犳暟鎹�', 'Error');
+ }
+ this.isShowSpinner = false;
+ } else {
+ console.log("r = " + JSON.stringify(r));
+ this.showMyToast('Error', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ this.showMyToast('Error', '閿�閲忓墠鍗佸鎴峰垵濮嬪寲澶辫触', 'Error');
+ });
+ }
+ }
+
+ amend(num1, num2, symbol) {
+ var str1 = num1.toString(),
+ str2 = num2.toString(),
+ result,
+ str1Length,
+ str2Length;
+ //瑙e喅鏁存暟娌℃湁灏忔暟鐐规柟娉�
+ try {
+ str1Length = str1.split(".")[1].length;
+ } catch (error) {
+ str1Length = 0;
+ }
+ try {
+ str2Length = str2.split(".")[1].length;
+ } catch (error) {
+ str2Length = 0;
+ }
+ var step = Math.pow(10, Math.max(str1Length, str2Length));
+ console.log(step);
+ switch (symbol) {
+ case "+":
+ result = (num1 * step + num2 * step) / step;
+ break;
+ case "-":
+ result = (num1 * step - num2 * step) / step;
+ break;
+ case "*":
+ result = (num1 * step * (num2 * step)) / step / step;
+ break;
+ case "/":
+ result = (num1 * step) / (num2 * step);
+ break;
+ default:
+ break;
+ }
+ return result;
+ }
+
+
+ keepTwoDecimalStr(num) {
+ const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
+ let s = result.toString();
+ let rs = s.indexOf('.');
+ if (rs < 0) {
+ rs = s.length;
+ s += '.';
+ }
+ while (s.length <= rs + 2) {
+ s += '0';
+ }
+ return s;
+ };
+
+ dataChange(event) {
+ let fieldName = event.target.getAttribute("data-field");
+ let value = event.detail.value;
+ console.log("fieldName = " + fieldName + " value = " + value);
+ switch (fieldName) {
+ case 'viewOption':
+ this.viewOption = value;
+ this.changelistView();
+ break;
+ case 'fiscalYearOption':
+ this.fiscalYearOption = value;
+ this.changeFiscalYear();
+ break;
+ }
+ }
+
+ changeFiscalYear() {
+ this.isShowSpinner = true;
+ changeFiscalYearView({
+ fiscalYear: this.fiscalYearOption
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ //top10瀹㈡埛
+ this.topInfo = r.entity.topInfo;
+ console.log("this.topInfo = " + JSON.stringify(this.topInfo));
+ this.topAccountData = this.topInfo.acList;
+ console.log(
+ "this.topAccountData = " + JSON.stringify(this.topAccountData)
+ );
+ let total = 100;
+ for (var i in this.topAccountData) {
+ console.log('i = ' + i);
+ this.topAccountData[i]["NameUrl"] = "/lexconsumableaccount?AccId=" + this.topAccountData[i].Id;
+ this.topAccountData[i]["StateMasterName"] = this.topAccountData[i].State_Master__r.Name;
+ this.topAccountData[i]["StateMasterUrl"] = "/" + this.topAccountData[i].State_Master__c;
+ this.topAccountData[i]["CityMasterName"] = this.topAccountData[i].City_Master__r.Name;
+ this.topAccountData[i]["CityMasterNameUrl"] = "/" + this.topAccountData[i].City_Master__c;
+ this.topAccountData[i]["RecordTypeName"] = this.topAccountData[i].RecordType.Name;
+ this.topAccountData[i]["isShowButton"] = true;
+ let number = this.keepTwoDecimalStr((this.amend(this.topInfo.deList[i], this.topInfo.saleAmount, '/') * 100).toFixed(2));
+ total -= number;
+ this.topAccountData[i]["proportion"] = number + '%';
+ }
+
+ // //鍏朵粬
+ if (total != 100) {
+ this.topAccountData.push({
+ Name: '...',
+ NameUrl: '/lexconsumableaccount',
+ proportion: total.toFixed(2) + '%',
+ CityMasterName: '...',
+ CityMasterNameUrl: '/lexconsumableaccount',
+ Town__c: '...',
+ isShowButton: false
+ })
+ } else {
+ let title = '';
+ for (var key in this.fiscalYearOptions) {
+ if (this.fiscalYearOption == this.fiscalYearOptions[key].value)
+ title = this.fiscalYearOptions[key].label;;
+ }
+ this.showMyToast(title, '鏃犳暟鎹�', 'Error');
+ }
+
+ this.isShowSpinner = false;
+ } else {
+ console.log("r = " + JSON.stringify(r));
+ this.showMyToast('Error', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ this.showMyToast('Error', '閿�閲忓墠鍗佸鎴峰垵濮嬪寲澶辫触', 'Error');
+ });
+ }
+
+ changelistView() {
+ this.isShowSpinner = true;
+ changelistView({
+ filterNameLwc: this.viewOption,
+ accountIdLwc: this.accountId,
+ agencyProTypeLwc: this.agencyProType,
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken,
+ sortFieldLWC: this.sortBy,
+ sortOrderLWC: this.sortDirection,
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ //鍒嗛〉
+ this.nextPageToken = r.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords = r.entity.paginatedAccounts.totalRecords;
+ this.recordStart = r.entity.paginatedAccounts.recordStart;
+ this.recordEnd = r.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(
+ r.entity.paginatedAccounts.totalRecords / this.pageSize
+ );
+ console.log("this.totalPages = " + this.totalPages);
+ this.paginationVisibility = this.totalPages > 1 ? true : false;
+
+ this.pageRecords = r.entity.pageRecords;
+ console.log("this.pageRecords = " + JSON.stringify(this.pageRecords));
+ for (var i in this.pageRecords) {
+ this.pageRecords[i]["NameUrl"] =
+ "/lexconsumableaccount?AccId=" + this.pageRecords[i].Id;
+ this.pageRecords[i]["StateMasterName"] =
+ this.pageRecords[i].State_Master__r.Name;
+ this.pageRecords[i]["StateMasterUrl"] =
+ "/" + this.pageRecords[i].State_Master__c;
+ this.pageRecords[i]["CityMasterName"] =
+ this.pageRecords[i].City_Master__r.Name;
+ this.pageRecords[i]["CityMasterNameUrl"] =
+ "/" + this.pageRecords[i].City_Master__c;
+ this.pageRecords[i]["RecordTypeName"] =
+ this.pageRecords[i].RecordType.Name;
+ }
+ this.isShowSpinner = false;
+ } else {
+ this.showMyToast('Error', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error.message))
+ });
+ }
+
+ showMyToast(title, message, variant) {
+ this.isShowSpinner = false;
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if (variant.toLowerCase() == 'success') {
+ iconName = 'utility:check';
+ } else {
+ iconName = 'utility:error';
+ }
+ if (message != '') {
+ content = '<h2><strong>' + title + '<strong/></h2><h5>' + message + '</h5>';
+ } else {
+ content = '<h2><strong>' + title + '<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').showToast(variant, content, iconName, 10000);
+ }
+
+ sortByMethod(field, reverse, primer) {
+ const key = primer
+ ? function (x) {
+ return primer(x[field]);
+ }
+ : function (x) {
+ return x[field];
+ };
+
+ return function (a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
+ };
+ }
+
+ onHandleSort(event) {
+ this.sortBy = event.detail.fieldName;
+ switch (this.sortBy) {
+ case "NameUrl":
+ this.sortBy = "Name";
+ break;
+ case "StateMasterUrl":
+ this.sortBy = "State_Master__r.Name";
+ break;
+ case "RecordTypeName":
+ this.sortBy = "RecordType.Name";
+ break;
+ case "CityMasterNameUrl":
+ this.sortBy = "City_Master__r.Name";
+ break;
+ }
+ this.sortDirection = event.detail.sortDirection;
+ this.currentPageToken = 0;
+ console.log("this.sortBy = " + this.sortBy);
+ console.log("this.sortDirection = " + this.sortDirection);
+ this.changelistView();
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ this.sortByMethod(sortedBy, sortDirection === "asc" ? 1 : -1);
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+
+ handlePrevious() {
+ this.currentPageToken =
+ Number(this.currentPageToken) - Number(this.pageSize);
+ this.changelistView();
+ }
+
+ handleNext() {
+ this.currentPageToken =
+ Number(this.currentPageToken) + Number(this.pageSize);
+ this.changelistView();
+ }
+ handleFirst() {
+ this.currentPageToken = 0;
+ this.changelistView();
+ }
+
+ handleLast() {
+ this.currentPageToken =
+ this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+ this.changelistView();
+ }
+
+ handlePageschange(event) {
+ console.log(event.detail);
+ this.pageSize = event.detail;
+ this.currentPageToken = 0;
+ this.changelistView();
+ }
+ get previousButtonDisabled() {
+ return this.currentPageToken === 0;
+ }
+
+ get nextButtonDisabled() {
+ return this.nextPageToken === undefined;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js-meta.xml b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.css b/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.css
new file mode 100644
index 0000000..da7bb6e
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.css
@@ -0,0 +1,31 @@
+nav {
+ display: none;
+ visibility: hidden;
+}
+
+.outerBorderCss {
+ border: 1px solid #D4D4D4;
+ border-radius: 5px;
+ border-top: 3px solid #565959;
+}
+
+.borderCss {
+ border: 1px solid #D4D4D4;
+ border-radius: 5px;
+ margin-bottom: 7px;
+ border-top: 3px solid #565959;
+}
+
+.headerDorderCss {
+ border-top: 1px solid #565959;
+ border-bottom: 1px solid #D4D4D4;
+ padding: 3px;
+}
+
+.centerCss {
+ text-align: center;
+}
+
+.centerCss .left {
+ margin-left: 100px;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.html b/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.html
new file mode 100644
index 0000000..884c635
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.html
@@ -0,0 +1,189 @@
+<template>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ <strong style="font-size: 20px;">娑堣�楀搧绠$悊绯荤粺</strong>
+ <div style="height: 20px;"></div>
+ <strong>{accountDataInfo.name}</strong>
+ </lightning-layout-item>
+ <lightning-layout-item size="9"></lightning-layout-item>
+ <lightning-layout-item size="1">
+ <!-- <p><lightning-formatted-url onclick={closePage} label="鍏抽棴绐楀彛"></lightning-formatted-url></p>
+ <p><lightning-formatted-url onclick={printPage} label="鎵撳嵃姝ら〉"></lightning-formatted-url></p> -->
+ <a href="javascript:" onclick={closePage}>鍏抽棴绐楀彛</a>
+ <div></div>
+ <a href="javascript:;" onclick={printPage}>鎵撳嵃姝ら〉</a>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <div class="outerBorderCss">
+ <div style="padding:5px;">
+ <div class="borderCss">
+ <div style="padding:10px;border-bottom:1px solid #DDE4E9">
+ <div lwc:dom="manual" class="resultDiv">
+ </div>
+ <p style="font-size: 15px;"><strong>瀹㈡埛淇℃伅</strong></p>
+ <div draggable="false">
+ <div class="slds-m-top_small slds-m-bottom_medium">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="瀹㈡埛鍚�" value={accountDataInfo.name}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="瀹㈡埛鎵�鏈変汉" value={accountDataInfo.ownerName}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="鍒悕1" value={accountDataInfo.site}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="鏈夋晥/鏃犳晥" value={accountDataInfo.isActive}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="鍒悕2" value={accountDataInfo.aliasName2}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="绂佺敤鐞嗙敱" value={accountDataInfo.banOnUseReason}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="鏀垮簻绛夌礆" value={accountDataInfo.grade}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="鍖婚櫌鎵�灞炴�ц川"
+ value={accountDataInfo.attributeType} variant="label-inline"
+ read-only></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="OCSM鍒嗙被(鍖婚櫌)"
+ value={accountDataInfo.oCMCategory} variant="label-inline"
+ read-only></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="鍖婚櫌涓撲笟鍖哄垎"
+ value={accountDataInfo.specialityType} variant="label-inline"
+ read-only></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ </div>
+
+ <div style="padding:10px;border-bottom:1px solid #DDE4E9">
+ <div lwc:dom="manual" class="resultDiv">
+ </div>
+ <p style="font-size: 15px;"><strong>鍦板潃淇℃伅</strong></p>
+ <div draggable="false">
+ <div class="slds-m-top_small slds-m-bottom_medium">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="鐪�" value={accountDataInfo.stateMasterName}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="鐢佃瘽" value={accountDataInfo.phone}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="甯�" value={accountDataInfo.cityMasterName}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="鐢佃瘽2" value={accountDataInfo.phoneCall}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="鍘�/鍖�" value={accountDataInfo.town}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="浼犵湡" value={accountDataInfo.fax}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="琛楅亾" value={accountDataInfo.street}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="閭紪" value={accountDataInfo.postalCode}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="鍦板潃" value={accountDataInfo.address}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ </div>
+
+ <div style="padding:10px;border-bottom:1px solid #DDE4E9">
+ <div lwc:dom="manual" class="resultDiv">
+ </div>
+ <p style="font-size: 15px;"><strong>绯荤粺淇℃伅</strong></p>
+ <div draggable="false">
+ <div class="slds-m-top_small slds-m-bottom_medium">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="2">
+ </lightning-layout-item>
+ <lightning-layout-item size="5">
+ <lightning-input type="text" label="姣嶅叕鍙�" value={accountDataInfo.parentName}
+ variant="label-inline" read-only></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js b/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js
new file mode 100644
index 0000000..03621bb
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js
@@ -0,0 +1,103 @@
+import { LightningElement, wire, api, track } from 'lwc';
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import accountInit from '@salesforce/apex/LexConsumableAccountInfoController.init';
+
+export default class LexConsumableAccountInfoPrint extends LightningElement {
+ @track AccId = '';
+ @track accountDataInfo = {
+ name: '',
+ ownerName: '',
+ site: '',
+ isActive: '',
+ aliasName2: '',
+ banOnUseReason: '',
+ grade: '',
+ attributeType: '',
+ oCMCategory: '',
+ specialityType: '',
+ stateMasterName: '',
+ phone: '',
+ cityMasterName: '',
+ phoneCall: '',
+ town: '',
+ fax: '',
+ street: '',
+ postalCode: '',
+ address: '',
+ parentName: ''
+ }
+
+ //鑾峰彇閾炬帴鍙傛暟
+ getQueryString(name) {
+ console.log("getQueryString name " + name);
+ let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+ let r = window.location.search.substr(1).match(reg);
+ if (r != null) {
+ return decodeURIComponent(r[2]);
+ }
+ return null;
+ }
+
+ connectedCallback(){
+ this.AccId = this.getQueryString("AccId");
+ this.AccId = this.AccId == null ? '' : this.AccId;
+ if (this.AccId != '') {
+ console.log('this.AccId = ' + this.AccId);
+ accountInit({
+ accId: this.AccId
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.accountDataInfo.name = r.entity.obj.Name;
+ this.accountDataInfo.ownerName = r.entity.obj.Owner == null ? '' : r.entity.obj.Owner.Name;
+ this.accountDataInfo.site = r.entity.obj.site;
+ this.accountDataInfo.isActive = r.entity.obj.Is_Active__c;
+ this.accountDataInfo.aliasName2 = r.entity.obj.Alias_Name2__c;
+ this.accountDataInfo.banOnUseReason = r.entity.obj.Ban_On_Use_Reason__c;
+ this.accountDataInfo.grade = r.entity.obj.Grade__c;
+ this.accountDataInfo.attributeType = r.entity.obj.Attribute_Type__c;
+ this.accountDataInfo.oCMCategory = r.entity.obj.OCM_Category__c;
+ this.accountDataInfo.specialityType = r.entity.obj.Speciality_Type__c;
+ this.accountDataInfo.stateMasterName = r.entity.obj.State_Master__r == null ? '' : r.entity.obj.State_Master__r.Name;
+ this.accountDataInfo.phone = r.entity.obj.Phone;
+ this.accountDataInfo.cityMasterName = r.entity.obj.City_Master__r == null ? '' : r.entity.obj.City_Master__r.Name;
+ this.accountDataInfo.phoneCall = r.entity.obj.PhoneCall__c;
+ this.accountDataInfo.town = r.entity.obj.Town__c;
+ this.accountDataInfo.fax = r.entity.obj.Fax;
+ this.accountDataInfo.street = r.entity.obj.Street__c;
+ this.accountDataInfo.postalCode = r.entity.obj.Postal_Code__c;
+ this.accountDataInfo.address = r.entity.obj.Address__c;
+ this.accountDataInfo.parentName = r.entity.obj.Parent == null ? '' : r.entity.obj.Parent.Name;
+ console.log('this.accountDataInfo = ' + JSON.stringify(this.accountDataInfo));
+ this.isShowAccountInfo = true;
+ this.isShowSpinner = false;
+ } else {
+ console.log('r = ' + JSON.stringify(r))
+ this.showToast('Error', r.msg);
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error))
+ this.showToast('Error', r.msg);
+ })
+ }
+ }
+
+ showToast(type, msg) {
+ this.isShowSpinner = false;
+ const event = new ShowToastEvent({
+ title: type,
+ variant: type,
+ message: msg
+ });
+ this.dispatchEvent(event);
+ }
+
+ printPage(){
+ window.print();
+ }
+
+ closePage(){
+ window.location.href = "/s/lexconsumableaccount";
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js-meta.xml b/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.css b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html
new file mode 100644
index 0000000..2f7e121
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html
@@ -0,0 +1,91 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <template if:true={showPage}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
+ <div style="padding:10px;">
+ <!-- 鎸夐挳 -->
+ <!-- <lightning-button style="margin: 5px;" label="鍗忚璁㈣揣" onclick={agreementorder}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin-right: 150px;" onclick={agreementorder}>鍗忚璁㈣揣</button>
+ <template if:true={showHop}>
+ <!-- <lightning-button style="margin: 5px;" label="鍖婚櫌鐗逛环" onclick={hospitalorder}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin-right: 150px;" onclick={hospitalorder}>鍖婚櫌鐗逛环</button>
+ </template>
+ <template if:true={hasSpecial}>
+ <!-- <lightning-button style="margin: 5px;" label="淇冮攢璁㈣揣" onclick={promotionorder}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" onclick={promotionorder}>淇冮攢璁㈣揣</button>
+ </template>
+ <p style="height: 10px;"></p>
+ <!-- 鎼滅储 -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>妫�绱㈡潯浠�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>妫�绱㈡潯浠�</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <table>
+ <tbody>
+ <tr>
+ <td style="width:10px;"></td>
+ <td style="width:122px;">
+ <div style="color:#696969;font-size:16px;">娑堣�楀搧璁㈠崟鍚嶇О</div>
+ </td>
+ <td style="width: 200px;">
+ <lightning-input class="inputFont" type="text" label="娑堣�楀搧璁㈠崟鍚嶇О" value={category1} variant="label-hidden" onchange={category1Change}></lightning-input>
+ </td>
+ <td style="width:30px;"></td>
+ <td style="width: 74px;">
+ <div style="color:#696969;font-size:16px;">璁㈠崟鏃ユ湡</div>
+ </td>
+ <td style="width: 200px;">
+ <lightning-input class="inputFont" type="date" name="orderDate" value={orderDate} label="璁㈠崟鏃ユ湡" variant="label-hidden" onchange={orderDateChange}></lightning-input>
+ </td>
+ <td style="width:30px;"></td>
+ <td style="width: 74px;">
+ <div style="color:#696969;font-size:16px;">璁㈠崟鐘舵��</div>
+ </td>
+ <td style="width: 200px;">
+ <lightning-combobox class="inputFont" name="orderStatus" label="璁㈠崟鐘舵��" value={orderStatus} placeholder="璇烽�夋嫨..." options={provinceOpts} variant="label-hidden" onchange={orderStatusChange}></lightning-combobox>
+ </td>
+ <td style="width: 30px;"></td>
+ <td style="width: 400;">
+ <!-- <lightning-button style="margin: 5px;" label="鎼滅储" onclick={searchProduct}></lightning-button>
+ <lightning-button style="margin: 5px;" label="娓呯┖" onclick={clear}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="margin-right: 30px;height:32px;" onclick={searchProduct}>鎼滅储</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="height:32px;" onclick={clear}>娓呯┖</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <!-- 璁㈣揣鏄庣粏 -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>璁㈣揣鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>璁㈣揣鏄庣粏</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <div class="table-container">
+ <lightning-datatable class="wrapped-header-datatable" key-field="id" hide-checkbox-column="true" data={raesList} columns={cols}></lightning-datatable>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js
new file mode 100644
index 0000000..2cf3248
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js
@@ -0,0 +1,221 @@
+import { LightningElement,wire,api,track } from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+import initPage from '@salesforce/apex/LexConsumableOrderManageController.init1';
+import searchConsumableorderdetails from '@salesforce/apex/LexConsumableOrderManageController.searchConsumableorderdetails';
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+
+export default class LexConsumableOrderManage extends NavigationMixin(LightningElement) {
+ @track category1;
+ @track orderDate;
+ @track orderStatus = '';
+ @track provinceOpts = [];
+ @track raesList = [];
+ @track title = [];
+ @track agencyProType;
+ @track accountid;
+ @track userWorkLocation;
+ @track hasHop = false;
+ @track showHop = false;
+ @track hasSpecial = false;
+ @track cols = [];
+ @track showSpinner = false;
+ @track showPage = false;
+ stylesLoaded = false;
+ //鏄惁涓�鐩存樉绀烘彁绀�
+ @track isNoteStay = true;
+
+ connectedCallback(){
+ this.showSpinner = true;
+ initPage()
+ .then(result=>{
+ this.isNoteStay = result.isNoteStay;
+ if(result.result == 'Success'){
+ this.provinceOpts = result.provinceOpts;
+ this.title = result.title;
+ this.raesList = result.raesList;
+ this.agencyProType = result.agencyProType;
+ this.accountid = result.accountid;
+ this.userWorkLocation = result.userWorkLocation;
+ this.hasHop = result.hasHop;
+ this.hasSpecial = result.hasSpecial;
+ this.cols = result.cols;
+ if(this.hasHop == true && this.agencyProType == 'ENG'){
+ this.showHop = true;
+ }
+ for(var i in this.raesList){
+ if(this.raesList[i].Order_ForHospital__c){
+ this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
+ this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
+ }
+ this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
+ }
+ this.showSpinner = false;
+ this.showPage = true;
+ }else{
+ this.showSpinner = false;
+ console.log("Error:"+result.errorMsg);
+ const evt = new ShowToastEvent({
+ title : '鍒濆鍖栭〉闈㈠け璐�',
+ message: result.errorMsg,
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ }
+ })
+ .catch(error=>{
+ this.showSpinner = false;
+ console.log("Error:"+error);
+ })
+ }
+
+ renderedCallback(){
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+ category1Change(event){
+ this.category1 = event.detail.value;
+ console.log('category1:'+this.category1);
+ }
+
+ orderDateChange(event){
+ this.orderDate = event.detail.value;
+ console.log('orderDate:'+this.orderDate);
+ }
+
+ orderStatusChange(event){
+ this.orderStatus = event.detail.value;
+ console.log('orderStatus:'+this.orderStatus);
+ }
+
+ agreementorder(event){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexconsumable?type=agreementorder'
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ hospitalorder(event){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexconsumable?type=hospitalorder'
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ promotionorder(event){
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexconsumable?type=promotionorder'
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ searchProduct(event){
+ this.showSpinner = true;
+ searchConsumableorderdetails({categoryStr:this.category1,orderDate:this.orderDate,orderStatus:this.orderStatus,accountidStr:this.accountid,agencyProTypeStr:this.agencyProType,userWorkLocationStr:this.userWorkLocation})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.raesList = result.raesList;
+ for(var i in this.raesList){
+ if(this.raesList[i].Order_ForHospital__c){
+ this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
+ this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
+ }
+ this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
+ }
+ this.showSpinner = false;
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ this.showSpinner = false;
+ this.raesList = result.raesList;
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏宠鍗�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ this.dispatchEvent(evt);
+ }
+ })
+ }
+
+ clear(event){
+ this.category1 = '';
+ this.orderDate = null;
+ this.orderStatus = '';
+ searchConsumableorderdetails({categoryStr:this.category1,orderDate:this.orderDate,orderStatus:this.orderStatus,accountidStr:this.accountid,agencyProTypeStr:this.agencyProType,userWorkLocationStr:this.userWorkLocation})
+ .then(result=>{
+ if(result.result == 'Success'){
+ this.raesList = result.raesList;
+ for(var i in this.raesList){
+ if(this.raesList[i].Order_ForHospital__c){
+ this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
+ this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
+ }
+ this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
+ }
+ this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success');
+ }else{
+ this.raesList = result.raesList;
+ console.log("Error:"+result.errorMsg);
+ if(result.errorMsg == '娌℃湁鎼滅储鍒扮浉鍏宠鍗�'){
+ this.showMyToast(result.errorMsg,'','error');
+ }else{
+ this.showMyToast('鎼滅储澶辫触',result.errorMsg,'error');
+ }
+ this.dispatchEvent(evt);
+ }
+ })
+ }
+
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').
+ showToast(variant,content,iconName,10000);
+ // var mode;
+ // if(this.isNoteStay){
+ // mode ='sticky';
+ // }else{
+ // mode = 'dismissable';
+ // }
+ // const evt = new ShowToastEvent({
+ // title: title,
+ // message: message,
+ // variant: variant,
+ // mode: mode
+ // });
+ // this.dispatchEvent(evt);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js-meta.xml b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCssUtility/lexCssUtility.css b/force-app/main/default/lwc/lexCssUtility/lexCssUtility.css
new file mode 100644
index 0000000..b9825ca
--- /dev/null
+++ b/force-app/main/default/lwc/lexCssUtility/lexCssUtility.css
@@ -0,0 +1,116 @@
+/* .lexstyle{ */
+ /* font-size: 13px;
+ width: 80% !important;
+ /* width:50px; */
+ /* --sds-c-button-text-color:red; */
+ /* 鑳屾櫙棰滆壊 */
+ /* --slds-c-button-brand-color-background:rgb(8,16,132); */
+ /* 瀛椾綋棰滆壊 */
+ /* --slds-c-button-brand-text-color:#FFFFFF; */
+ /* --slds-c-button-brand-text-color-hover:#ccc; */
+/* } */
+
+
+/* button杈规 */
+.lexBorder{
+ font-size: 18px;
+ font-family: 'sans-serif';
+ font-weight:500;
+ color:#0A81DF;
+ /* border:2px solid rgb(8,16,132); */
+ /* border-color:rgb(8,16,132); */
+ width: 160px;
+ height: 36px;
+ border-radius: 4px;
+ opacity: 1;
+ background: #FFFFFF;
+ box-sizing: border-box;
+ border:1px solid #0A81DF;
+}
+.lexsearchStyle{
+ font-size: 18px;
+ font-family: 'sans-serif';
+ font-weight:500;
+ width: 160px;
+ height: 36px;
+ border-radius: 4px;
+ opacity: 1;
+ background:#090F84;
+ color:#FFFFFF;
+}
+.lexclearStyle{
+ font-size: 18px;
+ font-family: 'sans-serif';
+ font-weight:500;
+ width: 160px;
+ height: 36px;
+ border-radius: 4px;
+ opacity: 1;
+ background: #FFFFFF;
+ border:1px solid #4d4d4d;
+ color:#333333;
+
+}
+
+
+/* button杈规 */
+.lexBorderWidth{
+ font-size: 18px;
+ font-family: 'sans-serif';
+ font-weight:500;
+ color:#0A81DF;;
+ /* border:2px solid rgb(8,16,132); */
+ /* border-color:rgb(8,16,132); */
+ width: 200px;
+ height: 36px;
+ border-radius: 4px;
+ opacity: 1;
+ background: #FFFFFF;
+ box-sizing: border-box;
+ border-style: rgb(212, 212, 212);
+}
+
+
+/* button璺濈 */
+.buttonMarginLeft{
+ margin-left:150px;
+}
+
+/* button鐭窛绂� */
+.buttonminMarginLeft{
+ margin-left:50px;
+}
+
+*:disabled {
+ color: rgb(201, 201, 201);
+ cursor: default;
+}
+
+/* 搴撳瓨鐩樼偣鍙樺寲鏄庣粏 */
+.changeDetail{
+ width:250px;
+ height:36px;
+ font-size: 18px;
+ font-family: 'sans-serif';
+ font-weight:500;
+ color:#0A81DF;;
+ border-radius: 4px;
+ opacity: 1;
+ background: #FFFFFF;
+ box-sizing: border-box;
+ border-style: rgb(212, 212, 212);
+}
+/* 妫�绱㈡潯浠跺瓧浣� */
+.searchName{
+ font-size: 16px;
+ font-family: 'sans-serif';
+ font-weight:500;
+
+}
+
+
+/* input 瀛椾綋澶у皬 by Link */
+.inputFont {
+ font-size: 14px;
+ --lwc-fontSize2:14px;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCssUtility/lexCssUtility.js-meta.xml b/force-app/main/default/lwc/lexCssUtility/lexCssUtility.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/lexCssUtility/lexCssUtility.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.html b/force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.html
new file mode 100644
index 0000000..a910547
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.html
@@ -0,0 +1,16 @@
+<!-- sldsValidatorIgnore -->
+<!-- sldsValidatorIgnore -->
+<template>
+ <div class="picklist-container">
+ <lightning-combobox
+ name="selecttype"
+ value={typeValue}
+ variant="label-hidden"
+ onchange={handleDataChange}
+ data-field="selecttype"
+ options={typeOptions}
+ disabled={isDisabledAttachment}
+ ></lightning-combobox>
+ </div>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js b/force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js
new file mode 100644
index 0000000..0a6be95
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js
@@ -0,0 +1,25 @@
+import { LightningElement,api } from 'lwc';
+
+export default class LexCustomAttachmentTypeComp extends LightningElement {
+ @api typeValue;
+ @api typeOptions;
+ @api recordId;
+ @api isDisabledAttachment;
+
+ connectedCallback(){
+ console.log('typeValue = ' + this.typeValue + ' typeOptions = ' + this.typeOptions + ' recordId' + this.recordId + ' isDisabledAttachment=' + this.isDisabledAttachment);
+ }
+
+ handleDataChange(event){
+ console.log('typeValue = ' + event.target.value);
+ this.typeValue = event.target.value;
+ this.dispatchEvent(new CustomEvent('typechange', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: { typeValue: this.typeValue, recordId: this.recordId }
+ }
+ }));
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js-meta.xml b/force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.html b/force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.html
new file mode 100644
index 0000000..dbe7731
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.html
@@ -0,0 +1,9 @@
+<template>
+ <lightning-input
+ variant="label-hidden"
+ type='text'
+ value = {DiffReason}
+ onblur={diffReasonBlur}>
+
+ </lightning-input>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js b/force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js
new file mode 100644
index 0000000..97cd01a
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js
@@ -0,0 +1,28 @@
+import { LightningElement,api, track } from 'lwc';
+
+export default class LexCustomDiffReasonComp extends LightningElement {
+ @api prodId;
+ @api boxPiece;
+ @track DiffReason = '';
+
+
+ connectedCallback(){
+ console.log('ProdId'+this.prodId);
+ }
+
+ diffReasonBlur(event){
+ console.log('LexCustomDiffReasonComp')
+ this.DiffReason = event.target.value;
+
+ this.dispatchEvent(new CustomEvent('diffreasons', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: { DiffReason: this.DiffReason, ProdId: this.prodId ,boxPiece:this.boxPiece}
+ }
+ }));
+ }
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js-meta.xml b/force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html b/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html
new file mode 100644
index 0000000..98db636
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html
@@ -0,0 +1,17 @@
+<template>
+ <template if:true={showNormal}>
+ <div style="margin-left: 10px;margin-right: 10px;margin-top: 10px;margin-bottom: 10px;font-size:16px;text-align: right;padding-right:10px;">
+ <lightning-formatted-number value={value}></lightning-formatted-number>
+ </div>
+ </template>
+ <template if:true={showRed}>
+ <div style="margin-left: 10px;margin-right: 10px;margin-top: 10px;margin-bottom: 10px;font-size:16px;background-color:red;text-align: right;padding-right:10px;">
+ <lightning-formatted-number value={value}></lightning-formatted-number>
+ </div>
+ </template>
+ <template if:true={showYellow}>
+ <div style="margin-left: 10px;margin-right: 10px;margin-top: 10px;margin-bottom: 10px;font-size:16px;background-color:yellow;text-align: right;padding-right:10px;">
+ <lightning-formatted-number value={value}></lightning-formatted-number>
+ </div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js b/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js
new file mode 100644
index 0000000..bbb177a
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js
@@ -0,0 +1,31 @@
+import { LightningElement,api, track } from 'lwc';
+
+export default class LexCustomInventoryColor extends LightningElement {
+ @api value;
+ @api upperlimit;
+ @api lowerlimit;
+ @api boxPrice;
+
+
+ @track showNormal = true;
+ @track showRed = false;
+ @track showYellow = false;
+
+ connectedCallback(){
+ console.log('value:'+this.value+"---"+this.upperlimit+"---"+this.lowerlimit);
+ this.showNormal = true;
+ this.showRed = false;
+ this.showYellow = false;
+ if(this.boxPrice == '鐩�'){
+ if(this.upperlimit != null && this.lowerlimit != null){
+ if(this.value > this.upperlimit){
+ this.showYellow = true;
+ this.showNormal = false;
+ }else if(this.value < this.lowerlimit) {
+ this.showRed = true;
+ this.showNormal = false;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js-meta.xml b/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customAgencyOppInput.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customAgencyOppInput.html
new file mode 100644
index 0000000..45c7582
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customAgencyOppInput.html
@@ -0,0 +1,3 @@
+<template>
+ <c-lex-agency-opp-cus-cell input-value={typeAttributes.inputValue} record-id={typeAttributes.recordId} field-name={typeAttributes.fieldName} show-type={typeAttributes.showType}></c-lex-agency-opp-cus-cell>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customAttachmentType.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customAttachmentType.html
new file mode 100644
index 0000000..797be40
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customAttachmentType.html
@@ -0,0 +1,10 @@
+<template>
+ <c-lex-custom-attachment-type-comp
+ type-value={typeAttributes.typeValue}
+ type-options={typeAttributes.typeOptions}
+ record-id={typeAttributes.recordId}
+ is-disabled-attachment={typeAttributes.isDisabledAttachment}
+ ontypechange={handleDataChange}
+ >
+ </c-lex-custom-attachment-type-comp>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customInventoryColor.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customInventoryColor.html
new file mode 100644
index 0000000..0ad4f99
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customInventoryColor.html
@@ -0,0 +1,3 @@
+<template>
+ <c-lex-custom-inventory-color value={typeAttributes.value} upperlimit={typeAttributes.upperlimit} lowerlimit={typeAttributes.lowerlimit} box-price = {typeAttributes.boxPrice}></c-lex-custom-inventory-color>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customOutboundCount.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customOutboundCount.html
new file mode 100644
index 0000000..b513653
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customOutboundCount.html
@@ -0,0 +1,7 @@
+<template>
+ <c-custom-outbound-count-comp
+ is-disable={typeAttributes.isDisable}
+ record-id={typeAttributes.recordId}
+ count={typeAttributes.count}>
+ </c-custom-outbound-count-comp>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html
new file mode 100644
index 0000000..3dedf49
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html
@@ -0,0 +1,3 @@
+<template>
+ <c-custom-output-good output-value={typeAttributes.outputValue} output-type={typeAttributes.type} record-id={typeAttributes.recordId}></c-custom-output-good>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html
new file mode 100644
index 0000000..00045c0
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html
@@ -0,0 +1,3 @@
+<template>
+ <c-lex-return-good-cus-input input-value={typeAttributes.inputValue} box-price={typeAttributes.boxPrice} record-id={typeAttributes.recordId}></c-lex-return-good-cus-input>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentAmount.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentAmount.html
new file mode 100644
index 0000000..6b8fb9f
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentAmount.html
@@ -0,0 +1,7 @@
+<template>
+ <c-custom-shipment-Amount-comp
+ shipment-amount={typeAttributes.shipmentAmount}
+ record-id={typeAttributes.recordId}>
+
+ </c-custom-shipment-Amount-comp>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html
new file mode 100644
index 0000000..9213e1e
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html
@@ -0,0 +1,9 @@
+<template>
+ <c-custom-shipment-number-comp
+ style="border-color: red;"
+ record-id={typeAttributes.recordId}
+ shipment-number={typeAttributes.shipmentNumber}
+ >
+
+ </c-custom-shipment-number-comp>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customShippingUnitPrice.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customShippingUnitPrice.html
new file mode 100644
index 0000000..56d603a
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customShippingUnitPrice.html
@@ -0,0 +1,8 @@
+<template>
+ <c-custom-shipping-unit-price-comp
+ record-id={typeAttributes.recordId}
+ shipping-unit-price={typeAttributes.shippingUnitPrice}
+ >
+
+ </c-custom-shipping-unit-price-comp>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customTableCellIcon.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customTableCellIcon.html
new file mode 100644
index 0000000..854b613
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customTableCellIcon.html
@@ -0,0 +1,3 @@
+<template>
+ <c-lex-table-cell-icon icon-name={typeAttributes.iconName} record-id={typeAttributes.recordId}></c-lex-table-cell-icon>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customTableInput.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customTableInput.html
new file mode 100644
index 0000000..7c38c74
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customTableInput.html
@@ -0,0 +1,3 @@
+<template>
+ <c-lex-custom-table-input input-value={typeAttributes.inputValue} record-id={typeAttributes.recordId} value-type={typeAttributes.valueType} upper-limit={typeAttributes.upperLimit} lower-limit={typeAttributes.lowerLimit} allnumber={typeAttributes.allnumber}></c-lex-custom-table-input>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customUnit.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customUnit.html
new file mode 100644
index 0000000..2c4f3c0
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customUnit.html
@@ -0,0 +1,12 @@
+<!-- sldsValidatorIgnore -->
+<!-- sldsValidatorIgnore -->
+<template>
+ <c-custom-unit-comp
+ unit-value={typeAttributes.unitValue}
+ unit-options={typeAttributes.unitOptions}
+ record-id={typeAttributes.recordId}
+ is-disabled={typeAttributes.isDisabled}
+ onunitchange={handleDataChange}
+ >
+ </c-custom-unit-comp>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customWeeklyReport.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customWeeklyReport.html
new file mode 100644
index 0000000..a8c0f83
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customWeeklyReport.html
@@ -0,0 +1,8 @@
+<template>
+ <c-custom-weekly-report-comp
+ record-id={typeAttributes.recordId}
+ hospital-name={typeAttributes.hospitalName}
+ is-show-button={typeAttributes.isShowButton}
+ >
+ </c-custom-weekly-report-comp>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomDiffReason.html b/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomDiffReason.html
new file mode 100644
index 0000000..f520c11
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomDiffReason.html
@@ -0,0 +1,5 @@
+<template>
+ <c-lex-custom-diff-reason-comp
+ prod-id={typeAttributes.ProdId} box-piece ={typeAttributes.boxPiece}>
+ </c-lex-custom-diff-reason-comp>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.html b/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.html
new file mode 100644
index 0000000..27e0f69
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.html
@@ -0,0 +1,3 @@
+<template>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js b/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js
new file mode 100644
index 0000000..e82595a
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js
@@ -0,0 +1,84 @@
+import LightningDatatable from 'lightning/datatable';
+import customUnitTemplate from './customUnit.html';
+import customShipmentNumberTemplate from './customShipmentNumber.html';
+import customShippingUnitPriceTemplate from './customShippingUnitPrice.html';
+import customShipmentAmountTemplate from './customShipmentAmount.html';
+import customDiffReasonTemplate from './lexCustomDiffReason.html';
+import attachmentTypeTemplate from './customAttachmentType.html';
+import customTableInputTemplate from './customTableInput.html';
+import customOutputGoodsTemplate from './customOutputGoods.html';
+import customReturnGoodInputTemplate from './customReturnGoodInput.html';
+import customInventoryColorTemplate from './customInventoryColor.html';
+import customTableCellIconTemplate from './customTableCellIcon.html';
+import customOutboundCountTemplate from './customOutboundCount.html';
+import customWeeklyReportTemplate from './customWeeklyReport.html';
+import customAgencyOppInputTemplate from './customAgencyOppInput.html';
+import { loadStyle} from 'lightning/platformResourceLoader';
+import LexCustomDataTable from '@salesforce/resourceUrl/LexCustomDataTable';
+
+export default class LexCustomLightningDatatable extends LightningDatatable {
+ static customTypes = {
+ customUnit: {
+ template: customUnitTemplate,
+ typeAttributes: ['unitValue','unitOptions','recordId','isDisabled'],
+ },
+ customShipment: {
+ template: customShipmentNumberTemplate,
+ typeAttributes: ['shipmentNumber','recordId'],
+ },
+ customShipmentUnitPrice: {
+ template: customShippingUnitPriceTemplate,
+ typeAttributes: ['shippingUnitPrice','recordId'],
+ },
+ customShipmentAmount: {
+ template: customShipmentAmountTemplate,
+ typeAttributes: ['shipmentAmount','recordId'],
+ },
+ customDiffReason : {
+ template: customDiffReasonTemplate,
+ typeAttributes: ['ProdId','boxPiece'],
+ },
+ customAttachmentType: {
+ template: attachmentTypeTemplate,
+ typeAttributes: ['typeValue','typeOptions','recordId','isDisabledAttachment'],
+ },
+ customTableInput: {
+ template: customTableInputTemplate,
+ typeAttributes:['inputValue','recordId','valueType','upperLimit','lowerLimit','allnumber'],
+ },
+ customOutputGood:{
+ template: customOutputGoodsTemplate,
+ typeAttributes:['outputValue','type','recordId'],
+ },
+ customReturnGoodInput:{
+ template: customReturnGoodInputTemplate,
+ typeAttributes:['inputValue','boxPrice','recordId'],
+ },
+ customInventoryColor:{
+ template: customInventoryColorTemplate,
+ typeAttributes:['value','upperlimit','lowerlimit','boxPrice'],
+ },
+ tableCellIcon:{
+ template: customTableCellIconTemplate,
+ typeAttributes:['iconName','recordId'],
+ },
+ outboundCount:{
+ template: customOutboundCountTemplate,
+ typeAttributes:['isDisable','recordId','Count'],
+ },
+ weeklyReport:{
+ template: customWeeklyReportTemplate,
+ typeAttributes:['recordId','hospitalName','isShowButton'],
+ },
+ agencyOppInput:{
+ template: customAgencyOppInputTemplate,
+ typeAttributes:['inputValue','recordId','fieldName','showType'],
+ }
+ };
+ constructor() {
+ super();
+ Promise.all([
+ loadStyle(this, LexCustomDataTable),
+ ]).then(() => {})
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js-meta.xml b/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.html b/force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.html
new file mode 100644
index 0000000..be0a1af
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.html
@@ -0,0 +1,8 @@
+<template>
+ <template if:true={showInputType}>
+ <lightning-input type="number" name="cusInput" label="cusInput" variant="label-hidden" value={inputValue} onchange={valueChange} onblur={blurInput}></lightning-input>
+ </template>
+ <template if:false={showInputType}>
+ <lightning-input name="cusInput" label="cusInput" variant="label-hidden" value={inputValue} onchange={valueChange}></lightning-input>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js b/force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js
new file mode 100644
index 0000000..739a642
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js
@@ -0,0 +1,44 @@
+import { LightningElement,api } from 'lwc';
+
+export default class LexCustomTableInput extends LightningElement {
+ @api inputValue;
+ @api recordId;
+ @api valueType;
+ @api upperLimit;
+ @api lowerLimit;
+ @api allnumber;
+
+ get showInputType(){
+ if(this.valueType == 'Number'){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ valueChange(event){
+ this.inputValue = event.target.value;
+
+ this.dispatchEvent(new CustomEvent('changevalue', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: { value: this.inputValue, recordId: this.recordId }
+ }
+ }));
+ }
+
+ blurInput(event){
+ console.log('value1:'+event.target.value);
+ console.log('limit:'+this.inputValue+'---'+ this.upperLimit+'---'+this.lowerLimit+'---'+this.allnumber);
+ this.dispatchEvent(new CustomEvent('valueblur', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: { value: this.inputValue, upperLimit: this.upperLimit, lowerLimit: this.lowerLimit, allnumber: this.allnumber }
+ }
+ }));
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js-meta.xml b/force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.css b/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.css
new file mode 100644
index 0000000..a8baaa2
--- /dev/null
+++ b/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.css
@@ -0,0 +1,43 @@
+@import 'c/lexCssUtility';
+
+lightning-input {
+ --lwc-colorBorderInput : #000000;
+}
+
+lightning-combobox{
+ --lwc-colorBorderInput : #000000;
+}
+
+/* table,tbody {
+ display: block;
+ height: 150px;
+ border: 0;
+ border-spacing: 0;
+ border-collapse: collapse;
+ cursor: default;
+}
+
+tbody {
+ overflow-y: scroll;
+}
+
+table thead,
+tbody tr {
+ display: table;
+ width: 100%;
+ table-layout: fixed;
+}
+
+table thead {
+ width: calc(100% - 1em)
+}
+
+table thead th {
+ background: #84acde;
+ width: 10%;
+}
+
+table tbody td {
+ width: 10%;
+ text-align: center;
+} */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.html b/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.html
new file mode 100644
index 0000000..5a4d467
--- /dev/null
+++ b/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.html
@@ -0,0 +1,199 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>璇环鏇存柊</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+ <!-- 鎼滅储 -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:10px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>妫�绱�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+ <!-- 绗竴琛� -->
+ <table style="margin-bottom: 20px;">
+ <tbody>
+ <tr>
+ <td style="width: 100px;">
+ <div style="font-size:16px;">缁忛攢鍟嗗尰闄�</div>
+ </td>
+ <td style="width: 230px;">
+ <lightning-input class="inputFont" variant="label-hidden" value={accSearch} onchange={accSearchChange}></lightning-input>
+ </td>
+ <td style="width: 30px;"></td>
+ <td style="width: 74px;">
+ <div style="font-size:16px;">閿�鍞媴褰�</div>
+ </td>
+ <td style="width: 230px;">
+ <lightning-input class="inputFont" variant="label-hidden" value={aooSearch} onchange={aooSearchChange}></lightning-input>
+ </td>
+ <td style="width: 30px;"></td>
+ <td style="width: 32px;">
+ <span style="font-size:16px;">鏄剧ず</span>
+ </td>
+ <td style="width: 50px;">
+ <lightning-combobox class="inputFont" variant="label-hidden" value={limits} options={limitOpts} onchange={limitsChange}></lightning-combobox>
+ </td>
+ <td style="width: 48px;">
+ <span style="font-size:16px;">鏉℃暟鎹�</span>
+ </td>
+ <td style="width: 30px;"></td>
+ <td style="width: 64px;">
+ <a href="#" onclick={expandAll} style="text-decoration: underline;font-size:16px;">鍏ㄩ儴灞曞紑</a>
+ </td>
+ <td></td>
+ </tr>
+ </tbody>
+ </table>
+ <!-- 绗簩琛� -->
+ <table>
+ <tbody>
+ <tr>
+ <td style="width: 100px;">
+ <div style="font-size:16px;">鏁版嵁瀛楁</div>
+ </td>
+ <td>
+ <lightning-combobox class="inputFont" variant="label-hidden" value={numtext1} options={textOpts} onchange={numtext1Change}></lightning-combobox>
+ </td>
+ <td>
+ <lightning-combobox style="margin-left:10px;" class="inputFont" variant="label-hidden" value={numtext2} options={equalOpts} onchange={numtext2Change}></lightning-combobox>
+ </td>
+ <td>
+ <lightning-input style="margin-left:10px;" class="inputFont" variant="label-hidden" value={numtext} onchange={numtextChange}></lightning-input>
+ </td>
+ <td style="width: 30px;"></td>
+ <td>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="height: 32px;" onclick={search}>妫�绱�</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="height: 32px;" onclick={save}>淇濆瓨</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <!-- 鏁版嵁灞曠ず -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>璇环鏁版嵁</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+ <c-lex-custom-lightning-datatable key-field="recordId" columns={colms} data={datas} oninputchange={agencyOppInputChange} class="wrapped-header-datatable"
+ default-sort-direction={defaultSortDirection} sorted-direction={sortDirection}
+ sorted-by={sortedBy} onsort={onHandleSort} hide-checkbox-column={hidecheckboxcolumn}></c-lex-custom-lightning-datatable>
+ <c-paginator onprevious={handlePrevious} onnext={handleNext} onpageschange={handlePageschange}
+ onfirst={handleFirst} onlast={handleLast} page-size-options={pageSizeOptions}
+ previous-button-disabled={previousButtonDisabled} next-button-disabled={nextButtonDisabled}
+ record-start={recordStart} record-end={recordEnd} total-records={totalRecords}></c-paginator>
+ <!-- <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="6">
+ <table id="tableLeft" >
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ </table>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <table id="tableRight">
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>1000000000000000000000000</td></tr>
+ </table>
+ </lightning-layout-item>
+ </lightning-layout> -->
+ <!-- <lightning-datatable id="leftTable" hide-checkbox-column key-field="field1" column-widths-mode="auto" columns={colmLeft} data={dataLeft} onscroll={scrollEvent}></lightning-datatable>
+ <lightning-datatable id="rightTable" hide-checkbox-column key-field="field1" column-widths-mode="auto" columns={colmRight} data={dataRight}></lightning-datatable> -->
+ <!-- <lightning-layout style="height:150px;" multiple-rows="true">
+ <lightning-layout-item size="6">
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ </lightning-layout-item>
+ </lightning-layout> -->
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js b/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js
new file mode 100644
index 0000000..5c1c630
--- /dev/null
+++ b/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js
@@ -0,0 +1,757 @@
+import { LightningElement, track } from 'lwc';
+import init from '@salesforce/apex/LexDealerInquiryModifyStateController.init';
+import searchOppInner from '@salesforce/apex/LexDealerInquiryModifyStateController.searchOppInner';
+import save from '@salesforce/apex/LexDealerInquiryModifyStateController.save';
+// import { loadScript , loadStyle } from 'lightning/platformResourceLoader';
+// import jQueryMin from '@salesforce/resourceUrl/lexJQuery';
+// import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+
+export default class LexDealerInquiryModifyState extends LightningElement {
+
+ @track showSpinner = true;
+ //琛ㄥご鏍峰紡
+ stylesLoaded = false;
+ @track accSearch = '';
+ @track aooSearch = '';
+ @track limits;
+ @track limitOpts = [];
+ @track numtext1 = '';
+ @track numtext2 = '=';
+ @track numtext;
+ @track textOpts = [];
+ @track equalOpts = [];
+ @track strColumus = '';
+ @track strRtColumus = '';
+
+ //鍒嗛〉start
+ @track sortBy = "";
+ //@track sortDirection = "asc";
+ @track pageSize = 10;
+ error;
+ records;
+ currentPageToken = 0;
+ nextPageToken = this.pageSize;
+ @track totalRecords = 0;
+ @track loader = false;
+ @track pageNumber = 1;
+ @track paginationVisibility = false;
+ @track totalPages = 1;
+ pageSizeOptions = [10, 25, 50, 100];
+ @track recordStart = 0;
+ @track recordEnd = 0;
+ //end
+ defaultSortDirection = "asc";
+ sortDirection = "asc";
+ sortedBy;
+ @track hidecheckboxcolumn = true;
+ @track changeFlg;
+ @track canEdit;
+ @track saveType;
+ @track sortKey;
+
+
+
+
+ // @track colmLeft = [
+ // {label:"OCSM璇环缂栫爜",fieldName:"field1",hideDefaultActions: true},
+ // {label:"OCSM璇环",fieldName:"field1",hideDefaultActions: true},
+ // {label:"绉戝鍒嗙被",fieldName:"field1",hideDefaultActions: true},
+ // {label:"鐘舵��1",fieldName:"field1",hideDefaultActions: true},
+ // {label:"Oly璇环闃舵",fieldName:"field1",hideDefaultActions: true},
+ // {label:"棰勬祴OCSM绛剧害鏃�",fieldName:"field1",hideDefaultActions: true},
+ // {label:"鏄惁涓婃湀棰勬祴璇环",fieldName:"field1",hideDefaultActions: true},
+ // {label:"鏄惁鏈湀棰勬祴璇环",fieldName:"field1",hideDefaultActions: true},
+ // {label:"鏄惁娆℃湀棰勬祴璇环",fieldName:"field1",hideDefaultActions: true},
+ // {label:"鎺堟潈鐢宠缂栫爜",fieldName:"field1",hideDefaultActions: true}
+ // ];
+ // @track colmRight = [
+ // {label:"璇环鍚�",fieldName:"field1",hideDefaultActions: true},
+ // {label:"缁忛攢鍟嗚浠风紪鐮�",fieldName:"field1",hideDefaultActions: true},
+ // {label:"缁忛攢鍟嗗尰闄�",fieldName:"field1",hideDefaultActions: true},
+ // {label:"绉戝鍒嗙被",fieldName:"field1",hideDefaultActions: true},
+ // {label:"绉戝鍚嶇О",fieldName:"field1",hideDefaultActions: true},
+ // {label:"甯�",fieldName:"field1",hideDefaultActions: true},
+ // {label:"浜у搧鍖哄垎1",fieldName:"field1",hideDefaultActions: true},
+ // {label:"浜у搧鍖哄垎2",fieldName:"field1",hideDefaultActions: true},
+ // {label:"浜у搧鍖哄垎3",fieldName:"field1",hideDefaultActions: true},
+ // {label:"瀹㈡埛浜哄憳",fieldName:"field1",hideDefaultActions: true},
+ // {label:"閿�鍞媴褰�",fieldName:"field1",hideDefaultActions: true},
+ // {label:"鍖婚櫌閲囪喘棰勭畻(涓嶅惈绋�,鍏�)",fieldName:"field1",hideDefaultActions: true},
+ // {label:"璁㈣揣閲戦(涓嶅惈绋�,鍏�)",fieldName:"field1",hideDefaultActions: true},
+ // {label:"棰勬祴涓嶰CSM绛剧害鏃�",fieldName:"field1",hideDefaultActions: true},
+ // {label:"棰勬祴鎷涙爣鏃�",fieldName:"field1",hideDefaultActions: true},
+ // {label:"璇环闃舵",fieldName:"field1",hideDefaultActions: true},
+ // {label:"鏄惁OCSM鍏变韩璇环",fieldName:"field1",hideDefaultActions: true}
+ // ];
+ // @track dataLeft = [
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"}
+ // ];
+ // @track dataRight = [
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"},
+ // {field1:"test"}
+ // ];
+
+ @track colms = [
+ {
+ label: "OCSM璇环缂栫爜", fieldName: "OCSM_Opportunity_No__c", hideDefaultActions: true, wrapText: true, initialWidth: 140,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "OCSM_Opportunity_No__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "OCSM璇环", fieldName: "Change_To_Opportunity_T__c", hideDefaultActions: true, wrapText: true, initialWidth: 100,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Change_To_Opportunity_T__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "绉戝鍒嗙被", fieldName: "Strategic_department_Class_Name__c", hideDefaultActions: true, wrapText: true, initialWidth: 105,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Strategic_department_Class_Name__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "鐘舵��1", fieldName: "Oly_Inquiry_Status1__c", hideDefaultActions: true, wrapText: true, initialWidth: 100,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Oly_Inquiry_Status1__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "Oly璇环闃舵", fieldName: "Oly_Inquiry_Stage__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Oly_Inquiry_Stage__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "棰勬祴OCSM绛剧害鏃�", fieldName: "Oly_Forecasted_Date__c", hideDefaultActions: true, wrapText: true, initialWidth: 150,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Oly_Forecasted_Date__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "鏄惁涓婃湀棰勬祴璇环", fieldName: "Oly_Forecast_last_month__c", hideDefaultActions: true, wrapText: true, initialWidth: 150,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Oly_Forecast_last_month__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "鏄惁鏈湀棰勬祴璇环", fieldName: "Oly_Forecast_this_month__c", hideDefaultActions: true, wrapText: true, initialWidth: 150,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Oly_Forecast_this_month__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "鏄惁娆℃湀棰勬祴璇环", fieldName: "Oly_NM_Forecast__c", hideDefaultActions: true, wrapText: true, initialWidth: 150,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Oly_NM_Forecast__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "鎺堟潈鐢宠缂栫爜", fieldName: "Oly_Authorized_DB_No__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Oly_Authorized_DB_No__c" },
+ showType: 'outputField'
+ },
+ },
+ // -----------------------------------------------
+ {
+ label: "璇环鍚�", fieldName: "NameLink", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ type: 'url',
+ typeAttributes: { label: { fieldName: 'Name' }, target: '_blank' }
+ },
+ {
+ label: "缁忛攢鍟嗚浠风紪鐮�", fieldName: "Agency_Opportunity_No__c", hideDefaultActions: true, wrapText: true, initialWidth: 130,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Agency_Opportunity_No__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "缁忛攢鍟嗗尰闄�", fieldName: "Agency_Hospital__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Agency_Hospital__c" },
+ showType: 'inputField'
+ },
+ },
+ {
+ label: "绉戝鍒嗙被", fieldName: "Department_Cateogy__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Department_Cateogy__c" },
+ showType: 'inputField'
+ },
+ },
+ {
+ label: "绉戝鍚嶇О", fieldName: "Department_Name_Text__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Department_Cateogy__c" },
+ showType: 'inputField'
+ },
+ },
+ {
+ label: "甯�", fieldName: "Hospital_City_Master__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Hospital_City_Master__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "浜у搧鍖哄垎1", fieldName: "Product_Category1_P__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Product_Category1_P__c" },
+ showType: 'inputField'
+ },
+ },
+ {
+ label: "浜у搧鍖哄垎2", fieldName: "Product_Category2_P__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Product_Category2_P__c" },
+ showType: 'inputField'
+ },
+ },
+ {
+ label: "浜у搧鍖哄垎3", fieldName: "Product_Category3_P__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Product_Category3_P__c" },
+ showType: 'inputField'
+ },
+ },
+ {
+ label: "瀹㈡埛浜哄憳", fieldName: "Agency_Contact__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Agency_Contact__c" },
+ showType: 'inputField'
+ },
+ },
+ {
+ label: "閿�鍞媴褰�", fieldName: "Agency_PersonName__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Agency_PersonName__c" },
+ showType: 'outputField'
+ },
+ },
+ {
+ label: "鍖婚櫌閲囪喘棰勭畻(涓嶅惈绋�,鍏�)", fieldName: "Amount__c", hideDefaultActions: true, wrapText: true, initialWidth: 200,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Amount__c" },
+ showType: 'inputField'
+ },
+
+ },
+ {
+ label: "璁㈣揣閲戦(涓嶅惈绋�,鍏�)", fieldName: "OCMSale_Price__c", hideDefaultActions: true, wrapText: true, initialWidth: 190,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "OCMSale_Price__c" },
+ showType: 'inputField'
+ },
+ },
+ {
+ label: "棰勬祴涓嶰CSM绛剧害鏃�", fieldName: "Close_Forecasted_Date__c", hideDefaultActions: true, wrapText: true, initialWidth: 190,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Close_Forecasted_Date__c" },
+ showType: 'inputField'
+ },
+ },
+ {
+ label: "棰勬祴鎷涙爣鏃�", fieldName: "Bid_Planned_Date__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "Bid_Planned_Date__c" },
+ showType: 'inputField'
+ },
+ },
+ {
+ label: "璇环闃舵", fieldName: "StageName__c", hideDefaultActions: true, wrapText: true, initialWidth: 110,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "StageName__c" },
+ showType: 'inputField'
+ },
+
+ },
+ {
+ label: "鏄惁OCSM鍏变韩璇环", fieldName: "OCM_Change_To_Opportunity_Flg__c", hideDefaultActions: true, wrapText: true, initialWidth: 190,sortable: true,
+ typeAttributes: {
+ recordId: { fieldName: "recordId" },
+ inputValue: { fieldName: "OCM_Change_To_Opportunity_Flg__c" },
+ showType: 'inputField'
+ },
+ }
+ ];
+ @track datas = [];
+
+
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+ //鍒濆鍖�
+ connectedCallback() {
+ this.loader = true;
+ this.init();
+
+ }
+ init(){
+ this.showSpinner = true;
+ init({
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken
+ })
+ .then(result => {
+ if (result.result == 'Success') {
+ console.log('result==>' + JSON.stringify(result));
+ //鍒嗛〉start
+ this.nextPageToken = result.paginatedAccounts.nextPageToken;
+ this.totalRecords = result.paginatedAccounts.totalRecords;
+ this.recordStart = result.paginatedAccounts.recordStart;
+ this.recordEnd = result.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(result.paginatedAccounts.totalRecords / this.pageSize);
+ console.log('this.totalPages = ' + this.totalPages);
+ this.paginationVisibility = this.totalPages > 1 ? true : false;
+ console.log('this.sortDirection = ' + this.sortDirection);
+ this.loader = false;
+ //鍒嗛〉end
+ this.limits = result.limits;
+ this.limitOpts = result.limitCusOpts;
+ // this.numtext1 = result.numtext1;
+ // this.numtext2 = result.numtext2;
+ // this.numtext = result.numtext;
+ this.textOpts = result.textCusOpts;
+ this.equalOpts = result.equalCusOpts;
+ this.datas = result.oppRecords;
+ this.strColumus = result.strColumus;
+ this.strRtColumus = result.strRtColumus;
+ this.changeFlg = result.oppRecords.changeFlg;
+ for (var i in this.datas) {
+ this.datas[i]['recordId'] = this.datas[i].opp.Id;
+ this.datas[i]['OCSM_Opportunity_No__c'] = this.datas[i].opp.OCSM_Opportunity_No__c;
+ this.datas[i]['Change_To_Opportunity_T__c'] = this.datas[i].opp.Change_To_Opportunity_T__c;
+ this.datas[i]['Strategic_department_Class_Name__c'] = this.datas[i].opp.Strategic_department_Class_Name__c;
+ this.datas[i]['Oly_Inquiry_Status1__c'] = this.datas[i].opp.Oly_Inquiry_Status1__c;
+ this.datas[i]['Oly_Inquiry_Stage__c'] = this.datas[i].opp.Oly_Inquiry_Stage__c;
+ this.datas[i]['Oly_Forecasted_Date__c'] = this.datas[i].opp.Oly_Forecasted_Date__c;
+ this.datas[i]['Oly_Forecast_last_month__c'] = this.datas[i].opp.Oly_Forecast_last_month__c;
+ this.datas[i]['Oly_Forecast_this_month__c'] = this.datas[i].opp.Oly_Forecast_this_month__c;
+ this.datas[i]['Oly_NM_Forecast__c'] = this.datas[i].opp.Oly_NM_Forecast__c;
+ this.datas[i]['Oly_Authorized_DB_No__c'] = this.datas[i].opp.Oly_Authorized_DB_No__c;
+ // -------
+ this.datas[i]['Name'] = this.datas[i].AgcOpp.Name;
+ this.datas[i]['Agency_Opportunity_No__c'] = this.datas[i].AgcOpp.Agency_Opportunity_No__c;
+ this.datas[i]['Agency_Hospital__c'] = this.datas[i].AgcOpp.Agency_Hospital__c;
+ this.datas[i]['Department_Cateogy__c'] = this.datas[i].AgcOpp.Department_Cateogy__c;
+ this.datas[i]['Department_Name_Text__c'] = this.datas[i].AgcOpp.Department_Name_Text__c;
+ this.datas[i]['Hospital_City_Master__c'] = this.datas[i].AgcOpp.Hospital_City_Master__c;
+ this.datas[i]['Product_Category1_P__c'] = this.datas[i].AgcOpp.Product_Category1_P__c;
+ this.datas[i]['Product_Category2_P__c'] = this.datas[i].AgcOpp.Product_Category2_P__c;
+ this.datas[i]['Product_Category3_P__c'] = this.datas[i].AgcOpp.Product_Category3_P__c;
+ this.datas[i]['Agency_Contact__c'] = this.datas[i].AgcOpp.Agency_Contact__c;
+ this.datas[i]['Agency_PersonName__c'] = this.datas[i].AgcOpp.Agency_PersonName__c;
+ this.datas[i]['Amount__c'] = this.datas[i].AgcOpp.Amount__c;
+ this.datas[i]['OCMSale_Price__c'] = this.datas[i].AgcOpp.OCMSale_Price__c;
+ this.datas[i]['Close_Forecasted_Date__c'] = this.datas[i].AgcOpp.Close_Forecasted_Date__c;
+ this.datas[i]['Bid_Planned_Date__c'] = this.datas[i].AgcOpp.Bid_Planned_Date__c;
+ this.datas[i]['StageName__c'] = this.datas[i].AgcOpp.StageName__c;
+ this.datas[i]['OCM_Change_To_Opportunity_Flg__c'] = this.datas[i].AgcOpp.OCM_Change_To_Opportunity_Flg__c;
+ this.datas[i]['NameLink'] = '/s/agency-opportunity/'+this.datas[i].opp.Id;
+ }
+ this.showMyToast(result.Msg, '', 'success');
+ this.showSpinner = false;
+ } else {
+ this.showSpinner = false;
+ this.showMyToast('鍒濆鍖栭〉闈㈠け璐�', result.Msg, 'error');
+ }
+ })
+ .catch(error => {
+ this.showSpinner = false;
+ console.log("Error:" + JSON.stringify(error));
+ this.showMyToast('鍒濆鍖栭〉闈㈠け璐�', JSON.stringify(error), 'error');
+ })
+
+ }
+
+ // renderedCallback() {
+ // if (!this.stylesLoaded) {
+ // Promise.all([loadStyle(this, WrappedHeaderTable),loadScript(this, jQueryMin)])
+ // .then(() => {
+ // console.log("Custom styles loaded");
+ // this.stylesLoaded = true;
+ // })
+ // .catch((error) => {
+ // console.error("Error loading custom styles");
+ // });
+ // // loadScript(this, jQueryMin+'/lexJQuery183.js')
+ // // .then(() => {
+ // // console.log('JQuery loaded.');
+ // // })
+ // // .catch(error=>{
+ // // console.log('Failed to load the JQuery : ' +error);
+ // // });
+ // // Promise.all([loadScript(this, jQueryMin)])
+ // // .then(() => {
+ // // console.log("Custom styles loaded");
+ // // this.stylesLoaded = true;
+ // // j$('.tableRight').scroll(function() {
+ // // j$('.tableLeft').scrollTop(j$(this).scrollTop());
+ // // });
+ // // })
+ // // .catch((error) => {
+ // // console.log(JSON.stringify(error));
+ // // console.error("Error loading custom styles");
+ // // });
+ // }
+ // }
+
+ agencyOppInputChange(event) {
+ this.changeFlg = 1;
+ var inputValue = event.detail.data.inputValue;
+ var recordId = event.detail.data.recordId;
+ var fieldName = event.detail.data.fieldName;
+ console.log("valueChange:" + recordId + '---' + fieldName + '---' + inputValue);
+ for (var i in this.datas) {
+ if (this.datas[i]['recordId'] == recordId) {
+ this.datas[i]['fieldName'] = inputValue;
+ this.datas[i]['changeFlg'] = this.changeFlg;
+ }
+ }
+ console.log(" this.datas==>" + JSON.stringify(this.datas));
+ }
+
+ accSearchChange(event) {
+ this.accSearch = event.detail.value;
+ }
+
+ aooSearchChange(event) {
+ this.aooSearch = event.detail.value;
+ }
+
+ limitsChange(event) {
+ this.limits = event.detail.value;
+ }
+
+ numtext1Change(event) {
+ this.numtext1 = event.detail.value;
+ }
+
+ numtext2Change(event) {
+ this.numtext2 = event.detail.value;
+ }
+
+ numtextChange(event) {
+ this.numtext = event.detail.value;
+ }
+
+ expandAll() {
+
+ }
+
+ search(){
+ console.log('鎼滅储');
+ this.showSpinner = true;
+ if(this.changeFlg == 1){
+ if (window.confirm('鐢婚潰涓婄殑鏁版嵁鏈夊彉鍖栵紝瑕佷繚瀛樻墍鍋氱殑鍙樻洿鍚楋紵\n鐐瑰嚮 [纭畾] 淇濆瓨骞舵绱n鐐瑰嚮 [鍙栨秷] 鍙绱紝鏀惧純淇濆瓨')) {
+ this.save();
+ this.searchOpp();
+ this.showSpinner = false;
+ }else{
+ console.log('鎼滅储1');
+ this.searchOpp();
+ this.showSpinner = false;
+ }
+ }else{
+ this.searchOpp();
+ this.showSpinner = false;
+
+
+ }
+ }
+ searchOpp(){
+ console.log('this.accSearch==>' + this.accSearch);
+ console.log('this.aooSearch==>' + this.aooSearch);
+ console.log('this.numtext==>' + this.numtext);
+ console.log('this.numtext1==>' + this.numtext1);
+ console.log('this.numtext2==>' + this.numtext2);
+ searchOppInner({
+ strColumus: this.strColumus,
+ strRtColumus: this.strRtColumus,
+ accSearch: this.accSearch,
+ aooSearch: this.aooSearch,
+ numtext: this.numtext,
+ numtext1: this.numtext1,
+ numtext2: this.numtext2,
+ }).then((result) => {
+ if (result.result == 'Success') {
+ //鍒嗛〉Start
+ // this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
+ // this.totalRecords = result.entity.paginatedAccounts.totalRecords;
+ // this.recordStart = result.entity.paginatedAccounts.recordStart;
+ // this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+ // this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
+ // console.log('this.totalPages = ' + this.totalPages);
+ // this.paginationVisibility = this.totalPages > 1 ? true : false;
+ //鍒嗛〉End
+ this.datas = result.oppRecords;
+ //change flag
+ // this.changeFlg= result.oppRecords.changeFlg;
+ console.log('result==>' + JSON.stringify(result));
+ for (var i in this.datas) {
+ this.datas[i]['recordId'] = this.datas[i].opp.Id;
+ this.datas[i]['OCSM_Opportunity_No__c'] = this.datas[i].opp.OCSM_Opportunity_No__c;
+ this.datas[i]['Change_To_Opportunity_T__c'] = this.datas[i].opp.Change_To_Opportunity_T__c;
+ this.datas[i]['Strategic_department_Class_Name__c'] = this.datas[i].opp.Strategic_department_Class_Name__c;
+ this.datas[i]['Oly_Inquiry_Status1__c'] = this.datas[i].opp.Oly_Inquiry_Status1__c;
+ this.datas[i]['Oly_Inquiry_Stage__c'] = this.datas[i].opp.Oly_Inquiry_Stage__c;
+ this.datas[i]['Oly_Forecasted_Date__c'] = this.datas[i].opp.Oly_Forecasted_Date__c;
+ this.datas[i]['Oly_Forecast_last_month__c'] = this.datas[i].opp.Oly_Forecast_last_month__c;
+ this.datas[i]['Oly_Forecast_this_month__c'] = this.datas[i].opp.Oly_Forecast_this_month__c;
+ this.datas[i]['Oly_NM_Forecast__c'] = this.datas[i].opp.Oly_NM_Forecast__c;
+ this.datas[i]['Oly_Authorized_DB_No__c'] = this.datas[i].opp.Oly_Authorized_DB_No__c;
+ // -------
+ this.datas[i]['Name'] = this.datas[i].AgcOpp.Name;
+ this.datas[i]['Agency_Opportunity_No__c'] = this.datas[i].AgcOpp.Agency_Opportunity_No__c;
+ this.datas[i]['Agency_Hospital__c'] = this.datas[i].AgcOpp.Agency_Hospital__c;
+ this.datas[i]['Department_Cateogy__c'] = this.datas[i].AgcOpp.Department_Cateogy__c;
+ this.datas[i]['Department_Name_Text__c'] = this.datas[i].AgcOpp.Department_Name_Text__c;
+ this.datas[i]['Hospital_City_Master__c'] = this.datas[i].AgcOpp.Hospital_City_Master__c;
+ this.datas[i]['Product_Category1_P__c'] = this.datas[i].AgcOpp.Product_Category1_P__c;
+ this.datas[i]['Product_Category2_P__c'] = this.datas[i].AgcOpp.Product_Category2_P__c;
+ this.datas[i]['Product_Category3_P__c'] = this.datas[i].AgcOpp.Product_Category3_P__c;
+ this.datas[i]['Agency_Contact__c'] = this.datas[i].AgcOpp.Agency_Contact__c;
+ this.datas[i]['Agency_PersonName__c'] = this.datas[i].AgcOpp.Agency_PersonName__c;
+ this.datas[i]['Amount__c'] = this.datas[i].AgcOpp.Amount__c;
+ this.datas[i]['OCMSale_Price__c'] = this.datas[i].AgcOpp.OCMSale_Price__c;
+ this.datas[i]['Close_Forecasted_Date__c'] = this.datas[i].AgcOpp.Close_Forecasted_Date__c;
+ this.datas[i]['Bid_Planned_Date__c'] = this.datas[i].AgcOpp.Bid_Planned_Date__c;
+ this.datas[i]['StageName__c'] = this.datas[i].AgcOpp.StageName__c;
+ this.datas[i]['OCM_Change_To_Opportunity_Flg__c'] = this.datas[i].AgcOpp.OCM_Change_To_Opportunity_Flg__c;
+
+ }
+ this.showSpinner = false;
+ this.showMyToast('鎼滅储鎴愬姛', result.Msg, 'success');
+
+ } else {
+ this.showSpinner = false;
+ this.showMyToast('鎼滅储澶辫触', result.Msg, 'error');
+
+ }
+ }).catch((error) => {
+ this.showSpinner = false;
+ console.log('error = ' + JSON.stringify(error));
+ });
+ }
+
+ save() {
+ this.showSpinner = true;
+ save({
+ oppRecordsLWC: this.datas,
+ sortKeyLWC:this.sortKey
+
+ }).then((result) => {
+ if (result.result == 'Success') {
+ this.datas = result.oppRecords;
+ console.log('result==>' + JSON.stringify(result));
+ this.showSpinner = false;
+ this.showMyToast('淇濆瓨鎴愬姛', '', 'success');
+
+ } else {
+ this.showSpinner = false;
+ this.showMyToast('淇濆瓨澶辫触', result.Msg, 'error');
+
+ }
+ }).catch((error) => {
+ this.showSpinner = false;
+ console.log('error = ' + JSON.stringify(error));
+ });
+
+ }
+
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if (variant == 'success') {
+ iconName = 'utility:check';
+ } else {
+ iconName = 'utility:error';
+ }
+ if (message != '') {
+ content = '<h2><strong>' + title + '<strong/></h2><h5>' + message + '</h5>';
+ } else {
+ content = '<h2><strong>' + title + '<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').
+ showToast(variant, content, iconName, 10000);
+ }
+ //鎺掑簭
+ sortByMethod(field, reverse, primer) {
+ const key = primer
+ ? function (x) {
+ return primer(x[field]);
+ }
+ : function (x) {
+ return x[field];
+ };
+
+ return function (a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
+ };
+ }
+
+ onHandleSort(event) {
+ console.log("Sort");
+ console.log("this.changeFlg"+this.changeFlg);
+ if(this.changeFlg == 1){
+ if (window.confirm('鐢婚潰涓婄殑鏁版嵁鏈夊彉鍖栵紝瑕佷繚瀛樻墍鍋氱殑鍙樻洿鍚楋紵\n鐐瑰嚮 [纭畾] 淇濆瓨骞舵帓搴廫n鐐瑰嚮 [鍙栨秷] 鍙帓搴忥紝鏀惧純淇濆瓨')){
+ this.sortBy = event.detail.fieldName;
+ this.sortDirection = event.detail.sortDirection;
+ this.currentPageToken = 0;
+ console.log('this.sortBy = ' + this.sortBy)
+ console.log('this.sortDirection = ' + this.sortDirection)
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.datas];
+ cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ this.datas = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ this.sortKey = this.sortBy;
+ this.save();
+ }else{
+ this.sortBy = event.detail.fieldName;
+ console.log('this.sortBy==>'+this.sortBy);
+ this.sortDirection = event.detail.sortDirection;
+ this.currentPageToken = 0;
+ console.log('this.sortBy = ' + this.sortBy)
+ console.log('this.sortDirection = ' + this.sortDirection)
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.datas];
+ cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ this.datas = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+ }else{
+ this.sortBy = event.detail.fieldName;
+ console.log('this.sortBy==>'+this.sortBy);
+ this.sortDirection = event.detail.sortDirection;
+ this.currentPageToken = 0;
+ console.log('this.sortBy = ' + this.sortBy)
+ console.log('this.sortDirection = ' + this.sortDirection)
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.datas];
+ cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ this.datas = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+ }
+ //鍒嗛〉
+ handlePaginatorChange(event) {
+ this.recordsToDisplay = event.detail.recordsToDisplay;
+ this.preSelected = event.detail.preSelected;
+ if (this.recordsToDisplay && this.recordsToDisplay > 0) {
+ this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
+ } else {
+ this.rowNumberOffset = 0;
+ }
+ }
+ handlePrevious() {
+ this.currentPageToken = Number(this.currentPageToken) - Number(this.pageSize);
+ this.init();
+ }
+
+ handleNext() {
+ this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize);
+ this.init();
+ }
+ handleFirst() {
+ this.currentPageToken = 0;
+ this.init();
+ }
+
+ handleLast() {
+ this.currentPageToken = this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+ this.init();
+ }
+
+ handlePageschange(event) {
+ console.log(event.detail);
+ this.pageSize = event.detail;
+ this.currentPageToken = 0;
+ this.init();
+ }
+ get previousButtonDisabled() {
+ return this.currentPageToken === 0;
+ }
+
+ get nextButtonDisabled() {
+ return this.nextPageToken === undefined;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js-meta.xml b/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexInventory/lexInventory.css b/force-app/main/default/lwc/lexInventory/lexInventory.css
new file mode 100644
index 0000000..9a393b0
--- /dev/null
+++ b/force-app/main/default/lwc/lexInventory/lexInventory.css
@@ -0,0 +1,18 @@
+@import 'c/lexCssUtility';
+.accordionClass {
+ --slds-c-accordion-heading-font-size: 1rem;
+ font-weight: bold;
+}
+
+.accordionClass2 {
+ font-weight: normal;
+}
+.count{
+ --slds-c-button-brand-color-background:rgb(8,16,132);
+ /* 瀛椾綋棰滆壊 */
+ --slds-c-button-brand-text-color:#FFFFFF;
+}
+:host {
+ --lwc-inputStaticFontSize: 16px;
+ --lwc-formLabelFontSize: 16px;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexInventory/lexInventory.html b/force-app/main/default/lwc/lexInventory/lexInventory.html
new file mode 100644
index 0000000..8e8f0d4
--- /dev/null
+++ b/force-app/main/default/lwc/lexInventory/lexInventory.html
@@ -0,0 +1,186 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <template if:true={showcount}>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;">
+ <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <div style="margin:12px;">
+ <p style="font-size: 18px;float:left"><strong>搴撳瓨鐩樼偣</strong></p>
+ </div>
+ <div style="margin-left:400px;margin-bottom:12px;">
+ <!-- <lightning-button class = 'lexstyle' label="鐩樼偣纭" title="鐩樼偣纭" onclick={saveConfirm}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="鐩樼偣纭" onclick={saveConfirm}>鐩樼偣纭</button>
+ </div>
+ </div>
+
+ <div style="padding:10px;">
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <table>
+ <colgroup>
+ <col width="160px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="90px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="85px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ </colgroup>
+ <tbody>
+ <tr>
+ <td></td>
+ <td align="right" class="searchName">BarCode</td>
+ <td style="width:600px"><lightning-textarea class="inputFont" name="BarCode" label=""
+ onchange={handleChange}></lightning-textarea></td>
+ <td align="right"></td>
+ <td></td>
+ <td style="width:200px">
+ <button style="margin-top:14px;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="鑾峰彇鏄庣粏" onclick={barcodeEntrys}>鑾峰彇鏄庣粏</button>
+ <!-- <lightning-button class = 'lexstyle' label="BarCode褰曞叆" title="BarCode褰曞叆"
+ onclick={barcodeEntrys} style="width: 300px;"></lightning-button> -->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <!-- <p style="font-size: 16px;"><strong>鍦ㄥ簱鍟嗗搧搴撳瓨涓�瑙�</strong></p> -->
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍦ㄥ簱鍟嗗搧搴撳瓨涓�瑙�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+
+ <div style="height: 300px;">
+ <template if:true={showTable}>
+ <c-lex-custom-lightning-datatable key-field="key" data={data} columns={columns}
+ ondiffreasons={diffreasons} onrowselection={getSelectedRows}
+ selected-rows={selectedRows} class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ </template>
+
+
+ </div>
+
+ </div>
+ </div>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <table>
+ <tr>
+ <td>
+ <!-- <p style="font-size: 16px;"><strong>璋冩暣鏄庣粏</strong></p> -->
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>璋冩暣鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ </td>
+ <template if:true={showbutton}>
+ <td align="center">
+ <!-- <lightning-button variant="brand" class='count' label="涓嬭浇鏈鐩樼偣搴撳瓨鍙樺寲鏄庣粏" title="涓嬭浇鏈鐩樼偣搴撳瓨鍙樺寲鏄庣粏"
+ onclick={exportData} style="width: 150px;"></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch changeDetail" label="涓嬭浇鏈鐩樼偣搴撳瓨鍙樺寲鏄庣粏" onclick={exportData}>涓嬭浇鏈鐩樼偣搴撳瓨鍙樺寲鏄庣粏</button>
+ </td>
+ </template>
+ </tr>
+ </table>
+ </div>
+ <!-- <template if:true={showTable}> -->
+ <div style="padding:10px;">
+ <lightning-datatable key-field="id" data={pageCodeRecords} columns={column}
+ hide-checkbox-column={hidecheckbox} class="wrapped-header-datatable">
+ </lightning-datatable>
+ <c-paginator onprevious={handlePrevious} onnext={handleNext} onpageschange={handlePageschange}
+ onfirst={handleFirst} onlast={handleLast} page-size-options={pageSizeOptions}
+ previous-button-disabled={previousButtonDisabled} next-button-disabled={nextButtonDisabled}
+ record-start={recordStart} record-end={recordEnd}
+ total-records={totalRecords}></c-paginator>
+ </div>
+ <!-- </template> -->
+ </div>
+ </div>
+
+
+ </div>
+ </template>
+
+
+ <template if:true={EditAble}>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;">
+ <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;">
+ <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:6px;">
+ <p style="font-size: 19px;"><strong>鐩樼偣鎯呭喌涓�瑙�</strong></p>
+ </div>
+ <div class="acc-container">
+ <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={conId}
+ onload={handleLoad2} class="hideHelpText">
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
+ <div class="slds-grid">
+ <div class="slds-col slds-size_1-of-2">
+ <lightning-output-field field-name="Name"
+ class="hehe-layoutItem" style="padding-left:20px;"></lightning-output-field>
+ </div>
+ <div class="slds-col slds-size_1-of-2">
+ <lightning-output-field field-name="Inventory_date__c"
+ class="hehe-layoutItem"></lightning-output-field>
+ </div>
+ </div>
+ </div>
+ </lightning-record-edit-form>
+ </div>
+ </div>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-top:10px">
+ <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:6px;">
+ <lightning-accordion allow-multiple-sections-open class="slds-m-around_medium"
+ active-section-name={activeSections}>
+ <lightning-accordion-section name="dataExpand" label="鐩樼偣鏄庣粏" class="accordionClass">
+ <lightning-datatable key-field="id" data={detailData} columns={dcolumns}
+ hide-checkbox-column={hidecheckbox}
+ class="wrapped-header-datatable accordionClass2">
+ </lightning-datatable>
+ </lightning-accordion-section>
+ </lightning-accordion>
+
+
+ </div>
+ </div>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-top:10px">
+ <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:6px;">
+ <lightning-accordion allow-multiple-sections-open class="slds-m-around_medium"
+ active-section-name={activeSections}>
+ <lightning-accordion-section name="dataExpand" label="鍦ㄥ簱璋冩暣鏄庣粏" class="accordionClass">
+ <lightning-datatable key-field="id" data={adjustdata} columns={stockadjustcolumns}
+ hide-checkbox-column={hidecheckbox}
+ class="wrapped-header-datatable accordionClass2">
+ </lightning-datatable>
+ </lightning-accordion-section>
+ </lightning-accordion>
+
+ </div>
+ </div>
+ </div>
+ </div>
+
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexInventory/lexInventory.js b/force-app/main/default/lwc/lexInventory/lexInventory.js
new file mode 100644
index 0000000..43d0f99
--- /dev/null
+++ b/force-app/main/default/lwc/lexInventory/lexInventory.js
@@ -0,0 +1,760 @@
+import { LightningElement, wire, api, track } from "lwc";
+import oninit from "@salesforce/apex/LexInventoryController.init";
+// import sheetjs from '@salesforce/resourceUrl/sheetjs';
+import barcodeEntry from "@salesforce/apex/LexInventoryController.searchConsumableorderdetails";
+import save from "@salesforce/apex/LexInventoryController.save";
+import datainit from "@salesforce/apex/LexInventoryListController.init";
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import { NavigationMixin } from "lightning/navigation";
+
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+//搴撳瓨鐩樼偣涓婚〉闈㈡暟鎹�
+const columns = [
+ {
+ label: "鏄惁鐩樼偣",
+ fieldName: "iscount",
+ hideDefaultActions: true,
+ initialWidth: 80,
+
+ },
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "Name__c",
+ hideDefaultActions: true,
+ // initialWidth: 400,
+ wrapText:true
+
+ },
+ {
+ label: "瑙勬牸",
+ initialWidth: 50,
+ fieldName: "Packing_list_manual__c",
+ cellAttributes: { alignment: "right" },
+ hideDefaultActions: true,
+
+
+ },
+ {
+ label: "鍗曚綅",
+ fieldName: "boxPiece",
+ initialWidth: 50,
+ hideDefaultActions: true,
+
+
+ },
+ {
+ label: "鏈夋晥鏈熷唴搴撳瓨",
+ fieldName: "limitCount",
+ initialWidth: 120,
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+ },
+
+ {
+ label: "杩囨湡搴撳瓨",
+ initialWidth: 100,
+ fieldName: "overlimitCount",
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+
+
+ },
+ {
+ label: "鐩樼偣",
+ initialWidth: 50,
+ fieldName: "Pandian",
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+
+
+ },
+ {
+ label: "涓㈠け",
+ initialWidth: 50,
+ fieldName: "Diff",
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+
+
+ },
+ {
+ label: "瀵诲洖",
+ initialWidth: 50,
+ fieldName: "refind",
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+
+
+ },
+ {
+ label: "宸紓鍘熷洜",
+ // fieldName: "DiffReason",
+ initialWidth: 200,
+ hideDefaultActions: true,
+ type: "customDiffReason",
+ typeAttributes: {
+ DiffReason: { fieldName: "DiffReason" },
+ ProdId: { fieldName: "ProdId" },
+ boxPiece: { fieldName: "boxPiece" }
+
+ },
+
+ },
+];
+
+//璋冩暣鏄庣粏
+const column = [
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "Name__c",
+ wrapText: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: "鍗曚綅",
+ fieldName: "Box_Piece__c",
+ hideDefaultActions: true,
+ initialWidth: 50,
+
+ },
+ {
+ label: "BarCode",
+ fieldName: "Bar_Code__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 500,
+ },
+ {
+ label: "璋冩暣鍘熷洜",
+ fieldName: "DiffReason",
+ hideDefaultActions: true,
+ wrapText: true,
+
+ },
+];
+//鐩樼偣鏄庣粏
+const dcolumns = [
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "Name__c",
+ hideDefaultActions: true,
+ // initialWidth: 250,
+ wrapText: true,
+
+
+ },
+ {
+ label: "搴撳瓨",
+ fieldName: "Count_Sum__c",
+ hideDefaultActions: true,
+ initialWidth: 100,
+ cellAttributes: { alignment: "right" },
+
+ },
+ {
+ label: "鐩樼偣",
+ fieldName: "inventory_sum__c",
+ hideDefaultActions: true,
+ initialWidth: 100,
+ cellAttributes: { alignment: "right" },
+
+ },
+ {
+ label: "涓㈠け",
+ fieldName: "Diff__c",
+ hideDefaultActions: true,
+ initialWidth: 100,
+ cellAttributes: { alignment: "right" },
+
+ },
+ {
+ label: "瀵诲洖",
+ fieldName: "Product_Refind__c",
+ hideDefaultActions: true,
+ initialWidth: 100,
+ cellAttributes: { alignment: "right" },
+
+ },
+ {
+ label: "宸紓鍘熷洜",
+ fieldName: "Lose_reason__c",
+ hideDefaultActions: true,
+
+ },
+];
+
+//鍦ㄥ簱璋冩暣鏄庣粏
+const stockadjustcolumns = [
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "Name__c",
+ wrapText: true,
+ hideDefaultActions: true,
+
+ },
+ {
+ label: "浜у搧鍨嬪彿",
+ fieldName: "Asset_Model_No__c",
+ hideDefaultActions: true,
+
+ },
+ {
+ label: "宸紓鍘熷洜",
+ fieldName: "Lose_reason__c",
+ hideDefaultActions: true,
+ initialWidth: 150,
+
+ },
+ {
+ label: "鏄惁涓㈠け",
+ type: "boolean",
+ fieldName: "Lose_Flag__c",
+ hideDefaultActions: true,
+
+ },
+];
+
+export default class LexInventory extends NavigationMixin(LightningElement) {
+ columns = columns;
+ column = column;
+ stockadjustcolumns = stockadjustcolumns;
+ dcolumns = dcolumns;
+ @track data = [];
+ @track codPageRecords = [];
+ @track pageCodeRecords = [];
+ @track accountName;
+ @track agencyProType;
+ @track userWorkLocation;
+ @track accountid
+ @track pandiandetailsMap
+ @track reSet
+ @track reSet1
+
+ @track showTable = false;
+ @track showbutton = false;
+ @track barcode = "";
+ @track ConsumableorderdetailsRecordsview = [];
+ @track consumableorderdetailsRecords = [];
+ @track showcount = true;
+
+ @track iSinventory = false
+ @track numberDetail;
+ @track hidecheckbox = true;
+ //鍒嗛〉start
+ @track sortBy = "";
+ @track sortDirection = "asc";
+ @track pageSize = 10;
+ error;
+ records;
+ currentPageToken = 0;
+ nextPageToken = this.pageSize;
+ @track totalRecords = 0;
+ @track loader = false;
+ @track pageNumber = 1;
+ @track paginationVisibility = false;
+ @track totalPages = 1;
+ pageSizeOptions = [10, 25, 50, 100];
+ @track recordStart = 0;
+ @track recordEnd = 0;
+ //end
+
+
+ //鍔犺浇妗�
+ // @track casesSpinner = true;
+ @track showSpinner = true;
+
+ //row
+ @track selectedRows = [];
+ //inventoryList
+ @track isSummonsFlag;
+ //灞曞紑鏍�
+ activeSections = ["dataExpand"];
+ columnHeader = ["娑堣�楀搧鍚嶇О", "鍗曚綅", "barCode", "璋冩暣鍘熷洜"];
+ //纭涓�瑙�
+ @track eSetId = "";
+ @track EditAble = false;
+ @track selectedData;
+ @track conId;
+ @track detailData = [];
+ @track adjustdata = [];
+ @track detalipan = [];
+
+
+ //瀵煎嚭csv
+ xlsDataHeader = ['娑堣�楀搧鍚嶇О', '鍗曚綅', 'barCode', '璋冩暣鍘熷洜'];
+
+ //鑾峰彇閾炬帴鍙傛暟
+ getQueryString(name) {
+ console.log("getQueryString name " + name);
+ let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+ let r = window.location.search.substr(1).match(reg);
+ if (r != null) {
+ return decodeURIComponent(r[2]);
+ }
+ return null;
+ }
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+
+ connectedCallback() {
+ console.log("===>鍒濆鍖�");
+
+ //鑾峰彇ESetid
+ this.eSetId = this.getQueryString("eSetId");
+ this.eSetId = this.eSetId == null ? "" : this.eSetId;
+ console.log(" this.eSetId" + this.eSetId);
+ if (this.eSetId == "") {
+ this.EditAble = false;
+ this.init();
+ } else {
+ this.inits();
+ this.showcount = false;
+ this.EditAble = true;
+ }
+
+ }
+ init() {
+
+ this.showSpinner = true;
+ oninit()
+ .then((result) => {
+ console.log("1112" + JSON.stringify(result));
+ result = JSON.parse(JSON.stringify(result));
+ console.log("result.status = " + result.status);
+ console.log("ConsumableorderdetailsRecordsview= " + result.entity.ConsumableorderdetailsRecordsview);
+ this.ConsumableorderdetailsRecordsview = JSON.parse(result.entity.ConsumableorderdetailsRecordsview);
+ this.consumableorderdetailsRecords = result.entity.consumableorderdetailsRecords;
+ console.log("consumableorderdetailsRecords= " + result.entity.consumableorderdetailsRecords);
+ console.log("浼犲弬绫诲瀷", typeof this.consumableorderdetailsRecords);
+ if (result.status == "Success") {
+ this.data = [];
+ this.data = this.ConsumableorderdetailsRecordsview[0];
+ console.log("this.data ==>" + JSON.stringify(this.data));
+ for (let i in this.data) {
+ this.data[i]["key"] = this.data[i]["ProdId"] + this.data[i]["boxPiece"];
+ this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
+ this.data[i]["Packing_list_manual__c"] = this.data[i].Prod.Packing_list_manual__c;
+ }
+ this.accountName = result.entity.accountName;
+ this.agencyProType = result.entity.agencyProType;
+ this.userWorkLocation = result.entity.userWorkLocation;
+ this.showSpinner = false;
+ this.accountid = result.entity.accountid;
+ this.showTable = true;
+ } else {
+ this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error');
+ this.showSpinner = false;
+ }
+ })
+ .catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ this.showSpinner = false;
+ });
+ //榛樿灞曞紑鏍�
+ this.activeSections = ["dataExpand"];
+ this.showTable = false;
+ this.showbutton = false;
+ }
+
+ //褰曞叆barcode
+ barcodeEntrys() {
+ console.log('Test');
+ this.showTable = false;
+ this.showbutton = false;
+ this.showSpinner = true;
+
+ //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+ const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+ console.log('selectedRows========> ' + JSON.stringify(selectedRows));
+ for (var i in this.data) {
+ this.data[i]["check"] = false;
+ }
+ for (var i in this.data) {
+ for (var j in selectedRows) {
+ if (this.data[i].ProdId+this.data[i]["boxPiece"] == selectedRows[j].ProdId+ selectedRows[j]["boxPiece"]) {
+ this.data[i]["check"] = true;
+ }
+ // console.log('this.data[i].ProdId+this.data[i]["boxPiece"]'+this.data[i].ProdId+this.data[i]["boxPiece"]);
+ console.log('selectedRows[j].ProdId+this.data[i]["boxPiece"]'+selectedRows[j].ProdId+selectedRows[j]["boxPiece"]);
+
+ }
+ }
+ // if(this.barcode == ''||this.barcode == null){
+ // this.showMyToast('鑾峰彇澶辫触','璇疯緭鍏arCode鍙�','error');
+
+ // }
+ console.log('this.data--->'+JSON.stringify(this.data));
+ console.log('this.currentPageToken'+this.currentPageToken);
+ this.selectedRows = [];
+ barcodeEntry({
+ accountName: this.accountName,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ barcode: this.barcode,
+ consumableorderdetailsRecordsLWC: JSON.stringify(this.data),
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken,
+ sortFieldLWC: this.sortBy,
+ sortOrderLWC: this.sortDirection
+
+ })
+ .then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log("result ===>" + JSON.stringify(result));
+ if (result.status == "Success1") {
+ //鍒嗛〉start
+ this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords = result.entity.paginatedAccounts.totalRecords;
+ this.recordStart = result.entity.paginatedAccounts.recordStart;
+ this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
+ console.log('this.totalPages = ' + this.totalPages);
+ this.paginationVisibility = this.totalPages > 1 ? true : false;
+ console.log('this.sortDirection = ' + this.sortDirection);
+ //鍒嗛〉end
+ this.codPageRecords = JSON.parse(result.entity.codPageRecords);
+ for (var i in this.codPageRecords) {
+ this.codPageRecords[i]["Name__c"] = this.codPageRecords[i].Prod.Name__c;
+ this.codPageRecords[i]["Box_Piece__c"] = this.codPageRecords[i].orderdetails2.Box_Piece__c;
+ this.codPageRecords[i]["Bar_Code__c"] = this.codPageRecords[i].orderdetails2.Bar_Code__c;
+ }
+ this.pageCodeRecords = result.entity.pageCodeRecords;
+ for (var i in this.pageCodeRecords) {
+ this.pageCodeRecords[i]["Name__c"] = this.pageCodeRecords[i].Prod.Name__c;
+ this.pageCodeRecords[i]["Box_Piece__c"] = this.pageCodeRecords[i].orderdetails2.Box_Piece__c;
+ this.pageCodeRecords[i]["Bar_Code__c"] = this.pageCodeRecords[i].orderdetails2.Bar_Code__c;
+ }
+ this.data = JSON.parse(result.entity.consumableorderdetailsRecords);
+ for (var i in this.data) {
+ this.data[i]["key"] = this.data[i]["ProdId"] + this.data[i]["boxPiece"];
+ this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
+ this.data[i]["Packing_list_manual__c"] = this.data[i].Prod.Packing_list_manual__c;
+ if (this.data[i]["check"]) {
+ this.selectedRows.push(this.data[i].ProdId + this.data[i]["boxPiece"]);
+ console.log("selectedRows:" + this.selectedRows);
+ }
+ }
+ this.iSinventory = result.entity.iSinventory;
+ this.pandiandetailsMap = result.entity.pandiandetailsMap;
+ this.reSet = result.entity.reSet1;
+ console.log("iSinventory:" + this.iSinventory);
+ this.showTable = true;
+ this.showbutton = true;
+ this.showSpinner = false;
+ console.log("result褰曞叆= " + JSON.stringify(result));
+ }
+ else {
+ if (result.status == "Sucess") {
+ //鍒嗛〉start
+ this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords = result.entity.paginatedAccounts.totalRecords;
+ this.recordStart = result.entity.paginatedAccounts.recordStart;
+ this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
+ console.log('this.totalPages = ' + this.totalPages);
+ this.paginationVisibility = this.totalPages > 1 ? true : false;
+ console.log('this.sortDirection = ' + this.sortDirection);
+ //鍒嗛〉end
+ this.codPageRecords = JSON.parse(result.entity.codPageRecords);
+ for (var i in this.codPageRecords) {
+ this.codPageRecords[i]["Name__c"] = this.codPageRecords[i].Prod.Name__c;
+ this.codPageRecords[i]["Box_Piece__c"] = this.codPageRecords[i].orderdetails2.Box_Piece__c;
+ this.codPageRecords[i]["Bar_Code__c"] = this.codPageRecords[i].orderdetails2.Bar_Code__c;
+ }
+ this.pageCodeRecords = result.entity.pageCodeRecords;
+ for (var i in this.pageCodeRecords) {
+ this.pageCodeRecords[i]["Name__c"] = this.pageCodeRecords[i].Prod.Name__c;
+ this.pageCodeRecords[i]["Box_Piece__c"] = this.pageCodeRecords[i].orderdetails2.Box_Piece__c;
+ this.pageCodeRecords[i]["Bar_Code__c"] = this.pageCodeRecords[i].orderdetails2.Bar_Code__c;
+ }
+ this.data = JSON.parse(result.entity.consumableorderdetailsRecords);
+ for (var i in this.data) {
+ this.data[i]["key"] = this.data[i]["ProdId"] + this.data[i]["boxPiece"];
+ this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
+ this.data[i]["Packing_list_manual__c"] = this.data[i].Prod.Packing_list_manual__c;
+ if (this.data[i]["check"]) {
+ this.selectedRows.push(this.data[i].ProdId + this.data[i]["boxPiece"]);
+ console.log("selectedRows:" + this.selectedRows);
+ }
+ }
+ this.iSinventory = result.entity.iSinventory;
+ this.pandiandetailsMap = result.entity.pandiandetailsMap;
+ this.reSet = result.entity.reSet;
+ console.log("iSinventory:" + this.iSinventory);
+ this.showTable = true;
+ this.showbutton = true;
+ this.showSpinner = false;
+ console.log("result褰曞叆= " + JSON.stringify(result));
+ } else {
+ console.log('Error:' + result.msg);
+ this.showMyToast(result.msg,'','error');
+ this.showSpinner = false;
+ this.showTable = true;
+ }
+ }
+ })
+ .catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ });
+ }
+ //鑾峰彇褰撳墠杈撳叆鍊�
+ handleChange(event) {
+ let value = event.detail.value;
+ console.log("value" + value);
+ this.barcode = value;
+ }
+
+ getSelectedRows(event) {
+ let selectedRowsEvent = event.detail.selectedRows;
+ this.selectedRows = [];
+ for (var i in selectedRowsEvent) {
+ this.selectedRows.push(selectedRowsEvent[i].ProdId+this.data[i]["boxPiece"]);
+ }
+ const selectedRows = event.detail.selectedRows;
+ console.log("this.selectedRows = " + JSON.stringify(selectedRows));
+ for (var i in selectedRows) {
+ this.selectedRows.push(selectedRows[i].ProdId+this.data[i]["boxPiece"]);
+ }
+
+ }
+
+ //瀵煎嚭涓篶sv
+ exportData() {
+ // Prepare a html table
+ let doc = '<table>';
+ // Add styles for the table
+ doc += '<style>';
+ doc += 'table, th, td {';
+ doc += ' border: 1px solid black;';
+ doc += ' border-collapse: collapse;';
+ doc += '}';
+ doc += '</style>';
+ // Add all the Table Headers
+ doc += '<tr>';
+ this.columnHeader.forEach(element => {
+ doc += '<th>' + element + '</th>'
+ });
+ doc += '</tr>';
+ // Add the data rows
+ this.codPageRecords.forEach(record => {
+ doc += '<tr>';
+ doc += '<th>' + record.Name__c + '</th>';
+ doc += '<th>' + record.Box_Piece__c + '</th>';
+ doc += '<th>' + record.Bar_Code__c + '</th>';
+ doc += '<th>' + record.DiffReason + '</th>';
+ doc += '</tr>';
+ });
+ doc += '</table>';
+ console.log('doc' + doc);
+ var element = 'data:application/vnd.ms-excel,' + encodeURIComponent(doc);
+ let downloadElement = document.createElement('a');
+ downloadElement.href = element;
+ downloadElement.target = '_self';
+ // use .csv as extension on below line if you want to export data as csv
+ downloadElement.download = '鍦ㄥ簱璋冩暣涓�瑙�.xls';
+ document.body.appendChild(downloadElement);
+ downloadElement.click();
+ }
+
+
+ //鑷畾涔塪ataType
+
+ diffreasons(event) {
+ const numberDetail = event.detail;
+ // this.numberDetail = numberDetail;
+ console.log("numberDetail" + JSON.stringify(numberDetail));
+ for (var i in this.data) {
+ console.log('this.data[i]["key"]' + this.data[i]["key"]);
+ console.log('numberDetail.data.ProdId+numberDetail.data.boxPiece' + numberDetail.data.ProdId + numberDetail.data.boxPiece);
+
+ if (this.data[i]["key"] == numberDetail.data.ProdId + numberDetail.data.boxPiece) {
+ this.data[i]["DiffReason"] = numberDetail.data.DiffReason;
+ }
+ }
+ console.log(" this.data==>" + JSON.stringify(this.data));
+ }
+
+ saveConfirm() {
+ console.log("杩涘叆鐩樼偣纭");
+ console.log('reSet' + this.reSet);
+ this.showSpinner = true;
+ console.log('pandiandetailsMap' + this.pandiandetailsMap);
+ //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+ const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+ console.log('selectedRows========> ' + JSON.stringify(selectedRows));
+ for (var i in this.data) {
+ this.data[i]["check"] = false;
+ }
+ for (var i in this.data) {
+ for (var j in selectedRows) {
+ if (this.data[i].ProdId+this.data[i]["boxPiece"] == selectedRows[j].ProdId+ selectedRows[j]["boxPiece"]) {
+ this.data[i]["check"] = true;
+ }
+ // console.log('this.data[i].ProdId+this.data[i]["boxPiece"]'+this.data[i].ProdId+this.data[i]["boxPiece"]);
+ console.log('selectedRows[j].ProdId+this.data[i]["boxPiece"]'+selectedRows[j].ProdId+selectedRows[j]["boxPiece"]);
+
+ }
+ }
+
+ // var el = this.template.querySelector("c-lex-custom-lightning-datatable");
+ // var selected = el.getSelectedRows();
+ // this.selectedData = selected;
+ // console.log("閫変腑鏁版嵁" + JSON.stringify(this.selectedData));
+ // console.log("reset" + JSON.stringify(this.reSet));
+ // console.log("reset1" + JSON.stringify(this.reSet1));
+ // console.log("r" + JSON.stringify(this.reSet1));
+
+ save({
+ iSinventory: this.iSinventory,
+ consumableorderdetailsRecordsLWC:JSON.stringify(this.data),
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ reSet: this.reSet,
+ pandiandetailsMap: this.pandiandetailsMap
+ })
+ .then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log("result = " + JSON.stringify(result));
+ console.log("111111");
+
+ if (result.status == "Success") {
+ let url = "/lexinventory?ESetid=" + result.entity.eSetId;
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ this.showSpinner = false;
+ console.log("Id" + this.eSetId);
+ // this.EditAble = true;
+ // this.showcount = false;
+ } else {
+ this.showMyToast('鐩樼偣澶辫触',result.msg,'error');
+ this.showSpinner = false;
+ }
+ })
+ .catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ this.showSpinner = false;
+ });
+ }
+
+ inits() {
+ this.showSpinner = true
+ datainit({
+ eSetId: this.eSetId,
+ })
+ .then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('鐩樼偣涓�瑙�===>' + JSON.stringify(result));
+
+ for (var i in result.entity.qs) {
+ this.conId = result.entity.qs[i].Id;
+ }
+ console.log("this.conId" + typeof this.conId);
+ this.detailData = JSON.parse(result.entity.consumableorderdetailsRecords);
+ if (result.entity.ConsumableorderdetailsRecordsError != null) {
+ this.adjustdata = JSON.parse(
+ result.entity.ConsumableorderdetailsRecordsError
+ );
+ for (let i in this.detailData) {
+ this.detailData[i].Name__c = this.detailData[i].Prod.Name__c;
+ this.detailData[i].Count_Sum__c = this.detailData[i].orderdetails1.Count_Sum__c;
+ this.detailData[i].inventory_sum__c = this.detailData[i].orderdetails1.inventory_sum__c;
+ this.detailData[i].Diff__c = this.detailData[i].orderdetails1.Diff__c;
+ this.detailData[i].Product_Refind__c = this.detailData[i].orderdetails1.Product_Refind__c;
+ this.detailData[i].Lose_reason__c = this.detailData[i].orderdetails1.Lose_reason__c;
+ }
+ for (let i in this.adjustdata) {
+ this.adjustdata[i].Name__c = this.adjustdata[i].Prod.Name__c;
+ this.adjustdata[i].Asset_Model_No__c = this.adjustdata[i].Prod.Asset_Model_No__c;
+ this.adjustdata[i].Lose_reason__c = this.adjustdata[i].orderdetails2.Lose_reason__c;
+ this.adjustdata[i].Lose_Flag__c = this.adjustdata[i].orderdetails2.Lose_Flag__c;
+ }
+ }
+ this.showSpinner = false;
+ console.log("result鐩樼偣Id" + JSON.stringify(this.conId));
+ console.log("璋冩暣鏄庣粏" + JSON.stringify(this.adjustdata));
+ })
+ .catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ this.showSpinner = false;
+ });
+ }
+ //鍒嗛〉
+ handlePrevious() {
+ this.currentPageToken = Number(this.currentPageToken) - Number(this.pageSize);
+ this.barcodeEntrys();
+ }
+
+ handleNext() {
+ console.log('111');
+ this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize);
+ this.barcodeEntrys();
+ }
+ handleFirst() {
+ this.currentPageToken = 0;
+ this.barcodeEntrys();
+ }
+
+ handleLast() {
+ this.currentPageToken = this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+ this.barcodeEntrys();
+ }
+
+ handlePageschange(event) {
+ console.log(event.detail);
+ this.pageSize = event.detail;
+ this.currentPageToken = 0;
+ this.barcodeEntrys();
+ }
+ get previousButtonDisabled() {
+ return this.currentPageToken === 0;
+ }
+
+ get nextButtonDisabled() {
+ return this.nextPageToken === undefined;
+ }
+
+ handleLoad2() {
+ console.log('handleLoad2')
+ try {
+ const style2 = document.createElement('style');
+ style2.innerText = '.hehe-layoutItem .slds-form-element__label {padding : 0px}';
+ this.template.querySelector('.hideHelpText').appendChild(style2);
+ } catch (error) {
+ console.log(error);
+ }
+ }
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexInventory/lexInventory.js-meta.xml b/force-app/main/default/lwc/lexInventory/lexInventory.js-meta.xml
new file mode 100644
index 0000000..6cf1ec7
--- /dev/null
+++ b/force-app/main/default/lwc/lexInventory/lexInventory.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.html b/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.html
new file mode 100644
index 0000000..bd7f8ea
--- /dev/null
+++ b/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.html
@@ -0,0 +1,9 @@
+<template>
+ <c-common-toast></c-common-toast>
+ <template if:true={isShowReminder}>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;color:#ff6a00;font-size:18px;">
+ <lightning-icon style="margin: 2px;" icon-name="custom:custom53" size="small"></lightning-icon>
+ <strong style="padding-top: 2px;"> 鎻愰啋锛歿msg}</strong>
+ </div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js b/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js
new file mode 100644
index 0000000..f154617
--- /dev/null
+++ b/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js
@@ -0,0 +1,64 @@
+import { LightningElement,track} from 'lwc';
+import initReminder from '@salesforce/apex/LexLicenceReminderController.initReminder';
+
+export default class LexLicenceReminder extends LightningElement {
+ @track days = 0;
+ @track isShowReminder = false;
+ @track msg = '';
+
+ connectedCallback(){
+ initReminder()
+ .then(result=>{
+ if (result.result == 'Success') {
+ this.days = result.days;
+ this.isShowReminder = result.isShowReminder;
+ if(this.days > 0){
+ this.msg = '鎮ㄧ殑鍖荤枟鍣ㄦ缁忚惀浼佷笟璁稿彲璇佽繕鏈�'+this.days+'澶╁氨鍒版湡浜嗭紒';
+ }else if(this.days == 0){
+ this.msg = '鎮ㄧ殑鍖荤枟鍣ㄦ缁忚惀浼佷笟璁稿彲璇佷粖澶╁氨鍒版湡浜嗭紒';
+ }else if(this.days < 0){
+ var days = this.days * -1
+ this.msg = '鎮ㄧ殑鍖荤枟鍣ㄦ缁忚惀浼佷笟璁稿彲璇佸凡缁忚繃鏈�'+days+'澶╀簡锛�';
+ }
+ } else {
+ console.log("Error:" + result.errorMsg);
+ this.showMyToast(result.errorMsg, '', 'error');
+ }
+ })
+ .catch(error => {
+ console.log("Error:" + JSON.stringify(error));
+ this.showMyToast('鍒濆鍖栨彁閱掑け璐�', JSON.stringify(error), 'error');
+ })
+ }
+
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').
+ showToast(variant,content,iconName,10000);
+ // var mode;
+ // if(this.isNoteStay){
+ // mode ='sticky';
+ // }else{
+ // mode = 'dismissable';
+ // }
+ // const evt = new ShowToastEvent({
+ // title: title,
+ // message: message,
+ // variant: variant,
+ // mode: mode
+ // });
+ // this.dispatchEvent(evt);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js-meta.xml b/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLookup/LexLookup.css b/force-app/main/default/lwc/lexLookup/LexLookup.css
new file mode 100644
index 0000000..0286cad
--- /dev/null
+++ b/force-app/main/default/lwc/lexLookup/LexLookup.css
@@ -0,0 +1,30 @@
+.slds-combobox__input,
+.slds-combobox_container {
+ transition: border 0.1s linear, box-shadow 0.1 linear;
+}
+
+.slds-combobox__input {
+ box-shadow: none;
+}
+
+.slds-combobox__input.has-custom-border {
+ box-shadow: 0 0 0 2px #fff inset, 0 0 0 3px rgb(221, 219, 218) inset;
+}
+
+.slds-combobox__input.has-custom-error {
+ border: 1px solid rgb(194, 57, 52);
+ box-shadow: rgb(194, 57, 52) 0 0 0 1px inset;
+}
+
+.slds-combobox_container.has-custom-error {
+ border: none !important;
+}
+
+.slds-combobox__input.has-custom-height {
+ height: 32px !important;
+}
+
+.form-error {
+ color: rgb(194, 57, 52);
+ display: block;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLookup/lexLookup.html b/force-app/main/default/lwc/lexLookup/lexLookup.html
new file mode 100644
index 0000000..36864a9
--- /dev/null
+++ b/force-app/main/default/lwc/lexLookup/lexLookup.html
@@ -0,0 +1,139 @@
+<template>
+ <div class={getFormElementClass}>
+ <label lwc:if={label} class={getLabelClass} for="combobox">
+ <abbr lwc:if={required} title="required" class="slds-required">*</abbr>
+ {label}
+ </label>
+ <div class="slds-form-element__control">
+ <div class={getContainerClass}>
+ <div class={getDropdownClass} aria-expanded={isListboxOpen} aria-haspopup="listbox" aria-owns="listbox"
+ role="combobox">
+ <!-- Search input start -->
+ <div class={getComboboxClass} role="none">
+ <template lwc:if={isSingleEntry}>
+ <lightning-icon icon-name={getSelectIconName} size="small"
+ alternative-text="Selected item icon" class={getSelectIconClass}>
+ </lightning-icon>
+ </template>
+
+ <!-- Text input -->
+ <input type="text" class={getInputClass} aria-autocomplete="list" aria-controls="listbox"
+ aria-activedescendant={_focusedResultIndex} autocomplete="off" role="textbox" id="combobox"
+ placeholder={placeholder} value={getInputValue} title={getInputTitle}
+ readonly={isInputReadonly} disabled={disabled} onfocus={handleFocus} onblur={handleBlur}
+ oninput={handleInput} onkeydown={handleKeyDown} />
+
+ <!-- Search icon -->
+ <lightning-icon icon-name="utility:search" size="x-small" alternative-text="Search icon"
+ class={getSearchIconClass}></lightning-icon>
+
+ <!-- Clear selection button icon for single entry lookups -->
+ <template lwc:if={isSingleEntry}>
+ <button title="Remove selected option" type="button" onclick={handleClearSelection}
+ class={getClearSelectionButtonClass} disabled={disabled}>
+ <lightning-icon icon-name="utility:close" size="x-small"
+ alternative-text="Remove selected option"
+ class="slds-button__icon"></lightning-icon>
+ </button>
+ </template>
+ </div>
+ <!-- Search input end -->
+
+ <!-- Result list box start -->
+ <div id="listbox" role="listbox" aria-label={label} onmousedown={handleComboboxMouseDown}
+ onmouseup={handleComboboxMouseUp} class={getListboxClass}>
+ <ul class="slds-listbox slds-listbox_vertical" role="presentation">
+ <!-- Spinner to display when waiting for results of search -->
+ <div lwc:if={loading}>
+ <lightning-spinner alternative-text="Loading" size="small"></lightning-spinner>
+ </div>
+
+ <!-- Result list start -->
+ <template for:each={searchResultsLocalState} for:item="item" for:index="index"
+ lwc:if={hasResults}>
+ <li key={item.result.id} role="presentation" class="slds-listbox__item">
+ <div class={item.classes} role="option" id={index} aria-label={item.result.title}
+ onclick={handleResultClick} data-recordid={item.result.id}>
+ <span class="slds-media__figure slds-listbox__option-icon">
+ <lightning-icon icon-name={item.result.icon} size="small"
+ alternative-text="Result item icon"></lightning-icon>
+ </span>
+ <span class="slds-media__body">
+ <span class="slds-listbox__option-text slds-listbox__option-text_entity">
+ <lightning-formatted-rich-text value={item.result.titleFormatted}
+ disable-linkify>
+ </lightning-formatted-rich-text>
+ </span>
+ <span lwc:if={item.result.subtitleFormatted}
+ class="slds-listbox__option-meta slds-listbox__option-meta_entity">
+ <lightning-formatted-rich-text value={item.result.subtitleFormatted}
+ disable-linkify>
+ </lightning-formatted-rich-text>
+ </span>
+ </span>
+ </div>
+ </li>
+ </template>
+ <!-- Result list end -->
+
+ <!-- No results start -->
+ <template lwc:else>
+ <li role="presentation">
+ <span class="slds-media slds-listbox__option_entity" role="option">
+ <span lwc:if={loading} class="slds-media__body">Loading...</span>
+ <span lwc:else class="slds-media__body">No results.</span>
+ </span>
+ </li>
+ </template>
+ <!-- No results end -->
+
+ <!-- Create new records -->
+ <template for:each={newRecordOptions} for:item="newRecord">
+ <li key={newRecord.value} role="presentation" class="slds-listbox__item">
+ <div class="slds-media slds-media_center slds-listbox__option slds-listbox__option_entity"
+ onclick={handleNewRecordClick} data-sobject={newRecord.value} role="option">
+ <span class="slds-media__figure slds-listbox__option-icon">
+ <lightning-icon icon-name="utility:add" size="small"
+ alternative-text={newRecord.label}></lightning-icon>
+ </span>
+ <span class="slds-media__body">
+ <span class="slds-listbox__option-text">{newRecord.label}</span>
+ </span>
+ </div>
+ </li>
+ </template>
+ <!-- Create new records end -->
+ </ul>
+ </div>
+ <!-- Result list box end -->
+ </div>
+ </div>
+
+ <!-- Multi-selection start -->
+ <template lwc:if={isMultiEntry}>
+ <div id="selection" role="listbox" aria-label={label} aria-orientation="horizontal">
+ <ul class="slds-listbox slds-listbox_inline slds-var-p-top_xxx-small" role="group"
+ aria-label="Selected options">
+ <template for:each={selection} for:item="item">
+ <li key={item.id} role="presentation">
+ <lightning-pill label={item.title} title={item.title}
+ onremove={handleRemoveSelectedItem} name={item.id}>
+ <lightning-icon icon-name={item.icon}></lightning-icon>
+ </lightning-pill>
+ </li>
+ </template>
+ </ul>
+ </div>
+ </template>
+ <!-- Multi-selection end -->
+
+ <!-- Errors start -->
+ <template for:each={_errors} for:item="error">
+ <div key={error.id} role="alert" class="slds-form-element__label slds-var-m-top_xx-small form-error">
+ {error.message}
+ </div>
+ </template>
+ <!-- Errors end -->
+ </div>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLookup/lexLookup.js b/force-app/main/default/lwc/lexLookup/lexLookup.js
new file mode 100644
index 0000000..7d2ef23
--- /dev/null
+++ b/force-app/main/default/lwc/lexLookup/lexLookup.js
@@ -0,0 +1,493 @@
+import { LightningElement, api, track } from 'lwc';
+import { NavigationMixin } from 'lightning/navigation';
+
+const SEARCH_DELAY = 300; // Wait 300 ms after user stops typing then, peform search
+
+const KEY_ARROW_UP = 38;
+const KEY_ARROW_DOWN = 40;
+const KEY_ENTER = 13;
+
+const VARIANT_LABEL_STACKED = 'label-stacked';
+const VARIANT_LABEL_INLINE = 'label-inline';
+const VARIANT_LABEL_HIDDEN = 'label-hidden';
+
+const REGEX_SOSL_RESERVED = /(\?|&|\||!|\{|\}|\[|\]|\(|\)|\^|~|\*|:|"|\+|-|\\)/g;
+const REGEX_EXTRA_TRAP = /(\$|\\)/g;
+
+export default class LexLookup extends NavigationMixin(LightningElement) {
+ // Public properties
+ @api variant = VARIANT_LABEL_STACKED;
+ @api label = '';
+ @api required = false;
+ @api disabled = false;
+ @api placeholder = '';
+ @api isMultiEntry = false;
+ @api scrollAfterNItems = null;
+ @api newRecordOptions = [];
+ @api minSearchTermLength = 2;
+ @api isDisabledForDealerText = false;
+ @api accountValue = '';
+
+ // Template properties
+ searchResultsLocalState = [];
+ loading = false;
+
+ // Private properties
+ _errors = [];
+ _hasFocus = false;
+ _isDirty = false;
+ _searchTerm = '';
+ _cleanSearchTerm;
+ _cancelBlur = false;
+ _searchThrottlingTimeout;
+ _searchResults = [];
+ _defaultSearchResults = [];
+ _curSelection = [];
+ _focusedResultIndex = null;
+
+
+
+
+
+ // PUBLIC FUNCTIONS AND GETTERS/SETTERS
+ @api
+ set selection(initialSelection) {
+ if (initialSelection) {
+ this._curSelection = Array.isArray(initialSelection) ? initialSelection : [initialSelection];
+ this.processSelectionUpdate(false);
+ }
+ }
+
+ get selection() {
+ return this._curSelection;
+ }
+
+ @api
+ set errors(errors) {
+ this._errors = errors;
+ // Blur component if errors are passed
+ if (this._errors?.length > 0) {
+ this.blur();
+ }
+ }
+
+ get errors() {
+ return this._errors;
+ }
+
+ @api
+ get validity() {
+ return { valid: !this._errors || this._errors.length === 0 };
+ }
+
+ @api
+ get value() {
+ return this.getSelection();
+ }
+
+ @api
+ setSearchResults(results) {
+ // Reset the spinner
+ this.loading = false;
+ // Clone results before modifying them to avoid Locker restriction
+ let resultsLocal = JSON.parse(JSON.stringify(results));
+ // Remove selected items from search results
+ const selectedIds = this._curSelection.map((sel) => sel.id);
+ resultsLocal = resultsLocal.filter((result) => selectedIds.indexOf(result.id) === -1);
+ // Format results
+ const cleanSearchTerm = this._searchTerm.replace(REGEX_SOSL_RESERVED, '.?').replace(REGEX_EXTRA_TRAP, '\\$1');
+ const regex = new RegExp(`(${cleanSearchTerm})`, 'gi');
+ this._searchResults = resultsLocal.map((result) => {
+ // Format title and subtitle
+ if (this._searchTerm.length > 0) {
+ result.titleFormatted = result.title
+ ? result.title.replace(regex, '<strong>$1</strong>')
+ : result.title;
+ result.subtitleFormatted = result.subtitle
+ ? result.subtitle.replace(regex, '<strong>$1</strong>')
+ : result.subtitle;
+ } else {
+ result.titleFormatted = result.title;
+ result.subtitleFormatted = result.subtitle;
+ }
+ // Add icon if missing
+ if (typeof result.icon === 'undefined') {
+ result.icon = 'standard:default';
+ }
+ return result;
+ });
+ // Add local state and dynamic class to search results
+ this._focusedResultIndex = null;
+ const self = this;
+ this.searchResultsLocalState = this._searchResults.map((result, i) => {
+ return {
+ result,
+ state: {},
+ get classes() {
+ let cls = 'slds-media slds-media_center slds-listbox__option slds-listbox__option_entity';
+ if (result.subtitleFormatted) {
+ cls += ' slds-listbox__option_has-meta';
+ }
+ if (self._focusedResultIndex === i) {
+ cls += ' slds-has-focus';
+ }
+ return cls;
+ }
+ };
+ });
+ }
+
+ @api
+ getSelection() {
+ console.log('get selection:' +this._curSelection);
+ return this._curSelection;
+ }
+
+ @api
+ setDefaultResults(results) {
+ this._defaultSearchResults = [...results];
+ if (this._searchResults.length === 0) {
+ this.setSearchResults(this._defaultSearchResults);
+ }
+ }
+
+ @api
+ blur() {
+ this.template.querySelector('input')?.blur();
+ }
+
+ connectedCallback(){
+ console.log('LexLookup accountValue = ' + this.accountValue);
+ console.log('isDisabledForDealerText = ' + this.isDisabledForDealerText);
+ }
+
+ // INTERNAL FUNCTIONS
+ updateSearchTerm(newSearchTerm) {
+ this._searchTerm = newSearchTerm;
+
+ // Compare clean new search term with current one and abort if identical
+ const newCleanSearchTerm = newSearchTerm.trim().replace(REGEX_SOSL_RESERVED, '?').toLowerCase();
+ if (this._cleanSearchTerm === newCleanSearchTerm) {
+ return;
+ }
+
+ // Save clean search term
+ this._cleanSearchTerm = newCleanSearchTerm;
+
+ // Ignore search terms that are too small after removing special characters
+ if (newCleanSearchTerm.replace(/\?/g, '').length < this.minSearchTermLength) {
+ this.setSearchResults(this._defaultSearchResults);
+ return;
+ }
+
+ // Apply search throttling (prevents search if user is still typing)
+ if (this._searchThrottlingTimeout) {
+ clearTimeout(this._searchThrottlingTimeout);
+ }
+ // eslint-disable-next-line @lwc/lwc/no-async-operation
+ this._searchThrottlingTimeout = setTimeout(() => {
+ // Send search event if search term is long enougth
+ if (this._cleanSearchTerm.length >= this.minSearchTermLength) {
+ // Display spinner until results are returned
+ this.loading = true;
+
+ const searchEvent = new CustomEvent('search', {
+ detail: {
+ searchTerm: this._cleanSearchTerm,
+ rawSearchTerm: newSearchTerm,
+ selectedIds: this._curSelection.map((element) => element.id)
+ }
+ });
+ this.dispatchEvent(searchEvent);
+ }
+ this._searchThrottlingTimeout = null;
+ }, SEARCH_DELAY);
+ }
+
+ isSelectionAllowed() {
+ if (this.isMultiEntry) {
+ return true;
+ }
+ return !this.hasSelection();
+ }
+
+ hasSelection() {
+ return this._curSelection.length > 0;
+ }
+
+ processSelectionUpdate(isUserInteraction) {
+ // Reset search
+ this._cleanSearchTerm = '';
+ this._searchTerm = '';
+ this.setSearchResults([...this._defaultSearchResults]);
+ // Indicate that component was interacted with
+ this._isDirty = isUserInteraction;
+ // Blur input after single select lookup selection
+ if (!this.isMultiEntry && this.hasSelection()) {
+ this._hasFocus = false;
+ }
+ // If selection was changed by user, notify parent components
+ if (isUserInteraction) {
+ const selectedIds = this._curSelection.map((sel) => sel.id);
+ this.dispatchEvent(new CustomEvent('selectionchange', { detail: selectedIds }));
+ }
+ }
+
+ // EVENT HANDLING
+
+ handleInput(event) {
+ // Prevent action if selection is not allowed
+ if (!this.isSelectionAllowed()) {
+ return;
+ }
+ this.updateSearchTerm(event.target.value);
+ }
+
+ handleKeyDown(event) {
+ if (this._focusedResultIndex === null) {
+ this._focusedResultIndex = -1;
+ }
+ if (event.keyCode === KEY_ARROW_DOWN) {
+ // If we hit 'down', select the next item, or cycle over.
+ this._focusedResultIndex++;
+ if (this._focusedResultIndex >= this._searchResults.length) {
+ this._focusedResultIndex = 0;
+ }
+ event.preventDefault();
+ } else if (event.keyCode === KEY_ARROW_UP) {
+ // If we hit 'up', select the previous item, or cycle over.
+ this._focusedResultIndex--;
+ if (this._focusedResultIndex < 0) {
+ this._focusedResultIndex = this._searchResults.length - 1;
+ }
+ event.preventDefault();
+ } else if (event.keyCode === KEY_ENTER && this._hasFocus && this._focusedResultIndex >= 0) {
+ // If the user presses enter, and the box is open, and we have used arrows,
+ // treat this just like a click on the listbox item
+ const selectedId = this._searchResults[this._focusedResultIndex].id;
+ console.log('selectedid:'+selectedId);
+ this.template.querySelector(`[data-recordid="${selectedId}"]`).click();
+ event.preventDefault();
+ }
+ }
+
+ handleResultClick(event) {
+ const recordId = event.currentTarget.dataset.recordid;
+
+ // Save selection
+ const selectedItem = this._searchResults.find((result) => result.id === recordId);
+ if (!selectedItem) {
+ return;
+ }
+ const newSelection = [...this._curSelection];
+ newSelection.push(selectedItem);
+ this._curSelection = newSelection;
+
+ // Process selection update
+ this.processSelectionUpdate(true);
+ }
+
+ handleComboboxMouseDown(event) {
+ const mainButton = 0;
+ if (event.button === mainButton) {
+ this._cancelBlur = true;
+ }
+ }
+
+ handleComboboxMouseUp() {
+ this._cancelBlur = false;
+ // Re-focus to text input for the next blur event
+ this.template.querySelector('input').focus();
+ }
+
+ handleFocus() {
+ // Prevent action if selection is not allowed
+ if (!this.isSelectionAllowed()) {
+ return;
+ }
+ this._hasFocus = true;
+ this._focusedResultIndex = null;
+ }
+
+ handleBlur() {
+ // Prevent action if selection is either not allowed or cancelled
+ if (!this.isSelectionAllowed() || this._cancelBlur) {
+ return;
+ }
+ const blurEvent = new CustomEvent('blur', {
+ detail: {}
+ });
+ this.dispatchEvent(blurEvent);
+ this._hasFocus = false;
+ if(!this.hasSelection()){
+ this._searchTerm = '';
+ }
+ }
+
+ handleRemoveSelectedItem(event) {
+ if (this.disabled) {
+ return;
+ }
+ const recordId = event.currentTarget.name;
+ this._curSelection = this._curSelection.filter((item) => item.id !== recordId);
+ // Process selection update
+ this.processSelectionUpdate(true);
+ }
+
+ handleClearSelection() {
+ this._curSelection = [];
+ this._hasFocus = false;
+ this.accountValue = '';
+ // Process selection update
+ this.processSelectionUpdate(true);
+ }
+
+ handleNewRecordClick(event) {
+ const objectApiName = event.currentTarget.dataset.sobject;
+ const selection = this.newRecordOptions.find((option) => option.value === objectApiName);
+
+ const preNavigateCallback = selection.preNavigateCallback
+ ? selection.preNavigateCallback
+ : () => Promise.resolve();
+ preNavigateCallback(selection).then(() => {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName,
+ actionName: 'new'
+ },
+ state: {
+ defaultFieldValues: selection.defaults
+ }
+ });
+ });
+ }
+
+ // STYLE EXPRESSIONS
+
+ get isSingleEntry() {
+ return !this.isMultiEntry;
+ }
+
+ get isListboxOpen() {
+ const isSearchTermValid = this._cleanSearchTerm && this._cleanSearchTerm.length >= this.minSearchTermLength;
+ return (
+ this._hasFocus &&
+ this.isSelectionAllowed() &&
+ (isSearchTermValid || this.hasResults || this.newRecordOptions?.length > 0)
+ );
+ }
+
+ get hasResults() {
+ return this._searchResults.length > 0;
+ }
+
+ get getFormElementClass() {
+ return this.variant === VARIANT_LABEL_INLINE
+ ? 'slds-form-element slds-form-element_horizontal'
+ : 'slds-form-element';
+ }
+
+ get getLabelClass() {
+ return this.variant === VARIANT_LABEL_HIDDEN
+ ? 'slds-form-element__label slds-assistive-text'
+ : 'slds-form-element__label';
+ }
+
+ get getContainerClass() {
+ let css = 'slds-combobox_container ';
+ if (this._errors.length > 0) {
+ css += 'has-custom-error';
+ }
+ return css;
+ }
+
+ get getDropdownClass() {
+ let css = 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click ';
+ if (this.isListboxOpen) {
+ css += 'slds-is-open';
+ }
+ return css;
+ }
+
+ get getInputClass() {
+ let css = 'slds-input slds-combobox__input has-custom-height ';
+ if (this._hasFocus && this.hasResults) {
+ css += 'slds-has-focus ';
+ }
+ if (this._errors.length > 0 || (this._isDirty && this.required && !this.hasSelection())) {
+ css += 'has-custom-error ';
+ }
+ if (!this.isMultiEntry) {
+ css += 'slds-combobox__input-value ' + (this.hasSelection() ? 'has-custom-border' : '');
+ }
+ return css;
+ }
+
+ get getComboboxClass() {
+ let css = 'slds-combobox__form-element slds-input-has-icon ';
+ if (this.isMultiEntry) {
+ css += 'slds-input-has-icon_right';
+ } else {
+ css += this.hasSelection() ? 'slds-input-has-icon_left-right' : 'slds-input-has-icon_right';
+ }
+ return css;
+ }
+
+ get getSearchIconClass() {
+ let css = 'slds-input__icon slds-input__icon_right ';
+ if (!this.isMultiEntry) {
+ css += this.hasSelection() ? 'slds-hide' : '';
+ }
+ return css;
+ }
+
+ get getClearSelectionButtonClass() {
+ return (
+ 'slds-button slds-button_icon slds-input__icon slds-input__icon_right ' +
+ (this.hasSelection() ? '' : 'slds-hide')
+ );
+ }
+
+ get getSelectIconName() {
+ if(this._curSelection[0])
+ console.log('this._curSelection[0].icon = ' + this._curSelection[0].icon);
+ return this.hasSelection() ? this._curSelection[0].icon : 'standard:default';
+ }
+
+ get getSelectIconClass() {
+ return 'slds-combobox__input-entity-icon ' + (this.hasSelection() ? '' : 'slds-hide');
+ }
+
+ get getInputValue() {
+ if (this.isMultiEntry) {
+ return this._searchTerm;
+ }
+ if(this.accountValue != ''){
+ return this.accountValue;
+ }
+ return this.hasSelection() ? this._curSelection[0].title : this._searchTerm;
+ }
+
+ get getInputTitle() {
+ if (this.isMultiEntry) {
+ return '';
+ }
+ return this.hasSelection() ? this._curSelection[0].title : '';
+ }
+
+ get getListboxClass() {
+ return (
+ 'slds-dropdown ' +
+ (this.scrollAfterNItems ? `slds-dropdown_length-with-icon-${this.scrollAfterNItems} ` : '') +
+ 'slds-dropdown_fluid'
+ );
+ }
+
+ get isInputReadonly() {
+ if (this.isMultiEntry) {
+ return false;
+ }
+ return this.hasSelection();
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLookup/lexLookup.js-meta.xml b/force-app/main/default/lwc/lexLookup/lexLookup.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/lexLookup/lexLookup.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewOrder/lexNewOrder.html b/force-app/main/default/lwc/lexNewOrder/lexNewOrder.html
new file mode 100644
index 0000000..44f8281
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewOrder/lexNewOrder.html
@@ -0,0 +1,7 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <div onclick={handleClick} style="width:200px;height:30px;background:#515151;font-weight:bold;font-size:16px Arial;color:white;border-radius: 5px 10px 10px 5px;;padding:5px 9px;cursor:pointer">鏂板缓娑堣�楀搧璁㈠崟</div>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewOrder/lexNewOrder.js b/force-app/main/default/lwc/lexNewOrder/lexNewOrder.js
new file mode 100644
index 0000000..7363f96
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewOrder/lexNewOrder.js
@@ -0,0 +1,25 @@
+import { LightningElement, track } from 'lwc';
+import { NavigationMixin } from 'lightning/navigation';
+
+export default class LexNewOrder extends NavigationMixin(LightningElement) {
+ @track showSpinner = true;
+
+ handleClick(event) {
+ this.showSpinner = true;
+ var rtId = event.target.id;
+ // this.clickedButtonLabel = event.target.label;
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName: 'Consumable_order__c',
+ actionName: 'new'
+ },
+ state: {
+ useRecordTypeCheck: 1
+ }
+ });
+ this.showSpinner = false;
+ }
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewOrder/lexNewOrder.js-meta.xml b/force-app/main/default/lwc/lexNewOrder/lexNewOrder.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewOrder/lexNewOrder.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.css b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.css
new file mode 100644
index 0000000..7156e21
--- /dev/null
+++ b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.css
@@ -0,0 +1,30 @@
+@import 'c/lexCssUtility';
+.outerBorderCss{
+ border: 1px solid #D4D4D4;
+ border-radius : 5px;
+ border-top : 3px solid #565959;
+}
+.borderCss{
+ border: 1px solid #D4D4D4;
+ border-radius : 5px;
+ margin-bottom : 7px;
+ border-top : 3px solid #565959;
+}
+.headerDorderCss{
+ border-top: 1px solid #565959;
+ border-bottom: 1px solid #D4D4D4;
+ padding:3px;
+}
+.centerCss{
+ text-align: center;
+}
+.centerCss .left{
+ margin-left: 100px;
+}
+.floatLeft{
+ float: left;
+}
+.fontWeight{
+ margin-left: 5px;
+ font-size:16px;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.html b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.html
new file mode 100644
index 0000000..3a9786f
--- /dev/null
+++ b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.html
@@ -0,0 +1,67 @@
+<!-- sldsValidatorIgnore -->
+<!-- sldsValidatorIgnore -->
+<template>
+ <c-common-toast></c-common-toast>
+ <template if:true={isShowSpinner}>
+ <lightning-spinner alternative-text="Loading" size="large"></lightning-spinner>
+ </template>
+ <div class="outerBorderCss">
+ <div style="padding: 5px">
+ <div class="borderCss">
+ <div style="padding: 10px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false" class="centerCss searchName">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="4" style="display: flex;align-items: center;">
+ <lightning-input class="floatLeft" label="" name="file uploader"
+ onchange={handleFilesChange} type="file" accept={acceptedType}
+ variant="label-hidden"></lightning-input>
+ <div class="slds-text-body_small floatLeft fontWeight">
+ {fileName}
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <!-- <lightning-button
+ label="璇诲彇csv鏂囦欢"
+ onclick={getCsvFile}
+ ></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={getCsvFile}>璇诲彇csv鏂囦欢</button>
+ </lightning-layout-item>
+ <lightning-layout-item size="4">
+ <!-- <lightning-button
+ label="瀵煎叆鏁版嵁"
+ onclick={dataImport}
+ disabled={saveFLGbln}
+ ></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={dataImport} disabled={saveFLGbln}>瀵煎叆鏁版嵁</button>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+
+ <div class="borderCss" style="margin-top: 10px;">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗曚俊鎭�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-datatable key-field="id" data={data} columns={columns} hide-checkbox-column
+ default-sort-direction={defaultSortDirection} sorted-direction={sortDirection}
+ sorted-by={sortedBy} onsort={onHandleSort} class="wrapped-header-datatable">
+ </lightning-datatable>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js
new file mode 100644
index 0000000..db4e6a3
--- /dev/null
+++ b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js
@@ -0,0 +1,270 @@
+import { LightningElement, api, track, wire } from "lwc";
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import init from "@salesforce/apex/LexOutboundorderImportController.init";
+import importCSVFile from "@salesforce/apex/LexOutboundorderImportController.importCSVFile";
+import dataImport from "@salesforce/apex/LexOutboundorderImportController.dataImport";
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+const columns = [
+ {
+ label: "鍑哄簱鍗曞悕绉�",
+ fieldName: "orderName",
+ hideDefaultActions: true,
+ initialWidth: 200
+ },
+ {
+ label: "鐩殑",
+ fieldName: "orderSummonsForDirction",
+ hideDefaultActions: true,
+ },
+ {
+ label: "鍖婚櫌缂栫爜",
+ fieldName: "hospitalCode",
+ hideDefaultActions: true,
+ },
+ {
+ label: "鍖婚櫌鍚嶇О",
+ fieldName: "hospitalName",
+ hideDefaultActions: true,
+ initialWidth: 300
+ },
+ {
+ label: "绉戝",
+ fieldName: "orderOrderForCustomerText",
+ hideDefaultActions: true,
+ },
+ {
+ label: "浜岀骇缁忛攢鍟�",
+ fieldName: "agencyName",
+ hideDefaultActions: true,
+ },
+ {
+ label: "鍑哄簱/閿�鍞棩鏈�",
+ fieldName: "orderOutboundDate",
+ hideDefaultActions: true,
+ },
+];
+export default class LexOutboundorderImport extends LightningElement {
+ @track isShowSpinner = true;
+ //鏂囦欢涓婁紶
+ @track showLoadingSpinner = false;
+ @track UploadFile = "Upload File";
+ @track fileName = "";
+ @track fileData = [];
+ @track fileColumns = [
+ {
+ label: "鏍囬",
+ fieldName: "url",
+ type: "url",
+ typeAttributes: { label: { fieldName: "Title" }, target: "_blank" },
+ hideDefaultActions: true,
+ },
+ {
+ label: "鍒涘缓浜�",
+ fieldName: "CreatedByName",
+ hideDefaultActions: true,
+ },
+ ];
+ filesUploaded = [];
+ fileContents;
+ fileReader;
+ content;
+ MAX_FILE_SIZE = 1500000;
+ get acceptedType() {
+ return [".csv"];
+ }
+
+ //鍒楄〃
+ columns = columns;
+ @track data = [];
+
+ //鏁版嵁
+ @track accountid = "";
+ @track userWorkLocation = "";
+ @track agencyProType = "";
+ @track accountName = "";
+ @track sqlagencyProType = "";
+ @track csvRecordStr = [];
+ @track saveFLGbln = false;
+ @track secondAgencyMap = {};
+ @track hospitalSysMap = {};
+
+ stylesLoaded = false;
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+ connectedCallback() {
+ init().then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.accountid = r.entity.accountid;
+ this.userWorkLocation = r.entity.userWorkLocation;
+ this.agencyProType = r.entity.agencyProType;
+ console.log('this.agencyProType = ' + this.agencyProType);
+ this.accountName = r.entity.accountName;
+ this.sqlagencyProType = r.entity.sqlagencyProType;
+ this.isShowSpinner = false;
+ } else {
+ console.log("r = " + JSON.stringify(r));
+ this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error')
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ this.showMyToast('閿欒', '鍒濆鍖栧け璐�', 'Error')
+ });
+ }
+
+ getCsvFile() {
+ this.isShowSpinner = true;
+
+ if (this.filesUploaded.length > 0) {
+ this.file = this.filesUploaded[0];
+ if (this.file.size > this.MAX_FILE_SIZE) {
+ window.console.log("鏂囦欢杩囧ぇ");
+ this.isShowSpinner = false;
+ return;
+ }
+ this.fileReader = new FileReader();
+
+ this.fileReader.onloadend = () => {
+ this.fileContents = this.fileReader.result;
+ let base64 = "base64,";
+ this.content = this.fileContents.indexOf(base64) + base64.length;
+ this.fileContents = this.fileContents.substring(this.content);
+ console.log('getCsvFile')
+ this.importCSVFile();
+ };
+ this.fileReader.readAsDataURL(this.file);
+ } else {
+ this.fileName = "閫夋嫨涓�涓猚sv鏂囦欢涓婁紶";
+ this.showMyToast('涓婁紶澶辫触', '閫夋嫨涓�涓猚sv鏂囦欢涓婁紶', 'Error')
+ }
+ }
+
+ importCSVFile() {
+ console.log('importCSVFile')
+ console.log('this.sqlagencyProType = ' + this.sqlagencyProType);
+ console.log('this.userWorkLocation = ' + this.userWorkLocation);
+ console.log('this.accountName = ' + this.accountName);
+ importCSVFile({
+ base64DataLwc: encodeURIComponent(this.fileContents),
+ sqlagencyProTypeLwc: this.sqlagencyProType,
+ userWorkLocationLwc: this.userWorkLocation,
+ accountNameLwc: this.accountName,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success" && r.msg == "") {
+ console.log("importCSVFile success");
+ this.saveFLGbln = r.entity.saveFLGbln;
+ this.csvRecordStr = r.entity.csvRecordStr;
+ this.secondAgencyMap = r.entity.secondAgencyMap;
+ this.hospitalSysMap = r.entity.hospitalSysMap;
+ this.data = r.entity.orderRecords;
+ for (var i in this.data) {
+ this.data[i]['orderName'] = this.data[i].order.Name;
+ this.data[i]['orderSummonsForDirction'] = this.data[i].order.SummonsForDirction__c;
+ this.data[i]['orderOrderForCustomerText'] = this.data[i].order.Order_ForCustomerText__c;
+ this.data[i]['orderOutboundDate'] = this.data[i].order.Outbound_Date__c;
+ }
+ this.isShowSpinner = false;
+ } else if (r.msg != "") {
+ console.log("r.msg = " + JSON.stringify(r.msg));
+ this.saveFLGbln = r.entity.saveFLGbln;
+ this.data = r.entity.orderRecords;
+ for (var i in this.data) {
+ this.data[i]['orderName'] = this.data[i].order.Name;
+ this.data[i]['orderSummonsForDirction'] = this.data[i].order.SummonsForDirction__c;
+ this.data[i]['orderOrderForCustomerText'] = this.data[i].order.Order_ForCustomerText__c;
+ this.data[i]['orderOutboundDate'] = this.data[i].order.Outbound_Date__c;
+ }
+ this.showMyToast('瀵煎叆澶辫触', r.msg, 'Error')
+ } else {
+ console.log("r.msg = " + JSON.stringify(r.msg));
+ this.showMyToast('瀵煎叆澶辫触', r.msg, 'Error')
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error.message));
+ this.showMyToast('瀵煎叆閿欒', '瀵煎叆澶辫触', 'Error')
+ });
+ }
+
+ dataImport() {
+ this.isShowSpinner = true;
+ let cloneData = this.data;
+ for (var i in cloneData) {
+ delete cloneData[i].orderName;
+ delete cloneData[i].orderSummonsForDirction;
+ delete cloneData[i].orderOrderForCustomerText;
+ delete cloneData[i].orderOutboundDate;
+ }
+ console.log('this.agencyProType = ' + this.agencyProType);
+ dataImport({
+ csvRecordStrLwc: this.csvRecordStr,
+ orderRecordsLwc: JSON.stringify(cloneData),
+ sqlagencyProTypeLwc: this.sqlagencyProType,
+ userWorkLocationLwc: this.userWorkLocation,
+ accountNameLwc: this.accountName,
+ accountidLwc: this.accountid,
+ agencyProTypeLwc: this.agencyProType,
+ secondAgencyMapLwc: this.secondAgencyMap,
+ hospitalSysMapLwc: this.hospitalSysMap,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success" && r.msg == "") {
+ this.saveFLGbln = true;
+ console.log("dataImport success");
+ this.showMyToast('鎴愬姛', '淇濆瓨鎴愬姛', 'Success')
+ } else if (r.msg != "") {
+ console.log("r.msg = " + JSON.stringify(r.msg));
+ this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error')
+ } else {
+ console.log("r.msg = " + JSON.stringify(r.msg));
+ this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error')
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error.message));
+ this.showMyToast('閿欒', '淇濆瓨澶辫触', 'Error')
+ });
+ }
+
+ handleFilesChange(event) {
+ console.log("handleFilesChange");
+ if (event.target.files.length > 0) {
+ this.filesUploaded = event.target.files;
+ this.fileName = event.target.files[0].name;
+ }
+ }
+
+ showMyToast(title, message, variant) {
+ this.isShowSpinner = false;
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if (variant.toLowerCase() == 'success') {
+ iconName = 'utility:check';
+ } else {
+ iconName = 'utility:error';
+ }
+ if (message != '') {
+ content = '<h2><strong>' + title + '<strong/></h2><h5>' + message + '</h5>';
+ } else {
+ content = '<h2><strong>' + title + '<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').showToast(variant, content, iconName, 10000);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js-meta.xml b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.css b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.html b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.html
new file mode 100644
index 0000000..84a3ed8
--- /dev/null
+++ b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.html
@@ -0,0 +1,135 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;">
+ <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <div style="margin: 12px;">
+ <p style="font-size: 18px;float:left"><strong>杩囨湡搴撳瓨閿�瀛�</strong></p>
+ </div>
+ <div style="margin-left:400px;margin-bottom:12px;">
+ <!-- <lightning-button variant="brand" class = 'lexstyle' label="閿�瀛樼‘璁�" title="閿�瀛樼‘璁�" onclick={saveConfirm}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="閿�瀛樼‘璁�" onclick={saveConfirm}>閿�瀛樼‘璁�</button>
+ </div>
+ </div>
+
+ <div style="padding:10px;">
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <table>
+ <colgroup>
+ <col width="160px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="90px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="85px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ </colgroup>
+ <tbody>
+ <tr>
+ <td></td>
+ <td align="right" class="searchName">BarCode</td>
+ <td style="width:600px"><lightning-textarea class="inputFont" name="BarCode" label=""
+ onchange={handleChange}></lightning-textarea></td>
+ <td align="right"></td>
+ <td></td>
+ <td style="width:200px">
+ <button style="margin-top:14px;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="鑾峰彇鏄庣粏" onclick={barcodeEntrys}>鑾峰彇鏄庣粏</button>
+ <!-- <lightning-button class='lexstyle' label="BarCode褰曞叆" title="BarCode褰曞叆" onclick={barcodeEntrys}
+ style="width: 150px;"></lightning-button> -->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:5px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <!-- <p style="font-size: 16px;"><strong>杩囨湡搴撳瓨涓�瑙�</strong></p> -->
+ <table>
+ <tr>
+ <td>
+ <!-- <p style="font-size: 16px;"><strong>閿�瀛樻槑缁�</strong></p> -->
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>杩囨湡搴撳瓨涓�瑙�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div style="padding:10px;">
+
+ <!-- <div style="height: 300px;"> -->
+ <template if:true={showTable}>
+ <c-lex-custom-lightning-datatable key-field="prodid" data={data} columns={columns}
+ onrowselection={getSelectedRows}
+ selected-rows={selectedRows} class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ </template>
+ <!-- 鍔犺浇妗� -->
+
+ <!-- <div if:true={casesSpinner} class="slds-spinner_inline spinner-padding"
+ style="margin-top:10px;">
+ <lightning-spinner variant="brand" alternative-text="Loading Cases" size="medium">
+ </lightning-spinner>
+ </div> -->
+
+ <!-- </div> -->
+
+ </div>
+ </div>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:5px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <table>
+ <tr>
+ <td>
+ <!-- <p style="font-size: 16px;"><strong>閿�瀛樻槑缁�</strong></p> -->
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>閿�瀛樻槑缁�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div style="padding:10px;">
+ <lightning-datatable
+ key-field="id" data={overduePageRecords} columns={column}
+ onrowselection={getSelectedRows} hide-checkbox-column="true"
+ selected-rows={selectedRows} class="wrapped-header-datatable">
+ </lightning-datatable>
+ </div>
+
+
+
+ <!-- <template if:true={showTables}>
+ <c-lex-custom-lightning-datatable key-field="prodid" data={overduePageRecords} columns={column}
+ onrowselection={getSelectedRows} hide-checkbox-column="true"
+ selected-rows={selectedRows}>
+ </c-lex-custom-lightning-datatable>
+ </template> -->
+
+
+ </div>
+ </div>
+ </div>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js
new file mode 100644
index 0000000..d81b24d
--- /dev/null
+++ b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js
@@ -0,0 +1,299 @@
+import { LightningElement, wire, api, track } from 'lwc';
+import init from '@salesforce/apex/LexOverdueStockController.init';
+import barcodeEntry from '@salesforce/apex/LexOverdueStockController.searchorderBean';
+import save from '@salesforce/apex/LexOverdueStockController.save';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+
+//杩囨湡搴撳瓨涓�瑙�
+const columns = [
+ {
+ label: '鏄惁閿�瀛�',
+ fieldName: 'iscount',
+ type: 'checkbox',
+ hideDefaultActions: true,
+ initialWidth: 80,
+ },
+ {
+ label: '娑堣�楀搧鍚嶇О',
+ fieldName: 'prodname',
+ type: 'prodname',
+ wrapText: true,
+ initialWidth: 350,
+
+ hideDefaultActions: true
+
+ },
+ {
+ label: '鍗曚綅',
+ fieldName: 'boxPiece',
+ hideDefaultActions: true,
+ // initialWidth: 250,
+
+ },
+ {
+ label: '杩囨湡鏁伴噺',
+ fieldName: 'overlimitCount',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'right' }
+
+ // initialWidth: 250,
+
+ },
+ {
+ label: '閿�瀛樻暟閲�',
+ fieldName: 'pandian',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'right' }
+ // initialWidth: 250,
+ // cellAttributes: { alignment: 'center' }
+ }
+ ];
+ //閿�瀛樻槑缁�
+const column = [
+
+ {
+ label: '娑堣�楀搧鍚嶇О',
+ fieldName: 'Name__c',
+ type: 'Name',
+ // initialWidth : 300,
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'left' }
+ },
+ {
+ label: '鍗曚綅',
+ fieldName: 'Box_Piece__c',
+ initialWidth : 80,
+ hideDefaultActions: true
+ },
+ {
+ label: 'BarCode',
+ fieldName: 'Bar_Code__c',
+ wrapText: true,
+ hideDefaultActions: true,
+ initialWidth : 500,
+ },
+ {
+ label: '浣跨敤鏈熼檺',
+ fieldName: 'Sterilization_limit__c',
+ hideDefaultActions: true,
+ // initialWidth : 250
+ }
+ ,
+ {
+ label: '閿�瀛樺師鍥�',
+ fieldName: 'diffReason',
+ hideDefaultActions: true,
+ initialWidth: 160
+ }
+ ];
+
+
+export default class LexOverdueStock extends NavigationMixin (LightningElement ){
+ columns = columns
+ column = column
+ @track data =[];
+ @track overduePageRecords = [];
+ @track iSinventory = false
+
+
+ //鍔犺浇妗�
+ // @track casesSpinner = true;
+ @track showSpinner =true;
+ //鏄剧ず鍙�
+ @track showbutton = false
+ @track showTable = false;
+ @track showTables = false;
+ //閿�瀛樹竴瑙堟暟鎹�
+ @track accountName;
+ @track agencyProType;
+ @track userWorkLocation;
+ @track barcode = ''
+ @track orderDetZaiku
+ @track selectedRows = [];
+ @track codPageRecordsLWC;
+ @track Id;
+ @track overdueList = [];
+
+
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+
+ //鍒濆鍖�
+ connectedCallback() {
+ console.log('鍒濆鍖�');
+ this.showSpinner = true;
+
+ init().then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result ='+JSON.stringify(result));
+ console.log('result 1='+result.entity.codPageRecords);
+ if(result.status = 'Success'){
+ this.data = JSON.parse(result.entity.codPageRecords);
+ this.codPageRecordsLWC = result.entity.codPageRecords;
+ console.log('this.data'+this.data);
+ this.accountName = result.entity.accountName;
+ this.agencyProType = result.entity.agencyProType;
+ this.userWorkLocation = result.entity.userWorkLocation;
+ this.showTable = true;
+ // this.casesSpinner = false;
+ this.showSpinner = false;
+ }else {
+ this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error');
+ this.showSpinner = false;
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+ }
+ //barcode褰曞叆
+ barcodeEntrys(){
+ this.showSpinner = true;
+ this.showTable = false;
+ console.log('code'+this.barcode);
+ console.log(' this.accountName'+ this.accountName);
+ console.log(' this.barcode'+ this.barcode);
+
+ if(this.barcode == ''||this.barcode==null){
+ this.showMyToast('鑾峰彇澶辫触','璇疯緭鍏arCode鍙�','error');
+ this.showSpinner = false;
+ }
+ barcodeEntry({
+ accountNameLWC: this.accountName,
+ agencyProTypeLWC: this.agencyProType,
+ userWorkLocationLWC:this.userWorkLocation,
+ barcodeLWC:this.barcode,
+ codPageRecordsLWC:this.codPageRecordsLWC
+ }).then((result)=>{
+ result = JSON.parse(JSON.stringify(result));
+ if (result.status == 'Success') {
+ this.overduePageRecords = JSON.parse(result.entity.overduePageRecords);
+ this.overdueList = result.entity.overdueList;
+ this.iSinventory = result.entity.iSinventory;
+ console.log('result褰曞叆'+JSON.stringify( result));
+ console.log('overdueList==>'+JSON.stringify( this.overdueList));
+ for(let i in this.overduePageRecords){
+ if(this.overduePageRecords[i].Prod!=null){
+ this.overduePageRecords[i]['Name__c'] = this.overduePageRecords[i].Prod.Name__c;
+
+ }
+ this.overduePageRecords[i]['Bar_Code__c'] = this.overduePageRecords[i].orderdetails2.Bar_Code__c;
+ this.overduePageRecords[i]['Box_Piece__c'] = this.overduePageRecords[i].orderdetails2.Box_Piece__c;
+ this.overduePageRecords[i]['Sterilization_limit__c'] = this.overduePageRecords[i].orderdetails2.Sterilization_limit__c;
+ }
+ this.data = JSON.parse(result.entity.codPageRecords);
+ console.log(' this.data'+ JSON.stringify(this.data));
+ for (var i in this.data) {
+ if (this.data[i]['check']) {
+ this.selectedRows.push(this.data[i].prodid);
+ console.log('selectedRows:' + this.selectedRows);
+ }
+ }
+ this.showSpinner = false;
+ // this.showTables = true;
+ this.showTable = true;
+ }else{
+ this.showMyToast('鑾峰彇澶辫触',result.msg,'error');
+ this.showSpinner = false;
+ }
+
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+
+ }
+ //鑾峰彇褰撳墠杈撳叆鍊�
+ handleChange(event) {
+ let value = event.detail.value;
+ console.log('value' + value);
+ this.barcode = value;
+ console.log('this.barcode'+this.barcode);
+ }
+ getSelectedRows(event) {
+ console.log('鎵撳嬀');
+ const selectedRows = event.detail.selectedRows;
+ console.log('this.selectedRows = ' + this.selectedRows);
+ for (var i in this.data) {
+ this.data[i]['check'] = false;
+ }
+ for (var i in this.data) {
+ for (var j in selectedRows) {
+ console.log('this.selectedRows111 = ' + selectedRows[j].prodid);
+ console.log('this.selectedRows1112 = ' + this.data[i].prodid );
+ if (this.data[i].prodid == selectedRows[j].prodid) {
+ this.data[i]['check'] = true;
+ }
+ }
+ }
+ }
+ //淇濆瓨
+ saveConfirm() {
+ console.log('杩涘叆閿�瀛樼‘璁�');
+ this.showSpinner = true;
+ var el = this.template.querySelector('c-lex-custom-lightning-datatable');
+ var selected = el.getSelectedRows();
+ this.selectedData = selected;
+ console.log('閫変腑鏁版嵁' + JSON.stringify(this.selectedData));
+ console.log('this.overdueList'+this.overdueList);
+ save({
+ iSinventory: this.iSinventory,
+ saveCodPageRecords: JSON.stringify(this.selectedData),
+ // saveoverdueList:JSON.stringify(this.overdueList)
+ saveoverdueList:this.overdueList
+ }).then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result淇濆瓨 = ' + JSON.stringify(result));
+ if (result.status == 'Success') {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__recordPage',
+ attributes: {
+ recordId:result.entity.Id,
+ objectApiName: 'Consumable_order__c',
+ actionName: 'view'
+ }
+ });
+ this.showSpinner = false;
+ } else {
+ this.showMyToast('閿�瀛樺け璐�',result.msg,'error');
+ this.showSpinner = false;
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showSpinner = false;
+ });
+ }
+
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
+ }
+
+ }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js-meta.xml b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js-meta.xml
new file mode 100644
index 0000000..2acb5e6
--- /dev/null
+++ b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.css b/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.html b/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.html
new file mode 100644
index 0000000..3dc4676
--- /dev/null
+++ b/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.html
@@ -0,0 +1,82 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <!-- <p style="font-size: 18px;"><strong>缁忛攢鍟嗗簱瀛樹笂涓嬮檺缂栬緫</strong></p> -->
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>缁忛攢鍟嗗簱瀛樹笂涓嬮檺缂栬緫</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <table class="slds-table slds-table_cell-buffer slds-table_bordered">
+ <thead>
+ <tr class="">
+ <!-- <th class="slds-size_3-of-10" scope="col">
+ <div class="slds-truncate" title="Name">S.No</div>
+ </th> -->
+ <th scope="col" align="center">
+ <div class="slds-truncate" style="font-size:16px;" title="Name">浜у搧鍨嬪彿</div>
+ </th>
+ <th scope="col">
+ <div class="slds-truncate" style="font-size:16px;" title="First Name">
+ 搴撳瓨涓嬮檺
+ </div>
+ </th>
+ <th scope="col">
+ <div class="slds-truncate" style="font-size:16px;" title="Last Name">搴撳瓨涓婇檺</div>
+ </th>
+ <th scope="col">
+ <div class="slds-truncate" style="font-size:16px;" title="Last Name">鎿嶄綔</div>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <template for:each = {invRecords} for:item = "inv" for:index="indexVar">
+ <tr key={inv.key} class="slds-hint-parent">
+ <td>
+ <div title="Prospecting">
+ <lightning-input key={inv.key} data-id={inv.key} data-index={indexVar} name="productNumber" label="productNumber" value={inv.productNumber} variant="label-hidden" onchange={handleProductChange}></lightning-input>
+ </div>
+ </td>
+ <td>
+ <div title="Prospecting">
+ <lightning-input key={inv.key} data-id={inv.key} data-index={indexVar} name="inventory1" label="inventory1" value={inv.inventory1} variant="label-hidden" onchange={handleProductChange}></lightning-input>
+ </div>
+ </td>
+ <td>
+ <div title="Prospecting">
+ <lightning-input key={inv.key} data-id={inv.key} data-index={indexVar} name="inventory2" label="inventory2" value={inv.inventory2} variant="label-hidden" onchange={handleProductChange}></lightning-input>
+ </div>
+ </td>
+ <td>
+ <a name={indexVar} data-id={inv.key} onclick={removeRow}>
+ <lightning-icon icon-name="utility:delete" alternative-text="delete" size="small"></lightning-icon>
+ </a>
+ </td>
+ </tr>
+ </template>
+ <tr>
+ <td></td>
+ <td>
+ <!-- <lightning-button label="琛屽鍔�" onclick={addRow} class="slds-m-left_x-small lexBorder"></lightning-button> -->
+ <button class="slds-m-left_x-small slds-button slds-button_neutral slds-button_stretch lexBorder" label="琛屽鍔�" onclick={addRow}>琛屽鍔�</button>
+ </td>
+ <td>
+ <!-- <lightning-button label="淇濆瓨" onclick={handleClick} class="slds-m-left_x-small lexBorder"></lightning-button> -->
+ <button class="slds-m-left_x-small slds-button slds-button_neutral slds-button_stretch lexBorder" label="淇濆瓨" onclick={handleClick}>淇濆瓨</button>
+ </td>
+ <td></td>
+
+ </tr>
+ </tbody>
+ </table>
+
+ </div>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js b/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js
new file mode 100644
index 0000000..c6976a3
--- /dev/null
+++ b/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js
@@ -0,0 +1,193 @@
+import { LightningElement, wire, api, track } from 'lwc';
+import oninit from "@salesforce/apex/LexProductLimitEditController.init";
+import save from "@salesforce/apex/LexUpAccountProLimit.upAccount";
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from "lightning/navigation";
+export default class InventoryEditingLWC extends NavigationMixin(LightningElement){
+ @track invRecords = [];
+ @track accountid;
+ @track upstring = '';
+ @track userPro_Type;
+ @track showSpinner = true;
+ //鑾峰彇閾炬帴鍙傛暟
+ getQueryString(name) {
+ console.log("getQueryString name " + name);
+ let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+ let r = window.location.search.substr(1).match(reg);
+ if (r != null) {
+ return decodeURIComponent(r[2]);
+ }
+ return null;
+ }
+
+ connectedCallback(){
+ this.showSpinner = true;
+ console.log(' === connectedCallback === ');
+ //鑾峰彇accountid userPro_Type
+ this.accountid = this.getQueryString("accountid");
+ this.accountid = this.accountid == null ? "" : this.accountid;
+ this.userPro_Type = this.getQueryString("userPro_Type");
+ this.userPro_Type = this.userPro_Type == null ? "" : this.userPro_Type;
+ //鑾峰彇鏁版嵁
+ oninit({
+ accountid:this.accountid,
+ userPro_Type:this.userPro_Type
+
+ }).then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result'+JSON.stringify(result));
+ if(result.status == 'Success'){
+ console.log('11===>'+result.entity.product_Limit);
+ console.log('11===>'+typeof(result.entity.product_Limit));
+ let str = result.entity.product_Limit;
+ var arr = str.split(',');
+ console.log('arr==>'+ arr);
+ console.log('arr==>'+ arr.length);
+ console.log('arr==>'+ typeof(arr));
+ for(var i in arr){
+ var arry = arr[i].split('|');
+ this.invRecords.push({
+ productNumber: arry[0],
+ inventory1:arry[1],
+ inventory2:arry[2]
+ });
+ }
+ this.showSpinner = false;
+ console.log('this.invRecords'+JSON.stringify(this.invRecords));
+ }else{
+ this.showSpinner = false;
+ console.log("error = " + JSON.stringify(error));
+
+ }
+ }).catch((error) => {
+ this.showSpinner = false;
+ console.log("error = " + JSON.stringify(error));
+ });
+ // this.inventoryTempRecords();
+
+ }
+
+ addRow(){
+ let objRow = {
+ productNumber: '',
+ inventory1: '',
+ inventory2: '',
+ id: ++this.keyIndex
+ }
+ this.invRecords = [...this.invRecords, Object.create(objRow)];
+ }
+ removeRow(event){
+ const indexPos = event.currentTarget.name;
+ let remList = [];
+ remList = this.invRecords;
+ remList.splice(indexPos,1);
+ this.invRecords = remList;
+ }
+
+ handleClick(){
+ this.showSpinner = true;
+ console.log('淇濆瓨');
+ console.log('this.invRecords'+JSON.stringify(this.invRecords));
+ for(var i in this.invRecords){
+ console.log('inven'+this.invRecords[i]["inventory1"]);
+ console.log('鏁板瓧'+this.isNum(this.invRecords[i]["inventory1"]));
+
+ if(this.isNum(this.invRecords[i]["inventory1"]) == false || this.isNum(this.invRecords[i]["inventory2"]==false)){
+ // alert("杈撳叆鏍煎紡涓嶆纭�,璇疯緭鍏ユ暟瀛�!");
+ this.showMyToast('淇濆瓨澶辫触','杈撳叆鏍煎紡涓嶆纭�,璇疯緭鍏ユ暟瀛�','error');
+ this.showSpinner = false;
+ return;
+ }
+ if(this.invRecords[i]["inventory1"] == ''||this.invRecords[i]["inventory1"] == null ||this.invRecords[i]["inventory2"] == null ||
+ this.invRecords[i]["inventory2"] == ''){
+ // alert('璇疯緭鍏�' +this.invRecords[i]["productNumber"] + '搴撳瓨涓婁笅闄愪俊鎭紒');
+ this.showMyToast('淇濆瓨澶辫触','璇疯緭鍏�' +this.invRecords[i]["productNumber"] + '搴撳瓨涓婁笅闄愪俊鎭�','error');
+ this.showSpinner = false;
+ return;
+ }
+ if(Number(this.invRecords[i]["inventory1"])>Number(this.invRecords[i]["inventory2"])){
+ // alert( this.invRecords[i]["productNumber"] + '搴撳瓨涓嬮檺澶т簬涓婇檺锛�');
+ this.showMyToast('淇濆瓨澶辫触',this.invRecords[i]["productNumber"] + '搴撳瓨涓嬮檺澶т簬涓婇檺','error');
+ this.showSpinner = false;
+ return;
+ }
+ }
+ let dataStr = ''
+ for(var i in this.invRecords){
+ dataStr = dataStr+this.invRecords[i]["productNumber"] +'|'+this.invRecords[i]["inventory1"]+'|'+this.invRecords[i]["inventory2"]+',';
+ }
+ console.log('dataStr==>'+dataStr);
+ this.upstring = dataStr.substring(0, dataStr.lastIndexOf(','));
+ console.log('upstring'+ this.upstring);
+ save({
+ accountId: this.accountid,
+ productLimit: this.upstring,
+ userPro_Type:this.userPro_Type
+ }).then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result===>'+JSON.stringify(result));
+ if(result.status == 'Success'){
+ this.showMyToast('淇濆瓨鎴愬姛','','success');
+ this.showSpinner = false;
+ // setTimeout(this.toLexToppage(),5000 );
+ setTimeout(() => {
+ this.toLexToppage();
+ }, 500);
+
+ }else{
+ this.showMyToast('淇濆瓨澶辫触',result.msg,'error');
+ this.showSpinner = false;
+
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ this.showSpinner = false;
+ });
+
+ this.inventoryTempRecords();
+ console.log( 'Save ==> ' + JSON.stringify(toSaveList));
+ }
+
+ handleProductChange(event){
+ if (event.target.name == 'productNumber') {
+ this.invRecords[event.currentTarget.dataset.index].productNumber = event.target.value;
+ console.log('===>invrecords'+JSON.stringify(this.invRecords));
+ }
+ else if (event.target.name == 'inventory1') {
+ this.invRecords[event.currentTarget.dataset.index].inventory1 = event.target.value;
+ }
+ else if (event.target.name == 'inventory2') {
+ this.invRecords[event.currentTarget.dataset.index].inventory2 = event.target.value;
+ }
+ }
+
+//鏁板瓧楠岃瘉
+isNum(num){
+ var reNum =/^[0-9]+$/;
+ return (reNum.test(num));
+ }
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
+ }
+ toLexToppage(){
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lextoppage'
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js-meta.xml b/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js-meta.xml
new file mode 100644
index 0000000..9bdd440
--- /dev/null
+++ b/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.css b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html
new file mode 100644
index 0000000..9e190eb
--- /dev/null
+++ b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html
@@ -0,0 +1,143 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;">
+
+ <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <div>
+ <!-- <p style="font-size: 18px;"><strong>鎷嗙洅</strong></p> -->
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鎷嗙洅</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ <div style="padding:10px;">
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <!-- <lightning-button variant="brand" class='lexstyle' style="margin-left:10px;" label="鎷嗙洅纭" title="鎷嗙洅纭" onclick={saveConfirm}></lightning-button>-->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin-left:10px;margin-top:12px;margin-bottom:12px;" label="鎷嗙洅纭" onclick={saveConfirm}>鎷嗙洅纭</button>
+ </div>
+ </div>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:5px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 16px">
+ <strong>BarCode褰曞叆</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+
+ <!-- <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> -->
+ <table>
+ <colgroup>
+ <col width="160px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="90px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="85px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ </colgroup>
+ <tbody>
+ <tr>
+ <td></td>
+ <td align="right" class="searchName">BarCode</td>
+ <td style="width:600px"><lightning-textarea class="inputFont" name="BarCode" label=""
+ onchange={handleChange}></lightning-textarea></td>
+ <td align="right"></td>
+ <td></td>
+ <td style="width: 200px;">
+ <button style="margin-top:14px;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="鑾峰彇鏄庣粏" onclick={getDetails}>鑾峰彇鏄庣粏</button>
+ <!-- <lightning-button variant="brand" class='lexstyle' label="鑾峰彇鏄庣粏" title="鑾峰彇鏄庣粏" onclick={getDetails}
+ ></lightning-button> -->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <!-- </div> -->
+ </div>
+
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:10px">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鎷嗙洅鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+
+ <!-- <div style="height: 300px;"> -->
+ <!-- <template if:true={showTable}> -->
+ <!-- <c-lex-custom-lightning-datatable key-field="prodid" data={data} columns={columns}
+ onrowselection={getSelectedRows} hide-checkbox-column="true"
+ selected-rows={selectedRows}>
+ </c-lex-custom-lightning-datatable> -->
+ <lightning-datatable
+ key-field="prodid" data={data} columns={columns}
+ onrowselection={getSelectedRows} hide-checkbox-column="true"
+ selected-rows={selectedRows} class="wrapped-header-datatable">
+ </lightning-datatable>
+ <!-- </template> -->
+ <!-- </div> -->
+
+ </div>
+ </div>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:10px">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <table>
+ <tr>
+ <td>
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>閿欒鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div style="padding:10px;">
+ <!-- <template if:true={showTables}> -->
+
+ <!-- <c-lex-custom-lightning-datatable key-field="id" data={errorDetail} columns={column}
+ onrowselection={getSelectedRows} hide-checkbox-column="true"
+ selected-rows={selectedRows}>
+ </c-lex-custom-lightning-datatable> -->
+ <lightning-datatable
+ key-field="id" data={errorDetail} columns={column}
+ onrowselection={getSelectedRows} hide-checkbox-column="true"
+ selected-rows={selectedRows} class="wrapped-header-datatable">
+ </lightning-datatable>
+ <!-- </template> -->
+
+
+ </div>
+ </div>
+ </div>
+
+
+
+ </div>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js
new file mode 100644
index 0000000..81ca3e2
--- /dev/null
+++ b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js
@@ -0,0 +1,244 @@
+import { LightningElement, wire, api, track } from 'lwc';
+import init from '@salesforce/apex/LexRemoveBoxController.init';
+import searchDeatail from '@salesforce/apex/LexRemoveBoxController.searchConsumableorderdetails';
+import saveconfirm from '@salesforce/apex/LexRemoveBoxController.removeBoxConfirm';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+// import { NavigationMixin } from 'lightning/navigation';
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+const columns = [
+ {
+ label: '娑堣�楀搧鍚嶇О',
+ fieldName: 'Name__c',
+ wrapText:true,
+ hideDefaultActions: true,
+ initialWidth: 400,
+
+ },
+ {
+ label: '瑙勬牸',
+ fieldName: 'ProductPacking_list_manual__c',
+ hideDefaultActions: true,
+ initialWidth: 50,
+ cellAttributes: { alignment: "right" },
+
+
+ },
+ {
+ label: 'CFDA鐘舵��',
+ fieldName: 'CFDA_Status__c',
+ hideDefaultActions: true,
+ initialWidth: 200,
+
+ },
+ {
+ label: '娉ㄥ唽璇佺紪鐮佸彿',
+ fieldName: 'Report_Product_Approbation__c',
+ hideDefaultActions: true,
+ initialWidth: 200,
+ },
+ {
+ label: '娉ㄥ唽璇佹晥鏈�',
+ fieldName: 'Report_Product_Expiration__c',
+ hideDefaultActions: true,
+ // initialWidth: 250,
+ },
+ {
+ label: 'BarCode',
+ fieldName: 'Bar_Code__c',
+ hideDefaultActions: true,
+ wrapText:true,
+ initialWidth:400,
+ }
+];
+
+const column = [
+ {
+ label: '娑堣�楀搧鍚嶇О',
+ fieldName: 'Name__c',
+ hideDefaultActions: true,
+
+ },
+ {
+ label: 'BarCode',
+ fieldName: 'Bar_Code__c',
+ hideDefaultActions: true,
+
+
+ }
+ ,
+ {
+ label: '閿欒鍘熷洜',
+ fieldName: 'ErrorReason',
+ hideDefaultActions: true,
+ }
+];
+
+
+
+
+export default class LexRemoveBox extends LightningElement {
+ columns = columns;
+ column = column;
+ @track selectedRows = [];
+ @track data = [];
+ @track errorDetail = [];
+
+ // 鏄剧ず
+ @track showTable = false
+ @track accountName
+ @track userWorkLocation
+ @track agencyProType
+ @track barcode = ''
+ @track saveFLGbln = false
+ @track dataSize = 0;
+
+ //鍔犺浇妗�
+ @track showSpinner = false
+
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+}
+
+ //鍒濆鍖�
+ connectedCallback() {
+ console.log('鍒濆鍖�');
+ this.showTable = false;
+
+ init().then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result =' + JSON.stringify(result));
+ if (result.status = 'Success') {
+ console.log('result');
+ this.agencyProType = result.entity.agencyProType;
+ this.userWorkLocation = result.entity.userWorkLocation;
+ this.accountName = result.entity.accountName;
+ // this.data = JSON.parse(result.entity.codPageRecords);
+ // this.showTable = true;
+ } else {
+ this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error');
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+ }
+ //褰曞叆
+ getDetails() {
+ searchDeatail({
+ accountName: this.accountName,
+ userWorkLocation: this.userWorkLocation,
+ agencyProType: this.agencyProType,
+ barcode: this.barcode
+ }).then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result =' + JSON.stringify(result));
+ if (result.status == 'Success') {
+ console.log('鎴愬姛');
+ this.data = JSON.parse(result.entity.ConsumableorderdetailsRecordsdummy);
+ this.errorDetail = JSON.parse(result.entity.ConsumableorderdetailsRecordserror);
+ this.dataSize = result.entity.dataSize;
+ console.log('this.dataSize'+this.dataSize);
+ for (let i in this.data) {
+ this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
+ this.data[i]['ProductPacking_list_manual__c'] = this.data[i].esd.ProductPacking_list_manual__c;
+ this.data[i]['CFDA_Status__c'] = this.data[i].esd.CFDA_Status__c;
+ this.data[i]['Report_Product_Approbation__c'] = this.data[i].esd.Report_Product_Approbation__c;
+ this.data[i]['Report_Product_Expiration__c'] = this.data[i].esd.Report_Product_Expiration__c;
+ this.data[i]['Bar_Code__c'] = this.data[i].esd.Bar_Code__c;
+ }
+ for (let i in this.errorDetail) {
+ this.errorDetail[i]['Name__c'] = this.errorDetail[i].Prod.Name__c;
+ this.errorDetail[i]['Bar_Code__c'] = this.errorDetail[i].esd.Bar_Code__c;
+ this.errorDetail[i]['ErrorReason'] = this.errorDetail[i].ErrorReason;
+ }
+ this.showTables = true;
+ this.showTable = true;
+ } else{
+ console.log('result.msg = ' + result.msg);
+ this.showMyToast('鑾峰彇澶辫触',result.msg,'error');
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+
+ }
+ //鑾峰彇褰撳墠杈撳叆鍊�
+ handleChange(event) {
+ let value = event.detail.value;
+ console.log('value' + value);
+ this.barcode = value;
+ console.log('this.barcode' + this.barcode);
+ }
+ saveConfirm() {
+ console.log('杩涘叆纭');
+ let msg = "纭鎷嗙洅鍚�";
+ if (this.dataSize>0) {
+ if (confirm(msg) == true) {
+ this.removeBox();
+ }
+ } else {
+ this.removeBox();
+ }
+
+ }
+ removeBox(){
+ this.showSpinner = true;
+ saveconfirm({
+ saveConsumableorderdetailsRecordsdummy: JSON.stringify(this.data),
+ accountName: this.accountName,
+ userWorkLocation: this.userWorkLocation,
+ agencyProType: this.agencyProType
+ }).then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result淇濆瓨 = ' + JSON.stringify(result));
+ if (result.status == 'Success') {
+ this.saveFLGbln = result.entity.saveFLGbln;
+ // this.showSpinner = false;
+ if(this.saveFLGbln){
+ this.showMyToast(result.msg,'','success');
+ this.showSpinner = false;
+ }
+ } else {
+ console.log('result.msg = ' + result.msg);
+ this.showMyToast('鎷嗙洅澶辫触',result.msg,'error');
+ this.showSpinner = false;
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
+
+
+ }
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js-meta.xml b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js-meta.xml
new file mode 100644
index 0000000..0cd2d48
--- /dev/null
+++ b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.html b/force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.html
new file mode 100644
index 0000000..848a41b
--- /dev/null
+++ b/force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.html
@@ -0,0 +1,10 @@
+<template>
+ <template if:true={showInputOrText}>
+ <lightning-input type="number" variant="label-hidden" value={inputValue} onchange={changeInputValue}></lightning-input>
+ </template>
+ <template if:false={showInputOrText}>
+ <div style="text-align: right;">
+ <lightning-formatted-number style="margin-left: 10px;" value={inputValue}></lightning-formatted-number>
+ </div>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js b/force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js
new file mode 100644
index 0000000..84d7bf9
--- /dev/null
+++ b/force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js
@@ -0,0 +1,31 @@
+import { LightningElement,api,track } from 'lwc';
+
+export default class LexReturnGoodCusInput extends LightningElement {
+ @api boxPrice;
+ @api inputValue;
+ @api recordId;
+
+ get showInputOrText(){
+ if(this.boxPrice == '鐩�'){
+ return false;
+ }else{
+ return true;
+ }
+ }
+
+ connectedCallback(){
+ console.log('inputValue:'+this.inputValue+this.boxPrice);
+ }
+
+ changeInputValue(event){
+ this.inputValue = event.detail.value;
+ this.dispatchEvent(new CustomEvent('changereturncount', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: { value: this.inputValue, boxPrice: this.boxPrice, recordId:this.recordId}
+ }
+ }));
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js-meta.xml b/force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.css b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.css
new file mode 100644
index 0000000..09e4478
--- /dev/null
+++ b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.css
@@ -0,0 +1,28 @@
+@import 'c/lexCssUtility';
+
+.outerBorderCss {
+ border: 1px solid #D4D4D4;
+ border-radius: 5px;
+ border-top: 3px solid #565959;
+}
+
+.borderCss {
+ border: 1px solid #D4D4D4;
+ border-radius: 5px;
+ margin-bottom: 7px;
+ border-top: 3px solid #565959;
+}
+
+.headerDorderCss {
+ border-top: 1px solid #565959;
+ border-bottom: 1px solid #D4D4D4;
+ padding: 3px;
+}
+
+.centerCss {
+ text-align: center;
+}
+
+.centerCss .left {
+ margin-left: 100px;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html
new file mode 100644
index 0000000..509cd8c
--- /dev/null
+++ b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html
@@ -0,0 +1,262 @@
+<!-- sldsValidatorIgnore -->
+<!-- sldsValidatorIgnore -->
+<template>
+ <c-common-toast></c-common-toast>
+ <div class="outerBorderCss">
+ <div style="padding: 5px">
+ <div class="borderCss">
+ <div style="padding: 15px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <!-- <div class="slds-m-top_small slds-m-bottom_medium"> -->
+ <!-- <lightning-button label="鏂板缓鍑哄簱鍗�" onclick={neworderhead}
+ class="slds-m-left_x-small" disabled></lightning-button>
+ <lightning-button label="涓婁紶宸插嚭搴撲竴瑙�" onclick={editProductLimit}
+ class="slds-m-left_x-small"></lightning-button> -->
+ 聽
+ <!-- <button class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
+ onclick={neworderhead}>
+ 鏂板缓鍑哄簱鍗�
+ </button>
+ 聽
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonMarginLeft lexBorderWidth"
+ onclick={editProductLimit}>
+ 涓婁紶宸插嚭搴撲竴瑙�
+ </button> -->
+
+ <lightning-layout multiple-rows>
+ <lightning-layout-item size="6">
+ <div class="slds-text-align_center">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
+ onclick={neworderhead}>
+ 鏂板缓鍑哄簱鍗�
+ </button>
+ 聽
+ <div class="slds-form-element__label searchName" style="visibility: hidden">
+ 鍑哄簱鏃� 浠�
+ </div>
+ <div class="slds-form-element__label searchName" style="visibility: hidden">
+  鍒�
+ </div>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
+ onclick={editProductLimit} style="margin-left: 4px;">
+ 涓婁紶宸插嚭搴撲竴瑙�
+ </button>
+ </div>
+ </div>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- </div> -->
+ </div>
+ </div>
+ </div>
+
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>妫�绱㈡潯浠�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 15px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-layout multiple-rows>
+ <lightning-layout-item size="6">
+ <div class="slds-text-align_center">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label searchName">
+ 鍑哄簱鏃� 浠�
+ </div>
+ <lightning-input type="date" variant="label-hidden" label="鍑哄簱鏃� 浠�"
+ onchange={dataChange} data-field="deliveryFromDate" value={deliveryFromDate}
+ style="min-width: 200px" class="inputFont"></lightning-input>
+ <div class="slds-form-element__label searchName">
+  鍒�
+ </div>
+ <lightning-input type="date" variant="label-hidden" label="鍒�"
+ onchange={dataChange} data-field="deliveryToDate" value={deliveryToDate}
+ style="min-width: 200px" class="inputFont"></lightning-input>
+ </div>
+ </div>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="3" style="margin-left: -80px;">
+ <div class="slds-text-align_center">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label searchName">
+ 鍑哄簱鍗曞彿
+ </div>
+ <lightning-input variant="label-hidden" label="鍑哄簱鍗曞彿" onchange={dataChange}
+ data-field="deliveryOrderNo" value={deliveryOrderNo}
+ style="min-width: 215px" class="inputFont"></lightning-input>
+ </div>
+ </div>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="3">
+ <div class="slds-text-align_center">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label searchName">
+ 瀹㈡埛鍚�
+ </div>
+ <lightning-input variant="label-hidden" label="瀹㈡埛鍚�" onchange={dataChange}
+ data-field="contactName" value={contactName} style="min-width: 215px"
+ class="inputFont"></lightning-input>
+ </div>
+ </div>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <lightning-layout multiple-rows style="margin-top: 20px">
+ <lightning-layout-item size="6">
+ <div class="slds-text-align_center">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <!-- <div class="slds-form-element__label searchName" style="visibility: hidden;">
+ 鍑哄簱鏃� 浠�</div> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
+ onclick={searchConsumableorderdetailsJs} style="width: 200px;">
+ 杩樻病鍑哄簱鐨勫嚭搴撳崟
+ </button>
+
+ <div class="slds-form-element__label searchName" style="visibility: hidden">
+ 鍑哄簱鏃� 浠�
+ </div>
+ <div class="slds-form-element__label searchName" style="visibility: hidden">
+  鍒�
+ </div>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
+ onclick={searchOrderInstatusJs} style="width: 215px;margin-left: 4px;">
+ 宸插嚭搴撴湭寮�绁ㄧ殑鍑哄簱鍗�
+ </button>
+ </div>
+ </div>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="3" style="margin-left: -80px;">
+ <div class="slds-text-align_center">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label searchName" style="visibility: hidden">
+ 鍑哄簱鍗曞彿
+ </div>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
+ onclick={searchConsumableorFinishJs} style="width: 215px">
+ 宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�
+ </button>
+ </div>
+ </div>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="3">
+ <div class="slds-text-align_center">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label searchName" style="visibility: hidden">
+ 瀹㈡埛鍚�
+ </div>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
+ onclick={clearJs} style="width: 215px">
+ 娓呯┖
+ </button>
+ </div>
+ </div>
+ </lightning-layout-item>
+
+ <!-- <lightning-layout-item size="5">
+ <div class="slds-text-align_center">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label searchName" style="visibility: hidden;">
+ 鍑哄簱鏃� 浠�</div>
+ <lightning-input type="date" variant="label-hidden" label="鍑哄簱鏃� 浠�"
+ onchange={dataChange} data-field="deliveryFromDate" value={deliveryFromDate}
+ style="min-width: 200px;visibility: hidden;"></lightning-input>
+
+ <div class="slds-form-element__label searchName" style="visibility: hidden;">
+  鍒�
+ </div>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorderWidth"
+ onclick={searchConsumableorderdetailsJs}>杩樻病鍑哄簱鐨勫嚭搴撳崟</button>
+ </div>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item size="3">
+ <div class="slds-text-align_center">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label searchName" style="visibility: hidden;">
+ 鍑哄簱鍗曞彿</div>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorderWidth"
+ onclick={searchOrderInstatusJs} style="width: 215px;">宸插嚭搴撴湭寮�绁ㄧ殑鍑哄簱鍗�</button>
+ </div>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item size="3">
+ <div class="slds-text-align_center">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label searchName" style="visibility: hidden;">瀹㈡埛鍚�
+ </div>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorderWidth"
+ onclick={searchConsumableorFinishJs}
+ style="width: 215px;">宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�</button>
+ </div>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item size="1">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorderWidth"
+ onclick={clearJs} style="width: 80px;">娓呯┖</button>
+ </div>
+ </lightning-layout-item> -->
+
+ <!-- <div class="slds-m-top_small slds-m-bottom_medium">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorderWidth lexBorder"
+ onclick={searchConsumableorderdetailsJs}>杩樻病鍑哄簱鐨勫嚭搴撳崟</button>
+ 聽 <button class="slds-button slds-button_neutral slds-button_stretch lexBorderWidth lexBorder buttonMarginLeft"
+ onclick={searchOrderInstatusJs} style="width: 215px;">宸插嚭搴撴湭寮�绁ㄧ殑鍑哄簱鍗�</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorderWidth lexBorder buttonMarginLeft"
+ onclick={searchConsumableorFinishJs} style="width: 215px;">宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorderWidth lexBorder buttonMarginLeft"
+ onclick={clearJs} >娓呯┖</button>
+ </div> -->
+ </lightning-layout>
+ </div>
+ </div>
+ </div>
+
+ <div class="borderCss">
+ <template if:true={isShowSpinner}>
+ <lightning-spinner alternative-text="Loading" size="large"></lightning-spinner>
+ </template>
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗曚竴瑙堣〃</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <template if:true={showTable}>
+ <div style="padding: 7px; height: 500px">
+ <lightning-datatable key-field="id" data={data} columns={columns} hide-checkbox-column
+ default-sort-direction={defaultSortDirection} sorted-direction={sortDirection}
+ sorted-by={sortedBy} onsort={onHandleSort} class="wrapped-header-datatable">
+ </lightning-datatable>
+ </div>
+ </template>
+ </div>
+ </div>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
new file mode 100644
index 0000000..0d98bf7
--- /dev/null
+++ b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
@@ -0,0 +1,410 @@
+import { LightningElement, wire, api, track } from 'lwc';
+import { NavigationMixin } from 'lightning/navigation';
+import init from '@salesforce/apex/LexSaleAndDeliveryController.init';//cleanUp
+import cleanUp from '@salesforce/apex/LexSaleAndDeliveryController.cleanUp';
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import searchOrderInstatus from '@salesforce/apex/LexSaleAndDeliveryController.searchOrderInstatus';
+import searchConsumableorderdetails from '@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorderdetails';
+import searchConsumableorFinish from '@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorFinish';
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+const columns = [
+ {
+ label: '鍑哄簱鏃�',
+ fieldName: 'Outbound_Date__c',
+ type: 'date',
+ initialWidth: 130,
+ hideDefaultActions: true,
+ sortable: true
+ },
+ {
+ label: '鍑哄簱鍗曞彿',
+ fieldName: 'url',
+ type: 'url',
+ initialWidth: 175,
+ typeAttributes: {
+ label: {
+ fieldName: 'Name'
+ },
+ target: '_blank'
+ },
+ hideDefaultActions: true,
+ initialWidth: 225,
+ sortable: true
+ },
+ {
+ label: '瀹㈡埛鍚�',
+ fieldName: 'ShipmentAccount__c',
+ hideDefaultActions: true,
+ wrapText: true,
+ sortable: true
+ },
+ {
+ label: '绉戝',
+ fieldName: 'Order_ForCustomerText__c',
+ hideDefaultActions: true,
+ initialWidth: 120
+ },
+ {
+ label: '鍑哄簱鍗曠姸鎬�',
+ fieldName: 'SummonsStatus_c__c',
+ hideDefaultActions: true,
+ sortable: true,
+ initialWidth: 100
+ },
+ {
+ label: '寮�绁ㄧ姸鎬�',
+ fieldName: 'Billed_Status__c',
+ hideDefaultActions: true,
+ sortable: true,
+ initialWidth: 100
+ },
+ {
+ label: '鏈彂绁ㄩ噾棰�(鍏�)',
+ fieldName: 'InvoiceNotPro_money__c',
+ hideDefaultActions: true,
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ initialWidth: 150
+ },
+ {
+ label: '鍒涘缓鏃ユ湡',
+ fieldName: 'CreatedDate',
+ hideDefaultActions: true,
+ sortable: true,
+ type: "date",
+ typeAttributes: {
+ timeZone: "Asia/Shanghai",
+ day: "numeric",
+ month: "numeric",
+ year: "numeric",
+ hour: "2-digit",
+ minute: "2-digit"
+ },
+ initialWidth: 200
+ }
+];
+export default class LexSaleAndDelivery extends NavigationMixin(LightningElement) {
+ columns = columns;
+ @track isShowSpinner = true;
+ @track message = '';
+ @track deliveryFromDate = '';
+ @track deliveryToDate = '';
+ @track deliveryOrderNo = '';
+ @track contactName = '';
+ @track data = [];
+ @track userinfoId = '';
+ @track accountid = '';
+ @track agencyProType = '';
+ @track userWorkLocation = '';
+ @track showTable = false;
+ @track hidecheckboxcolumn = true;
+
+ //鎺掑簭
+ defaultSortDirection = 'asc';
+ sortDirection = 'asc';
+ sortedBy;
+
+
+ stylesLoaded = false;
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+ connectedCallback() {
+ init().then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.userinfoId = r.entity.userinfoId;
+ this.accountid = r.entity.accountid;
+ this.agencyProType = r.entity.agencyProType;
+ this.userWorkLocation = r.entity.userWorkLocation;
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ console.log('this.data = ' + JSON.stringify(this.data));
+ this.isShowSpinner = false;
+ this.showTable = true;
+
+ } else {
+ console.log('r = ' + JSON.stringify(r))
+ this.showMyToast('鍒濆鍖栧け璐�', r.msg,'Error');
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error))
+ this.showMyToast('閿欒', '鍒濆鍖栧け璐�','Error');
+ })
+ }
+
+
+
+ //鏂板缓鍑哄簱鍗�
+ neworderhead() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexsummonscreat'
+ }
+ });
+ }
+
+ //宸插嚭搴撴湭寮�绁ㄧ殑鍑哄簱鍗�
+ searchOrderInstatusJs() {
+ this.isShowSpinner = true;
+ this.showTable = false;
+ console.log('searchOrderInstatusJs');
+ searchOrderInstatus({
+ orderDate: this.deliveryFromDate,
+ deliverDate: this.deliveryToDate,
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ category1: this.deliveryOrderNo,
+ category2: this.contactName
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message,'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message,'Success');
+ }
+ this.isShowSpinner = false;
+ //this.isCssLoaded = true
+ this.showTable = true;
+ } else {
+ this.showMyToast('閿欒', r.msg,'Error');
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error))
+ })
+ }
+
+ //杩樻病鍑哄簱鐨勫嚭搴撳崟
+ searchConsumableorderdetailsJs() {
+ this.isShowSpinner = true;
+ this.showTable = false;
+ console.log('searchConsumableorderdetailsJs');
+ console.log('this.deliveryFromDate = ' + this.deliveryFromDate);
+ console.log('this.deliveryToDate = ' + this.deliveryToDate);
+ searchConsumableorderdetails({
+ orderDate: this.deliveryFromDate,
+ deliverDate: this.deliveryToDate,
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ category1: this.deliveryOrderNo,
+ category2: this.contactName
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message,'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message,'Success');
+ }
+ this.isShowSpinner = false;
+ this.showTable = true;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg,'Error');
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error))
+ this.showMyToast('鎼滅储澶辫触', '鎼滅储杩樻病鍑哄簱鐨勫嚭搴撳崟鍑洪敊','Error');
+ })
+ }
+
+ //宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�
+ searchConsumableorFinishJs() {
+ this.isShowSpinner = true;
+ this.showTable = false;
+ console.log('searchConsumableorFinishJs');
+ searchConsumableorFinish({
+ orderDate: this.deliveryFromDate,
+ deliverDate: this.deliveryToDate,
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ category1: this.deliveryOrderNo,
+ category2: this.contactName
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message,'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message,'Success');
+ }
+ this.isShowSpinner = false;
+ this.showTable = true;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg,'Error');
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error))
+ this.showMyToast('鎼滅储澶辫触', '鎼滅储宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗曞嚭閿�','Error');
+ })
+ }
+
+ //娓呯┖
+ clearJs() {
+ this.deliveryFromDate = '';
+ this.deliveryToDate = '';
+ this.deliveryOrderNo = '';
+ this.contactName = '';
+ this.isShowSpinner = true;
+ this.showTable = false;
+ cleanUp({
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message,'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message,'Success');
+ }
+ this.isShowSpinner = false;
+ this.showTable = true;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg,'Error');
+ }
+ }).catch((error) => {
+ console.log('error = ' + JSON.stringify(error))
+ this.showMyToast('鎼滅储澶辫触', '鎼滅储澶辫触','Error');
+ })
+ }
+
+ //Capture the event fired from the paginator component
+ handlePaginatorChange(event) {
+ this.recordsToDisplay = event.detail.recordsToDisplay;
+ this.preSelected = event.detail.preSelected;
+ if (this.recordsToDisplay && this.recordsToDisplay > 0) {
+ this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
+ } else {
+ this.rowNumberOffset = 0;
+ }
+ }
+
+ //鎺掑簭
+ onHandleSort(event) {
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.data];
+ cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ this.data = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+
+ sortBy(field, reverse, primer) {
+ const key = primer
+ ? function (x) {
+ return primer(x[field]);
+ }
+ : function (x) {
+ return x[field];
+ };
+
+ return function (a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
+ };
+ }
+
+
+ dataChange(event) {
+ let fieldName = event.target.getAttribute("data-field");
+ let value = event.detail.value;
+ switch (fieldName) {
+ case 'deliveryFromDate':
+ this.deliveryFromDate = value;
+ break
+ case 'deliveryToDate':
+ this.deliveryToDate = value;
+ break
+ case 'deliveryOrderNo':
+ this.deliveryOrderNo = value;
+ break
+ case 'contactName':
+ this.contactName = value;
+ break
+ default:
+ console.log('no data');
+ }
+
+ }
+
+ editProductLimit() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexoutboundorderimport'
+ }
+ });
+ }
+
+ showMyToast(title, message, variant) {
+ this.isShowSpinner = false;
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if (variant.toLowerCase() == 'success') {
+ iconName = 'utility:check';
+ } else {
+ iconName = 'utility:error';
+ }
+ if (message != '') {
+ content = '<h2><strong>' + title + '<strong/></h2><h5>' + message + '</h5>';
+ } else {
+ content = '<h2><strong>' + title + '<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').showToast(variant, content, iconName, 10000);
+ }
+
+ @track isModalOpen = false;
+ openModal() {
+ this.isModalOpen = true;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js-meta.xml b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSaleAndDelivery/templates/boxorpieceType.html b/force-app/main/default/lwc/lexSaleAndDelivery/templates/boxorpieceType.html
new file mode 100644
index 0000000..8e1a0ae
--- /dev/null
+++ b/force-app/main/default/lwc/lexSaleAndDelivery/templates/boxorpieceType.html
@@ -0,0 +1,4 @@
+<template>
+ <c-boxorpiece-type
+ custom-value-a={typeAttributes.customValueA}></c-boxorpiece-type>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css
new file mode 100644
index 0000000..3e12bf1
--- /dev/null
+++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css
@@ -0,0 +1,34 @@
+@import 'c/lexCssUtility';
+.outerBorderCss{
+ border: 1px solid #D4D4D4;
+ border-radius : 5px;
+ border-top : 3px solid #565959;
+}
+.borderCss{
+ border: 1px solid #D4D4D4;
+ border-radius : 5px;
+ margin-bottom : 7px;
+ border-top : 3px solid #565959;
+}
+.headerDorderCss{
+ border-top: 1px solid #565959;
+ border-bottom: 1px solid #D4D4D4;
+ padding:3px;
+}
+.centerCss{
+ text-align: center;
+}
+.centerCss .left{
+ margin-left: 100px;
+}
+.datatable {
+ max-height: 400px !important;
+}
+.tableColumn {
+ margin-top: 5px !important;
+ overflow-x: auto;
+}
+:host {
+ --lwc-inputStaticFontSize: 16px;
+ --lwc-formLabelFontSize: 16px;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
new file mode 100644
index 0000000..8e43278
--- /dev/null
+++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
@@ -0,0 +1,1048 @@
+<!-- sldsValidatorIgnore -->
+<!-- sldsValidatorIgnore -->
+<template>
+ <c-common-toast></c-common-toast>
+ <template if:true={isShowSpinner}>
+ <lightning-spinner alternative-text="Loading" size="large"></lightning-spinner>
+ </template>
+ <!-- 鎼滅储瀹㈡埛鍚� -->
+ <template if:true={isModalOpen}>
+ <!-- Modal/Popup Box LWC starts here -->
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true"
+ aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
+ <div class="slds-modal__container">
+ <!-- Modal/Popup Box LWC header here -->
+ <header class="slds-modal__header">
+ <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
+ title="Close" onclick={closeModal}>
+ <lightning-icon icon-name="utility:close" alternative-text="close" variant="inverse"
+ size="small"></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">
+ 缁忛攢鍟嗗尰闄㈡绱�
+ </h2>
+ </header>
+ <!-- Modal/Popup Box LWC body starts here -->
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
+ <lightning-layout>
+ <lightning-layout-item flexibility="auto" padding="around-small">
+ <lightning-input type="text" label="鍖婚櫌鍚嶇О" onchange={dataChange}
+ data-field="searchHospitalName" value={searchHospitalName} variant="label-inline"
+ class="inputFont"></lightning-input>
+ </lightning-layout-item>
+ <lightning-layout-item flexibility="auto" padding="around-small" style="padding-top: 16px;">
+ <!-- <lightning-button label="妫�绱�" onclick={searchHospital}></lightning-button> -->
+ <button class="slds-button slds-button_neutral" onclick={searchHospital}
+ title="searchHospital" style="font-size: 16px;">
+ 妫�绱�
+ </button>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <div class="tableColumn">
+ <lightning-layout class="datatable" style="height: 250px;">
+ <lightning-datatable class="datatabel slds-border_top wrapped-header-datatable"
+ key-field="id" data={hospitalList} columns={hospitalColumns} hide-checkbox-column="true"
+ onrowaction={searchHandleRowAction}>
+ </lightning-datatable>
+ </lightning-layout>
+ </div>
+ </div>
+ <!-- Modal/Popup Box LWC footer starts here -->
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral" onclick={closeModal} title="Cancel"
+ style="font-size: 16px;">
+ 鍏抽棴
+ </button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+
+ <!-- 涓婁紶闄勪欢寮圭獥 -->
+ <template if:true={showAttPop}>
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true"
+ aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small"
+ style="border: 1px solid #D4D4D4;">
+ <template if:true={showPopSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <div class="slds-modal__container">
+ <header class="slds-modal__header" style="background-color: #F3F3F3;">
+ <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
+ title="Close" onclick={closePop}>
+ <lightning-icon icon-name="utility:close" alternative-text="close" variant="inverse"
+ size="small"></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-02" class="slds-text-heading_medium slds-hyphenate">涓婁紶闄勪欢</h2>
+ </header>
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2"
+ style="border: 1px solid #F3F3F3;">
+ <div class="slds-m-top_medium slds-m-bottom_x-large">
+ <div class="slds-p-around_medium lgc-bg">
+ <lightning-input type="file" label="闄勪欢涓婁紶"
+ accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
+ onchange={attChange}></lightning-input>
+ </div>
+ <p>宸查�夋嫨鏂囦欢锛歿fileName}
+ <template if:true={attDelBtn}>
+ <a onclick={removeAtt}>绉婚櫎</a>
+ </template>
+ </p>
+ </div>
+ </div>
+ <footer class="slds-modal__footer">
+ <lightning-button style="margin-left: 10px;" variant="neutral" label="鍙栨秷"
+ onclick={closePop}></lightning-button>
+ <lightning-button style="margin-left: 10px;" variant="neutral" label="涓婁紶"
+ onclick={handleSave}></lightning-button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+
+ <div class="outerBorderCss">
+ <div style="padding: 5px">
+ <template if:false={isShippingSales}>
+ <!-- 鎸夐挳 -->
+ <div class="borderCss">
+ <div style="padding: 15px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <table>
+ <colgroup>
+ <col width="150px" />
+ <col width="310px" />
+ <col width="310px" />
+ <col width="310px" />
+ <col width="200px" />
+ <col width="200px" />
+ <col width="90px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="85px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ </colgroup>
+ <tr>
+ <td>
+ <template if:true={isSaveShow}>
+ <!-- <lightning-button label="淇濆瓨" onclick={saveConfirmJs}
+ style="width: 150px"></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={saveConfirmJs}>淇濆瓨</button>
+ </template>
+ </td>
+ <td colspan="4">
+ <!-- <template if:true={isSaveShow}>
+ <lightning-button label="淇濆瓨" onclick={saveConfirmJs}
+ style="width: 150px"></lightning-button>
+ </template> -->
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <template if:true={isEditShow}>
+ <!-- <lightning-button label="缂栬緫鍑哄簱鍗�" onclick={EditConsumable}
+ style="width: 150px" disabled={isEditDisabled}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={EditConsumable} disabled={isEditDisabled}>缂栬緫鍑哄簱鍗�</button>
+ </template>
+ </td>
+
+ <td>
+ <template if:true={isDeliveryShow}>
+ <!-- <lightning-button label="鍑鸿揣/閿�鍞�" onclick={GoodsDeliveryJs}
+ style="width: 150px;" disabled={isDeliveryDisabled}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={GoodsDeliveryJs} disabled={isDeliveryDisabled}>鍑鸿揣/閿�鍞�</button>
+ </template>
+ </td>
+
+ <td>
+ <template if:true={isOpenToInvoiceShow}>
+ <!-- <lightning-button label="寮�绁�" onclick={openToInvoiceJs} style="width: 150px"
+ disabled={isOpenToInvoiceDisabled}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={openToInvoiceJs} disabled={isOpenToInvoiceDisabled}>寮�绁�</button>
+ </template>
+ </td>
+
+ <td>
+ <template if:false={EditAble}>
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={uploadOrder}>涓婁紶闄勪欢</button>
+ </template>
+ </td>
+ </tr>
+ <tr style="height: 5px;"></tr>
+ <tr>
+ <td></td>
+ <td>
+ <template if:true={isPraseToPDFShow}>
+ <!-- <lightning-button label="鎵撳嵃鎸囩ず鍗�" onclick={PraseToPDFJs} style="width: 150px"
+ disabled={isPraseToPDFDisabled}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={PraseToPDFJs} disabled={isPraseToPDFDisabled}>鎵撳嵃鎸囩ず鍗�</button>
+ </template>
+ </td>
+
+ <td>
+
+ <template if:true={isOpenReportShow}>
+ <!-- <lightning-button label="鏄剧ず鏄庣粏 " onclick={openReportJs}
+ style="width: 150px" disabled={isOpenReportDisabled}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={openReportJs} disabled={isOpenReportDisabled}>鏄剧ず鏄庣粏</button>
+ </template>
+ </td>
+ <td>
+
+ <template if:true={isDeleteShow}>
+ <!-- <lightning-button label="鍒犻櫎" onclick={DeleteConsumable} style="width: 150px"
+ disabled={isDeleteDisabled}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={DeleteConsumable} disabled={isDeleteDisabled}>鍒犻櫎</button>
+ </template>
+ </td>
+ <td></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+
+ <!-- 鍑哄簱鍗曚俊鎭� EditAble = true -->
+ <template if:true={EditAble}>
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗曚俊鎭�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <!-- SummonsStatus_c__c == '浠锋牸鏈畾' -->
+ <template if:true={summonsStatusPriceNotDetermined}>
+ <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
+ onload={handleLoad}>
+ <!-- 鍑哄簱鍗曞彿 鍑哄簱鍗曠姸鎬� -->
+ <lightning-layout multiple-rows="true">
+ <template if:true={isSummonsFlag}>
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="Name"
+ class="hehe-layoutItem"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="SummonsStatus_c__c"></lightning-output-field>
+ </lightning-layout-item>
+ </template>
+ </lightning-layout>
+
+ <!-- 鐩殑 寮�绁ㄧ姸鎬� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field field-name="SummonsForDirction__c"
+ class="searchName"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field field-name="Billed_Status__c"
+ class="searchName"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 浜岀骇缁忛攢鍟� -->
+ <template if:true={isSummonsForDirctionTwoShow}>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Order_Dealer_Info__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </template>
+
+ <!-- 瀹㈡埛鍚� 鍙戠エ-->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field class="hideHelpText"
+ field-name="ShipmentAccount__c"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-input-field data-field={ConInvoice_Code__c}
+ onchange={invoiceChange} field-name="ConInvoice_Code__c"
+ class="inputFont"></lightning-input-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 绉戝 鍑哄簱閲戦 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Order_ForCustomerText__c"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="Shipment_total_amount__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 娌℃湁纭畾浠锋牸 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="NoConfirmedPrice__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-record-edit-form>
+ </template>
+
+ <!-- SummonsStatus_c__c != '浠锋牸鏈畾' -->
+ <template if:false={summonsStatusPriceNotDetermined}>
+ <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
+ onsubmit={handleSubmit} onload={handleLoad}>
+ <!-- 鍑哄簱鍗曞彿 鍑哄簱鍗曠姸鎬� -->
+ <lightning-layout multiple-rows="true">
+ <template if:true={isSummonsFlag}>
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field field-name="Name"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-output-field
+ field-name="SummonsStatus_c__c"></lightning-output-field>
+ </lightning-layout-item>
+ </template>
+ </lightning-layout>
+
+ <!-- 鐩殑 浜岀骇缁忛攢鍟� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-input-field data-field="summonsForDirction"
+ value={summonsForDirction} field-name="SummonsForDirction__c"
+ required="true" onchange={ChangeDirction}
+ class="inputFont"></lightning-input-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-combobox data-field="secondaryDistributor"
+ name="secondaryDistributor" label="浜岀骇缁忛攢鍟�"
+ value={secondaryDistributor} placeholder="璇烽�夋嫨..."
+ options={secondaryDistributorOptions} variant="label-inline"
+ onchange={dataChange} disabled={isDisabledSecondaryDistributor}
+ class="inputFont"></lightning-combobox>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 瀹㈡埛鍚� 缁忛攢鍟嗗綍鍏� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <div
+ class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
+ <lightning-icon size="x-small"
+ class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default"
+ icon-name="utility:search"></lightning-icon>
+ <lightning-input type="text" name="HospitalName" label="瀹㈡埛鍚�"
+ value={HospitalName} variant="label-inline"
+ onclick={searchHospitalNameModal} data-field="HospitalName"
+ disabled={isDisabledHospitalName} onchange={clearAgencyI}
+ class="inputFont"></lightning-input>
+ </div>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <template if:true={isMutualTransferGoods}>
+ <c-lex-lookup onsearch={handleSearch}
+ onselectionchange={handleSelectionChange} label="缁忛攢鍟�(褰曞叆)"
+ variant="label-inline" placeholder="鎼滅储缁忛攢鍟�"
+ onisdisabledfordealertext={isDisabledForDealerText}
+ account-value={accountValue} onblur={vpClear2Delay}
+ disabled={isDisabledForDealerText} class="inputFont">
+ </c-lex-lookup>
+ </template>
+ <template if:false={isMutualTransferGoods}>
+ <lightning-input type="text" name="Order_ForDealerText__c"
+ label="缁忛攢鍟�(褰曞叆)" value={ForDealerText} onchange={dataChange}
+ data-field="Order_ForDealerText__c"
+ disabled={isDisabledForDealerText} variant="label-inline"
+ class="inputFont">
+ </lightning-input>
+ </template>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 绉戝 鎬婚噾棰� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-input-field onchange={dataChange}
+ data-field="ForCustomerText" value={ForCustomerText}
+ field-name="Order_ForCustomerText__c"
+ disabled={isDisabledForCustomerText}
+ class="inputFont"></lightning-input-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-input type="text" name="sumPrice" label="鎬婚噾棰�"
+ value={sumPrice} variant="label-inline" onchange={dataChange}
+ data-field="sumPrice" readonly></lightning-input>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 娌℃湁纭畾浠锋牸 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <lightning-input-field value={NoConfirmedPrice}
+ field-name="NoConfirmedPrice__c" data-field="NoConfirmedPrice"
+ onchange={dataChange}></lightning-input-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-record-edit-form>
+ </template>
+ </div>
+ </div>
+ </div>
+ </template>
+
+ <!-- 鍑哄簱鍗曚俊鎭� EditAble = false -->
+ <template if:false={EditAble}>
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗曚俊鎭�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
+ onload={handleLoad2}>
+ <!-- 鍑哄簱鍗曞彿 鍑哄簱鍗曠姸鎬� -->
+ <lightning-layout multiple-rows="true">
+ <template if:true={isSummonsFlag}>
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="Name"
+ class="hehe-layoutItem"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="SummonsStatus_c__c"
+ class="hehe-layoutItem"></lightning-output-field>
+ </lightning-layout-item>
+ </template>
+ </lightning-layout>
+
+ <!-- 鐩殑 寮�绁ㄧ姸鎬� -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="SummonsForDirction__c"
+ class="hehe-layoutItem"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="Billed_Status__c"
+ class="hehe-layoutItem"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 浜岀骇缁忛攢鍟� -->
+ <template if:true={isSummonsForDirctionTwoShow}>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="Order_Dealer_Info__c"
+ class="hehe-layoutItem"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </template>
+
+ <!-- 瀹㈡埛鍚� 鍙戠エ-->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item size="4" class="hehe-layoutItem">
+ <lightning-output-field class="hideHelpText"
+ field-name="ShipmentAccount__c"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <template if:true={isConInvoiceShow}>
+ <lightning-layout-item size="4">
+ <lightning-input-field data-field={ConInvoice_Code__c}
+ onchange={invoiceChange} field-name="ConInvoice_Code__c"
+ class="hehe-layoutItem inputFont"></lightning-input-field>
+ </lightning-layout-item>
+ </template>
+ </lightning-layout>
+
+ <!-- 绉戝 鍑哄簱閲戦 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="Order_ForCustomerText__c"
+ class="hehe-layoutItem"></lightning-output-field>
+ </lightning-layout-item>
+
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="Shipment_total_amount__c"
+ class="hehe-layoutItem"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 娌℃湁纭畾浠锋牸 -->
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+
+ <lightning-layout-item size="4">
+ <lightning-output-field field-name="NoConfirmedPrice__c"
+ class="hehe-layoutItem"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <!-- 闄勪欢棰勮 -->
+ <template if:false={EditAble}>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1">
+ </lightning-layout-item>
+ <lightning-layout-item size="11">
+ <lightning-card class="attListTitle" variant="Narrow" title="闄勪欢鍒楄〃"
+ icon-name="utility:attach">
+
+ <lightning-layout slot="footer" multiple-rows="true">
+ <template for:each={fileData} for:item="item" for:index="index">
+ <lightning-layout-item padding="around-none" size="2"
+ key={item.recordId}
+ style="text-align: left;padding:5px">
+ <lightning-icon title={item.Title}
+ style="margin-left: 20px;" icon-name="doctype:gform"
+ alternative-text={item.Title}
+ size="large"></lightning-icon><br />
+ <span title={item.Title}>
+ {item.fileName}
+ </span>
+ <p>
+ <!-- <a data-fileid ={item.documentId} onclick={previweAtt}> -->
+ <a href={item.attUrl} target="_blank">
+ 棰勮
+ </a> 路
+ <a href={item.downloadUrl}>
+ 涓嬭浇
+ </a> 路
+ <a data-fileid={item.recordId} onclick={deleteAtt}>
+ 鍒犻櫎
+ </a>
+ </p>
+ <!-- <p>{item.updateDate} 路 {item.ownerName}</p> -->
+ </lightning-layout-item>
+ </template>
+ </lightning-layout>
+ </lightning-card>
+ </lightning-layout-item>
+ </lightning-layout>
+ </template>
+
+ </lightning-record-edit-form>
+ </div>
+ </div>
+ </div>
+ </template>
+
+ <!-- 妫�绱� -->
+ <template if:true={isSearchShow}>
+ <div class="borderCss">
+ <div style="padding: 3px;height:110px;">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-layout multiple-rows>
+ <lightning-layout-item style="padding: 10px;" flexibility="auto">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label">娑堣�楀搧鍚嶇О</div>
+ <lightning-input type="text" name="consumableName" label="娑堣�楀搧鍚嶇О"
+ value={consumableName} variant="label-hidden" onchange={dataChange}
+ data-field="consumableName" class="inputFont"></lightning-input>
+ </div>
+
+ </lightning-layout-item>
+ <lightning-layout-item style="padding: 10px;" flexibility="auto">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label" style="width:80px">绗�3鍒嗙被</div>
+ <lightning-combobox name="progress" label="绗�3鍒嗙被" value={Category3}
+ variant="label-hidden" options={category3Options} onchange={dataChange}
+ data-field="Category3" style="min-width: 160px;"
+ class="inputFont"></lightning-combobox>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item style="padding: 10px;" flexibility="auto">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label" style="width:80px">绗�4鍒嗙被</div>
+ <lightning-combobox name="progress" label="绗�4鍒嗙被" value={Category4}
+ variant="label-hidden" options={category4Options} onchange={dataChange}
+ data-field="Category4" style="min-width: 160px;"
+ class="inputFont"></lightning-combobox>
+ </div>
+
+ </lightning-layout-item>
+ <lightning-layout-item style="padding: 10px;" flexibility="auto">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label" style="width:80px">绗�5鍒嗙被</div>
+ <lightning-combobox name="progress" label="绗�5鍒嗙被" value={Category5}
+ variant="label-hidden" onchange={dataChange} data-field="Category5"
+ options={category5Options} style="min-width: 160px;"
+ class="inputFont"></lightning-combobox>
+ </div>
+
+ </lightning-layout-item>
+ <template if:true={hasHosPro}>
+ <lightning-layout-item style="padding: 10px;" flexibility="auto">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label">鍖婚櫌鐗逛环</div>
+ <lightning-combobox name="progress" label="鍖婚櫌鐗逛环" value={outOutPattern}
+ variant="label-hidden" options={outOutPatternOptionList}
+ onchange={dataChange} data-field="outOutPattern"
+ style="min-width: 140px;" class="inputFont"></lightning-combobox>
+ </div>
+ </lightning-layout-item>
+ </template>
+ </lightning-layout>
+ <div style="float:right;margin-right:50px;">
+ <!-- <lightning-button label="妫�绱�" onclick={searchProductJs}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder lexsearchStyle"
+ onclick={searchProductJs}>妫�绱�</button>
+
+
+ <!-- <lightning-button label="娓呯┖" onclick={ClearJs}></lightning-button> -->
+ <button style="margin-left:10px;"
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder lexclearStyle"
+ onclick={ClearJs}>娓呯┖</button>
+ </div>
+
+ </div>
+ </div>
+ </div>
+ </template>
+
+ <!-- 鍑哄簱鍗曟槑缁� -->
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗曟槑缁�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <template if:true={EditAble}>
+ <template if:true={showTable}>
+ <c-lex-custom-lightning-datatable key-field="Id" data={data} columns={columns}
+ onunitchange={handleUnitChange} onshipmentnumber={handleShipmentNumber}
+ onshipmentunitprice={handleShipmentUnitPrice} onrowselection={getSelectedRows}
+ selected-rows={selectedRows} default-sort-direction={defaultSortDirection}
+ sorted-direction={sortDirection} sorted-by={sortedBy} onsort={onHandleSort}
+ style="word-wrap:break-word; word-break:break-all; "
+ class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ </template>
+ <c-paginator onprevious={handlePrevious} onnext={handleNext}
+ onpageschange={handlePageschange} onfirst={handleFirst} onlast={handleLast}
+ page-size-options={pageSizeOptions} previous-button-disabled={previousButtonDisabled}
+ next-button-disabled={nextButtonDisabled} record-start={recordStart}
+ record-end={recordEnd} total-records={totalRecords}></c-paginator>
+ </template>
+
+ <template if:false={EditAble}>
+ <template if:true={showTable}>
+ <c-lex-custom-lightning-datatable hide-checkbox-column key-field="Id" data={editData}
+ columns={editColumns} onunitchange={handleUnitChange}
+ onshipmentnumber={handleShipmentNumber}
+ onshipmentunitprice={handleShipmentUnitPrice} onrowselection={getSelectedRows}
+ selected-rows={selectedRows} default-sort-direction={defaultSortDirection}
+ sorted-direction={sortDirection} sorted-by={sortedBy} onsort={onHandleSort}
+ style="word-wrap:break-word; word-break:break-all; "
+ class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ <c-paginator onprevious={editHandlePrevious} onnext={editHandleNext}
+ onpageschange={editHandlePageschange} onfirst={editHandleFirst}
+ onlast={editHandleLast} page-size-options={pageSizeOptions}
+ previous-button-disabled={previousButtonDisabled}
+ next-button-disabled={nextButtonDisabled} record-start={recordStart}
+ record-end={recordEnd} total-records={totalRecords}></c-paginator>
+ </template>
+ </template>
+
+ <template if:true={isEditShowSpinner}>
+ <lightning-spinner alternative-text="Uploading now"></lightning-spinner>
+ </template>
+ </div>
+ </div>
+
+ <!-- 鍑哄簱浜у搧鏄庣粏 -->
+ <template if:true={isShowOutboundProductDetails}>
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱浜у搧鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <lightning-datatable key-field="id" data={consumableorderdetails2Records}
+ columns={consumableorderdetails2RecordsColumns} hide-checkbox-column
+ class="wrapped-header-datatable">
+ </lightning-datatable>
+ </div>
+ </div>
+ </template>
+
+ <!-- 涓婁紶闄勪欢 -->
+ <!-- <template if:false={EditAble}>
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 16px">
+ <strong>闄勪欢</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-card title="">
+ <lightning-layout multiple-rows="true" style="margin-top: -20px">
+ <lightning-layout-item size="5">
+ </lightning-layout-item>
+ <lightning-layout-item padding="around-small">
+ <lightning-button label='涓婁紶闄勪欢' onclick={uploadOrder}></lightning-button>
+ </lightning-layout-item>
+ </lightning-layout>
+ <template if:true={showLoadingSpinner}>
+ <lightning-spinner alternative-text="Uploading now"></lightning-spinner>
+ </template>
+ <footer style="margin-top: 20px" class="deleteAtt">
+ <c-lex-custom-lightning-datatable key-field="id" data={fileData}
+ columns={fileColumns} onclickicon={deleteAtt} hide-checkbox-column
+ class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ </footer>
+ </lightning-card>
+ </div>
+ </div>
+ </div>
+ </template> -->
+ </template>
+
+ <!-- 鍑鸿揣/閿�鍞� -->
+ <template if:true={isShippingSales}>
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑鸿揣绠$悊</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px;">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-layout multiple-rows="true" style="height:50px">
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ </lightning-layout-item>
+ <template if:true={isSales}>
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <!-- <lightning-button label="閿�鍞�" onclick={SaveP}
+ style="margin-top:-10px"></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={SaveP}>閿�鍞�</button>
+ </lightning-layout-item>
+ </template>
+ <template if:false={isSales}>
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <!-- <lightning-button label="鍑鸿揣" onclick={SaveE}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={SaveE}>鍑鸿揣</button>
+ </lightning-layout-item>
+ </template>
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ </lightning-layout-item>
+ </lightning-layout>
+
+ <template if:true={isShowInformation}>
+ <div class="borderCss" style="margin-top: 5px;">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑哄簱鍗曚俊鎭�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-record-edit-form object-api-name="Consumable_order__c"
+ record-id={cocId} onload={handleLoad2}>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="3" padding="around-small">
+ <!-- <lightning-output-field field-name="Name"></lightning-output-field> -->
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label" style="padding: 0px;">
+ 鍑哄簱鍗曞彿锛�</div>
+ <lightning-output-field field-name="Name"
+ variant="label-hidden"></lightning-output-field>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item size="4" padding="around-small">
+ <!-- <lightning-output-field
+ field-name="ShipmentAccount__c" class="hideHelpText"></lightning-output-field> -->
+ <div
+ class="slds-grid slds-grid_vertical-align-center hehe-layoutItem">
+ <div class="slds-form-element__label" style="padding: 0px;">
+ 瀹㈡埛鍚嶏細</div>
+ <lightning-output-field field-name="ShipmentAccount__c"
+ variant="label-hidden"></lightning-output-field>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item size="2" padding="around-small">
+ <!-- <lightning-output-field
+ field-name="Order_ForCustomerText__c"></lightning-output-field> -->
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label" style="padding: 0px;">
+ 绉戝锛�</div>
+ <lightning-output-field
+ field-name="Order_ForCustomerText__c"
+ variant="label-hidden"></lightning-output-field>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item size="2" padding="around-small">
+ <!-- <lightning-output-field
+ field-name="SummonsForDirction__c"></lightning-output-field> -->
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label" style="padding: 0px;">
+ 鐩殑锛�</div>
+ <lightning-output-field field-name="SummonsForDirction__c"
+ variant="label-hidden"></lightning-output-field>
+ </div>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-record-edit-form>
+ </div>
+ </div>
+ </div>
+
+ <template if:true={isBarcode}>
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>BarCode褰曞叆</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-record-edit-form object-api-name="Consumable_order__c"
+ record-id={cocId}>
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="1"></lightning-layout-item>
+ <lightning-layout-item padding="around-small">
+ <!-- <lightning-textarea name="Barcode" label="BarCode鍙�"
+ onchange={dataChange} variant="label-inline"
+ data-field="Barcode"
+ value={Barcode}></lightning-textarea> -->
+
+ <div class="slds-grid">
+ <div class="slds-form-element__label">BarCode鍙�</div>
+ <lightning-textarea name="Barcode" label="BarCode鍙�"
+ onchange={dataChange} variant="label-hidden"
+ data-field="Barcode" value={Barcode}
+ style="min-width: 400px;"></lightning-textarea>
+ </div>
+ </lightning-layout-item>
+ <lightning-layout-item padding="around-small">
+ <div class="slds-grid slds-grid_vertical-align-center">
+ <div class="slds-form-element__label">
+ <!-- <lightning-button label="纭"
+ onclick={SalesearchProductJs}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={SalesearchProductJs}>鑾峰彇鏄庣粏</button>
+ </div>
+ </div>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-record-edit-form>
+ </div>
+ </div>
+ </div>
+ </template>
+
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑鸿揣鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <!-- <lightning-datatable key-field="id" data={salesData} columns={salesColumns}
+ hide-checkbox-column
+ style="word-wrap:break-word; word-break:break-all; "
+ class="wrapped-header-datatable">
+ </lightning-datatable> -->
+ <c-lex-custom-lightning-datatable key-field="Id" data={salesData}
+ columns={salesColumns} onoutboundcount={handleOutboundCount}
+ hide-checkbox-column
+ style="word-wrap:break-word; word-break:break-all; "
+ class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ </div>
+ </div>
+ </div>
+
+ <div class="borderCss">
+ <div class="headerDorderCss">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鍑鸿揣閿欒鏄庣粏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding: 7px">
+ <div lwc:dom="manual" class="resultDiv"></div>
+ <div draggable="false">
+ <lightning-datatable key-field="id" data={salesErrorData}
+ columns={salesErrorColumns} hide-checkbox-column
+ style="word-wrap:break-word; word-break:break-all; "
+ class="wrapped-header-datatable">
+ </lightning-datatable>
+ </div>
+ </div>
+ </div>
+
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ </lightning-layout-item>
+ <template if:true={isSales}>
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <!-- <lightning-button label="閿�鍞�" onclick={SaveP}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={SaveP}>閿�鍞�</button>
+ </lightning-layout-item>
+ </template>
+ <template if:false={isSales}>
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ <!-- <lightning-button label="鍑鸿揣" onclick={SaveE}></lightning-button> -->
+ <button
+ class="slds-button slds-button_neutral slds-button_stretch lexBorder"
+ onclick={SaveE}>鍑鸿揣</button>
+ </lightning-layout-item>
+ </template>
+ <lightning-layout-item class="hehe-layoutItem" size="4">
+ </lightning-layout-item>
+ </lightning-layout>
+ </template>
+ </div>
+ </div>
+ </div>
+ </template>
+ </div>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
new file mode 100644
index 0000000..74a0853
--- /dev/null
+++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
@@ -0,0 +1,2490 @@
+import { LightningElement, wire, api, track } from "lwc"; save
+import init from "@salesforce/apex/LexSummonsCreatController.init";
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import searchConsumableorderdetails from "@salesforce/apex/LexSummonsCreatController.searchConsumableorderdetails";
+import PraseToPDF from "@salesforce/apex/LexSummonsCreatController.PraseToPDF";
+import apexSearch from "@salesforce/apex/LexSummonsCreatController.search";
+import saveFile from "@salesforce/apex/LexSummonsCreatController.saveFile";
+import getFiles from "@salesforce/apex/LexSummonsCreatController.getFiles";
+import GoodsDelivery from "@salesforce/apex/LexSummonsCreatController.GoodsDelivery";
+import DelConsumable from "@salesforce/apex/LexSummonsCreatController.DelConsumable";
+import categoryAllload from "@salesforce/apex/LexSummonsCreatController.categoryAllload";
+import categoryload from "@salesforce/apex/LexSummonsCreatController.categoryload";
+import GoodsDeliveryInit from "@salesforce/apex/LexSaleOrderController.GoodsDeliveryInit";
+import SearchPro from "@salesforce/apex/LexSaleOrderController.SearchPro";
+import ProdElivery from "@salesforce/apex/LexSaleOrderController.ProdElivery";
+import ProSale from "@salesforce/apex/LexSaleOrderController.ProSale";
+import save from "@salesforce/apex/LexSummonsCreatController.save";
+import OPPORTUNITY_OBJECT from "@salesforce/schema/Consumable_Orderdetails__c";
+import { getObjectInfo } from "lightning/uiObjectInfoApi";
+import hospitalInit from "@salesforce/apex/lexSearchAgencyHospitalController.init";
+import serContact from "@salesforce/apex/lexSearchAgencyHospitalController.serContact";
+import deleteAtt from '@salesforce/apex/LexConsumableController.deleteAtt';
+import { NavigationMixin } from "lightning/navigation";
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+import ConsumableOutboundReportId from '@salesforce/label/c.ConsumableOutboundReportId';
+const customLabel = {
+ ConsumableOutboundReportId
+}
+
+export default class LexSummonsCreat extends NavigationMixin(LightningElement) {
+ @track label = customLabel;
+ @track isShowSpinner = true;
+ @track isEditShowSpinner = false;
+ @track showResults = true;
+ @track results = [
+ {
+ Id: "1",
+ Name: "z",
+ },
+ {
+ Id: "2",
+ Name: "h",
+ },
+ {
+ Id: "3",
+ Name: "j",
+ },
+ ];
+
+ @track COLS = [
+ {
+ label: "Account Name",
+ type: "customName",
+ typeAttributes: {
+ accountName: { fieldName: "Name" },
+ },
+ },
+ ];
+ @track columns = [
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "Name__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 175,
+ sortable: true
+ },
+ {
+ label: "瑙勬牸",
+ fieldName: "packinglist",
+ cellAttributes: { alignment: "right" },
+ wrapText: true,
+ initialWidth: 50,
+ hideDefaultActions: true,
+ },
+ {
+ label: "CFDA鐘舵��",
+ fieldName: "SFDA_Status__c",
+ initialWidth: 105,
+ wrapText: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: "娉ㄥ唽璇佺紪鐮佸彿",
+ fieldName: "approbation_No",
+ wrapText: true,
+ initialWidth: 115,
+ hideDefaultActions: true,
+ },
+ {
+ label: "娉ㄥ唽璇佹晥鏈�",
+ wrapText: true,
+ initialWidth: 115,
+ fieldName: "expiration_Date",
+ hideDefaultActions: true,
+ },
+ {
+ label: "绗�3鍒嗙被",
+ fieldName: "Category3__c",
+ wrapText: true,
+ initialWidth: 115,
+ hideDefaultActions: true,
+ sortable: true,
+ },
+ {
+ label: "绗�4鍒嗙被",
+ fieldName: "Category4__c",
+ wrapText: true,
+ initialWidth: 115,
+ hideDefaultActions: true,
+ sortable: true,
+ },
+ {
+ label: "绗�5鍒嗙被",
+ fieldName: "Category5__c",
+ wrapText: true,
+ initialWidth: 115,
+ hideDefaultActions: true,
+ sortable: true,
+ },
+ {
+ label: "鍗曚綅",
+ type: "customUnit",
+ initialWidth: 100,
+ hideDefaultActions: true,
+ typeAttributes: {
+ unitValue: { fieldName: "unitValue" },
+ unitOptions: { fieldName: "unitOptions" },
+ recordId: { fieldName: "Id" },
+ },
+ },
+ {
+ label: "鍑鸿揣鏁伴噺",
+ type: "customShipment",
+ initialWidth: 100,
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+ typeAttributes: {
+ recordId: { fieldName: "Id" },
+ shipmentNumber: { fieldName: "shipmentNumber" },
+ },
+ },
+ {
+ label: "鍑鸿揣鍗曚环(鍏�)",
+ type: "customShipmentUnitPrice",
+ hideDefaultActions: true,
+ initialWidth: 120,
+ typeAttributes: {
+ recordId: { fieldName: "Id" },
+ shippingUnitPrice: { fieldName: "shippingUnitPrice" },
+ },
+ },
+ {
+ label: "鍑鸿揣閲戦(鍏�)",
+ type: "customShipmentAmount",
+ initialWidth: 120,
+ cellAttributes: { alignment: "right" },
+ hideDefaultActions: true,
+ typeAttributes: {
+ shipmentAmount: { fieldName: "shipmentAmount" },
+ },
+ },
+ {
+ label: "鏈夋晥鏈熷唴搴撳瓨(鐩�)",
+ fieldName: "Boxnumber",
+ cellAttributes: { alignment: "right" },
+ wrapText: true,
+ initialWidth: 160,
+ hideDefaultActions: true,
+ },
+ {
+ label: "鏈夋晥鏈熷唴搴撳瓨(涓�)",
+ fieldName: "Piecenumber",
+ cellAttributes: { alignment: "right" },
+ wrapText: true,
+ initialWidth: 160,
+ hideDefaultActions: true,
+ },
+ ];
+ @track editColumns = [
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "Name__c",
+ hideDefaultActions: true,
+ initialWidth: 320,
+ wrapText: true,
+ sortable: true,
+ },
+ {
+ label: "瑙勬牸",
+ fieldName: "packinglist",
+ initialWidth: 80,
+ cellAttributes: { alignment: "right" },
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "CFDA鐘舵��",
+ fieldName: "SFDA_Status__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "娉ㄥ唽璇佺紪鐮佸彿",
+ fieldName: "approbation_No",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "娉ㄥ唽璇佹晥鏈�",
+ fieldName: "expiration_Date",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "绗�3鍒嗙被",
+ fieldName: "Category3__c",
+ initialWidth: 100,
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ },
+ {
+ label: "绗�4鍒嗙被",
+ fieldName: "Category4__c",
+ initialWidth: 100,
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ },
+ {
+ label: "绗�5鍒嗙被",
+ fieldName: "Category5__c",
+ initialWidth: 100,
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ },
+ {
+ label: "鍗曚綅",
+ fieldName: "Box_Piece__c",
+ initialWidth: 50,
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "鍑鸿揣鏁伴噺",
+ fieldName: "Shipment_Count__c",
+ cellAttributes: { alignment: "right" },
+ hideDefaultActions: true,
+ initialWidth: 100,
+ wrapText: true,
+ },
+ {
+ label: "鍑鸿揣鍗曚环(鍏�)",
+ fieldName: "shippingUnitPrice",
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ ];
+ @track editData = [];
+
+ @track hospitalList = [];
+ @track hospitalColumns = [
+ {
+ label: "鍖婚櫌鍚嶇О",
+ fieldName: "Name",
+ initialWidth: 400,
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "鐪佷唤",
+ fieldName: "stateMasterName",
+ hideDefaultActions: true,
+ },
+ {
+ label: "閫夋嫨",
+ fieldName: "Id1",
+ type: "button",
+ hideDefaultActions: true,
+ typeAttributes: {
+ label: "閫夋嫨",
+ name: "Id2",
+ size: 1,
+ },
+ },
+ ];
+
+ @track accountid = "";
+ @track consumableproductdetailsRecords = [];
+ @track SummonsStatus = "";
+ @track ESetid = "";
+ @track statusEdit = "";
+ @track cocLwc = {};
+ @track selectedRows = [];
+ @track ConsumableOut_report = "";
+ @track isMutualTransferGoods = false;
+ @track Barcode = "";
+ @track summonsForDirction = '';
+ @track accountValue = '';
+
+ @track consumableorderdetails2RecordsColumns = [
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "ProdName",
+ hideDefaultActions: true,
+ },
+ {
+ label: "鎵规鍙�",
+ fieldName: "orderdetails2SerialLotNo__c",
+ hideDefaultActions: true,
+ },
+ {
+ label: "绠$悊缂栫爜",
+ fieldName: "orderdetails2TracingCode__c",
+ hideDefaultActions: true,
+ },
+ {
+ label: "浣跨敤鏈熼檺",
+ fieldName: "orderdetails2Sterilization_limit__c",
+ hideDefaultActions: true,
+ },
+ ];
+ @track consumableorderdetails2Records = [];
+
+ //鍑鸿揣/閿�鍞�
+ @track salesColumns = [
+ {
+ label: "娑堣�楀搧璁㈠崟",
+ fieldName: "ConsumableorderminorUrl",
+ hideDefaultActions: true,
+ type: "url",
+ typeAttributes: {
+ label: { fieldName: "Consumable_order_minor__c" },
+ target: "_blank",
+ },
+ wrapText: true,
+ },
+ {
+ label: "娑堣�楀搧鏄庣粏2鍚嶇О",
+ fieldName: "orderdetails2NameUrl",
+ type: "url",
+ typeAttributes: {
+ label: { fieldName: "orderdetails2Name" },
+ target: "_blank",
+ },
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 240
+ },
+ {
+ label: "鍗曚綅",
+ fieldName: "Box_Piece__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 50
+ },
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "ProdName",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "鍙戣揣鏃ユ湡",
+ fieldName: "Deliver_date__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "BarCode",
+ fieldName: "Bar_Code__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 400
+ },
+ {
+ label: "浣跨敤鏈熼檺",
+ fieldName: "Sterilization_limit__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 120
+ },
+ {
+ label: "鍑鸿揣鏁伴噺",
+ fieldName: 'outboundCount',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+ }
+ ];
+ @track salesData = [];
+
+ @track salesErrorColumns = [
+ {
+ label: "娑堣�楀搧璁㈠崟",
+ fieldName: "ConsumableorderminorUrl",
+ hideDefaultActions: true,
+ type: "url",
+ typeAttributes: {
+ label: { fieldName: "Consumable_order_minor__c" },
+ target: "_blank",
+ },
+ wrapText: true,
+ },
+ {
+ label: "娑堣�楀搧鏄庣粏2鍚嶇О",
+ fieldName: "orderdetails2Name",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 240
+ },
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "ProdName",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "鍗曚綅",
+ fieldName: "Box_Piece__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 50
+ },
+ {
+ label: "BarCode",
+ fieldName: "Bar_Code__c",
+ hideDefaultActions: true,
+ initialWidth: 400
+ },
+ {
+ label: "浣跨敤鏈熼檺",
+ fieldName: "Sterilization_limit__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 120
+ },
+ {
+ label: "閿欒鍘熷洜",
+ fieldName: "ErrorReason",
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ ];
+ @track salesErrorData = [];
+ @track salesAccountName = "";
+ @track salesUserWorkLocation = "";
+ @track salesAccountid = "";
+ @track salesOrderdetails = [];
+ @track salesCoc = {};
+ @track salesOrderpieceorboxMap;
+ @track salesOrderpriceMap;
+ @track salesOrderagencypriceMap;
+
+ //鏄剧ず鎸夐挳
+ @track isSaveShow = false;
+ @track isEditShow = false;
+ @track isDeliveryShow = false;
+ @track isOpenToInvoiceShow = false;
+ @track isPraseToPDFShow = false;
+ @track isOpenReportShow = false;
+ @track isDeleteShow = false;
+ @track isFileShow = false;
+ @track isShippingSales = false;
+ @track isSales = false;
+ @track isBarcode = true;
+ @track isShowInformation = true;
+ @track isShowOutboundProductDetails = false;
+ @track showAttPop = false;
+ @track showPopSpinner = false;
+
+ //disable鎸夐挳
+ @track isEditDisabled = false;
+ @track isDeliveryDisabled = false;
+ @track isOpenToInvoiceDisabled = true;
+ @track isPraseToPDFDisabled = true;
+ @track isOpenReportDisabled = true;
+ @track isDeleteDisabled = false;
+
+ //鍑哄簱鍗曚俊鎭�
+ @track cocId = "";
+ @track EditAble = false;
+ @track summonsStatusPriceNotDetermined = false;
+ @track isSummonsForDirctionTwoShow = false;
+ @track isSummonsFlag = false;
+ @track isConInvoiceShow = false;
+ @track sumPrice = "";
+ @track isSearchShow = false;
+ @track Existarrive = false;
+ @track Category3 = "";
+ @track category3Options = [];
+ @track Category4 = "";
+ @track category4Options = [];
+ @track Category5 = "";
+ @track category5Options = [];
+ //鍙戠エid
+ @track invoiceId = '';
+
+ //浜岀骇缁忛攢鍟�
+ @track secondaryDistributor = "";
+ @track secondaryDistributorOptions = [];
+ @track isDisabledSecondaryDistributor = false;
+
+ //缁忛攢鍟嗗綍鍏�
+ @track ForDealerText = "";
+ @track isDisabledForDealerText = false;
+
+ //瀹㈡埛鍚�
+ @track isModalOpen = false;
+ @track HospitalName = "";
+ @track searchHospitalName = "";
+ @track OECId = "";
+ @track isDisabledHospitalName = false;
+
+ //绉戝
+ @track ForCustomerText = "";
+ @track isDisabledForCustomerText = false;
+
+ //娌℃湁纭畾浠锋牸
+ @track NoConfirmedPrice = false;
+
+ //娑堣�楀搧鍚嶇О
+ @track consumableName = "";
+
+ @track agencyProType = "";
+ @track accountName = "";
+ @track userWorkLocation = "";
+ @track OutPattern__c = false;
+ @track outOutPattern = "";
+
+ //鍑哄簱鍗曟槑缁�
+ @track showTable = false;
+ @track data = [];
+ @track isSelectShow = false;
+ @track hidecheckboxcolumn = false;
+ @track is345Show = false;
+ @track arriveorder = "";
+ @track hasHosPro = false;
+ @track InvoiceProNotLabel = "";
+ @track RrturnProLabel = "";
+ @track InvoicedLabel = "";
+ @track outOutPatternOptionList = [];
+
+ //鏂囦欢涓婁紶
+ @track showLoadingSpinner = false;
+ @track UploadFile = "Upload File";
+ @track fileName = "";
+ @track fileData = [];
+ @track fileColumns = [
+ {
+ label: "鏍囬",
+ fieldName: "url",
+ type: "url",
+ typeAttributes: { label: { fieldName: "Title" }, target: "_blank" },
+ hideDefaultActions: true,
+ },
+ {
+ label: "鍒涘缓浜�",
+ fieldName: "CreatedByName",
+ hideDefaultActions: true,
+ },
+ {
+ label: '',
+ type: 'tableCellIcon',
+ typeAttributes: {
+ iconName: 'utility:delete',
+ recordId: {
+ fieldName: 'Id'
+ }
+ },
+ initialWidth: 50,
+ hideDefaultActions: true
+ },
+ ];
+ filesUploaded = [];
+ fileContents;
+ fileReader;
+ content;
+ MAX_FILE_SIZE = 1500000;
+
+ //鍒嗛〉start
+ //@track sortBy = "";
+ //@track sortDirection = "asc";
+ defaultSortDirection = 'asc';
+ sortDirection = 'asc';
+ sortedBy;
+ @track pageSize = 10;
+ error;
+ records;
+ currentPageToken = 0;
+ nextPageToken = this.pageSize;
+ @track totalRecords = 0;
+ @track loader = false;
+ @track pageNumber = 1;
+ @track paginationVisibility = false;
+ @track totalPages = 1;
+ pageSizeOptions = [10, 25, 50, 100];
+ @track recordStart = 0;
+ @track recordEnd = 0;
+ //end
+ @track SearchDone = '';
+
+ stylesLoaded = false;
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+ //InvoiceProNotLabel RrturnProLabel InvoicedLabel
+ @wire(getObjectInfo, { objectApiName: OPPORTUNITY_OBJECT })
+ oppInfo({ data, error }) {
+ if (data) {
+ this.InvoiceProNotLabel = data.fields.InvoiceProNot_count__c.label;
+ this.RrturnProLabel = data.fields.RrturnPro_count__c.label;
+ this.InvoicedLabel = data.fields.Invoiced_Procount__c.label;
+ console.log("this.InvoiceProNotLabel = " + this.InvoiceProNotLabel);
+ console.log("this.RrturnProLabel = " + this.RrturnProLabel);
+ console.log("this.InvoicedLabel = " + this.InvoicedLabel);
+ }
+ }
+
+ //鑾峰彇閾炬帴鍙傛暟
+ getQueryString(name) {
+ console.log("getQueryString name " + name);
+ let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+ let r = window.location.search.substr(1).match(reg);
+ if (r != null) {
+ return decodeURIComponent(r[2]);
+ }
+ return null;
+ }
+ connectedCallback() {
+ console.log("connectedCallback LexSummonsCreat");
+ this.ESetid = this.getQueryString("ESetid");
+ this.ESetid = this.ESetid == null ? "" : this.ESetid;
+ //statusEdit
+ this.statusEdit = this.getQueryString("KeyWords");
+ this.statusEdit = this.statusEdit == null ? "" : this.statusEdit;
+ console.log("this.ESetid = " + this.ESetid);
+ console.log("this.statusEdit = " + this.statusEdit);
+ if (this.ESetid == "") {
+ this.isShowInformation = false;
+ }
+ console.log("init LexSummonsCreat");
+ init({
+ ESetidJs: this.ESetid,
+ statusEdit: this.statusEdit,
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+
+ if (r.status == "Success") {
+
+ //鍒嗛〉
+ console.log('r.entity.paginatedAccounts = ' + JSON.stringify(r.entity.paginatedAccounts));
+ this.nextPageToken = r.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords = r.entity.paginatedAccounts.totalRecords;
+ this.recordStart = r.entity.paginatedAccounts.recordStart;
+ this.recordEnd = r.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(r.entity.paginatedAccounts.totalRecords / this.pageSize);
+ console.log('this.totalPages = ' + this.totalPages);
+
+
+ this.OECId = r.entity.HospitalInfo == null ? '' : r.entity.HospitalInfo;
+ console.log("this.OECId = " + this.OECId);
+ this.ConsumableOut_report = r.entity.ConsumableOut_report;
+ console.log("this.ConsumableOut_report = " + this.ConsumableOut_report);
+ this.accountid = r.entity.accountid;
+ this.consumableproductdetailsRecords =
+ r.entity.consumableproductdetailsRecords;
+ this.accountName = r.entity.accountName;
+ this.agencyProType = r.entity.agencyProType;
+ this.accountName = r.entity.accountName;
+ this.userWorkLocation = r.entity.userWorkLocation;
+ this.EditAble = r.entity.EditAble;
+ this.consumableorderdetails2Records = r.entity.consumableorderdetails2Records;
+ for (var i in this.consumableorderdetails2Records) {
+ this.consumableorderdetails2Records[i]["ProdName"] = this.consumableorderdetails2Records[i].Prod.Name;
+ this.consumableorderdetails2Records[i]["orderdetails2SerialLotNo__c"] = this.consumableorderdetails2Records[i].orderdetails2.SerialLotNo__c;
+ this.consumableorderdetails2Records[i]["orderdetails2TracingCode__c"] = this.consumableorderdetails2Records[i].orderdetails2.TracingCode__c;
+ this.consumableorderdetails2Records[i]["orderdetails2Sterilization_limit__c"] = this.consumableorderdetails2Records[i].orderdetails2.Sterilization_limit__c;
+ }
+ this.isShowOutboundProductDetails = r.entity.consumableorderdetails2Count > 0 ? true : false;
+ console.log("this.agencyProType = " + this.agencyProType);
+ console.log("this.EditAble = " + this.EditAble);
+ //鏌ヨ闄勪欢
+ if (!this.EditAble) this.getFiles();
+ //绗�3鍒嗙被
+ for (var key in r.entity.categoryOptionMap) {
+ let object = {};
+ object["label"] = r.entity.categoryOptionMap[key];
+ object["value"] = key;
+ this.category3Options.push(object);
+ }
+ console.log("this.category3Options = " + JSON.stringify(this.category3Options));
+ //绗�4鍒嗙被
+ for (var key in r.entity.category4OptionMap) {
+ let object = {};
+ object["label"] = r.entity.category4OptionMap[key];
+ object["value"] = key;
+ this.category4Options.push(object);
+ }
+ console.log("this.category4Options = " + this.category4Options);
+ //绗�5鍒嗙被
+ for (var key in r.entity.category5OptionMap) {
+ let object = {};
+ object["label"] = r.entity.category5OptionMap[key];
+ object["value"] = key;
+ this.category5Options.push(object);
+ }
+ console.log("this.category5Options = " + this.category5Options);
+
+ this.data = r.entity.pageRecords;
+ this.editData = r.entity.pageRecords;
+ console.log("this.data start = " + JSON.stringify(this.data));
+ this.hasHosPro = r.entity.hasHosPro;
+ console.log("this.hasHosPro = " + this.hasHosPro);
+ if (this.EditAble) {
+ for (var i in this.data) {
+ let unitOptions = [];
+ for (var key in this.data[i].boxorpieceMap) {
+ let unitOption = {};
+ unitOption["label"] = this.data[i].boxorpieceMap[key];
+ unitOption["value"] = key;
+ unitOptions.push(unitOption);
+ }
+ this.data[i]["unitOptions"] = unitOptions;
+ this.data[i]["unitValue"] = this.data[i]["unitValue"] == null ? unitOptions[0].value : this.data[i]["unitValue"];
+ if (this.EditAble) {
+ this.data[i].orderdetails1["Box_Piece__c"] = this.data[i].orderdetails1["Box_Piece__c"] == null ? unitOptions[0].value : this.data[i].orderdetails1["Box_Piece__c"];
+ this.data[i]["unitValue"] = this.data[i].orderdetails1["Box_Piece__c"] == null ? unitOptions[0].value : this.data[i].orderdetails1["Box_Piece__c"];
+ console.log('this.data[i].orderdetails1["Box_Piece__c"] = ' + this.data[i].orderdetails1["Box_Piece__c"]);
+ this.data[i].orderdetails1["Shipment_Count__c"] = this.data[i].orderdetails1["Shipment_Count__c"] == null ? 0 : this.data[i].orderdetails1["Shipment_Count__c"];
+ this.data[i].orderdetails1["Delivery_List_RMB__c"] = this.data[i].orderdetails1["Delivery_List_RMB__c"] == null ? 0.0 : this.data[i].orderdetails1["Delivery_List_RMB__c"];
+ } else {
+ this.data[i]["InvoiceProNot_count__c"] = this.data[i].orderdetails1.InvoiceProNot_count__c;
+ this.data[i]["RrturnPro_count__c"] = this.data[i].orderdetails1.RrturnPro_count__c;
+ this.data[i]["Invoiced_Procount__c"] = this.data[i].orderdetails1.Invoiced_Procount__c;
+ }
+ // this.data[i]["shipmentNumber"] = 0;
+ // this.data[i]["shippingUnitPrice"] = 0.0;
+ //this.data[i]["shipmentNumber"] = this.data[i].orderdetails1["Shipment_Count__c"] == 0 ? '' : this.data[i].orderdetails1["Shipment_Count__c"];
+ //this.data[i]["shippingUnitPrice"] = this.data[i].orderdetails1["Delivery_List_RMB__c"] == 0 ? '' : this.data[i].orderdetails1["Delivery_List_RMB__c"];
+ this.data[i]["shipmentNumber"] = this.data[i].orderdetails1["Shipment_Count__c"];
+ this.data[i]["shippingUnitPrice"] = this.data[i].orderdetails1["Delivery_List_RMB__c"];
+
+
+
+ this.data[i]["Id"] = this.data[i].Prod.Id;
+
+ if (this.hasHosPro) {
+ if (this.data[i]["hospitalSpecialOffer"]) {
+ this.data[i]["Id"] = this.data[i].Prod.Id + 'ishos';
+ } else {
+ this.data[i]["Id"] = this.data[i].Prod.Id + 'nothos';
+ }
+ }
+ this.data[i]["recordId"] = this.data[i].Prod.Id;
+ this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
+ this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
+ this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
+ this.data[i]["Category4__c"] = this.data[i].Prod.Category4__c;
+ this.data[i]["Category5__c"] = this.data[i].Prod.Category5__c;
+ this.data[i]["Box_Piece__c"] = this.data[i].orderdetails1.Box_Piece__c;
+ this.data[i]["shipmentAmount"] = this.data[i].orderdetails1.Shipment_amount__c;
+ this.data[i]["Shipment_amount__c"] = this.data[i].orderdetails1.Shipment_amount__c;
+ this.data[i]["Shipment_Count__c"] = this.data[i].orderdetails1.Shipment_Count__c;
+
+ if (this.data[i]['check']) {
+ this.selectedRows.push(this.data[i].Id);
+ }
+ }
+ console.log('EditAble this.data = ' + JSON.stringify(this.data))
+ } else {
+ for (var i in this.editData) {
+ this.editData[i]["unitValue"] = this.editData[i]["unitValue"];
+ this.editData[i]["InvoiceProNot_count__c"] = this.editData[i].orderdetails1.InvoiceProNot_count__c;
+ this.editData[i]["RrturnPro_count__c"] = this.editData[i].orderdetails1.RrturnPro_count__c;
+ this.editData[i]["Invoiced_Procount__c"] = this.editData[i].orderdetails1.Invoiced_Procount__c;
+ this.editData[i]["shipmentNumber"] = this.editData[i].orderdetails1["Shipment_Count__c"];
+ this.editData[i]["shippingUnitPrice"] = this.editData[i].orderdetails1["Delivery_List_RMB__c"];
+
+ this.editData[i]["recordId"] = this.editData[i].Prod.Id;
+ this.editData[i]["Id"] = this.editData[i].Prod.Id;
+ this.editData[i]["Name__c"] = this.editData[i].Prod.Name__c;
+ this.editData[i]["SFDA_Status__c"] = this.editData[i].Prod.SFDA_Status__c;
+ this.editData[i]["Category3__c"] = this.editData[i].Prod.Category3__c;
+ this.editData[i]["Category4__c"] = this.editData[i].Prod.Category4__c;
+ this.editData[i]["Category5__c"] = this.editData[i].Prod.Category5__c;
+ this.editData[i]["Box_Piece__c"] = this.editData[i].orderdetails1.Box_Piece__c;
+ this.editData[i]["shipmentAmount"] = this.editData[i].orderdetails1.Shipment_amount__c;
+ //this.editData[i]["Shipment_amount__c"] = this.editData[i].orderdetails1.Shipment_amount__c;
+ this.editData[i]["Delivery_List_RMB__c"] = this.editData[i].orderdetails1.Delivery_List_RMB__c;
+ this.editData[i]["Shipment_Count__c"] = this.editData[i].orderdetails1.Shipment_Count__c;
+ }
+ console.log('end this.editData = ' + JSON.stringify(this.editData));
+ }
+
+ console.log("this.data = " + JSON.stringify(this.data));
+ //show
+ if (r.entity.EditDelCommitBtnDisabled || r.entity.EditAble) {
+ this.isSaveShow = true;
+ } else {
+ this.isEditShow = true;
+ this.isDeliveryShow = true;
+ this.isOpenToInvoiceShow = true;
+ this.isPraseToPDFShow = true;
+ this.isOpenReportShow = true;
+ this.isDeleteShow = true;
+ }
+
+ this.Existarrive = r.entity.Existarrive;
+
+ console.log("this.EditAble = " + this.EditAble);
+
+ //disable
+
+ if (Object.values(r.entity.coc).length > 0) {
+ this.cocLwc = r.entity.coc;
+ console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
+ var coc = r.entity.coc;
+ this.accountValue = coc.Order_ForDealerText__c;
+ this.ForDealerText = coc.Order_ForDealerText__c;
+ console.log('this.accountValue = ' + this.accountValue);
+ this.cocId = coc.Id;
+ console.log('cocId = ' + this.cocId);
+ coc.SummonsStatus = coc.SummonsStatus_c__c;
+ if (coc.SummonsStatus_c__c == "宸插畬鎴�") {
+ this.isEditDisabled = true;
+ }
+ if (
+ coc.SummonsStatus_c__c == "鎵瑰噯" ||
+ coc.SummonsStatus_c__c == "宸查攢鍞緟涓婁紶绾冲搧涔�" ||
+ coc.SummonsStatus_c__c == "鍑哄簱鍗曞凡鎵撳嵃" ||
+ coc.SummonsStatus_c__c == "宸插畬鎴�"
+ ) {
+ this.isDeliveryDisabled = true;
+ }
+ if (
+ ((coc.Billed_Status__c != "鍏ㄩ儴寮�绁�" &&
+ coc.SummonsStatus_c__c == "宸插畬鎴�") ||
+ coc.Onchange_order__c == true) &&
+ coc.SummonsForDirction__c != "浜掔浉璋冭揣"
+ ) {
+ this.isOpenToInvoiceDisabled = false;
+ }
+ if (
+ coc.SummonsStatus_c__c == "宸查攢鍞緟涓婁紶绾冲搧涔�" ||
+ coc.SummonsStatus_c__c == "鎵瑰噯" ||
+ coc.SummonsStatus_c__c == "鍑哄簱鍗曞凡鎵撳嵃" ||
+ coc.SummonsStatus_c__c == "鑽夋涓�"
+ ) {
+ this.isPraseToPDFDisabled = false;
+ }
+ if ((coc.Billed_Status__c != "杩樻病寮�绁�" || coc.SummonsStatus_c__c == "宸插畬鎴�") && this.agencyProType != 'ET') {
+ this.isOpenReportDisabled = false;
+ }
+ if (
+ coc.SummonsStatus_c__c == "宸查攢鍞緟涓婁紶绾冲搧涔�" ||
+ coc.SummonsStatus_c__c == "浠锋牸鏈畾" ||
+ coc.SummonsStatus_c__c == "鎵瑰噯" ||
+ coc.SummonsStatus_c__c == "鍑哄簱鍗曞凡鎵撳嵃" ||
+ coc.SummonsStatus_c__c == "宸插畬鎴�"
+ ) {
+ this.isDeleteDisabled = true;
+ }
+ this.isConInvoiceShow =
+ coc.SummonsStatus_c__c == "宸插畬鎴�" &&
+ coc.SummonsForDirction__c != "浜掔浉璋冭揣"
+ ? true
+ : false;
+ this.summonsStatusPriceNotDetermined =
+ coc.SummonsStatus_c__c == "浠锋牸鏈畾" ? true : false;
+ this.isSummonsForDirctionTwoShow =
+ coc.SummonsForDirction__c == "閿�鍞粰浜岀骇缁忛攢鍟�" ? true : false;
+ }
+ this.isSearchShow =
+ !this.Existarrive &&
+ r.entity.coc.SummonsStatus_c__c != "浠锋牸鏈畾" &&
+ r.entity.EditAble
+ ? true
+ : false;
+ this.hidecheckboxcolumn = !this.isSearchShow;
+ this.arriveorder = r.entity.arriveorder;
+ this.is345Show =
+ this.arriveorder == "" && this.Existarrive == false && this.EditAble
+ ? true
+ : false;
+ //濡傛灉涓嶆樉绀�345鍒嗙被锛宑olumns閲岄潰鍒犻櫎3锛�4锛�5鍒嗙被
+ if (!this.is345Show) {
+ for (var i = 0; i < this.columns.length; i++) {
+ if (this.columns[i].label == "绗�3鍒嗙被") {
+ this.columns.splice(i, 1);
+ }
+ }
+ for (var i = 0; i < this.columns.length; i++) {
+ if (this.columns[i].label == "绗�4鍒嗙被") {
+ this.columns.splice(i, 1);
+ }
+ }
+ for (var i = 0; i < this.columns.length; i++) {
+ if (this.columns[i].label == "绗�5鍒嗙被") {
+ this.columns.splice(i, 1);
+ }
+ }
+ for (var i = 0; i < this.editColumns.length; i++) {
+ if (this.editColumns[i].label == "绗�3鍒嗙被") {
+ this.editColumns.splice(i, 1);
+ }
+ }
+ for (var i = 0; i < this.editColumns.length; i++) {
+ if (this.editColumns[i].label == "绗�4鍒嗙被") {
+ this.editColumns.splice(i, 1);
+ }
+ }
+ for (var i = 0; i < this.editColumns.length; i++) {
+ if (this.editColumns[i].label == "绗�5鍒嗙被") {
+ this.editColumns.splice(i, 1);
+ }
+ }
+ }
+ //濡傛灉EditAble==false锛屽垹闄� 鍑鸿揣閲戦(鍏�) 鏈夋晥鏈熷唴搴撳瓨(鐩�) 鏈夋晥鏈熷唴搴撳瓨(涓�) 3鍒� 灞曠ず 杩樻病鍙戠エ鏁伴噺 杩斿搧鏁伴噺 宸插彂绁ㄦ暟閲�
+ //type : "number",
+ // typeAttributes:{
+ // minimumFractionDigits:2,
+ // },
+ if (!this.EditAble) {
+ let object1 = {
+ label: this.InvoiceProNotLabel,
+ fieldName: "InvoiceProNot_count__c",
+ type: "number",
+ initialWidth: 120,
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ hideDefaultActions: true,
+ };
+ let object2 = {
+ label: this.RrturnProLabel,
+ fieldName: "RrturnPro_count__c",
+ initialWidth: 100,
+ cellAttributes: { alignment: "right" },
+ hideDefaultActions: true,
+ };
+ let object3 = {
+ label: this.InvoicedLabel,
+ fieldName: "Invoiced_Procount__c",
+ initialWidth: 100,
+ type: "number",
+ typeAttributes: {
+ minimumFractionDigits: 2,
+ },
+ hideDefaultActions: true,
+ };
+ this.editColumns.push(object1);
+ this.editColumns.push(object2);
+ this.editColumns.push(object3);
+ } else {
+ this.ForCustomerText = this.cocLwc.Order_ForCustomerText__c;
+ console.log('EditAble = true this.ForCustomerText = ' + this.ForCustomerText);
+ this.summonsForDirction = this.cocLwc.SummonsForDirction__c;
+ console.log('EditAble = true this.summonsForDirction = ' + this.summonsForDirction);
+ let value = this.summonsForDirction;
+ switch (value) {
+ case "鐩存帴閿�鍞粰鍖婚櫌":
+ this.isDisabledHospitalName = false;
+ this.isDisabledForCustomerText = false;
+ this.secondaryDistributor = "";
+ this.ForDealerText = "";
+ this.accountValue = "";
+ this.isDisabledForDealerText = true;
+ this.isDisabledSecondaryDistributor = true;
+ break;
+ case "鍖婚櫌璇曠敤":
+ this.isDisabledHospitalName = false;
+ this.isDisabledForCustomerText = false;
+ this.isDisabledForDealerText = false;
+ this.isDisabledSecondaryDistributor = false;
+ this.isMutualTransferGoods = false;
+ break;
+ case "閿�鍞粰浜岀骇缁忛攢鍟�":
+ this.isDisabledHospitalName = false;
+ this.isDisabledForCustomerText = false;
+ this.isDisabledForDealerText = false;
+ this.isDisabledSecondaryDistributor = false;
+ this.isMutualTransferGoods = false;
+ break;
+ case "浜掔浉璋冭揣":
+ this.isDisabledHospitalName = true;
+ this.HospitalName = "";
+ this.OECId = "";
+ this.isDisabledForCustomerText = true;
+ this.ForCustomerText = "";
+ this.cocLwc["Order_ForCustomerText__c"] = "";
+ this.isDisabledForDealerText = false;
+ this.isDisabledSecondaryDistributor = false;
+ this.isMutualTransferGoods = true;
+ break;
+ default:
+ this.isDisabledHospitalName = false;
+ this.isDisabledForCustomerText = false;
+ this.isDisabledForDealerText = false;
+ this.isDisabledSecondaryDistributor = false;
+ }
+ }
+
+ //濡傛灉hasHosPro = true 鍖婚櫌鐗逛环
+ if (this.hasHosPro) {
+ let object1 = {
+ label: "鍖婚櫌鐗逛环",
+ fieldName: "hospitalSpecialOffer",
+ type: 'boolean',
+ initialWidth: 100,
+ hideDefaultActions: true,
+ };
+ this.columns.push(object1);
+ this.editColumns.push(object1);
+ }
+ //鍑哄簱鍗曚俊鎭�
+ this.isSummonsFlag = r.entity.SummonsFlag == "visible" ? true : false;
+ console.log("r.entity.provinceOptsMap = " + r.entity.provinceOptsMap);
+ for (var key in r.entity.provinceOptsMap) {
+ let object = {};
+ object["label"] = r.entity.provinceOptsMap[key];
+ object["value"] = key;
+ this.secondaryDistributorOptions.push(object);
+ }
+ for (var key in r.entity.outOutPatternOptionMap) {
+ let object = {};
+ object["label"] = r.entity.outOutPatternOptionMap[key];
+ object["value"] = key;
+ this.outOutPatternOptionList.push(object);
+ }
+ console.log(
+ "this.secondaryDistributorOptions = " +
+ JSON.stringify(this.secondaryDistributorOptions)
+ );
+ this.HospitalName = r.entity.HospitalName;
+ this.sumPrice = r.entity.sumPrice.toFixed(2) + "鍏�";
+ this.isShowSpinner = false;
+ this.showTable = true;
+ console.log("ESetid = " + this.ESetid);
+ } else {
+ console.log("r = " + JSON.stringify(r));
+ this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ this.showMyToast('閿欒', '鍒濆鍖栧け璐�', 'Error');
+ });
+ }
+
+ ChangeDirction(event) {
+ let value = event.target.value;
+ this.summonsForDirction = value;
+ this.cocLwc["SummonsForDirction__c"] = value;
+ console.log("閫夋嫨浜� = " + value);
+ switch (value) {
+ case "鐩存帴閿�鍞粰鍖婚櫌":
+ this.isDisabledHospitalName = false;
+ this.isDisabledForCustomerText = false;
+ this.secondaryDistributor = "";
+ this.ForDealerText = "";
+ this.isDisabledForDealerText = true;
+ this.isDisabledSecondaryDistributor = true;
+ this.isMutualTransferGoods = false;
+ break;
+ case "鍖婚櫌璇曠敤":
+ this.isDisabledHospitalName = false;
+ this.isDisabledForCustomerText = false;
+ this.isDisabledForDealerText = false;
+ this.isDisabledSecondaryDistributor = false;
+ this.isMutualTransferGoods = false;
+ break;
+ case "閿�鍞粰浜岀骇缁忛攢鍟�":
+ this.isDisabledHospitalName = false;
+ this.isDisabledForCustomerText = false;
+ this.isDisabledForDealerText = false;
+ this.isDisabledSecondaryDistributor = false;
+ this.isMutualTransferGoods = false;
+ break;
+ case "浜掔浉璋冭揣":
+ this.isDisabledHospitalName = true;
+ this.HospitalName = "";
+ this.OECId = "";
+ this.isDisabledForCustomerText = true;
+ this.ForCustomerText = "";
+ this.cocLwc["Order_ForCustomerText__c"] = "";
+ this.isDisabledForDealerText = false;
+ this.isDisabledSecondaryDistributor = false;
+ this.isMutualTransferGoods = true;
+ break;
+ default:
+ this.isDisabledHospitalName = false;
+ this.isDisabledForCustomerText = false;
+ this.isDisabledForDealerText = false;
+ this.isDisabledSecondaryDistributor = false;
+ this.isMutualTransferGoods = false;
+ }
+ }
+
+ dataChange(event) {
+ let fieldName = event.target.getAttribute("data-field");
+ let value = event.detail.value;
+ console.log("fieldName = " + fieldName + " value = " + value);
+ switch (fieldName) {
+ case "summonsForDirction":
+ this.summonsForDirction = value;
+ break;
+ case "secondaryDistributor":
+ this.secondaryDistributor = value;
+ break;
+ case "HospitalName":
+ this.HospitalName = value;
+ break;
+ case "outOutPattern":
+ this.outOutPattern = value;
+ break;
+ case "ForDealerText":
+ this.ForDealerText = value;
+ this.cocLwc["Order_ForDealerText__c"] = value;
+ break;
+ case "ForCustomerText":
+ this.cocLwc["Order_ForCustomerText__c"] = value;
+ this.ForCustomerText = value;
+ break;
+ case "sumPrice":
+ this.sumPrice = value.toFixed(2);
+ break;
+ case "NoConfirmedPrice":
+ this.NoConfirmedPrice = !this.NoConfirmedPrice;
+ this.cocLwc["NoConfirmedPrice__c"] = this.NoConfirmedPrice;
+ console.log("this.NoConfirmedPrice = " + this.NoConfirmedPrice);
+ break;
+ case "consumableName":
+ this.consumableName = value;
+ break;
+ case "Category3":
+ this.Category3 = value;
+ //璋冪敤鍚庡彴鏄剧ず绗洓浜斿垎绫�
+ this.showAllCate();
+ if (this.Category3 == '') {
+ this.Category4 = '';
+ this.Category5 = '';
+ }
+ break;
+ case "Category4":
+ this.Category4 = value;
+ //璋冪敤鍚庡彴鏄剧ず绗簲鍒嗙被
+ this.showCate();
+ if (this.Category4 == '') {
+ this.Category5 = '';
+ }
+ break;
+ case "Category5":
+ this.Category5 = value;
+ break;
+ case "searchHospitalName":
+ this.searchHospitalName = value;
+ break;
+ case "Barcode":
+ this.Barcode = value;
+ break;
+ case "Order_ForDealerText__c":
+ this.cocLwc["Order_ForDealerText__c"] = value;
+ break;
+ }
+ }
+
+ showAllCate() {
+ console.log('showAllCate')
+ categoryAllload({
+ category3Lwc: this.Category3
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.category4Options = [];
+ this.category5Options = [];
+ //绗�4鍒嗙被
+ for (var key in r.entity.category4OptionMap) {
+ let object = {};
+ object["label"] = r.entity.category4OptionMap[key];
+ object["value"] = key;
+ this.category4Options.push(object);
+ }
+ console.log("this.category4Options = " + this.category4Options);
+ //绗�5鍒嗙被
+ for (var key in r.entity.category5OptionMap) {
+ let object = {};
+ object["label"] = r.entity.category5OptionMap[key];
+ object["value"] = key;
+ this.category5Options.push(object);
+ }
+ } else {
+ console.log("r = " + JSON.stringify(r));
+ this.showMyToast('4/5鍒嗙被鏌ヨ澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error" + JSON.stringify(error));
+ });
+ }
+
+ showCate() {
+ console.log('showAllCate')
+ categoryload({
+ category3Lwc: this.Category3,
+ category4Lwc: this.Category4
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.category4Options = [];
+ this.category5Options = [];
+ //绗�4鍒嗙被
+ for (var key in r.entity.category4OptionMap) {
+ let object = {};
+ object["label"] = r.entity.category4OptionMap[key];
+ object["value"] = key;
+ this.category4Options.push(object);
+ }
+ console.log("this.category4Options = " + this.category4Options);
+ //绗�5鍒嗙被
+ for (var key in r.entity.category5OptionMap) {
+ let object = {};
+ object["label"] = r.entity.category5OptionMap[key];
+ object["value"] = key;
+ this.category5Options.push(object);
+ }
+ } else {
+ console.log("r = " + JSON.stringify(r));
+ this.showMyToast('Error', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error" + JSON.stringify(error));
+ });
+ }
+
+ invoiceChange(event) {
+ this.invoiceId = event.target.value;
+ console.log('this.invoiceId = ' + this.invoiceId);
+ }
+
+ showMyToast(title, message, variant) {
+ this.isShowSpinner = false;
+ this.showLoadingSpinner = false;
+ this.isEditShowSpinner = false;
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if (variant.toLowerCase() == 'success') {
+ iconName = 'utility:check';
+ } else {
+ iconName = 'utility:error';
+ }
+ if (message != '') {
+ content = '<h2><strong>' + title + '<strong/></h2><h5>' + message + '</h5>';
+ } else {
+ content = '<h2><strong>' + title + '<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').showToast(variant, content, iconName, 10000);
+ }
+
+ searchProductJs() {
+ this.isEditShowSpinner = true;
+ //this.showTable = false;
+ //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+ const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+ console.log('selectedRows = ' + selectedRows);
+ for (var i in this.data) {
+ this.data[i]["check"] = false;
+ }
+ for (var i in this.data) {
+ for (var j in selectedRows) {
+ if (this.data[i].Id == selectedRows[j].Id) {
+ this.data[i]["check"] = true;
+ }
+ }
+ }
+
+ let cloneData = this.data;
+ for (var i in cloneData) {
+ cloneData[i]["Name"] = cloneData[i].Name__c;
+ cloneData[i]["Category3"] = cloneData[i].Category3__c;
+ cloneData[i]["Category4"] = cloneData[i].Category4__c;
+ cloneData[i]["Category5"] = cloneData[i].Category5__c;
+ cloneData[i]["BoxPiece"] = cloneData[i].Box_Piece__c;
+ delete cloneData[i].Name__c;
+ delete cloneData[i].Category3__c;
+ delete cloneData[i].Category4__c;
+ delete cloneData[i].Category5__c;
+ delete cloneData[i].Box_Piece__c;
+ }
+
+ console.log("cloneData = " + JSON.stringify(cloneData));
+ searchConsumableorderdetails({
+ agencyProTypeLwc: this.agencyProType,
+ accountNameLwc: this.accountName,
+ userWorkLocationLwc: this.userWorkLocation,
+ outOutPattern: this.outOutPattern,
+ category1: this.consumableName,
+ category3: this.Category3,
+ category4: this.Category4,
+ category5: this.Category5,
+ editAbleLwc: this.EditAble,
+ pageRecordsLwcLwc: cloneData,
+ consumableproductdetailsRecordsLwc: this.consumableproductdetailsRecords,
+ arriveorderLwc: this.arriveorder,
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+
+ //鍒嗛〉
+ console.log('r.entity.paginatedAccounts = ' + JSON.stringify(r.entity.paginatedAccounts));
+ this.nextPageToken = r.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords = r.entity.paginatedAccounts.totalRecords;
+ this.recordStart = r.entity.paginatedAccounts.recordStart;
+ this.recordEnd = r.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(r.entity.paginatedAccounts.totalRecords / this.pageSize);
+ console.log('this.totalPages = ' + this.totalPages);
+
+
+ this.SearchDone = r.entity.SearchDone;
+ let tempData = [];
+ this.selectedRows = [];
+ tempData = r.entity.pageRecords;
+ for (var i in tempData) {
+ let unitOptions = [];
+ for (var key in tempData[i].boxorpieceMap) {
+ let unitOption = {};
+ unitOption["label"] = tempData[i].boxorpieceMap[key];
+ unitOption["value"] = key;
+ unitOptions.push(unitOption);
+ }
+ tempData[i]["unitOptions"] = unitOptions;
+ tempData[i]["unitValue"] = tempData[i]["unitValue"] == null ? unitOptions[0].value : tempData[i]["unitValue"];
+ if (this.EditAble) {
+ tempData[i].orderdetails1["Box_Piece__c"] = tempData[i].orderdetails1["Box_Piece__c"] == null ? unitOptions[0].value : tempData[i].orderdetails1["Box_Piece__c"];
+ tempData[i]["unitValue"] = tempData[i].orderdetails1["Box_Piece__c"] == null ? unitOptions[0].value : tempData[i].orderdetails1["Box_Piece__c"];
+ tempData[i].orderdetails1["Shipment_Count__c"] = tempData[i].orderdetails1["Shipment_Count__c"] == null ? 0 : tempData[i].orderdetails1["Shipment_Count__c"];
+ tempData[i].orderdetails1["Delivery_List_RMB__c"] = tempData[i].orderdetails1["Delivery_List_RMB__c"] == null ? 0.0 : tempData[i].orderdetails1["Delivery_List_RMB__c"];
+ } else {
+ tempData[i]["InvoiceProNot_count__c"] =
+ tempData[i].orderdetails1.InvoiceProNot_count__c;
+ tempData[i]["RrturnPro_count__c"] =
+ tempData[i].orderdetails1.RrturnPro_count__c;
+ tempData[i]["Invoiced_Procount__c"] =
+ tempData[i].orderdetails1.Invoiced_Procount__c;
+ }
+ tempData[i]["shipmentNumber"] = tempData[i].orderdetails1["Shipment_Count__c"];
+ tempData[i]["shippingUnitPrice"] = tempData[i].orderdetails1["Delivery_List_RMB__c"];
+
+
+ console.log('tempData[i]["hospitalSpecialOffer"] = ' + tempData[i]["hospitalSpecialOffer"])
+ if (tempData[i]["hospitalSpecialOffer"]) {
+ tempData[i]["Id"] = tempData[i].Prod.Id + 'ishos';
+ } else {
+ tempData[i]["Id"] = tempData[i].Prod.Id + 'nothos';
+ }
+ tempData[i]["recordId"] = tempData[i]["Id"];
+ tempData[i]["Name__c"] = tempData[i].Prod.Name__c;
+ tempData[i]["SFDA_Status__c"] = tempData[i].Prod.SFDA_Status__c;
+ tempData[i]["Category3__c"] = tempData[i].Prod.Category3__c;
+ tempData[i]["Category4__c"] = tempData[i].Prod.Category4__c;
+ tempData[i]["Category5__c"] = tempData[i].Prod.Category5__c;
+ tempData[i]["Box_Piece__c"] = tempData[i].orderdetails1.Box_Piece__c;
+ tempData[i]["shipmentAmount"] = tempData[i].orderdetails1.Shipment_amount__c;
+ tempData[i]["Shipment_amount__c"] = tempData[i].orderdetails1.Shipment_amount__c;
+ tempData[i]["Shipment_Count__c"] = tempData[i].orderdetails1.Shipment_Count__c;
+
+ if (tempData[i]["shippingUnitPrice"] && tempData[i]["shipmentNumber"])
+ tempData[i]["shipmentAmount"] = this.amend(
+ tempData[i]["shipmentNumber"],
+ tempData[i]["shippingUnitPrice"],
+ "*"
+ );
+
+ if (tempData[i]['check']) {
+ this.selectedRows.push(tempData[i].Id);
+ }
+
+ }
+ this.data = tempData;
+ console.log("this.data = " + JSON.stringify(this.data));
+ console.log(" this.selectedRows = " + JSON.stringify(this.selectedRows));
+ //this.showTable = true;
+ this.isEditShowSpinner = false;
+ } else {
+ console.log("r = " + JSON.stringify(r));
+ this.showMyToast('鏌ヨ澶辫触', r.msg, 'Error');
+ }
+ });
+ }
+
+ searchHospitalNameModal() {
+ console.log("searchHospitalNameModal");
+ hospitalInit({
+ ctype: this.agencyProType,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ if (r.status == "Success") {
+ this.hospitalList = r.entity.at;
+ for (var i in this.hospitalList) {
+ this.hospitalList[i]["stateMasterName"] =
+ this.hospitalList[i].State_Master__r.Name;
+ }
+ console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
+ this.isModalOpen = true;
+ }
+ });
+ }
+
+ searchHospital() {
+ console.log("this.searchHospitalName = " + this.searchHospitalName);
+ serContact({
+ searchName: this.searchHospitalName,
+ ctype: this.agencyProType,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ if (r.status == "Success") {
+ this.hospitalList = r.entity.at;
+ for (var i in this.hospitalList) {
+ this.hospitalList[i]["stateMasterName"] =
+ this.hospitalList[i].State_Master__r.Name;
+ }
+ console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
+ }
+ });
+ }
+
+ searchHandleRowAction(event) {
+ console.log("searchHandleRowAction");
+ let row = event.detail.row;
+ this.OECId = row.Id;
+ this.HospitalName = row.Name;
+ console.log(
+ "this.OECId = " + this.OECId + " this.HospitalName = " + this.HospitalName
+ );
+ this.isModalOpen = false;
+ console.log("this.isModalOpen = " + this.isModalOpen);
+ }
+
+ clearAgencyI(event) {
+ this.HospitalName = event.target.value;
+ if (this.HospitalName == "" || this.HospitalName == null) {
+ this.OECId = "";
+ }
+ console.log("this.HospitalName = " + this.HospitalName);
+ console.log("this.OECId = " + this.OECId);
+ if (this.OECId != null && this.OECId != "") {
+ this.checkOutPattern();
+ }
+ }
+
+ checkOutPattern() {
+ //鏍规嵁鐢ㄦ埛閫変腑鐨勪骇鍝佺粰 鍑哄簱鍗曚笂鐨勬槸鍚﹀尰闄㈢壒浠峰嚭搴撳瓧娈佃祴鍊�
+ let ishos = 0;
+ for (var i in this.data) {
+ if (
+ this.data[i].check == true &&
+ this.data[i].hospitalSpecialOffer == true
+ ) {
+ ishos = ishos + 1;
+ }
+ }
+ if (ishos > 0) {
+ this.cocLwc["OutPattern__c"] = true;
+ } else {
+ this.cocLwc["OutPattern__c"] = false;
+ }
+ }
+
+ closeModal() {
+ this.isModalOpen = false;
+ }
+
+ handleUnitChange(event) {
+ console.log("handleUnitChange");
+ const unitDetail = event.detail;
+ console.log("unitDetail = " + JSON.stringify(unitDetail));
+ for (var i in this.data) {
+ if (this.data[i].Id == unitDetail.data.recordId) {
+ this.data[i].unitValue = unitDetail.data.unitValue;
+ this.data[i].orderdetails1["Box_Piece__c"] = unitDetail.data.unitValue;
+ }
+ }
+ console.log("this.data = " + JSON.stringify(this.data));
+ }
+
+ handleShipmentNumber(event) {
+ console.log("handleShipmentNumber");
+ const numberDetail = event.detail;
+ console.log("numberDetail = " + JSON.stringify(numberDetail));
+ let index = 0;
+ for (var i in this.data) {
+ if (this.data[i].Id == numberDetail.data.recordId) {
+ index = i;
+ this.data[i].shipmentNumber = Number(numberDetail.data.shipmentnumber);
+ this.data[i].orderdetails1["Shipment_Count__c"] = Number(
+ numberDetail.data.shipmentnumber
+ );
+ console.log('this.data[i].orderdetails1["Shipment_Count__c"] = ' + this.data[i].orderdetails1["Shipment_Count__c"]);
+ console.log('this.selectedRows.indexOf(this.data[i].Id) = ' + this.selectedRows.indexOf(this.data[i].Id));
+ if (this.data[i].orderdetails1["Shipment_Count__c"] != '') {
+ if (this.selectedRows.indexOf(this.data[i].Id) == -1) {
+ this.selectedRows.push(this.data[i].Id);
+ }
+ this.data[i].check = true;
+ } else {
+ if (this.selectedRows.indexOf(this.data[i].Id) != -1) {
+ this.selectedRows.splice(this.selectedRows.indexOf(this.data[i].Id), 1);
+ }
+ this.data[i].check = false;
+ }
+ this.selectedRows = [...this.selectedRows];
+ console.log('this.selectedRows = ' + JSON.stringify(this.selectedRows));
+ }
+ }
+ this.ComputePrice(
+ index,
+ this.data[index].shipmentNumber,
+ this.data[index].shippingUnitPrice
+ );
+ }
+
+ handleShipmentUnitPrice(event) {
+ console.log("handleShipmentUnitPrice");
+ const priceDetail = event.detail;
+ let index = 0;
+ for (var i in this.data) {
+ if (this.data[i].Id == priceDetail.data.recordId) {
+ index = i;
+ this.data[i].shippingUnitPrice = Number(
+ priceDetail.data.shipmentunitprice
+ );
+ this.data[i].orderdetails1["Delivery_List_RMB__c"] = Number(
+ priceDetail.data.shipmentunitprice
+ );
+ }
+ }
+ this.ComputePrice(
+ index,
+ this.data[index].shipmentNumber,
+ this.data[index].shippingUnitPrice
+ );
+ }
+
+ ComputePrice(index, number, price) {
+ console.log("index = " + index);
+ console.log("number = " + number);
+ console.log("price = " + price);
+ let shipmentAmount = this.amend(number, price, "*");
+ console.log("shipmentAmount = " + shipmentAmount);
+ let sumPrice = 0.0;
+ this.data[index].shipmentAmount = shipmentAmount;
+ for (var i in this.data) {
+ if (this.data[i].shipmentAmount) sumPrice += this.data[i].shipmentAmount;
+ }
+ this.sumPrice = sumPrice.toFixed(2) + "鍏�";
+ //瀛樹笅閫夋嫨琛岋紝涓嶄細琚竻绌�
+ // if (this.selectedRows.indexOf(this.data[index].Id) == -1)
+ // this.selectedRows.push(this.data[index].Id);
+ // this.selectedRows = [];
+ // for (var i in this.data) {
+ // if (this.data[i].check) {
+ // this.selectedRows.push(this.data[i].Id);
+ // }
+ // }
+ this.data = [...this.data];
+ // this.selectedRows = [...this.selectedRows]
+ // console.log("this.selectedRows = " + JSON.stringify(this.selectedRows));
+ console.log("this.data = " + JSON.stringify(this.data));
+ }
+
+ //num1 num2浼犲叆涓や釜鍊� symbol +-*/绗﹀彿
+ amend(num1, num2, symbol) {
+ var str1 = num1.toString(),
+ str2 = num2.toString(),
+ result,
+ str1Length,
+ str2Length;
+ //瑙e喅鏁存暟娌℃湁灏忔暟鐐规柟娉�
+ try {
+ str1Length = str1.split(".")[1].length;
+ } catch (error) {
+ str1Length = 0;
+ }
+ try {
+ str2Length = str2.split(".")[1].length;
+ } catch (error) {
+ str2Length = 0;
+ }
+ var step = Math.pow(10, Math.max(str1Length, str2Length));
+ //
+ console.log(step);
+ switch (symbol) {
+ case "+":
+ result = (num1 * step + num2 * step) / step;
+ break;
+ case "-":
+ result = (num1 * step - num2 * step) / step;
+ break;
+ case "*":
+ result = (num1 * step * (num2 * step)) / step / step;
+ break;
+ case "/":
+ result = (num1 * step) / (num2 * step);
+ break;
+ default:
+ break;
+ }
+ return result;
+ }
+
+ getSelectedRows(event) {
+ let selectedRowsEvent = event.detail.selectedRows;
+ console.log('selectedRowsEvent = ' + JSON.stringify(selectedRowsEvent))
+ this.selectedRows = [];
+ for (var i in selectedRowsEvent) {
+ this.selectedRows.push(selectedRowsEvent[i].Id)
+ }
+ // for (var i in this.data) {
+ // for (var j in selectedRowsEvent) {
+ // if (this.data[i].Id == selectedRowsEvent[j].Prod.Id) {
+ // this.ComputePrice(
+ // i,
+ // this.data[i].shipmentNumber,
+ // this.data[i].shippingUnitPrice
+ // );
+ // }
+ // }
+ // }
+ // this.ComputePrice(
+ // index,
+ // this.data[index].shipmentNumber,
+ // this.data[index].shippingUnitPrice
+ // );
+ // const selectedRows = event.detail.selectedRows;
+ // console.log("this.selectedRows = " + this.selectedRows);
+ // for (var i in this.data) {
+ // this.data[i]["check"] = false;
+ // }
+ // for (var i in this.data) {
+ // for (var j in selectedRows) {
+ // if (this.data[i].Id == selectedRows[j].Id) {
+ // this.data[i]["check"] = true;
+ // }
+ // }
+ // }
+ }
+
+ saveConfirmJs() {
+ let msg = "鍑哄簱浠锋牸浠呭彲鎿嶄綔涓�娆″彉鏇达紝淇濆瓨鍚庡皢鏃犳硶淇敼銆俓n\n璇风‘璁わ紒";
+ if (this.SummonsStatus == "浠锋牸鏈畾") {
+ if (confirm(msg) == true) {
+ this.saveConfirm();
+ }
+ } else {
+ this.saveConfirm();
+ }
+ }
+
+ saveConfirm() {
+ this.isShowSpinner = true;
+
+ //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+ const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+ console.log('selectedRows = ' + selectedRows);
+ for (var i in this.data) {
+ this.data[i]["check"] = false;
+ }
+ for (var i in this.data) {
+ for (var j in selectedRows) {
+ if (this.data[i].Id == selectedRows[j].Id) {
+ this.data[i]["check"] = true;
+ }
+ }
+ }
+
+ let cloneData = this.data;
+ for (var i in cloneData) {
+ cloneData[i]["Name"] = cloneData[i].Name__c;
+ cloneData[i]["Category3"] = cloneData[i].Category3__c;
+ cloneData[i]["Category4"] = cloneData[i].Category4__c;
+ cloneData[i]["Category5"] = cloneData[i].Category5__c;
+ cloneData[i]["BoxPiece"] = cloneData[i].Box_Piece__c;
+ delete cloneData[i].Name__c;
+ delete cloneData[i].Category3__c;
+ delete cloneData[i].Category4__c;
+ delete cloneData[i].Category5__c;
+ delete cloneData[i].Box_Piece__c;
+ }
+ console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
+ console.log("this.OECId = " + this.OECId);
+ console.log("this.HospitalName = " + this.HospitalName);
+ console.log("this.secondaryDistributor = " + this.secondaryDistributor);
+ console.log("this.pageRecordsLwc = " + JSON.stringify(cloneData));
+ console.log("this.accountid = " + this.accountid);
+ console.log("this.ESetid = " + this.ESetid);
+ console.log(
+ "this.consumableproductdetailsRecords = " +
+ JSON.stringify(this.consumableproductdetailsRecords)
+ );
+ save({
+ cocLwc: this.cocLwc,
+ hospitalInfoLwc: this.OECId,
+ hospitalNameLwc: this.HospitalName,
+ secondaryDistributorLwc: this.secondaryDistributor,
+ pageRecordsLwc: cloneData,
+ accountidLwc: this.accountid,
+ ESetIdLwc: this.ESetid,
+ consumableproductdetailsRecordsLwc: this.consumableproductdetailsRecords,
+ agencyProTypeLwc: this.agencyProType,
+ userWorkLocationLwc: this.userWorkLocation
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ debugger
+ if (r.status == "Success") {
+ // let url = "/lexsummonscreat?ESetid=" + r.entity.ESetId;
+ // this[NavigationMixin.Navigate]({
+ // type: "standard__webPage",
+ // attributes: {
+ // url: url,
+ // },
+ // });
+ window.location.href = "/s/lexsummonscreat?ESetid=" + r.entity.ESetId;
+ } else {
+ console.log("r.msg = " + r.msg);
+ this.showMyToast('淇濆瓨澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ });
+ }
+
+ //鎵撳嵃鎸囩ず鍗�
+ PraseToPDFJs() {
+ console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
+ console.log("this.ESetId = " + this.ESetid);
+ PraseToPDF({
+ cocLwc: this.cocLwc,
+ ESetId: this.ESetid,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ window.open("/customer/summonsPDF?ESetid=" + r.entity.ESetId);
+ } else {
+ console.log("r.msg = " + r.msg);
+ this.showMyToast('鎵撳嵃澶辫触', r.msg, 'Error');
+ }
+ });
+ }
+
+ //鏄剧ず鏄庣粏
+ openReportJs() {
+ console.log("openReportJs");
+ var reportId = this.ESetid;
+ reportId = reportId.substring(0, 15);
+ let reportFilters = '[{"operator":"equals","value":"' + reportId + '","column":"FK_CUSTENT_ID"}]';
+ let reportUrl = this.label.ConsumableOutboundReportId;
+ console.log("reportUrl = " + reportUrl);
+ let url = "/report/" + reportUrl + "?reportFilters=" + encodeURIComponent(reportFilters);
+ console.log("url = " + url);
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ }
+
+ vpClear2Delay(event) {
+ console.log("vpClear2Delay");
+ if (this.summonsForDirction != "浜掔浉璋冭揣") {
+ this.cocLwc["Order_ForDealerText__c"] = event.target.value;
+ console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
+ } else {
+ //console.log('Order_ForDealerTextID__c = ' + this.cocLwc['Order_ForDealerTextID__c'])
+ this.cocLwc["Order_ForDealerText__c"] =
+ this.cocLwc["Order_ForDealerTextID__c"] == "" ||
+ this.cocLwc["Order_ForDealerTextID__c"] == null ||
+ this.cocLwc["Order_ForDealerTextID__c"] == undefined
+ ? ""
+ : this.cocLwc["Order_ForDealerText__c"];
+ console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
+ // console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc));
+ // this.ForDealerText = this.cocLwc['Order_ForDealerText__c'];
+ // event.target.value = this.cocLwc['Order_ForDealerText__c'];
+ // console.log('this.ForDealerText = ' + this.ForDealerText);
+ }
+ }
+ handleSearch(event) {
+ const lookupElement = event.target;
+ console.log("event.detail = " + JSON.stringify(event.detail));
+ apexSearch({
+ searchTerm: event.detail.searchTerm,
+ }).then((results) => {
+ lookupElement.setSearchResults(results);
+ }).catch((error) => {
+ console.log("error" + JSON.stringify(error));
+ });
+ }
+
+ handleSelectionChange(event) {
+ const selection = event.target.getSelection();
+ console.log("selection = " + JSON.stringify(selection));
+ this.cocLwc["Order_ForDealerTextID__c"] = selection[0].id;
+ this.cocLwc["Order_ForDealerText__c"] = selection[0].title;
+ console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
+ }
+
+ handleFilesChange(event) {
+ console.log("handleFilesChange");
+ if (event.target.files.length > 0) {
+ this.filesUploaded = event.target.files;
+ this.fileName = event.target.files[0].name;
+ }
+ }
+
+ handleSave() {
+ console.log("saveFile");
+ if (this.filesUploaded.length > 0) {
+ this.file = this.filesUploaded[0];
+ if (this.file.size > this.MAX_FILE_SIZE) {
+ this.showMyToast('淇濆瓨澶辫触', '鏂囦欢杩囧ぇ', 'Error');
+ return;
+ }
+ this.showPopSpinner = true;
+ this.fileReader = new FileReader();
+
+ this.fileReader.onloadend = () => {
+ this.fileContents = this.fileReader.result;
+ let base64 = "base64,";
+ this.content = this.fileContents.indexOf(base64) + base64.length;
+ this.fileContents = this.fileContents.substring(this.content);
+ this.saveToFile();
+ };
+ this.fileReader.readAsDataURL(this.file);
+ } else {
+ this.fileName = "閫夋嫨涓�涓枃浠朵笂浼�";
+ }
+ }
+
+ saveToFile() {
+ console.log("saveToFile");
+ console.log("base64Data = " + encodeURIComponent(this.fileContents));
+ saveFile({
+ recordId: this.ESetid,
+ fileName: this.fileName,
+ base64Data: encodeURIComponent(this.fileContents),
+ }).then((r) => {
+ this.showPopSpinner = false;
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ this.closePop();
+ this.showMyToast('鎴愬姛', '涓婁紶鎴愬姛', 'Success');
+ this.getFiles();
+ }).catch((error) => {
+ this.showPopSpinner = false;
+ console.log("error = " + error.message);
+ this.showMyToast('澶辫触', '涓婁紶澶辫触', 'Error');
+ });
+ }
+
+ getFiles() {
+ console.log("getFiles");
+ this.showLoadingSpinner = true;
+ getFiles({
+ recordId: this.ESetid,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ this.fileData = r.entity.cvList;
+ console.log("this.fileData = " + JSON.stringify(this.fileData));
+ for (var i in this.fileData) {
+ this.fileData[i]["Id"] = this.fileData[i].Id;
+ this.fileData[i]["recordId"] = this.fileData[i].Id;
+ this.fileData[i]["url"] = "/" + this.fileData[i].Id;
+ this.fileData[i]["Title"] = this.fileData[i].Title;
+ this.fileData[i]["attUrl"] = '/' + this.fileData[i].Id;
+ this.fileData[i]['downloadUrl'] = '/sfc/servlet.shepherd/document/download/' + this.fileData[i].ContentDocumentId + '?operationContext=S1';
+ }
+ console.log("this.fileData = " + this.fileData);
+ this.showLoadingSpinner = false;
+ }).catch((error) => {
+ console.log("error = " + error.message);
+ this.showMyToast('澶辫触', '鑾峰彇闄勪欢澶辫触', 'Error');
+ });
+ }
+
+ GoodsDeliveryJs() {
+ this.isShowSpinner = true;
+
+ //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+ const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+ console.log('selectedRows = ' + selectedRows);
+ for (var i in this.data) {
+ this.data[i]["check"] = false;
+ }
+ for (var i in this.data) {
+ for (var j in selectedRows) {
+ if (this.data[i].Id == selectedRows[j].Id) {
+ this.data[i]["check"] = true;
+ }
+ }
+ }
+
+ let cloneData = this.data;
+ for (var i in cloneData) {
+ cloneData[i]["Name"] = cloneData[i].Name__c;
+ cloneData[i]["Category3"] = cloneData[i].Category3__c;
+ cloneData[i]["Category4"] = cloneData[i].Category4__c;
+ cloneData[i]["Category5"] = cloneData[i].Category5__c;
+ cloneData[i]["BoxPiece"] = cloneData[i].Box_Piece__c;
+ delete cloneData[i].Name__c;
+ delete cloneData[i].Category3__c;
+ delete cloneData[i].Category4__c;
+ delete cloneData[i].Category5__c;
+ delete cloneData[i].Box_Piece__c;
+ }
+ console.log("cloneData = " + JSON.stringify(cloneData));
+ GoodsDelivery({
+ cocLwc: this.cocLwc,
+ ESetId: this.ESetid,
+ pageRecordsLwcLwc: cloneData,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ console.log(
+ "Summons_Order_type__c = " + this.cocLwc["Summons_Order_type__c"]
+ );
+ this.isSales = this.cocLwc["Summons_Order_type__c"] == "閿�鍞�" ? true : false;
+ this.GoodsDeliveryInit();
+ } else {
+ console.log("r.msg = " + r.msg);
+ this.showMyToast('閿欒', r.msg, 'Error');
+ }
+ this.isShippingSales = true;
+ }).catch((error) => {
+ console.log("error = " + error.message);
+ this.showMyToast('澶辫触', '璺宠浆澶辫触', 'Error');
+ });
+ }
+
+ GoodsDeliveryInit() {
+ console.log("GoodsDeliveryInit");
+ GoodsDeliveryInit({
+ ESetId: this.ESetid,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ this.salesCoc = r.entity.coc;
+ this.salesAccountName = r.entity.accountName;
+ this.salesUserWorkLocation = r.entity.userWorkLocation;
+ this.salesAccountid = r.entity.accountid;
+ this.salesOrderdetails = r.entity.orderdetails;
+ console.log('this.salesOrderdetails = ' + JSON.stringify(this.salesOrderdetails))
+ this.salesData = r.entity.consumableorderdetailsRecords;
+ this.salesErrorData = r.entity.consumableorderdetailsRecordserror;
+ this.salesOrderpieceorboxMap = r.entity.orderpieceorboxMap;
+ this.salesOrderpriceMap = r.entity.orderpriceMap;
+ this.salesOrderagencypriceMap = r.entity.orderagencypriceMap;
+ this.isShowSpinner = false;
+ } else {
+ console.log("r.msg = " + r.msg);
+ this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + error.message);
+ this.showMyToast('閿欒', '鍒濆鍖栧け璐�', 'Error');
+ });
+ }
+
+ SalesearchProductJs() {
+ console.log("this.Barcode = " + this.Barcode);
+ this.isShowSpinner = true;
+ SearchPro({
+ cocLwc: this.salesCoc,
+ barcodeLwc: this.Barcode,
+ accountName: this.salesAccountName,
+ userWorkLocation: this.salesUserWorkLocation,
+ accountid: this.salesAccountid,
+ orderdetails: this.salesOrderdetails,
+ orderpieceorboxMap: this.salesOrderpieceorboxMap,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ console.log("SearchPro success");
+ this.salesErrorData = r.entity.consumableorderdetailsRecordserror;
+ this.salesData = r.entity.consumableorderdetailsRecords;
+ for (var i in this.salesErrorData) {
+ this.salesErrorData[i]["Id"] = this.salesErrorData[i].orderdetails2.Id;
+ this.salesErrorData[i]["Consumable_order_minor__c"] = this.salesErrorData[i].orderdetails2.Consumable_order_minor__r != null ? this.salesErrorData[i].orderdetails2.Consumable_order_minor__r.Name : '';
+ this.salesErrorData[i]["ConsumableorderminorUrl"] = this.salesErrorData[i].orderdetails2.Consumable_order_minor__c != null ? "/" + this.salesErrorData[i].orderdetails2.Consumable_order_minor__c : '';
+ this.salesErrorData[i]["orderdetails2Name"] = this.salesErrorData[i].orderdetails2.Name;
+ this.salesErrorData[i]["ProdName"] = this.salesErrorData[i].Prod.Name;
+ this.salesErrorData[i]["Box_Piece__c"] = this.salesErrorData[i].orderdetails2.Box_Piece__c;
+ this.salesErrorData[i]["Bar_Code__c"] = this.salesErrorData[i].orderdetails2.Bar_Code__c;
+ this.salesErrorData[i]["Sterilization_limit__c"] = this.salesErrorData[i].orderdetails2.Sterilization_limit__c;
+ }
+ console.log('this.salesData = ' + JSON.stringify(this.salesData));
+ for (var i in this.salesData) {
+ this.salesData[i]["Id"] = this.salesData[i].orderdetails2.Id;
+ this.salesData[i]["Consumable_order_minor__c"] = this.salesData[i].orderdetails2.Consumable_order_minor__r != null ? this.salesData[i].orderdetails2.Consumable_order_minor__r.Name : '';
+ this.salesData[i]["ConsumableorderminorUrl"] = this.salesData[i].orderdetails2.Consumable_order_minor__c != null ? "/" + this.salesData[i].orderdetails2.Consumable_order_minor__c : '';
+ this.salesData[i]["orderdetails2Name"] = this.salesData[i].orderdetails2.Name;
+ this.salesData[i]["orderdetails2NameUrl"] = "/" + this.salesData[i].orderdetails2.Id;
+ this.salesData[i]["Box_Piece__c"] = this.salesData[i].orderdetails2.Box_Piece__c;
+ this.salesData[i]["ProdName"] = this.salesData[i].Prod.Name;
+ this.salesData[i]["Deliver_date__c"] = this.salesData[i].orderdetails2.Deliver_date__c;
+ this.salesData[i]["Bar_Code__c"] = this.salesData[i].orderdetails2.Bar_Code__c;
+ this.salesData[i]["Sterilization_limit__c"] = this.salesData[i].orderdetails2.Sterilization_limit__c;
+ if (this.salesData[i]["Box_Piece__c"] == '鐩�') {
+ console.log('this.salesData[i] = ' + JSON.stringify(this.salesData[i]))
+ this.salesData[i]["outboundCount"] = this.salesData[i].outboundCount;
+ } else {
+ for (var j in this.salesOrderdetails) {
+ console.log('this.salesOrderdetails[j].Consumable_product__c = ' + this.salesOrderdetails[j].Consumable_product__c);
+ console.log('this.salesData[i].orderdetails2.Consumable_product__c = ' + this.salesData[i].orderdetails2.Consumable_product__c);
+ if (this.salesOrderdetails[j].Consumable_product__c == this.salesData[i].orderdetails2.Consumable_product__c) {
+ this.salesData[i]["outboundCount"] = this.salesOrderdetails[j].Shipment_Count__c;
+ }
+ }
+ }
+
+ //salescolomus
+ // console.log('this.salesData[i]["Box_Piece__c"] = ' + this.salesData[i]["Box_Piece__c"])
+ // if (this.salesData[i]["Box_Piece__c"] == '鐩�') {
+ // this.salesData[i]["isDisable"] = true;
+ // this.salesData[i]["count"] = this.salesData[i].outboundCount;
+ // }
+ // if (this.salesData[i]["Box_Piece__c"] == '涓�') {
+ // this.salesData[i]["isDisable"] = false;
+ // }
+ }
+ this.salesColumns = [...this.salesColumns];
+ this.isShowSpinner = false;
+ } else {
+ console.log("r.msg = " + r.msg);
+ this.showMyToast('鑾峰彇澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error.message));
+ });
+ }
+
+ handleOutboundCount(event) {
+ let outboundDetail = event.detail;
+ for (var i in this.salesData) {
+ if (this.salesData[i].Id == outboundDetail.data.recordId) {
+ this.salesData[i]['outboundCount'] = outboundDetail.data.count
+ }
+ }
+ console.log('this.salesData = ' + JSON.stringify(this.salesData))
+ }
+
+ SaveP() {
+ let cloneSalesData = this.salesData;
+ for (var i in cloneSalesData) {
+ delete cloneSalesData[i].Consumable_order_minor__c;
+ delete cloneSalesData[i].ConsumableorderminorUrl;
+ delete cloneSalesData[i].orderdetails2Name;
+ delete cloneSalesData[i].orderdetails2NameUrl;
+ delete cloneSalesData[i].Box_Piece__c;
+ delete cloneSalesData[i].ProdName;
+ delete cloneSalesData[i].Deliver_date__c;
+ delete cloneSalesData[i].Bar_Code__c;
+ delete cloneSalesData[i].Sterilization_limit__c;
+ cloneSalesData[i]["ErrorReason"] = "";
+ }
+ this.isShowSpinner = true;
+ ProSale({
+ ESetIdLwc: this.ESetid,
+ cocLwc: this.salesCoc,
+ barcodeLwc: this.Barcode,
+ accountNameLwc: this.salesAccountName,
+ userWorkLocationLwc: this.salesUserWorkLocation,
+ consumableorderdetailsRecordsLwc: JSON.stringify(cloneSalesData),
+ orderdetailsLwc: this.salesOrderdetails,
+ orderpriceMapLwc: this.salesOrderpriceMap,
+ orderagencypriceMapLwc: this.salesOrderagencypriceMap,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ console.log("ProdElivery success");
+ this.isShowSpinner = false;
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: "/lexsaleanddelivery",
+ },
+ });
+ } else {
+ console.log("r.msg = " + r.msg);
+ this.showMyToast('閿�鍞け璐�', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error.message));
+ this.showMyToast('閿欒', '閿�鍞け璐�', 'Error');
+ });
+ }
+
+ SaveE() {
+ let cloneSalesData = this.salesData;
+ for (var i in cloneSalesData) {
+ delete cloneSalesData[i].Consumable_order_minor__c;
+ delete cloneSalesData[i].orderdetails2Name;
+ delete cloneSalesData[i].orderdetails2NameUrl;
+ delete cloneSalesData[i].Box_Piece__c;
+ delete cloneSalesData[i].ProdName;
+ delete cloneSalesData[i].Deliver_date__c;
+ delete cloneSalesData[i].Bar_Code__c;
+ delete cloneSalesData[i].Sterilization_limit__c;
+ cloneSalesData[i]["ErrorReason"] = "";
+ }
+ this.isShowSpinner = true;
+ ProdElivery({
+ ESetIdLwc: this.ESetid,
+ cocLwc: this.salesCoc,
+ barcodeLwc: this.Barcode,
+ accountNameLwc: this.salesAccountName,
+ userWorkLocationLwc: this.salesUserWorkLocation,
+ consumableorderdetailsRecordsLwc: JSON.stringify(cloneSalesData),
+ orderdetailsLwc: this.salesOrderdetails,
+ orderpriceMapLwc: this.salesOrderpriceMap,
+ orderagencypriceMapLwc: this.salesOrderagencypriceMap,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ console.log("ProdElivery success");
+ this.isShowSpinner = false;
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: "/lexsaleanddelivery",
+ },
+ });
+ } else {
+ console.log("r.msg = " + r.msg);
+ this.showMyToast('鍑鸿揣澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + JSON.stringify(error.message));
+ this.showMyToast('閿欒', '鍑鸿揣澶辫触', 'Error');
+ });
+ }
+
+ //鍙戠エ
+ openToInvoiceJs() {
+ let url = '';
+ console.log('this.invoiceId = ' + this.invoiceId);
+ if (this.invoiceId.length > 0 && this.invoiceId != '000000000000000') {
+ url = "/lexconinvoiceview?deliveryId=" + this.ESetid + "&invoiceId=" + this.invoiceId + "&KeyWords=Redirect";
+ } else {
+ url = "/lexconinvoiceview?deliveryId=" + this.ESetid + "&KeyWords=Redirect";
+ }
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ }
+
+ //鍒犻櫎
+ DeleteConsumable() {
+ this.isShowSpinner = true;
+ DelConsumable({
+ ESetId: this.ESetid,
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ let url = "/lexsaleanddelivery";
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ } else {
+ console.log("r.msg = " + r.msg);
+ this.showMyToast('鍒犻櫎澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ console.log("error = " + error.message);
+ this.showMyToast('閿欒', '鍒犻櫎澶辫触', 'Error');
+ });
+ }
+
+ handleLoad() {
+ console.log('handleLoad')
+ try {
+ const style = document.createElement('style');
+ style.innerText = '.hehe-layoutItem .slds-button__icon {display: none;}';
+ this.template.querySelector('.hideHelpText').appendChild(style);
+ } catch (error) {
+ console.log(error);
+ }
+ }
+
+ handleLoad2() {
+ console.log('handleLoad2')
+ try {
+ const style = document.createElement('style');
+ style.innerText = '.hehe-layoutItem .slds-button__icon {display: none;}';
+ this.template.querySelector('.hideHelpText').appendChild(style);
+
+ const style2 = document.createElement('style');
+ style2.innerText = '.hehe-layoutItem .slds-form-element__label {padding : 0px}';
+ this.template.querySelector('.hideHelpText').appendChild(style2);
+ } catch (error) {
+ console.log(error);
+ }
+ }
+ //缂栬緫鍑哄簱鍗�
+ EditConsumable() {
+ let url = "/lexsummonscreat?ESetid=" + this.ESetid + "&KeyWords=Redirect";
+ this[NavigationMixin.Navigate]({
+ type: "standard__webPage",
+ attributes: {
+ url: url,
+ },
+ });
+ }
+
+ //鏄剧ず涓婁紶闄勪欢
+ uploadOrder(event) {
+ this.showAttPop = true;
+ }
+
+ //闄勪欢change浜嬩欢
+ attChange(event) {
+ if (event.target.files.length > 0) {
+ this.filesUploaded = event.target.files;
+ this.fileName = event.target.files[0].name;
+ console.log('this.fileName:' + this.fileName);
+ }
+ }
+
+ //鏄惁鏄剧ず闄勪欢绉婚櫎
+ get attDelBtn() {
+ if (this.fileName != '' && this.fileName != null && this.fileName != '璇烽�夋嫨涓�涓枃浠朵笂浼�') {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ //鍏抽棴闄勪欢寮圭獥
+ closePop() {
+ this.showAttPop = false;
+ this.filesUploaded = [];
+ this.fileName = null;
+ }
+
+ //绉婚櫎闄勪欢
+ removeAtt() {
+ this.filesUploaded = [];
+ this.fileName = '';
+ }
+
+ ClearJs() {
+ this.consumableName = '';
+ this.Category3 = '';
+ this.Category4 = '';
+ this.Category5 = '';
+ this.searchProductJs();
+ }
+
+ sortBy(field, reverse, primer) {
+ const key = primer
+ ? function (x) {
+ return primer(x[field]);
+ }
+ : function (x) {
+ return x[field];
+ };
+
+ return function (a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
+ };
+ }
+
+ onHandleSort(event) {
+
+ //灏嗗凡缁忛�夊ソ浜嗙殑鏀惧埌鍓嶉潰锛屼笉杩涜鎺掑簭
+ if (this.EditAble) {
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.data];
+ cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ let index = 0;
+ let selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+ let selectedRowsIds = [];
+ for (var i in selectedRows) {
+ selectedRowsIds.push(selectedRows[i].Id);
+ }
+ console.log('selectedRowsIds = ' + JSON.stringify(selectedRowsIds));
+ for (var i = 0; i < cloneData.length; i++) {
+ if (selectedRowsIds.indexOf(cloneData[i].Id) != -1) {
+ if (i != 0) {
+ let temp = cloneData[index];
+ cloneData[index] = cloneData[i];
+ cloneData[i] = temp;
+ }
+ index++;
+ }
+ }
+ this.data = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ } else {
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.editData];
+ cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ this.editData = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+ }
+
+ handlePrevious() {
+ this.currentPageToken = Number(this.currentPageToken) - Number(this.pageSize);
+ this.searchProductJs();
+ }
+
+ handleNext() {
+ this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize);
+ this.searchProductJs();
+ }
+ handleFirst() {
+ this.currentPageToken = 0;
+ this.searchProductJs();
+ }
+
+ handleLast() {
+ this.currentPageToken = this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+ this.searchProductJs();
+ }
+
+ handlePageschange(event) {
+ console.log(event.detail);
+ this.pageSize = event.detail;
+ this.currentPageToken = 0;
+ this.searchProductJs();
+ }
+
+
+
+ editHandlePrevious() {
+ this.currentPageToken = Number(this.currentPageToken) - Number(this.pageSize);
+ this.searchEditProductJs();
+ }
+
+ editHandleNext() {
+ this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize);
+ this.searchEditProductJs();
+ }
+ editHandleFirst() {
+ this.currentPageToken = 0;
+ this.searchEditProductJs();
+ }
+
+ editHandleLast() {
+ this.currentPageToken = this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+ this.searchEditProductJs();
+ }
+
+ editHandlePageschange(event) {
+ console.log(event.detail);
+ this.pageSize = event.detail;
+ this.currentPageToken = 0;
+ this.searchEditProductJs();
+ }
+
+ searchEditProductJs() {
+ this.isEditShowSpinner = true;
+ this.showTable = false;
+ init({
+ ESetidJs: this.ESetid,
+ statusEdit: this.statusEdit,
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken
+ }).then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log("r = " + JSON.stringify(r));
+ if (r.status == "Success") {
+ //鍒嗛〉
+ console.log('r.entity.paginatedAccounts = ' + JSON.stringify(r.entity.paginatedAccounts));
+ this.nextPageToken = r.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords = r.entity.paginatedAccounts.totalRecords;
+ this.recordStart = r.entity.paginatedAccounts.recordStart;
+ this.recordEnd = r.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(r.entity.paginatedAccounts.totalRecords / this.pageSize);
+ console.log('this.totalPages = ' + this.totalPages);
+
+ this.editData = r.entity.pageRecords;
+ console.log("this.data start = " + JSON.stringify(this.data));
+ for (var i in this.editData) {
+ this.editData[i]["unitValue"] = this.editData[i]["unitValue"];
+ this.editData[i]["InvoiceProNot_count__c"] = this.editData[i].orderdetails1.InvoiceProNot_count__c;
+ this.editData[i]["RrturnPro_count__c"] = this.editData[i].orderdetails1.RrturnPro_count__c;
+ this.editData[i]["Invoiced_Procount__c"] = this.editData[i].orderdetails1.Invoiced_Procount__c;
+ this.editData[i]["shipmentNumber"] = this.editData[i].orderdetails1["Shipment_Count__c"];
+ this.editData[i]["shippingUnitPrice"] = this.editData[i].orderdetails1["Delivery_List_RMB__c"];
+
+ this.editData[i]["recordId"] = this.editData[i].Prod.Id;
+ this.editData[i]["Id"] = this.editData[i].Prod.Id;
+ this.editData[i]["Name__c"] = this.editData[i].Prod.Name__c;
+ this.editData[i]["SFDA_Status__c"] = this.editData[i].Prod.SFDA_Status__c;
+ this.editData[i]["Category3__c"] = this.editData[i].Prod.Category3__c;
+ this.editData[i]["Category4__c"] = this.editData[i].Prod.Category4__c;
+ this.editData[i]["Category5__c"] = this.editData[i].Prod.Category5__c;
+ this.editData[i]["Box_Piece__c"] = this.editData[i].orderdetails1.Box_Piece__c;
+ this.editData[i]["shipmentAmount"] = this.editData[i].orderdetails1.Shipment_amount__c;
+ //this.editData[i]["Shipment_amount__c"] = this.editData[i].orderdetails1.Shipment_amount__c;
+ this.editData[i]["Delivery_List_RMB__c"] = this.editData[i].orderdetails1.Delivery_List_RMB__c;
+ this.editData[i]["Shipment_Count__c"] = this.editData[i].orderdetails1.Shipment_Count__c;
+ }
+ this.showTable = true;
+ this.isEditShowSpinner = false;
+ } else {
+ console.log("r = " + JSON.stringify(r));
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ }).catch((error) => {
+ this.showMyToast('閿欒', '鎼滅储澶辫触', 'Error');
+ });
+ }
+
+ get previousButtonDisabled() {
+ return this.currentPageToken === 0;
+ }
+
+ get nextButtonDisabled() {
+ return this.nextPageToken === undefined;
+ }
+
+ //鍒犻櫎闄勪欢
+ deleteAtt(event) {
+ this.showLoadingSpinner = true;
+ //var recordId = event.detail.data.recordId;
+ var recordId = event.target.getAttribute("data-fileid");
+ console.log('attid:' + recordId);
+ deleteAtt(
+ {
+ contentVersionId: recordId
+ }
+ ).then(result => {
+ if (result.result == 'Success') {
+ this.showMyToast('鎴愬姛', '鍒犻櫎鎴愬姛', 'Success');
+ this.getFiles();
+ } else {
+ this.showMyToast('鍒犻櫎澶辫触', result.errorMsg, 'Error');
+ }
+ }).catch(error => {
+ this.showMyToast('閿欒', '鍒犻櫎澶辫触', 'Error');
+ })
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js-meta.xml b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.html b/force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.html
new file mode 100644
index 0000000..6a27e23
--- /dev/null
+++ b/force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.html
@@ -0,0 +1,3 @@
+<template>
+ <lightning-button-icon icon-name={iconName} onclick={iconClick} style="text-align: center;"></lightning-button-icon>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js b/force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js
new file mode 100644
index 0000000..1931b2a
--- /dev/null
+++ b/force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js
@@ -0,0 +1,22 @@
+import { LightningElement,api } from 'lwc';
+
+export default class LexTableCellIcon extends LightningElement {
+ @api iconName;
+ @api recordId;
+
+ connectedCallback(){
+ console.log("recordId0:"+this.recordId);
+ }
+
+ iconClick(){
+ console.log("recordId:"+this.recordId);
+ this.dispatchEvent(new CustomEvent('clickicon', {
+ composed: true,
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ data: {recordId:this.recordId}
+ }
+ }));
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js-meta.xml b/force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTopPage/lexTopPage.css b/force-app/main/default/lwc/lexTopPage/lexTopPage.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/lexTopPage/lexTopPage.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTopPage/lexTopPage.html b/force-app/main/default/lwc/lexTopPage/lexTopPage.html
new file mode 100644
index 0000000..8886b5c
--- /dev/null
+++ b/force-app/main/default/lwc/lexTopPage/lexTopPage.html
@@ -0,0 +1,214 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <template if:true={showPage}>
+ <!-- <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 16px">
+ <strong>涓婚〉</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+ <lightning-button style="margin: 5px;" label="鏂板缓娑堣�楀搧璁㈠崟" onclick={newOrder}></lightning-button>
+ <p style="height: 10px;"></p>
+ </div>
+ </div> -->
+ <!-- 鏈叏閮ㄥ彂璐ц鍗曟槑缁� -->
+ <template if:true={over_view}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>鏈叏閮ㄥ彂璐ц鍗曟槑缁�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>鏈叏閮ㄥ彂璐ц鍗曟槑缁�</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <c-lex-custom-lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="Id" data={raesList} columns={colms} onclicklink={clickLick}></c-lex-custom-lightning-datatable>
+ </div>
+ </div>
+ </template>
+ <!-- 浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧 -->
+ <template if:true={overlimit}>
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="prodName" data={overlimitdateorderdetails} columns={colm3}></lightning-datatable>
+ </div>
+ </div>
+ </template>
+ <!-- 缁忛攢鍟嗕俊鎭�
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 16px">
+ <strong>缁忛攢鍟嗕俊鎭�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+ <lightning-accordion allow-multiple-sections-open active-section-name={activeSections}>
+ <lightning-record-view-form record-id={accountId} object-api-name="Account">
+ <lightning-accordion-section label="缁忛攢鍟嗚缁嗕俊鎭�" name="A">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Management_Code__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Name"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Ban_On_Use_Date__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Ban_On_Use_Reason__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Dealer_discount__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Sales_Shop_Class__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Deposit_Receipt_Finished__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Deposit_Receipt_Completion_Day__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-accordion-section>
+ <lightning-accordion-section label="钀ヤ笟璁稿彲璇佷功鐘跺喌" name="B">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Business_Authorization_No__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Business_Paper_Expiration_Date__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Tax_Practice_No__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Tax_Practice_Expiration_Date__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Medical_Equipment_Num__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Medical_Equipment_Expiration_Date__c"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-accordion-section>
+ <lightning-accordion-section label="鍦板潃淇℃伅" name="C">
+ <lightning-layout multiple-rows="true">
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Postal_Code__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Phone"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Address_Together__c"></lightning-output-field>
+ </lightning-layout-item>
+ <lightning-layout-item size="6">
+ <lightning-output-field field-name="Fax"></lightning-output-field>
+ </lightning-layout-item>
+ </lightning-layout>
+ </lightning-accordion-section>
+ </lightning-record-view-form>
+ </lightning-accordion>
+ </div>
+ </div> -->
+ <!--缁忛攢鍟嗗簱瀛樹笂涓嬮檺 -->
+ <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>缁忛攢鍟嗗簱瀛樹笂涓嬮檺</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ <!-- <p style="font-size: 16px;"><strong>缁忛攢鍟嗗簱瀛樹笂涓嬮檺</strong></p> -->
+ </div>
+ <div style="padding:10px;">
+ <div lwc:dom="manual" id="resultDiv" class="resultDiv"></div>
+ <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="prodName" data={productLimitRecords} columns={colm4}></lightning-datatable>
+ <p style="height: 10px;"></p>
+ <div draggable="false" >
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width: 220px;" onclick={editProductLimit}>缁忛攢鍟嗕骇鍝佷笂涓嬮檺缂栬緫</button>
+ </div>
+ </div>
+ </div>
+ <!-- 鍦ㄥ簱鍟嗗搧搴撳瓨涓�瑙� -->
+ <!-- <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
+ <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 16px">
+ <strong>鍦ㄥ簱鍟嗗搧搴撳瓨涓�瑙�</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+ <template if:true={showTable}>
+ <c-lex-custom-lightning-datatable key-field="id" data={pageRecords} columns={columns}
+ default-sort-direction={defaultSortDirection} sorted-direction={sortDirection}
+ sorted-by={sortedBy} onsort={onHandleSort} hide-checkbox-column={hidecheckboxcolumn}
+ class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ </template>
+ <c-paginator onprevious={handlePrevious} onnext={handleNext} onpageschange={handlePageschange}
+ onfirst={handleFirst} onlast={handleLast} page-size-options={pageSizeOptions}
+ previous-button-disabled={previousButtonDisabled} next-button-disabled={nextButtonDisabled}
+ record-start={recordStart} record-end={recordEnd} total-records={totalRecords}></c-paginator>
+ </div>
+ </div> -->
+ <!-- 璁㈠崟鍚勭鏁伴噺淇℃伅寮圭獥 -->
+ <template if:true={showPop}>
+ <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small" style="border: 1px solid #D4D4D4;">
+ <div class="slds-modal__container">
+ <header class="slds-modal__header" style="background-color: #F3F3F3;">
+ <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closePop}>
+ <lightning-icon icon-name="utility:close"
+ alternative-text="close"
+ variant="inverse"
+ size="small" ></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">{popTitle}</h2>
+ </header>
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1" style="border: 1px solid #F3F3F3;">
+ <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="prodModel" columns={colms2} data={recordList}></lightning-datatable>
+ </div>
+ <footer class="slds-modal__footer">
+ <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="鍏抽棴" onclick={closePop}></lightning-button> -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="margin-left: 10px;" variant="neutral" label="鍏抽棴" onclick={closePop}>鍏抽棴</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </template>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTopPage/lexTopPage.js b/force-app/main/default/lwc/lexTopPage/lexTopPage.js
new file mode 100644
index 0000000..cb6582a
--- /dev/null
+++ b/force-app/main/default/lwc/lexTopPage/lexTopPage.js
@@ -0,0 +1,667 @@
+import { LightningElement, wire, api, track } from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+import initPage from '@salesforce/apex/LexTopPageController.initPage';
+import initTotalNum from '@salesforce/apex/LexConsumableGoodsInfo.initTotalNum';
+import initArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initArrDet';
+import initArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll';
+import initDeliveryDet from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet';
+import initDeliveryDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll';
+import initNotArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet';
+import initNotArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll';
+import initMoreThan7 from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7';
+import initMoreThan7All from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All';
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+export default class LexTopPage extends NavigationMixin(LightningElement) {
+ @track title = [];
+ @track raesList = [];
+ @track column = [];
+ @track overlimitdateorderdetails = [];
+ @track productLimitRecords = [];
+ @track accountInfo;
+ @track accountId;
+ @track userPro_Type;
+ @track pageRecords = [];
+ @track csvData = [];
+ @track product_Limit;
+ @track over_view = false;
+ @track overlimit = false;
+ @track hasHos = false;
+ @track activeSections = ['A', 'B', 'C'];
+ @track isRender = false;
+ @track consumableorderdetailsRecordsview;
+ @track showSpinner = true;
+ @track showPage = false;
+ //
+ @track showPop = false;
+ @track popTitle;
+ @track totalNum;
+ @track orderNumberArrived;
+ @track deliveryDetailCount;
+ @track orderNumberNotarrive;
+ @track moreThanSevenDays;
+ stylesLoaded = false;
+
+ @track showTable = false;
+ @track hidecheckboxcolumn = true;
+ //鎺掑簭
+ defaultSortDirection = "asc";
+ sortDirection = "asc";
+ sortedBy;
+
+ //鍒嗛〉start
+ @track sortBy = "";
+ @track pageSize = 10;
+ error;
+ records;
+ currentPageToken = 0;
+ nextPageToken = this.pageSize;
+ @track totalRecords = 0;
+ @track loader = false;
+ @track pageNumber = 1;
+ @track paginationVisibility = false;
+ @track totalPages = 1;
+ pageSizeOptions = [10, 25, 50, 100];
+ @track recordStart = 0;
+ @track recordEnd = 0;
+ //end
+
+ //鏄惁涓�鐩存樉绀烘彁绀�
+ @track isNoteStay = true;
+
+ //鏈叏閮ㄥ彂璐ц鍗曟槑缁哻ol
+ @track colms = [
+ {
+ label: '娑堣�楀搧璁㈠崟鍚嶇О',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "Name" },
+ type: 'Title',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true,initialWidth: 200
+ },
+ { label: 'SAP鍚堝悓鍙�', fieldName: 'ContractNo__c', hideDefaultActions: true},
+ {
+ label: '璁㈠崟鎬绘暟',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "Total_num__c" },
+ type: 'TotalNum',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true, initialWidth: 100
+ },
+ {
+ label: '宸插埌璐ф暟閲�',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "OrderNumber_arrived__c" },
+ type: 'ArrDet',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true, initialWidth: 110
+ },
+ {
+ label: '寰呯郴缁熸搷浣滃叆搴撴暟閲�',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "Delivery_detail_count__c" },
+ type: 'DeliveryDet',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true, initialWidth: 180
+ },
+ {
+ label: '杩樻病鍙戣揣鏁伴噺',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "OrderNumber_notarrive__c" },
+ type: 'NotArrDet',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true, initialWidth: 120
+ },
+ {
+ label: '鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�',
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "More_than_seven_days__c" },
+ type: 'MoreThan7',
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true, initialWidth: 180
+ },
+ { label: '鏈�鏂板彂璐ф棩鏈�', fieldName: 'Shipment_date__c', hideDefaultActions: true , initialWidth: 140},
+ { label: '棣栨鍙戣揣鏃ユ湡', fieldName: 'First_Delivery__c', hideDefaultActions: true , initialWidth: 140}
+ ];
+
+ @track colms2 = [
+ { label: '浜у搧鍨嬪彿', fieldName: 'prodModel', hideDefaultActions: true },
+ { label: '鏁伴噺', fieldName: 'recordCount', hideDefaultActions: true ,initialWidth: 100}
+ ];
+
+ //浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧col
+ @track colm3 = [
+ { label: '浜у搧鍨嬪彿', fieldName: 'prodName', hideDefaultActions: true },
+ { label: '鏁伴噺', fieldName: 'countid', hideDefaultActions: true ,cellAttributes: { alignment: "left" }},
+ { label: '鍗曚綅', fieldName: 'BoxPiece', hideDefaultActions: true ,cellAttributes: { alignment: "left" }}
+ ];
+
+ //缁忛攢鍟嗗簱瀛樹笂涓嬮檺col
+ @track colm4 = [
+ { label: '浜у搧鍨嬪彿', fieldName: 'prodName', hideDefaultActions: true },
+ { label: '搴撳瓨涓嬮檺', fieldName: 'limitLow', hideDefaultActions: true ,cellAttributes: { alignment: "left" }},
+ { label: '搴撳瓨涓婇檺', fieldName: 'limitUp', hideDefaultActions: true ,cellAttributes: { alignment: "left" }}
+ ];
+ @track columns = [
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "Name__c",
+ type: "Name",
+ sortable: true,
+ hideDefaultActions: true,
+ wrapText: true,
+ cellAttributes: { alignment: "left" }
+ },
+ {
+ label: "瑙勬牸",
+ fieldName: "packing_list",
+ cellAttributes: { alignment: "right" },
+ initialWidth: 50,
+ wrapText: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: "绗笁鍒嗙被",
+ fieldName: "Category3__c",
+ initialWidth: 85,
+ cellAttributes: { alignment: "left" },
+ hideDefaultActions: true,
+ wrapText: true,
+ },
+ {
+ label: "绗洓鍒嗙被",
+ fieldName: "Category4__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 85,
+ hideDefaultActions: true,
+ wrapText: true,
+
+ },
+ {
+ label: "绗簲鍒嗙被",
+ fieldName: "Category5__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 85,
+ hideDefaultActions: true,
+ wrapText: true,
+ sortable: true,
+
+ },
+ {
+ label: "CFDA鐘舵��",
+ fieldName: "SFDA_Status__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 80,
+ hideDefaultActions: true,
+ },
+ {
+ label: "娉ㄥ唽璇佺紪鐮佸彿",
+ fieldName: "approbation_No",
+ cellAttributes: { alignment: "left" },
+ wrapText: true,
+ initialWidth: 155,
+ hideDefaultActions: true,
+ },
+ {
+ label: "娉ㄥ唽璇佹晥鏈�",
+ fieldName: "expiration_Date",
+ cellAttributes: { alignment: "left" },
+ wrapText: true,
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: "浜у搧鏁伴噺涓嬮檺",
+ fieldName: "lowerlimit",
+ cellAttributes: { alignment: "right" },
+ wrapText: true,
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: "浣跨敤鏈熼檺",
+ fieldName: "guaranteeperiod",
+ cellAttributes: { alignment: "left" },
+ hideDefaultActions: true,
+ initialWidth: 95
+ },
+
+ {
+ label: '鏈夋晥鏈熷唴搴撳瓨',
+ type: "customInventoryColor",
+ cellAttributes: { alignment: "right" },
+ typeAttributes: {
+ value: { fieldName: "limitCount" },
+ upperlimit: { fieldName: "upperlimit" },
+ lowerlimit: { fieldName: "lowerlimit" },
+ boxPrice: { fieldName: "BoxPiece" },
+ },
+ hideDefaultActions: true,
+
+ initialWidth: 95
+ },
+ {
+ label: "杩囨湡搴撳瓨",
+ fieldName: "overlimitCount",
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+ initialWidth: 75
+ },
+ {
+ label: "鍗曚綅",
+ fieldName: "BoxPiece",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 50,
+ wrapText: true,
+ hideDefaultActions: true,
+ },
+
+ ];
+
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+ connectedCallback() {
+ this.loader = true;
+ this.init();
+ }
+ init() {
+ this.showSpinner = true;
+ initPage({
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken,
+ })
+ .then(result => {
+ this.isNoteStay = result.isNoteStay;
+ console.log('isNoteStay:'+result.isNoteStay);
+ if (result.result == 'Success') {
+ //鍒嗛〉start
+ this.nextPageToken = result.paginatedAccounts.nextPageToken;
+ this.totalRecords = result.paginatedAccounts.totalRecords;
+ this.recordStart = result.paginatedAccounts.recordStart;
+ this.recordEnd = result.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(result.paginatedAccounts.totalRecords / this.pageSize);
+ console.log('this.totalPages = ' + this.totalPages);
+ this.paginationVisibility = this.totalPages > 1 ? true : false;
+ console.log('this.sortDirection = ' + this.sortDirection);
+ this.loader = false;
+ //鍒嗛〉end
+ this.title = result.title;
+ this.totalNum = result.totalNum;
+ this.orderNumberArrived = result.orderNumberArrived;
+ this.deliveryDetailCount = result.deliveryDetailCount;
+ this.orderNumberNotarrive = result.orderNumberNotarrive;
+ this.moreThanSevenDays = result.moreThanSevenDays;
+ this.raesList = result.raesList;
+ this.raesList.push({ Id: '1', Name: '寰呮搷浣滃叆搴撹鍗曟眹鎬�', Total_num__c: this.totalNum, OrderNumber_arrived__c: this.orderNumberArrived, Delivery_detail_count__c: this.deliveryDetailCount, OrderNumber_notarrive__c: this.orderNumberNotarrive, More_than_seven_days__c: this.moreThanSevenDays });
+ this.column = result.column;
+ this.accountInfo = result.accountInfo;
+ this.accountId = result.accountInfo.Id;
+ this.pageRecords = result.pageRecords;
+ this.overlimitdateorderdetails = result.overlimitdateorderdetails;
+ this.over_view = result.over_view;
+ this.overlimit = result.overlimit;
+ this.hasHos = result.hasHos;
+ this.product_Limit = result.product_Limit;
+ console.log('result==>' + JSON.stringify(result));
+ for (var i in this.pageRecords) {
+ this.pageRecords[i]["Name__c"] = this.pageRecords[i].Prod.Name__c;
+ this.pageRecords[i]["Category3__c"] = this.pageRecords[i].Prod.Category3__c;
+ this.pageRecords[i]["Category4__c"] = this.pageRecords[i].Prod.Category3__c;
+ this.pageRecords[i]["Category5__c"] = this.pageRecords[i].Prod.Category3__c;
+ this.pageRecords[i]["SFDA_Status__c"] = this.pageRecords[i].Prod.SFDA_Status__c;
+ }
+ //hasHos = true 鍖婚櫌鐗逛环
+ if (this.hasHos) {
+ let object1 = {
+ label: "鍖婚櫌鐗逛环",
+ fieldName: "hospitalSpecialOffer",
+ hideDefaultActions: true,
+ type: 'boolean',
+ cellAttributes: { alignment: "left" },
+ initialWidth: 75
+
+ };
+ this.columns.push(object1);
+ console.log(' this.columns' + this.columns);
+ for (var j in this.pageRecords) {
+ this.pageRecords[j]["Name__c"] = this.pageRecords[j].Prod.Name__c;
+ this.pageRecords[j]["Category3__c"] = this.pageRecords[j].Prod.Category3__c;
+ this.pageRecords[j]["Category4__c"] = this.pageRecords[j].Prod.Category3__c;
+ this.pageRecords[j]["Category5__c"] = this.pageRecords[j].Prod.Category3__c;
+ this.pageRecords[j]["SFDA_Status__c"] = this.pageRecords[j].Prod.SFDA_Status__c;
+ this.pageRecords[j]["hospitalSpecialOffer__c"] = this.pageRecords[j].hospitalSpecialOffer;
+ }
+ }
+ this.showTable = true;
+ if (this.product_Limit != null && this.product_Limit != '') {
+ var records = this.product_Limit.split(",");
+ for (var i in records) {
+ var parms = records[i].split("|");
+ var record = new Object();
+ record["prodName"] = parms[0];
+ record["limitLow"] = parms[1];
+ record["limitUp"] = parms[2];
+ this.productLimitRecords.push(record);
+ }
+ }
+ // this.productLimitRecords = records;
+ console.log("productLimitRecords:" + JSON.stringify(this.productLimitRecords));
+ console.log("product_Limit:" + this.product_Limit);
+ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
+ //add by WangXueqin 2023/05/05
+ this.userPro_Type = result.userPro_Type;
+ console.log('this.accountId:' + this.accountId);
+ console.log('this.accountInfo:' + JSON.stringify(this.accountInfo));
+ this.showSpinner = false;
+ this.showPage = true;
+ // this.showMyToast('鍒濆鍖栭〉闈㈡垚鍔�', '', 'success');
+ } else {
+ this.showPage = true;
+ this.showSpinner = false;
+ console.log("Error:" + result.errorMsg);
+ this.showMyToast('鍒濆鍖栭〉闈㈠け璐�', result.errorMsg, 'error');
+ }
+ })
+ .catch(error => {
+ this.showSpinner = false;
+ console.log("Error:" + error);
+ this.showMyToast('鍒濆鍖栭〉闈㈠け璐�', JSON.stringify(error), 'error');
+ })
+ }
+
+ //鐐瑰嚮閾炬帴
+ clickLick(event) {
+ var outputValue = event.detail.data.value;
+ var outputType = event.detail.data.type;
+ var recordId = event.detail.data.recordId;
+ console.log("click:" + outputValue + "---" + outputType + "---" + recordId);
+ if (outputType == 'Title') {
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexarrivegoods?ESetId=' + recordId
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ } else if (outputType == 'TotalNum') {
+ this.popTitle = '鎵�鏈変骇鍝佷竴瑙�';
+ initTotalNum({ ordId: recordId, type: '' })
+ .then(result => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast('鍔犺浇鎵�鏈変骇鍝佷竴瑙堥〉闈㈠け璐�', result.errorMsg, 'error');
+ }
+ })
+ } else if (outputType == 'ArrDet') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夊凡鍒拌揣浜у搧涓�瑙�';
+ initArrDetAll({ type: '' })
+ .then(result => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast('鍔犺浇鎵�鏈夊凡鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�', result.errorMsg, 'error');
+ }
+ })
+ } else {
+ this.popTitle = '宸插埌璐т骇鍝佷竴瑙�';
+ initArrDet({ orderId: recordId })
+ .then(result => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast('鍔犺浇宸插埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�', result.errorMsg, 'error');
+ }
+ })
+ }
+ } else if (outputType == 'DeliveryDet') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙�';
+ initDeliveryDetAll({ type: '' })
+ .then(result => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast('鍔犺浇鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�', result.errorMsg, 'error');
+ }
+ })
+ } else {
+ this.popTitle = '鏈埌璐т骇鍝佷竴瑙�';
+ initDeliveryDet({ orderId: recordId })
+ .then(result => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast('鍔犺浇鏈埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�', result.errorMsg, 'error');
+ }
+ })
+ }
+ } else if (outputType == 'NotArrDet') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙�';
+ initNotArrDetAll({ type: '' })
+ .then(result => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast('鍔犺浇鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙堥〉闈㈠け璐�', result.errorMsg, 'error');
+ }
+ })
+ } else {
+ this.popTitle = '杩樻病鍙戣揣鏁伴噺';
+ initNotArrDet({ orderId: recordId })
+ .then(result => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast('鍔犺浇杩樻病鍙戣揣鏁伴噺椤甸潰澶辫触', result.errorMsg, 'error');
+ }
+ })
+ }
+
+ } else if (outputType == 'MoreThan7') {
+ if (recordId == '1') {
+ this.popTitle = '鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟';
+ initMoreThan7All({ type: '' })
+ .then(result => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast('鍔犺浇鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟椤甸潰澶辫触', result.errorMsg, 'error');
+ }
+ })
+ } else {
+ this.popTitle = '鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�';
+ initMoreThan7({ orderId: recordId })
+ .then(result => {
+ if (result.result == 'Success') {
+ this.recordList = result.recordList;
+ console.log('data:' + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast('鍔犺浇鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁伴〉闈㈠け璐�', result.errorMsg, 'error');
+ }
+ })
+ }
+ }
+ }
+
+ //鍏抽棴寮圭獥
+ closePop() {
+ this.showPop = false;
+ }
+
+ editProductLimit(event) {
+ //add by Wang Xueqin 2023/05/05
+ let url = "/lexproductlimitedit?accountid=" + this.accountId + "&userPro_Type=" + this.userPro_Type;
+ const config = {
+ type: 'standard__webPage',
+ attributes: {
+ url: url
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ //鏂板缓娑堣�楀搧璁㈠崟
+ newOrder() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName: 'Consumable_order__c',
+ actionName: 'new'
+ },
+ state: {
+ useRecordTypeCheck: 1
+ }
+ });
+ }
+
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').
+ showToast(variant,content,iconName,10000);
+ // var mode;
+ // if(this.isNoteStay){
+ // mode ='sticky';
+ // }else{
+ // mode = 'dismissable';
+ // }
+ // const evt = new ShowToastEvent({
+ // title: title,
+ // message: message,
+ // variant: variant,
+ // mode: mode
+ // });
+ // this.dispatchEvent(evt);
+ }
+ //鎺掑簭
+
+ sortByMethod(field, reverse, primer) {
+ const key = primer
+ ? function (x) {
+ return primer(x[field]);
+ }
+ : function (x) {
+ return x[field];
+ };
+
+ return function (a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
+ };
+ }
+
+ onHandleSort(event) {
+ console.log("Sort");
+ this.sortBy = event.detail.fieldName;
+ this.sortDirection = event.detail.sortDirection;
+ this.currentPageToken = 0;
+ console.log('this.sortBy = ' + this.sortBy)
+ console.log('this.sortDirection = ' + this.sortDirection)
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.pageRecords];
+ cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ this.pageRecords = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+ //鍒嗛〉
+ handlePaginatorChange(event) {
+ this.recordsToDisplay = event.detail.recordsToDisplay;
+ this.preSelected = event.detail.preSelected;
+ if (this.recordsToDisplay && this.recordsToDisplay > 0) {
+ this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
+ } else {
+ this.rowNumberOffset = 0;
+ }
+ }
+ handlePrevious() {
+ this.currentPageToken = Number(this.currentPageToken) - Number(this.pageSize);
+ this.init();
+ }
+
+ handleNext() {
+ this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize);
+ this.init();
+ }
+ handleFirst() {
+ this.currentPageToken = 0;
+ this.init();
+ }
+
+ handleLast() {
+ this.currentPageToken = this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+ this.init();
+ }
+
+ handlePageschange(event) {
+ console.log(event.detail);
+ this.pageSize = event.detail;
+ this.currentPageToken = 0;
+ this.init();
+ }
+ get previousButtonDisabled() {
+ return this.currentPageToken === 0;
+ }
+
+ get nextButtonDisabled() {
+ return this.nextPageToken === undefined;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTopPage/lexTopPage.js-meta.xml b/force-app/main/default/lwc/lexTopPage/lexTopPage.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexTopPage/lexTopPage.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css
new file mode 100644
index 0000000..49d6963
--- /dev/null
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css
@@ -0,0 +1 @@
+@import 'c/lexCssUtility';
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
new file mode 100644
index 0000000..18ee0c9
--- /dev/null
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
@@ -0,0 +1,129 @@
+<template>
+ <template if:true={showSpinner}>
+ <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+ </template>
+ <c-common-toast></c-common-toast>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;">
+ <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <!-- <p style="font-size: 18px;"><strong>搴撳瓨绠$悊</strong></p> -->
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>搴撳瓨绠$悊</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:10px;">
+ <!-- <lightning-button variant="brand" class = 'lexstyle' style="margin:12px;" label="搴撳瓨鐩樼偣" title="搴撳瓨鐩樼偣"
+ onclick={inventoryCount}></lightning-button>
+ <lightning-button variant="brand" class = 'lexstyle' style="margin: 12px;" label="杩囨湡搴撳瓨閿�瀛�" title="杩囨湡搴撳瓨閿�瀛�"
+ onclick={handleExpired}></lightning-button>
+ <lightning-button variant="brand" class = 'lexstyle' style="margin: 12px;" label="鎷嗙洅" title="鎷嗙洅" onclick={removeBox}></lightning-button>
+ <lightning-button variant="brand" class = 'lexstyle' style="margin: 12px;" label="鍙栨秷鎷嗙洅" title="鍙栨秷鎷嗙洅"
+ onclick={cancelremoveBox}></lightning-button> -->
+ <button style ="margin-left:5px;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="搴撳瓨鐩樼偣" onclick={inventoryCount}>搴撳瓨鐩樼偣</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="杩囨湡搴撳瓨閿�瀛�" style = "margin-left:150px;" onclick={handleExpired}>杩囨湡搴撳瓨閿�瀛�</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="鎷嗙洅" style = "margin-left:150px;" onclick={removeBox}>鎷嗙洅</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="鍙栨秷鎷嗙洅" style = "margin-left:150px;" onclick={cancelremoveBox}>鍙栨秷鎷嗙洅</button>
+ </div>
+ </div>
+
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:30px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;height:115px">
+ <table style="margin-top:10px;">
+ <colgroup>
+ <col width="160px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="90px" />
+ <col width="100px" />
+ <col width="85px" />
+ <col width="100px" />
+ <col width="10px" />
+ <col width="70px" />
+ <col width="100px" />
+ </colgroup>
+ <tbody>
+ <tr>
+ <td style="width:10px;"></td>
+ <td style="width:250px">
+ <div style="width:90px;margin-left:12px;" class="searchName">娑堣�楀搧鍚嶇О</div>
+ </td>
+ <td style="width: 21%;">
+ <lightning-input class="searchName" type="text" name="Name" label="娑堣�楀搧鍚嶇О" value={Name}
+ variant="label-hidden" onchange={dataChange}
+ data-field="Name"></lightning-input>
+ </td>
+ <td style="width:150px">
+ <div style="width:90px;text-align:center;" class="searchName">绗�3鍒嗙被</div>
+ </td>
+ <td style="width: 21%;">
+ <lightning-combobox class="inputFont" style="margin-left:5px;" name="CategoryThree" label="绗�3鍒嗙被" value={value}
+ placeholder="璇烽�夋嫨..." options={category3Options} variant="label-hidden"
+ data-field="CategoryThree" onchange={dataChange}></lightning-combobox>
+ </td>
+ <td style="width:150px">
+ <div style="width:90px;text-align:center;" class="searchName">绗�4鍒嗙被</div>
+ </td>
+ <td style="width: 21%;">
+ <lightning-combobox class="inputFont" name="CategoryFour" label="绗�4鍒嗙被" value={value}
+ placeholder="璇烽�夋嫨..." options={category4Options} variant="label-hidden"
+ data-field="CategoryFour" onchange={dataChange}></lightning-combobox>
+ </td>
+ <td style="width:150px">
+ <div style="width:90px;text-align:center;" class="searchName">绗�5鍒嗙被</div>
+ </td>
+ <td style="width: 21%;">
+ <lightning-combobox class="inputFont" name="CategoryFive" label="绗�5鍒嗙被" value={value}
+ placeholder="璇烽�夋嫨..." options={category5Options} variant="label-hidden"
+ data-field="CategoryFive" onchange={dataChange}></lightning-combobox>
+ </td>
+ <td style="width: 1%;"></td>
+ </tr>
+ </tbody>
+ </table>
+ <br/>
+ <div style="float:right;margin-right:10px;"> <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" label="娑堣�楀搧鎼滅储" onclick={searchOrderDetail}>娑堣�楀搧鎼滅储</button>
+ <button style="margin-left:10px;" class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" label="娓呯┖" onclick={clearAll}>娓呯┖</button></div>
+
+ </div>
+ </div>
+ <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
+ <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
+ <!-- <p style="font-size: 16px;"><strong>搴撳瓨璇︽儏</strong></p> -->
+ <lightning-layout>
+ <lightning-layout-item padding="around-small">
+ <p style="font-size: 18px">
+ <strong>搴撳瓨璇︽儏</strong>
+ </p>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ <div style="padding:10px;">
+ <template if:true={showTable}>
+ <c-lex-custom-lightning-datatable key-field="id" data={data} columns={columns}
+ default-sort-direction={defaultSortDirection} sorted-direction={sortDirection}
+ sorted-by={sortedBy} onsort={onHandleSort} hide-checkbox-column={hidecheckboxcolumn}
+ class="wrapped-header-datatable">
+ </c-lex-custom-lightning-datatable>
+ </template>
+ <c-paginator onprevious={handlePrevious} onnext={handleNext} onpageschange={handlePageschange}
+ onfirst={handleFirst} onlast={handleLast} page-size-options={pageSizeOptions}
+ previous-button-disabled={previousButtonDisabled} next-button-disabled={nextButtonDisabled}
+ record-start={recordStart} record-end={recordEnd} total-records={totalRecords}></c-paginator>
+ </div>
+ </div>
+ </div>
+
+
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
new file mode 100644
index 0000000..7b2a2c7
--- /dev/null
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
@@ -0,0 +1,656 @@
+import { LightningElement, wire, api, track } from 'lwc';
+import oninit from "@salesforce/apex/LexInventoryViewController.init";
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import searchOrder from "@salesforce/apex/LexInventoryViewController.searchConsumableorderdetails";
+import categoryAllload from "@salesforce/apex/LexInventoryViewController.categoryAllload";
+import { NavigationMixin } from "lightning/navigation";
+
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+
+export default class LexinventoryViewLWC extends NavigationMixin(LightningElement) {
+ //鍒嗛〉start
+ @track sortBy = "";
+ //@track sortDirection = "asc";
+ @track pageSize = 10;
+ error;
+ records;
+ currentPageToken = 0;
+ nextPageToken = this.pageSize;
+ @track totalRecords = 0;
+ @track loader = false;
+ @track pageNumber = 1;
+ @track paginationVisibility = false;
+ @track totalPages = 1;
+ pageSizeOptions = [10,25,50,100];
+ @track recordStart = 0;
+ @track recordEnd = 0;
+ //end
+
+ @track data = [];
+ @track message = "";
+ @track Name;
+ @track CategoryThree;
+
+ @track category3Options = [];
+ @track CategoryFour;
+ @track category4Options = [];
+ @track CategoryFive;
+ @track category5Options = [];
+ @track orderDetZaikuList = [];
+ @track accountName;
+ @track agencyProType;
+ @track userWorkLocation;
+ @track value = "";
+ @track showTable = false;
+ @track hidecheckboxcolumn = true;
+ @track check = false;
+ //鍔犺浇
+ @track showSpinner = false;
+ @track showSpinners = false;
+ //鍖婚櫌鐗逛环
+ @track hasHos = false;
+ //琛ㄥご鏍峰紡
+ stylesLoaded = false;
+
+
+ @track columns = [
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "Name__c",
+ type: "Name",
+ sortable: true,
+ hideDefaultActions: true,
+ // initialWidth: 300,
+ wrapText: true,
+ cellAttributes: { alignment: "left" }
+ },
+ {
+ label: "绗笁鍒嗙被",
+ fieldName: "Category3__c",
+ initialWidth: 90,
+ cellAttributes: { alignment: "left" },
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ },
+ {
+ label: "绗洓鍒嗙被",
+ fieldName: "Category4__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 90,
+ hideDefaultActions: true,
+ wrapText: true,
+ sortable: true,
+
+ },
+ {
+ label: "绗簲鍒嗙被",
+ fieldName: "Category5__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 90,
+ hideDefaultActions: true,
+ wrapText: true,
+ sortable: true,
+
+ },
+
+ {
+ label: "瑙勬牸",
+ fieldName: "packing_list",
+ cellAttributes: { alignment: "right" },
+ initialWidth: 55,
+ wrapText: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: "鍗曚綅",
+ fieldName: "BoxPiece",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 55,
+ wrapText: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: "娉ㄥ唽璇佺紪鐮佸彿",
+ fieldName: "approbation_No",
+ cellAttributes: { alignment: "left" },
+ wrapText: true,
+ initialWidth: 155,
+ hideDefaultActions: true,
+ },
+ {
+ label: "娉ㄥ唽鏈夋晥鏈�",
+ fieldName: "expiration_Date",
+ cellAttributes: { alignment: "left" },
+ wrapText: true,
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: "CFDA鐘舵��",
+ fieldName: "SFDA_Status__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 95,
+ wrapText: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: "浣跨敤鏈熼檺",
+ fieldName: "guaranteeperiod",
+ cellAttributes: { alignment: "left" },
+ hideDefaultActions: true,
+ initialWidth: 105
+ },
+ {
+ label:'鏈夋晥鏈熷唴搴撳瓨',
+ type: "customInventoryColor",
+ // sortable: true,
+ cellAttributes: {alignment: "right" },
+ typeAttributes: {
+ value: { fieldName:"limitCount"},
+ upperlimit: { fieldName: "upperlimit" },
+ lowerlimit: { fieldName: "lowerlimit" },
+ boxPrice:{ fieldName: "BoxPiece" },
+ },
+ hideDefaultActions: true,
+ initialWidth:150
+ },
+
+ {
+ label: "杩囨湡搴撳瓨",
+ fieldName: "overlimitCount",
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+ initialWidth:80
+ }
+ ];
+ defaultSortDirection = "asc";
+ sortDirection = "asc";
+ sortedBy;
+
+
+
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ console.error("Error loading custom styles");
+ });
+ }
+ }
+
+
+ connectedCallback() {
+ this.loader = true;
+ this.init();
+ }
+
+ init() {
+ this.showSpinner = true;
+ oninit({
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken,
+ sortFieldLWC: this.sortBy,
+ sortOrderLWC: this.sortDirection
+ }).then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log("result.pageRecords = " + JSON.stringify(result.entity.pageRecords));
+ console.log("result.consumableorderdetailsRecords = " + JSON.stringify(result.entity.consumableorderdetailsRecords));
+ console.log("result.status = " + result.status);
+ console.log("result = " + JSON.stringify(result));
+ console.log("result 1= " + JSON.stringify(result.entity));
+ console.log("result 2= " + JSON.stringify(result.entity.pageRecords));
+ console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.categoryOptionMap));
+ console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.category4OptionMap));
+ console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.category5OptionMap));
+ if (result.status == "Success") {
+ console.log('result.entity.paginatedAccounts = ' + JSON.stringify(result.entity.paginatedAccounts));
+ this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords = result.entity.paginatedAccounts.totalRecords;
+ this.recordStart = result.entity.paginatedAccounts.recordStart;
+ this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
+ console.log('this.totalPages = ' + this.totalPages);
+ this.paginationVisibility = this.totalPages > 1 ? true : false;
+
+ this.loader = false;
+ this.data = result.entity.pageRecords;
+
+ for (var i in this.data) {
+ this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
+ this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
+ this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c;
+ this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c;
+ this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
+ }
+ this.showTable = true;
+ this.orderDetZaikuList = result.entity.orderDetZaikuList;
+ this.accountName = result.entity.accountName;
+ this.agencyProType = result.entity.agencyProType;
+ this.userWorkLocation = result.entity.userWorkLocation;
+ let option1ValueTemp = [];
+ for (var key in result.entity.categoryOptionMap) {
+ let object = {};
+ object['label'] = result.entity.categoryOptionMap[key];
+ object['value'] = key;
+ option1ValueTemp.push(object);
+ }
+ this.category3Options = option1ValueTemp;
+ console.log(' this.optionscatone===>' + JSON.stringify(this.optionscatone));
+ let option2ValueTemp = [];
+ for (var key in result.entity.category4OptionMap) {
+ let object = {};
+ object["label"] = result.entity.category4OptionMap[key];
+ object["value"] = key;
+ option2ValueTemp.push(object);
+ }
+ this.category4Options = option2ValueTemp;
+ let option3ValueTemp = [];
+ for (var key in result.entity.category5OptionMap) {
+ let object = {};
+ object["label"] = result.entity.category5OptionMap[key];
+ object["value"] = key;
+ option3ValueTemp.push(object);
+ }
+ this.category5Options = option3ValueTemp;
+ this.hasHos = result.entity.hasHos;
+ console.log('this.hasHos'+this.hasHos);
+ //棰滆壊鏍囪
+
+ //hasHos = true 鍖婚櫌鐗逛环
+ if (this.hasHos) {
+ let object1 = {
+ label: "鍖婚櫌鐗逛环",
+ fieldName: "hospitalSpecialOffer__c",
+ hideDefaultActions: true,
+ type:'boolean',
+ cellAttributes: { alignment: "left" },
+ initialWidth:80
+
+ };
+ this.columns.push(object1);
+ console.log(' this.columns'+ this.columns);
+ for (var j in this.data) {
+ this.data[j]["Name__c"] = this.data[j].Prod.Name__c;
+ this.data[j]["Category3__c"] = this.data[j].Prod.Category3__c;
+ this.data[j]["Category4__c"] = this.data[j].Prod.Category3__c;
+ this.data[j]["Category5__c"] = this.data[j].Prod.Category3__c;
+ this.data[j]["SFDA_Status__c"] = this.data[j].Prod.SFDA_Status__c;
+ this.data[j]["hospitalSpecialOffer__c"] = this.data[j].hospitalSpecialOffer;
+ console.log('this.data[j].hospitalSpecialOffer__c'+this.data[j].hospitalSpecialOffer);
+ }
+ }
+ this.showSpinner = false;
+ } else {
+ // this.showToast("Error",'Error', result.msg);
+ this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error');
+ }
+ }).catch((error) => {
+ this.loader = false;
+ this.showSpinner = false;
+ console.log("error = " + JSON.stringify(error));
+ });
+ }
+
+ handleChange(event) {
+ let fieldName = event.target.getAttribute("data-field");
+ let value = event.detail.value;
+ console.log("======>fieldName" + fieldName);
+ console.log("======>value" + value);
+ switch (fieldName) {
+ case "Name":
+ this.Name = value;
+ break;
+ case "CategoryThree":
+ this.CategoryThree = value;
+ break;
+ case "CategoryFour":
+ this.CategoryFour = value;
+ break;
+ case "CategoryFive":
+ this.CategoryFive = value;
+ break;
+ default:
+ console.log("no data");
+ }
+ }
+ dataChange(event) {
+ let fieldName = event.target.getAttribute("data-field");
+ let value = event.detail.value;
+ console.log("fieldName = " + fieldName + " value = " + value);
+ switch (fieldName) {
+ case "Name":
+ this.Name = value;
+ break;
+ case "CategoryThree":
+ this.CategoryThree = value;
+ //璋冪敤鍚庡彴鏄剧ず绗洓浜斿垎绫�
+ this.showAllCate();
+ if (this.CategoryThree == '') {
+ this.CategoryFour = '';
+ this.CategoryFive = '';
+ }
+ break;
+ case "CategoryFour":
+ this.Category4 = value;
+ //璋冪敤鍚庡彴鏄剧ず绗簲鍒嗙被
+ this.showCate();
+ if (this.CategoryFour == '') {
+ this.CategoryFive = '';
+ }
+ break;
+ case "CategoryFive":
+ this.CategoryFive = value;
+ break;
+ }
+ }
+
+
+ showAllCate() {
+ categoryAllload({
+ category3LWC: this.CategoryThree,
+ agencyProTypeLWC:this.agencyProType
+ }).then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log("result = " + JSON.stringify(result));
+ if (result.status == "Success") {
+ this.category4Options = [];
+ this.category5Options = [];
+ //绗�4鍒嗙被
+ for (var key in result.entity.category4OptionMap) {
+ let object = {};
+ object["label"] = result.entity.category4OptionMap[key];
+ object["value"] = key;
+ this.category4Options.push(object);
+ }
+ console.log("this.category4Options = " + JSON.stringify(this.category4Options));
+ //绗�5鍒嗙被
+ for (var key in result.entity.category5OptionMap) {
+ let object = {};
+ object["label"] = result.entity.category5OptionMap[key];
+ object["value"] = key;
+ this.category5Options.push(object);
+ }
+ } else {
+ console.log("result = " + JSON.stringify(result));
+ this.showMyToast(result.msg,'','error');
+ }
+ }).catch((error) => {
+ console.log("error" + JSON.stringify(error));
+ });
+ }
+
+ searchOrderDetail() {
+ this.showTable = false;
+ searchOrder({
+ category1: this.Name,
+ Category3: this.CategoryThree,
+ Category4: this.CategoryFour,
+ Category5: this.CategoryFive,
+ orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
+ accountName: this.accountName,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken,
+ // sortFieldLWC: this.sortBy,
+ // sortOrderLWC: this.sortDirection
+ })
+ .then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ if (result.status == "Success") {
+ this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords = result.entity.paginatedAccounts.totalRecords;
+ this.recordStart = result.entity.paginatedAccounts.recordStart;
+ this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
+ console.log('this.totalPages = ' + this.totalPages);
+ this.paginationVisibility = this.totalPages > 1 ? true : false;
+ console.log('this.sortDirection = ' + this.sortDirection);
+ // this.showToast("Success",'鎼滅储鎴愬姛', result.msg);
+ this.showMyToast('鎼滅储鎴愬姛',result.msg,'success');
+ this.data = result.entity.pageRecords;
+ console.log('鎼滅储Data==>'+JSON.stringify(this.data));
+ for (var i in this.data) {
+ this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
+ this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
+ this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c;
+ this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c;
+ this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
+ this.data[i]["hospitalSpecialOffer__c"] = this.data[i].hospitalSpecialOffer;
+ }
+ this.data = [...this.data];
+ console.log('this.data = ' + JSON.stringify(this.data));
+ this.showTable = true;
+ } else {
+ // this.showToast("Error",'Error', result.msg);
+ this.showMyToast('鎼滅储澶辫触',result.msg,'error');
+ }
+ })
+ .catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ });
+ }
+ inventoryCount() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexinventory'
+ }
+ });
+ }
+
+ handleExpired() {
+ console.log('杩囨湡搴撳瓨鍛㈤攢瀛�');
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexoverduestock'
+ }
+ });
+
+ }
+ removeBox() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexremovebox'
+ }
+ });
+
+ }
+ cancelremoveBox() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexcancelremovebox'
+ }
+ });
+
+ }
+
+ clearAll() {
+ this.showSpinner = true;
+ this.showTable = false;
+ this.Name = '';
+ this.CategoryThree = '';
+ this.CategoryFour = '';
+ this.CategoryFive = '';
+ this.template.querySelectorAll("lightning-combobox").forEach((each) => {
+ each.value = null;
+ });
+ console.log(' this.CategoryThree' + this.CategoryThree);
+ console.log('鏁版嵁鍒楄〃' + this.data);
+ searchOrder({
+ category1: this.Name,
+ Category3: this.CategoryThree,
+ Category4: this.CategoryFour,
+ Category5: this.CategoryFive,
+ orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
+ accountName: this.accountName,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken,
+ })
+ .then((result) => {
+ console.log("result鎼滅储 = " + JSON.stringify(result));
+ result = JSON.parse(JSON.stringify(result));
+ if (result.status == "Success") {
+
+ this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords = result.entity.paginatedAccounts.totalRecords;
+ this.recordStart = result.entity.paginatedAccounts.recordStart;
+ this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
+ console.log('this.totalPages = ' + this.totalPages);
+ this.paginationVisibility = this.totalPages > 1 ? true : false;
+ console.log('this.sortDirection = ' + this.sortDirection);
+ this.data = result.entity.pageRecords;
+
+ for (var i in this.data) {
+ this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
+ this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
+ this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c;
+ this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c;
+ this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
+ }
+ this.showSpinner = false;
+ this.showTable = true;
+ this.showMyToast('鎼滅储鎴愬姛',result.msg,'success');
+ // this.showToast("Success",'鎼滅储鎴愬姛', result.msg);
+ this.showSpinner = false;
+ } else {
+ // this.showToast("Error", 'Error',result.msg);
+ this.showMyToast('鎼滅储澶辫触',result.msg,'error');
+ }
+ })
+ .catch((error) => {
+ console.log("error = " + JSON.stringify(error));
+ });
+ }
+
+ sortByMethod(field, reverse, primer) {
+ const key = primer
+ ? function (x) {
+ return primer(x[field]);
+ }
+ : function (x) {
+ return x[field];
+ };
+
+ return function (a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
+ };
+ }
+
+ onHandleSort(event) {
+ console.log("Sort");
+ this.sortBy = event.detail.fieldName;
+ this.sortDirection = event.detail.sortDirection;
+ this.currentPageToken = 0;
+ console.log('this.sortBy = ' + this.sortBy)
+ console.log('this.sortDirection = ' + this.sortDirection)
+ // if('limitCount' != this.sortBy)
+ // this.searchOrderDetail();
+ // else{
+ // const { fieldName: sortedBy, sortDirection } = event.detail;
+ // const cloneData = [...this.data];
+ // cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ // this.data = cloneData;
+ // this.sortDirection = sortDirection;
+ // this.sortedBy = sortedBy;
+ // }
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.data];
+ cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ this.data = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+ handlePaginatorChange(event) {
+ this.recordsToDisplay = event.detail.recordsToDisplay;
+ this.preSelected = event.detail.preSelected;
+ if (this.recordsToDisplay && this.recordsToDisplay > 0) {
+ this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
+ } else {
+ this.rowNumberOffset = 0;
+ }
+ }
+
+ handlePrevious() {
+ this.currentPageToken = Number(this.currentPageToken) - Number(this.pageSize);
+ this.searchOrderDetail();
+ }
+
+ handleNext() {
+ this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize);
+ this.searchOrderDetail();
+ }
+ handleFirst() {
+ this.currentPageToken = 0;
+ this.searchOrderDetail();
+ }
+
+ handleLast() {
+ this.currentPageToken = this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+ this.searchOrderDetail();
+ }
+
+ handlePageschange(event) {
+ console.log(event.detail);
+ this.pageSize = event.detail;
+ this.currentPageToken = 0;
+ this.searchOrderDetail();
+ }
+ get previousButtonDisabled() {
+ return this.currentPageToken === 0;
+ }
+
+ get nextButtonDisabled() {
+ return this.nextPageToken === undefined;
+ }
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if(variant == 'success'){
+ iconName = 'utility:check';
+ }else{
+ iconName = 'utility:error';
+ }
+ if(message != ''){
+ content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+ }else{
+ content = '<h2><strong>'+title+'<strong/></h2>';
+ }
+ this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
+
+
+ // showToast(type,title,msg) {
+ // this.showSpinner = false;
+ // let mode = '';
+ // if (type.toLowerCase() != 'success') {
+ // mode = 'sticky';
+ // } else {
+ // mode = 'dismissable';
+ // }
+ // const event = new ShowToastEvent({
+ // title: title,
+ // variant: type,
+ // message: msg,
+ // mode: mode
+ // });
+ // this.dispatchEvent(event);
+ // }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js-meta.xml b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js-meta.xml
new file mode 100644
index 0000000..d893635
--- /dev/null
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightningCommunity__Page</target>
+ <target>lightningCommunity__Default</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.css b/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.css
new file mode 100644
index 0000000..021bb90
--- /dev/null
+++ b/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.css
@@ -0,0 +1,24 @@
+.customSelect select {
+ padding-right: 1.25rem;
+ min-height: inherit;
+ line-height: normal;
+ height: 1.4rem;
+}
+.customSelect label {
+ margin-top: .1rem;
+}
+.customSelect .slds-select_container::before {
+ border-bottom: 0;
+}
+.customInput {
+ width: 3rem;
+ height: 1.4rem;
+ text-align: center;
+ border: 1px solid #dddbda;
+ border-radius: 3px;
+ background-color:#fff;
+}
+
+.THIS .slds-table_header-fixed_container {
+ min-height: 12em;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.html b/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.html
new file mode 100644
index 0000000..8294ccc
--- /dev/null
+++ b/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.html
@@ -0,0 +1,80 @@
+<template>
+ <template if:true={records}>
+ <div class="slds-grid slds-grid_vertical-align-center slds-grid_align-spread">
+ <div class="slds-col"><!--RECORDS PER PAGE-->
+ <div style={paginationVisibility} class="slds-list_inline slds-p-bottom_xx-small customSelect">
+ <label class="slds-text-color_weak slds-p-horizontal_x-small" for="recordsPerPage">Page Size:</label>
+ <div class="slds-select_container">
+ <select class="slds-select" id="recordsPerPage" onchange={handleRecordsPerPage}>
+ <template for:each={pageSizeOptions} for:item="option">
+ <option key={option} value={option}>{option}</option>
+ </template>
+ </select>
+ </div>
+ </div>
+ </div>
+ <!-- <div class="slds-col">
+ <div if:true={showSearchBox}>
+ <div class="slds-p-horizontal_x-small slds-p-bottom_xx-small">
+ <lightning-input label="" type="search" placeholder="Search" variant="label-hidden" onchange={handleKeyChange}></lightning-input>
+ </div>
+ </div>
+ </div> -->
+ </div>
+
+ <div class="slds-grid slds-grid_vertical-align-center slds-grid_align-spread">
+ <div class="slds-col">
+ <div class="slds-col slds-p-bottom_xx-small">
+ <span>
+ <label class="slds-text-color_weak slds-p-horizontal_x-small" >Total: {filtredNum}</label>
+ </span>
+ <span>
+ <label class="slds-text-color_weak slds-p-horizontal_x-small" >Selected: {totalSelected}</label>
+ </span>
+ </div>
+ </div>
+ </div>
+
+
+ <div class="slds-grid slds-grid_vertical-align-center slds-grid_align-spread" >
+ <div class="slds-col" style={tableHeightStyle}>
+ <lightning-datatable key-field={keyField}
+ hide-checkbox-column = {hidecheckboxcolumn}
+ data={recordsToDisplay}
+ columns={columns}
+ max-row-selection={maxRowSelection}
+ onrowselection={getSelectedRows}
+ selected-rows={preSelected}
+ default-sort-direction={defaultSortDirection}
+ sorted-direction={sortDirection}
+ sorted-by={sortedBy}
+ onsort={handelSort}
+ show-row-number-column = {showrownumber}>
+ </lightning-datatable>
+ </div>
+ </div>
+
+ <div class="slds-grid slds-grid_vertical-align-center slds-grid_align-spread" style="padding-top: 0.5em;">
+ <div class="slds-col"></div>
+ <div class="slds-col"></div>
+ <!--PAGE NAVIGATION-->
+ <div class="slds-col">
+ <div style={paginationVisibility}>
+ <div class="slds-col slds-p-bottom_xx-small">
+ <span>
+ <lightning-button-icon icon-name="utility:chevronleft" variant="bare" size="medium" alternative-text="Previous Page" onclick={previousPage}></lightning-button-icon>
+ </span>
+ <label class="slds-text-color_weak slds-p-horizontal_x-small" for="pageNum">Page:</label>
+ <input type="number" id="pageNum" value={pageNumber} maxlength="4" onkeypress={handlePageNumberChange} class="customInput" title="Go to a Page"></input>
+ <span> of <b id="totalPages">{totalPages}</b></span>
+ <span>
+ <template if:true={pageNumber}></template>
+ <lightning-button-icon icon-name="utility:chevronright" variant="bare" size="medium" alternative-text="Next Page" onclick={nextPage} class="slds-p-horizontal_x-small"></lightning-button-icon>
+ </span>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js b/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js
new file mode 100644
index 0000000..a6ede92
--- /dev/null
+++ b/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js
@@ -0,0 +1,273 @@
+import { LightningElement, api,track } from 'lwc';
+import customUnitTemplate from './templates/customUnit.html';
+import customShipmentNumberTemplate from './templates/customShipmentNumber.html';
+import customShippingUnitPriceTemplate from './templates/customShippingUnitPrice.html';
+
+const DELAY = 300;
+const recordsPerPage = [5,10,25,50,75,100];
+const pageNumber = 1;
+const SHOWDIV = 'visibility:visible';
+const HIDEDIV = 'visibility:hidden';
+const DEFAULTHEIGHT = '300';
+
+export default class LwcDatatableUtility extends LightningElement {
+
+ static customTypes = {
+ customUnit: {
+ template: customUnitTemplate,
+ standardCellLayout: true,
+ typeAttributes: ['Id'],
+ },
+ customShipment: {
+ template: customShipmentNumberTemplate,
+ standardCellLayout: true,
+ typeAttributes: ['Id'],
+ },
+ customShipmentUnitPrice: {
+ template: customShippingUnitPriceTemplate,
+ standardCellLayout: true,
+ typeAttributes: ['Id'],
+ }
+ // Other types here
+ }
+
+ // Input Attributes from Parent Componant
+ @api keyField = 'Id';
+ @api showSearchBox = false; //Show/hide search box; valid values are true/false
+ @api showPagination; //Show/hide pagination; valid values are true/false
+ @api pageSizeOptions = recordsPerPage; //Page size options; valid values are array of integers
+ @api totalRecords; //Total no.of records; valid type is Integer
+ @api records; //All records available in the data table; valid type is Array
+ @api maxRowSelection; //All records available in the data table; valid type is Array
+ @api columns = []; //Records to be displayed on the page
+ @api hidecheckboxcolumn = false;
+ @api showrownumber = false;
+
+ tableHeightStyle = 'height: '+ DEFAULTHEIGHT +'px;'; // Set Default Height as 300px
+ @api
+ get tableHeight() {
+ return this.tableHeightStyle;
+ }
+
+ set tableHeight(value) {
+ this.tableHeightStyle = 'height: '+ value +'px;';
+ }
+
+ pageSize; //No.of records to be displayed per page
+ totalPages; //Total no.of pages
+ pageNumber = pageNumber; //Page number
+ searchKey; //Search Input
+ paginationVisibility = SHOWDIV;
+ rowNumberOffset; //Row number
+ preSelected; //preSelectedOnDisplay
+ recordsToDisplay = []; //Records to be displayed on the page
+
+ filteredRecords = []; //Filtered records available in the data table; valid type is Array
+ selectedRecords = []; //OverallSelected records in the data table; valid type is Array
+ pageSelectedRecords = []; //Page Selected rows in the data table; valid type is Array
+ filtredNum; // Total no.of Filtered records; valid type is Integer
+ totalSelected = 0;
+ refreshCurrentData;
+ //SORT
+ defaultSortDirection = 'asc';
+ sortDirection = 'asc';
+ sortedBy;
+
+ //Called after the component finishes inserting to DOM
+ connectedCallback() {
+ console.log('杩涘叆 瀛愮粍浠� connectedCallback ');
+ console.log('this.records = ' + JSON.stringify(this.records));
+ console.log('keyField = ' + this.keyField);
+ if(this.pageSizeOptions && this.pageSizeOptions.length > 0)
+ this.pageSize = this.pageSizeOptions[0];
+ else{
+ this.pageSize = this.totalRecords;
+ this.showPagination = false;
+ }
+ this.paginationVisibility = this.showPagination === false ? HIDEDIV : SHOWDIV;
+ this.filteredRecords = this.records;
+ this.filtredNum = this.totalRecords;
+ this.setRecordsOnPage();
+ }
+
+ handleRecordsPerPage(event){
+ this.pageSize = event.target.value;
+ this.setRecordsOnPage();
+ }
+
+ handlePageNumberChange(event){
+ if(event.keyCode === 13){
+ this.pageNumber = event.target.value;
+ this.setRecordsOnPage();
+ }
+ }
+
+ previousPage(){
+ this.pageNumber = this.pageNumber-1;
+ this.setRecordsOnPage();
+ }
+ nextPage(){
+ this.pageNumber = this.pageNumber+1;
+ this.setRecordsOnPage();
+ }
+
+ @api
+ setRecordsOnPage(){
+ this.recordsToDisplay = [];
+ if(!this.pageSize)
+ this.pageSize = this.filtredNum;
+
+ this.totalPages = Math.ceil(this.filtredNum/this.pageSize);
+
+ this.setPaginationControls();
+ for(let i=(this.pageNumber-1)*this.pageSize; i < this.pageNumber*this.pageSize; i++){
+ if(i === this.filtredNum) break;
+ this.recordsToDisplay.push(this.filteredRecords[i]);
+ }
+
+ this.preSelected = [];
+ this.selectedRecords.forEach((item) => {
+ if(item.selected)
+ this.preSelected.push(item.Id);
+ })
+ let paginatedRecords = new Object();
+ paginatedRecords.recordsToDisplay = this.recordsToDisplay;
+ paginatedRecords.preSelected = this.preSelected;
+ if(this.maxRowSelection === '1' ){
+ this.totalSelected = 0;
+ }
+ if(this.selectedRecords && this.selectedRecords.length > 0){
+ this.refreshCurrentData = true;
+ }
+ }
+
+ setPaginationControls(){
+ // Previous/Next buttons visibility by Total pages
+ if(this.totalPages === 1){
+ this.showPrevious = HIDEDIV;
+ this.showNext = HIDEDIV;
+ }else if(this.totalPages > 1){
+ this.showPrevious = SHOWDIV;
+ this.showNext = SHOWDIV;
+ }
+ // Previous/Next buttons visibility by Page number
+ if(this.pageNumber <= 1){
+ this.pageNumber = 1;
+ this.showPrevious = HIDEDIV;
+ }else if(this.pageNumber >= this.totalPages){
+ this.pageNumber = this.totalPages;
+ this.showNext = HIDEDIV;
+ }
+ // Previous/Next buttons visibility by Pagination visibility
+ if(this.paginationVisibility === HIDEDIV){
+ this.showPrevious = HIDEDIV;
+ this.showNext = HIDEDIV;
+ }
+ }
+
+ handleKeyChange(event) {
+ window.clearTimeout(this.delayTimeout);
+ const searchKey = event.target.value;
+ if(searchKey){
+ this.delayTimeout = setTimeout(() => {
+ //this.paginationVisibility = HIDEDIV;
+ this.setPaginationControls();
+
+ this.searchKey = searchKey;
+ //Use other field name here in place of 'Name' field if you want to search by other field
+ //this.recordsToDisplay = this.records.filter(rec => rec.includes(searchKey));
+ //Search with any column value (Updated as per the feedback)
+ this.filteredRecords = this.records.filter(rec => JSON.stringify(rec).toLowerCase().includes(searchKey.toLowerCase()));
+ this.filtredNum = this.filteredRecords.length;
+ this.setRecordsOnPage();
+ }, DELAY);
+ }else{
+ this.filteredRecords = this.records;
+ this.filtredNum = this.totalRecords;
+ this.paginationVisibility = SHOWDIV;
+ this.setRecordsOnPage();
+ }
+ }
+
+ handelRowsSelected(selectedRows) {
+ console.log(selectedRows.length);
+ this.totalSelected = 0;
+ this.pageSelectedRecords = [];
+ if(this.maxRowSelection != '1' && this.recordsToDisplay &&
+ this.recordsToDisplay.length > 0 &&
+ ((selectedRows.length === 0 && !this.refreshCurrentData) || selectedRows.length > 0) ){
+ this.recordsToDisplay.forEach((item)=>{
+ var row = new Object();
+ row.Id = item.Id;
+ if(selectedRows.includes(item.Id)){
+ row.selected = true;
+ }else{
+ row.selected = false;
+ }
+ this.pageSelectedRecords.push(row) ;
+ });
+ }
+ // To store previous row Selection
+ if(this.selectedRecords.length == 0 ){
+ this.selectedRecords = this.pageSelectedRecords;
+ }
+ this.selectedRecords = this.mergeObjectArray(this.selectedRecords, this.pageSelectedRecords, "Id");
+ if(this.maxRowSelection === '1' && selectedRows && selectedRows.length > 0){
+ this.totalSelected = 1;
+ }else{
+ let i=0;
+ this.selectedRecords.forEach(item => {
+ if(item.selected){
+ i++;
+ this.totalSelected = i;
+ }
+ })
+ //this.totalSelected = this.totalSelected ===1 && selectedRows.length ===0? 0: this.totalSelected;
+ }
+ const filterSelected = this.selectedRecords.filter(({ selected }) => selected === true );
+ this.dispatchEvent(new CustomEvent('setselectedrecords', {detail: filterSelected})); //Send records to display on table to the parent component
+ this.refreshCurrentData = false;
+ }
+
+ mergeObjectArray(firstArray, secondArray, prop){
+ var reduced = firstArray.filter( aitem => ! secondArray.find ( bitem => aitem[prop] === bitem[prop]) )
+ //let arr3 = arr1.map((item, i) => Object.assign({}, item, arr2[i]));
+ return reduced.concat(secondArray);
+ }
+
+ getSelectedRows(event) {
+ const selectedRows = event.detail.selectedRows;
+ let selectedRecordIds = [];
+ // Display that fieldName of the selected rows
+ for (let i = 0; i < selectedRows.length; i++){
+ selectedRecordIds.push(selectedRows[i].Id);
+ }
+ this.handelRowsSelected(selectedRecordIds);
+ }
+
+ handelSort(event){
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.filteredRecords];
+ cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ this.filteredRecords = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ this.setRecordsOnPage();
+ }
+
+ sortBy(field, reverse, primer) {
+ const key = primer
+ ? function(x) {
+ return primer(x[field]);
+ }
+ : function(x) {
+ return x[field];
+ };
+
+ return function(a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
+ };
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js-meta.xml b/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js-meta.xml
new file mode 100644
index 0000000..4087371
--- /dev/null
+++ b/force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js-meta.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>48.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightning__AppPage</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lwcDatatableUtility/templates/customShipmentNumber.html b/force-app/main/default/lwc/lwcDatatableUtility/templates/customShipmentNumber.html
new file mode 100644
index 0000000..62d1cfc
--- /dev/null
+++ b/force-app/main/default/lwc/lwcDatatableUtility/templates/customShipmentNumber.html
@@ -0,0 +1,11 @@
+<template>
+ <lightning-input
+ type="text"
+ name="shipmentNumber"
+ label="deliveryOrderNo"
+ variant="label-hidden"
+ onchange={dataChange}
+ data-field="shipmentNumber"
+ value={shipmentNumber}
+ ></lightning-input>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lwcDatatableUtility/templates/customShippingUnitPrice.html b/force-app/main/default/lwc/lwcDatatableUtility/templates/customShippingUnitPrice.html
new file mode 100644
index 0000000..d10e147
--- /dev/null
+++ b/force-app/main/default/lwc/lwcDatatableUtility/templates/customShippingUnitPrice.html
@@ -0,0 +1,11 @@
+<template>
+ <lightning-input
+ type="number"
+ name="shipmentUnitPrice"
+ label="deliveryOrderNo"
+ variant="label-hidden"
+ onchange={dataChange}
+ data-field="shipmentUnitPrice"
+ value={shipmentUnitPrice}
+ ></lightning-input>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lwcDatatableUtility/templates/customUnit.html b/force-app/main/default/lwc/lwcDatatableUtility/templates/customUnit.html
new file mode 100644
index 0000000..169416c
--- /dev/null
+++ b/force-app/main/default/lwc/lwcDatatableUtility/templates/customUnit.html
@@ -0,0 +1,8 @@
+<!-- sldsValidatorIgnore -->
+<!-- sldsValidatorIgnore -->
+<template>
+ <select>
+ <option value="鐩�">鐩�</option>
+ <option value="涓�">涓�</option>
+ </select>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/myCustomTypeDatatable/customName.html b/force-app/main/default/lwc/myCustomTypeDatatable/customName.html
new file mode 100644
index 0000000..f33c4ea
--- /dev/null
+++ b/force-app/main/default/lwc/myCustomTypeDatatable/customName.html
@@ -0,0 +1,6 @@
+<template>
+ <lightning-badge
+ label={typeAttributes.accountName}
+ icon-name="standard:account">
+ </lightning-badge>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/myCustomTypeDatatable/customNumber.html b/force-app/main/default/lwc/myCustomTypeDatatable/customNumber.html
new file mode 100644
index 0000000..ae6203e
--- /dev/null
+++ b/force-app/main/default/lwc/myCustomTypeDatatable/customNumber.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="slds-p-around_x-small">
+ <lightning-formatted-number value={value} class="slds-float_right"></lightning-formatted-number>
+ <lightning-icon icon-name={typeAttributes.status} alternative-text="Employer Status"></lightning-icon>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/myCustomTypeDatatable/customShipmentNumber.html b/force-app/main/default/lwc/myCustomTypeDatatable/customShipmentNumber.html
new file mode 100644
index 0000000..62d1cfc
--- /dev/null
+++ b/force-app/main/default/lwc/myCustomTypeDatatable/customShipmentNumber.html
@@ -0,0 +1,11 @@
+<template>
+ <lightning-input
+ type="text"
+ name="shipmentNumber"
+ label="deliveryOrderNo"
+ variant="label-hidden"
+ onchange={dataChange}
+ data-field="shipmentNumber"
+ value={shipmentNumber}
+ ></lightning-input>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/myCustomTypeDatatable/customShippingUnitPrice.html b/force-app/main/default/lwc/myCustomTypeDatatable/customShippingUnitPrice.html
new file mode 100644
index 0000000..d10e147
--- /dev/null
+++ b/force-app/main/default/lwc/myCustomTypeDatatable/customShippingUnitPrice.html
@@ -0,0 +1,11 @@
+<template>
+ <lightning-input
+ type="number"
+ name="shipmentUnitPrice"
+ label="deliveryOrderNo"
+ variant="label-hidden"
+ onchange={dataChange}
+ data-field="shipmentUnitPrice"
+ value={shipmentUnitPrice}
+ ></lightning-input>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/myCustomTypeDatatable/customUnit.html b/force-app/main/default/lwc/myCustomTypeDatatable/customUnit.html
new file mode 100644
index 0000000..169416c
--- /dev/null
+++ b/force-app/main/default/lwc/myCustomTypeDatatable/customUnit.html
@@ -0,0 +1,8 @@
+<!-- sldsValidatorIgnore -->
+<!-- sldsValidatorIgnore -->
+<template>
+ <select>
+ <option value="鐩�">鐩�</option>
+ <option value="涓�">涓�</option>
+ </select>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.html b/force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.html
new file mode 100644
index 0000000..ba53413
--- /dev/null
+++ b/force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.html
@@ -0,0 +1,2 @@
+<template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js b/force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js
new file mode 100644
index 0000000..5d161b7
--- /dev/null
+++ b/force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js
@@ -0,0 +1,41 @@
+import { LightningElement,api,wire,track } from 'lwc';
+import LightningDatatable from 'lightning/datatable';
+import customUnitTemplate from './customUnit.html';
+import customShipmentNumberTemplate from './customShipmentNumber.html';
+import customShippingUnitPriceTemplate from './customShippingUnitPrice.html';
+import customNameTemplate from './customName.html';
+import customNumberTemplate from './customNumber.html';
+
+
+export default class MyCustomTypeDatatable extends LightningDatatable {
+
+
+ // static customTypes = {
+ // customUnit: {
+ // template: customUnitTemplate,
+ // //typeAttributes: ['value'],
+ // },
+ // customShipment: {
+ // template: customShipmentNumberTemplate,
+ // //typeAttributes: ['value'],
+ // },
+ // customShipmentUnitPrice: {
+ // template: customShippingUnitPriceTemplate,
+ // //typeAttributes: ['value'],
+ // }
+ // // Other types here
+ // }
+
+ static customTypes = {
+ customName: {
+ template: customNameTemplate,
+ standardCellLayout: true,
+ typeAttributes: ['accountName'],
+ }
+ // Other types here
+ }
+
+ connectedCallback(){
+ console.log('MyCustomTypeDatatable enter')
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js-meta.xml b/force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/navigateToRecord/navigateToRecord.html b/force-app/main/default/lwc/navigateToRecord/navigateToRecord.html
new file mode 100644
index 0000000..d1cb4b2
--- /dev/null
+++ b/force-app/main/default/lwc/navigateToRecord/navigateToRecord.html
@@ -0,0 +1,3 @@
+<template>
+ <a href="#" onclick={navigate}>{label}</a>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/navigateToRecord/navigateToRecord.js b/force-app/main/default/lwc/navigateToRecord/navigateToRecord.js
new file mode 100644
index 0000000..7d499a1
--- /dev/null
+++ b/force-app/main/default/lwc/navigateToRecord/navigateToRecord.js
@@ -0,0 +1,20 @@
+import { LightningElement, api } from 'lwc';
+import { NavigationMixin } from 'lightning/navigation';
+
+export default class NavigateToRecord extends NavigationMixin(
+ LightningElement
+) {
+ @api recordId;
+ @api label;
+
+ navigate(event) {
+ event.preventDefault();
+ this[NavigationMixin.Navigate]({
+ type: 'standard__recordPage',
+ attributes: {
+ recordId: this.recordId,
+ actionName: 'view'
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/navigateToRecord/navigateToRecord.js-meta.xml b/force-app/main/default/lwc/navigateToRecord/navigateToRecord.js-meta.xml
new file mode 100644
index 0000000..b9a3113
--- /dev/null
+++ b/force-app/main/default/lwc/navigateToRecord/navigateToRecord.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>54.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/paginator/paginator.css b/force-app/main/default/lwc/paginator/paginator.css
new file mode 100644
index 0000000..12cf97d
--- /dev/null
+++ b/force-app/main/default/lwc/paginator/paginator.css
@@ -0,0 +1,12 @@
+.customSelect select {
+ padding-right: 1.25rem;
+ min-height: inherit;
+ line-height: normal;
+ height: 1.4rem;
+}
+.customSelect label {
+ margin-top: .1rem;
+}
+.customSelect .slds-select_container::before {
+ border-bottom: 0;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/paginator/paginator.html b/force-app/main/default/lwc/paginator/paginator.html
new file mode 100644
index 0000000..3add3b3
--- /dev/null
+++ b/force-app/main/default/lwc/paginator/paginator.html
@@ -0,0 +1,42 @@
+<template>
+ <lightning-card>
+ <div class="slds-grid slds-grid_vertical-align-center slds-grid_align-spread">
+ <div class="slds-col"><!--RECORDS PER PAGE-->
+ <div class="slds-list_inline slds-p-bottom_xx-small customSelect">
+ <label class="slds-text-color_weak slds-p-horizontal_x-small" for="recordsPerPage">Page Size:</label>
+ <div class="slds-select_container">
+ <select class="slds-select" id="recordsPerPage" onchange={handleRecordsPerPage}>
+ <template for:each={pageSizeOptions} for:item="option">
+ <option key={option} value={option}>{option}</option>
+ </template>
+ </select>
+ </div>
+ </div>
+ </div>
+ <div class="slds-align_absolute-center">
+ <lightning-layout>
+ <lightning-layout-item>
+ <lightning-button icon-name="utility:jump_to_left" onclick={handleFirst} class="first"
+ disabled={previousButtonDisabled}></lightning-button>
+ </lightning-layout-item>
+ <lightning-layout-item>
+ <lightning-button icon-name="utility:chevronleft" onclick={handlePrevious} class="previous"
+ disabled={previousButtonDisabled}></lightning-button>
+ </lightning-layout-item>
+ <lightning-layout-item flexibility="grow"></lightning-layout-item>
+ <span class="slds-badge slds-badge_lightest">
+ {recordStart}-{recordEnd} 鍏� {totalRecords}涓�
+ </span>
+ <lightning-layout-item>
+ <lightning-button icon-name="utility:chevronright" onclick={handleNext}
+ class="next" disabled={nextButtonDisabled}></lightning-button>
+ </lightning-layout-item>
+ <lightning-layout-item>
+ <lightning-button icon-name="utility:jump_to_right" onclick={handleLast} class="last"
+ disabled={nextButtonDisabled}></lightning-button>
+ </lightning-layout-item>
+ </lightning-layout>
+ </div>
+ </div>
+ </lightning-card>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/paginator/paginator.js b/force-app/main/default/lwc/paginator/paginator.js
new file mode 100644
index 0000000..290042f
--- /dev/null
+++ b/force-app/main/default/lwc/paginator/paginator.js
@@ -0,0 +1,32 @@
+import { LightningElement, api } from 'lwc';
+
+export default class Paginator extends LightningElement {
+ @api previousButtonDisabled;
+ @api nextButtonDisabled;
+ @api recordStart;
+ @api recordEnd;
+ @api totalRecords;
+ @api pageSizeOptions;
+
+ handlePrevious() {
+ this.dispatchEvent(new CustomEvent('previous'));
+ }
+
+ handleNext() {
+ this.dispatchEvent(new CustomEvent('next'));
+ }
+
+ handleFirst() {
+ this.dispatchEvent(new CustomEvent('first'));
+ }
+
+ handleLast() {
+ this.dispatchEvent(new CustomEvent('last'));
+ }
+
+ handleRecordsPerPage(event){
+ let perpages = event.target.value;
+ let pageschangeEvent = new CustomEvent("pageschange",{detail:perpages});
+ this.dispatchEvent(pageschangeEvent);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/paginator/paginator.js-meta.xml b/force-app/main/default/lwc/paginator/paginator.js-meta.xml
new file mode 100644
index 0000000..b9a3113
--- /dev/null
+++ b/force-app/main/default/lwc/paginator/paginator.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>54.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/permissionsets/Community_LEX_PS.permissionset-meta.xml b/force-app/main/default/permissionsets/Community_LEX_PS.permissionset-meta.xml
new file mode 100644
index 0000000..449d434
--- /dev/null
+++ b/force-app/main/default/permissionsets/Community_LEX_PS.permissionset-meta.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
+ <classAccesses>
+ <apexClass>LexArriveGoodsController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexArriveGoodsMainController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexArriveGsDetailsController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexCancelRemoveBoxController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexConInvoiceList</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexConInvoiceViewController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexConInvoicedetailsController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexConsumableAccountController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexConsumableAccountInfoController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexConsumableAccountSOQL</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexConsumableController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexConsumableGoodsInfo</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexConsumableOrderManageController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexDealerInquiryModifyStateController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexInventoryController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexInventoryListController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexInventoryViewController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexLicenceReminderController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexOutboundorderImportController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexOverdueStockController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexProductLimitEditController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexRemoveBoxController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexSaleAndDeliveryController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexSaleOrderController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexSearchContractController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexSearchHospitalController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexSummonsCreatController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexTopPageController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexUpAccountProLimit</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>LexUtility</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <classAccesses>
+ <apexClass>lexSearchAgencyHospitalController</apexClass>
+ <enabled>true</enabled>
+ </classAccesses>
+ <flowAccesses>
+ <enabled>true</enabled>
+ <flow>CommunityWeeklyReport</flow>
+ </flowAccesses>
+ <hasActivationRequired>false</hasActivationRequired>
+ <label>Community LEX PS</label>
+ <objectPermissions>
+ <allowCreate>true</allowCreate>
+ <allowDelete>false</allowDelete>
+ <allowEdit>false</allowEdit>
+ <allowRead>true</allowRead>
+ <modifyAllRecords>false</modifyAllRecords>
+ <object>Agency_Report_Header__c</object>
+ <viewAllRecords>false</viewAllRecords>
+ </objectPermissions>
+ <objectPermissions>
+ <allowCreate>true</allowCreate>
+ <allowDelete>false</allowDelete>
+ <allowEdit>false</allowEdit>
+ <allowRead>true</allowRead>
+ <modifyAllRecords>false</modifyAllRecords>
+ <object>Agency_Report__c</object>
+ <viewAllRecords>false</viewAllRecords>
+ </objectPermissions>
+ <userPermissions>
+ <enabled>true</enabled>
+ <name>ChatterEnabledForUser</name>
+ </userPermissions>
+ <userPermissions>
+ <enabled>true</enabled>
+ <name>ViewContent</name>
+ </userPermissions>
+</PermissionSet>
diff --git a/force-app/main/default/triggers/ContentDocumentLink.trigger b/force-app/main/default/triggers/ContentDocumentLink.trigger
new file mode 100644
index 0000000..fca83c5
--- /dev/null
+++ b/force-app/main/default/triggers/ContentDocumentLink.trigger
@@ -0,0 +1,68 @@
+trigger ContentDocumentLink on ContentDocumentLink (before delete, after insert) {
+
+ system.debug('enter ContentDocumentLink');
+ system.debug('Trigger.new = ' + (List<ContentDocumentLink>) Trigger.new);
+ system.debug('Trigger.old = ' + (List<ContentDocumentLink>) Trigger.old);
+
+ String invoiceStart = System.Label.invoiceStart;
+ System.debug('invoiceStart = ' + invoiceStart);
+ List<String> rentalIds = new List<String>();
+ List<String> attIds = new List<String>();
+ // List<String> rentaldelIds = new List<String>();
+ // List<String> attdelIds = new List<String>();
+
+ if (Trigger.isAfter && Trigger.isInsert) {
+ System.debug('Trigger.isAfter && Trigger.isInsert');
+ for (ContentDocumentLink cdl : Trigger.new) {
+ System.debug('cdl.LinkedEntityId = ' + cdl.LinkedEntityId);
+ System.debug('cdl.ContentDocumentId = ' + cdl.ContentDocumentId);
+ if (String.valueOf(cdl.LinkedEntityId).startsWith(invoiceStart)) {
+ System.debug('String.valueOf(cdl.LinkedEntityId).startsWith(invoiceStart)');
+ rentalIds.add(cdl.LinkedEntityId);
+ attIds.add(cdl.ContentDocumentId);
+ System.debug('rentalIds = ' + rentalIds);
+ System.debug('attIds = ' + attIds);
+ }
+ }
+ }
+
+ // if (Trigger.isBefore && Trigger.isDelete) {
+ // System.debug('Trigger.isBefore && Trigger.isDelete');
+ // for (ContentDocumentLink cdl : Trigger.old) {
+ // System.debug('cdl.LinkedEntityId = ' + cdl.LinkedEntityId);
+ // System.debug('cdl.ContentDocumentId = ' + cdl.ContentDocumentId);
+ // if (String.valueOf(cdl.LinkedEntityId).startsWith(invoiceStart)) {
+ // System.debug('String.valueOf(cdl.LinkedEntityId).startsWith(invoiceStart)');
+ // rentaldelIds.add(cdl.LinkedEntityId);
+ // attdelIds.add(cdl.ContentDocumentId);
+ // System.debug('rentaldelIds = ' + rentaldelIds);
+ // System.debug('attdelIds = ' + attdelIds);
+ // }
+ // }
+ // }
+
+
+ if (rentalIds.size() > 0) {
+ List<Consumable_order__c> rentalList = new List<Consumable_order__c>();
+ for (Consumable_order__c ra : [SELECT Id FROM Consumable_order__c WHERE Id IN :rentalIds]) {
+ ra.Consumable_pdf_insert_day__c = Date.today();
+ ra.Order_Attachment__c = attIds[0];
+ rentalList.add(ra);
+ }
+ System.debug('rentalList = ' + rentalList);
+ ControllerUtil.updRentalApplyList(rentalList);
+ }
+
+ // if (rentaldelIds.size() > 0) {
+ // List<Consumable_accessories_invoice__c> rentaldelList = new List<Consumable_accessories_invoice__c>();
+ // for (Consumable_accessories_invoice__c ra : [
+ // SELECT Id
+ // FROM Consumable_accessories_invoice__c
+ // WHERE Invoice_code__c IN :rentaldelIds AND Attachment_ID__c IN :attdelIds
+ // ]) {
+ // rentaldelList.add(ra);
+ // }
+ // System.debug('rentaldelList = ' + rentaldelList);
+ // ControllerUtil.delConsumableAccessoriesInvoiceSet(rentaldelList);
+ // }
+}
\ No newline at end of file
diff --git a/force-app/main/default/triggers/ContentDocumentLink.trigger-meta.xml b/force-app/main/default/triggers/ContentDocumentLink.trigger-meta.xml
new file mode 100644
index 0000000..b01a1f0
--- /dev/null
+++ b/force-app/main/default/triggers/ContentDocumentLink.trigger-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>57.0</apiVersion>
+ <status>Active</status>
+</ApexTrigger>
diff --git a/force-app/main/default/triggers/ContentDocumentTrigger.trigger b/force-app/main/default/triggers/ContentDocumentTrigger.trigger
new file mode 100644
index 0000000..ed34043
--- /dev/null
+++ b/force-app/main/default/triggers/ContentDocumentTrigger.trigger
@@ -0,0 +1,64 @@
+trigger ContentDocumentTrigger on ContentDocument(before delete) {
+ System.debug('enter ContentDocumentTrigger');
+ // system.debug('Trigger.new = ' + (List<ContentDocument>) Trigger.new);
+ // system.debug('Trigger.old = ' + (List<ContentDocument>) Trigger.old);
+
+ String invoiceStart = System.Label.invoiceStart;
+ // List<String> rentalIds = new List<String>();
+ // List<String> attIds = new List<String>();
+ List<String> rentaldelIds = new List<String>();
+ List<String> attdelIds = new List<String>();
+
+ // if (Trigger.isAfter && Trigger.isInsert) {
+ // for (ContentDocument cd : Trigger.new) {
+ // System.debug('cd.Id = ' + cd.Id);
+ // ContentDocumentLink cdl = [SELECT id, LinkedEntityId FROM ContentDocumentLink WHERE ContentDocumentId = :cd.Id];
+ // System.debug('cdl.LinkedEntityId = ' + cdl.LinkedEntityId);
+ // if (String.valueOf(cdl.LinkedEntityId).startsWith(invoiceStart)) {
+ // rentalIds.add(cdl.LinkedEntityId);
+ // attIds.add(cd.Id);
+ // }
+ // }
+ // }
+
+ if (Trigger.isBefore && Trigger.isDelete) {
+ for (ContentDocument cd : Trigger.old) {
+ System.debug('cd.Id = ' + cd.Id);
+ List<ContentDocumentLink> cdlList = [SELECT id, LinkedEntityId FROM ContentDocumentLink WHERE ContentDocumentId = :cd.Id];
+ System.debug('cdlList = ' + cdlList);
+ System.debug('cd.Id = ' + cd.Id);
+ for (ContentDocumentLink cdl : cdlList) {
+ if (String.valueOf(cdl.LinkedEntityId).startsWith(invoiceStart)) {
+ System.debug('String.valueOf(cdl.LinkedEntityId).startsWith(invoiceStart)');
+ rentaldelIds.add(cdl.LinkedEntityId);
+ attdelIds.add(cd.Id);
+ }
+ }
+ }
+ }
+
+ // if (rentalIds.size() > 0) {
+ // List<Consumable_order__c> rentalList = new List<Consumable_order__c>();
+ // for (Consumable_order__c ra : [SELECT Id FROM Consumable_order__c WHERE Id IN :rentalIds]) {
+ // ra.Consumable_pdf_insert_day__c = Date.today();
+ // ra.Order_Attachment__c = attIds[0];
+ // rentalList.add(ra);
+ // }
+ // ControllerUtil.updRentalApplyList(rentalList);
+ // }
+
+ if (rentaldelIds.size() > 0) {
+ System.debug('rentaldelIds = ' + rentaldelIds);
+ System.debug('attdelIds = ' + attdelIds);
+ List<Consumable_accessories_invoice__c> rentaldelList = new List<Consumable_accessories_invoice__c>();
+ for (Consumable_accessories_invoice__c ra : [
+ SELECT Id
+ FROM Consumable_accessories_invoice__c
+ WHERE Invoice_code__c IN :rentaldelIds AND Attachment_ID__c IN :attdelIds
+ ]) {
+ rentaldelList.add(ra);
+ }
+ System.debug('rentaldelList = ' + rentaldelList);
+ ControllerUtil.delConsumableAccessoriesInvoiceSet(rentaldelList);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/triggers/ContentDocumentTrigger.trigger-meta.xml b/force-app/main/default/triggers/ContentDocumentTrigger.trigger-meta.xml
new file mode 100644
index 0000000..b01a1f0
--- /dev/null
+++ b/force-app/main/default/triggers/ContentDocumentTrigger.trigger-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>57.0</apiVersion>
+ <status>Active</status>
+</ApexTrigger>
diff --git a/force-app/main/default/triggers/ContentVersionTrigger.trigger b/force-app/main/default/triggers/ContentVersionTrigger.trigger
new file mode 100644
index 0000000..80888c5
--- /dev/null
+++ b/force-app/main/default/triggers/ContentVersionTrigger.trigger
@@ -0,0 +1,48 @@
+trigger ContentVersionTrigger on ContentVersion (after insert, before delete) {
+ // System.debug('enter ContentVersionTrigger');
+ // List<String> rentalIds = new List<String>();
+ // List<String> attIds = new List<String>();
+ // List<String> rentaldelIds = new List<String>();
+ // List<String> attdelIds = new List<String>();
+
+ // if (Trigger.isAfter && Trigger.isInsert) {
+ // for (ContentVersion cv : Trigger.new) {
+ // if (String.valueOf(cv.FirstPublishLocationId).startsWith('a2K')) {
+ // rentalIds.add(cv.FirstPublishLocationId);
+ // attIds.add(cv.Id);
+ // }
+ // }
+ // }
+
+ // if (Trigger.isBefore && Trigger.isDelete) {
+ // for (ContentVersion cv : Trigger.old) {
+ // if (String.valueOf(cv.FirstPublishLocationId).startsWith('a2K')) {
+ // rentaldelIds.add(cv.FirstPublishLocationId);
+ // attdelIds.add(cv.Id);
+ // }
+ // }
+ // }
+
+ // if (rentalIds.size() > 0) {
+ // List<Consumable_order__c> rentalList = new List<Consumable_order__c>();
+ // for (Consumable_order__c ra : [SELECT Id FROM Consumable_order__c WHERE Id IN :rentalIds]) {
+ // ra.Consumable_pdf_insert_day__c = Date.today();
+ // ra.Order_Attachment__c = attIds[0];
+ // rentalList.add(ra);
+ // }
+ // ControllerUtil.updRentalApplyList(rentalList);
+ // }
+
+ // if (rentaldelIds.size() > 0) {
+ // List<Consumable_accessories_invoice__c> rentaldelList = new List<Consumable_accessories_invoice__c>();
+ // for (Consumable_accessories_invoice__c ra : [
+ // SELECT Id
+ // FROM Consumable_accessories_invoice__c
+ // WHERE Invoice_code__c IN :rentaldelIds AND Attachment_ID__c IN :attdelIds
+ // ]) {
+ // rentaldelList.add(ra);
+ // }
+ // System.debug('rentaldelList = ' + rentaldelList);
+ // ControllerUtil.delConsumableAccessoriesInvoiceSet(rentaldelList);
+ // }
+}
\ No newline at end of file
diff --git a/force-app/main/default/triggers/ContentVersionTrigger.trigger-meta.xml b/force-app/main/default/triggers/ContentVersionTrigger.trigger-meta.xml
new file mode 100644
index 0000000..24523ca
--- /dev/null
+++ b/force-app/main/default/triggers/ContentVersionTrigger.trigger-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexTrigger>
--
Gitblit v1.9.1