buli
2023-07-14 744f42c5496e656a1f9927740a3b37c0b97a6cba
lexcommunityupload0714
9个文件已添加
154个文件已修改
38424 ■■■■ 已修改文件
.sf/config.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/AgencyAccount/AgencyAccount.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/CreateTarget/CreateTarget.cmp 549 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/CreateTarget/CreateTarget.cmp-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/CreateTarget/CreateTarget.css 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/CreateTarget/CreateTargetHelper.js 570 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImport.cmp 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.auradoc 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.css 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.design 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.svg 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Controller.js 396 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Helper.js 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Renderer.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.cmp 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.css 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityController.js 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js 83 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.cmp 1012 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.css 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportController.js 151 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js 3744 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp 756 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReport.css 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReportController.js 138 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js 2801 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ArriveGoodsController.cls 3720 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ArriveGoodsControllerTest.cls 1842 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ArriveGoodsControllerTestV2.cls 107 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ArriveGoodsControllerTestV2.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/Batch_FixAttachmentToFiles.cls 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/DealerInquiryModifyStateController.cls 183 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGoodsControllerTest.cls 235 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGoodsControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGoodsControllerTest1.cls 121 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGoodsControllerTest1.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGoodsMainController.cls 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls 163 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexCancelRemoveBoxController.cls 487 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls 544 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoiceListTest.cls 182 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoiceListTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoiceViewController.cls 491 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoiceViewControllerTest.cls 2825 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoiceViewControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoicedetailsController.cls 195 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls 211 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountController.cls 184 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountControllerTest.cls 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountSOQL.cls 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountSOQLTest.cls 100 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountSOQLTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableController.cls 674 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableControllerTest.cls 879 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableGoodsInfoTest.cls 610 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableGoodsInfoTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableOrderManageController.cls 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls 121 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryController.cls 548 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryControllerTest.cls 697 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryListController.cls 104 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryListControllerTest.cls 106 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryListControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryViewControllerTest.cls 759 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryViewControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexLicenceReminderControllerTest.cls 157 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexLicenceReminderControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexOutboundorderImportController.cls 220 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexOutboundorderImportControllerTest.cls 520 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexOutboundorderImportControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexOverdueStockController.cls 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexOverdueStockControllerTest.cls 139 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexOverdueStockControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexProductLimitEditControllerTest.cls 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexProductLimitEditControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexRemoveBoxControllerTest.cls 468 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexRemoveBoxControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSaleOrderController.cls 408 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSaleOrderControllerTest.cls 1084 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSaleOrderControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSearchContractControllerTest.cls 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSearchContractControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSearchHospitalControllerTest.cls 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSearchHospitalControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSummonsCreatController.cls 812 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSummonsCreatControllerTest.cls 1837 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSummonsCreatControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexTopPageControllerTest.cls 226 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexTopPageControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexUpAccountProLimit.cls 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls 163 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexUtilityTest.cls 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexUtilityTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LookupSearchResultTest.cls 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LookupSearchResultTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ResponseBodyLWCTest.cls 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ResponseBodyLWCTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/contentassets/OlympusCommunityLoginBG.asset-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/contentassets/OlympusCommunityLogo.asset-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.html 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.html 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customMydrComp/customMydrComp.html 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customMydrComp/customMydrComp.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customMydrComp/customMydrComp.js-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customOutputGood/customOutputGood.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html 107 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js 574 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js 330 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html 335 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js 1369 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumable/lexConsumable.html 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumable/lexConsumable.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexInventory/lexInventory.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexInventory/lexInventory.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js 270 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTopPage/lexTopPage.html 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTopPage/lexTopPage.js 508 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/paginator/paginator.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/paginator/paginator.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/DealerInquiryModifyState.page 732 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/DealerInquiryModifyState.page-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/permissionsets/Community_Consumable_LEX_PS.permissionset-meta.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger 502 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ContentDocumentLink.trigger 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ContentDocumentTrigger.trigger 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest/LEXC02packagelexcommunityupdate.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.sf/config.json
@@ -1,3 +1,3 @@
{
  "target-org": "OlympusProd"
  "target-org": "OlympusStageEnv"
}
force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp
@@ -12,11 +12,14 @@
    <ltng:require scripts="{! $Resource.jquery183minjs }" />
    <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" afterScriptsLoaded="{!c.scriptsLoaded}" />
    <aura:renderIf isTrue="{!v.login}">
        <div class="slds-spinner_container height100vh">
        <!-- add by Deloitte-Link 2023-6-19 -->
        <div class="weeklyReportSpinner">
            <div class="slds-spinner_container">
            <div class="slds-spinner--brand slds-spinner slds-spinner--medium" role="alert">
                <span class="slds-assistive-text">Loading</span>
                    <span id="aa" class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
                </div>
            </div>
        </div>
    </aura:renderIf>
@@ -77,7 +80,8 @@
            
            <div class="slds-truncate">
                <a href="{!'/partner/s/agency-contact/' + item.Id}" style="position: relative;">
                    {!item.Name}
                    <span class="encrypt">{!item.Name}</span>
                    <span class="decrypt">{!item.awsdata.name}</span>
                </a>
            </div>
          </th>
force-app/main/default/aura/AgencyAccount/AgencyAccount.css
@@ -19,3 +19,14 @@
.THIS tr:hover .encrypt{
    display: none;
}
/* add by Deloitte-Link 2023-6-19 start*/
.THIS .weeklyReportSpinner{
    top:100px;
}
.THIS .slds-spinner_container{
    position: absolute;
    top:100px;
}
/* add by Deloitte-Link 2023-6-19 end*/
force-app/main/default/aura/CreateTarget/CreateTarget.cmp
@@ -1,8 +1,4 @@
<aura:component
  controller="CreateTargetCmp"
  implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,forceCommunity:availableForAllPageTypes"
  access="global"
>
<aura:component controller="CreateTargetCmp" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,forceCommunity:availableForAllPageTypes" access="global" >
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
  <aura:attribute name="recordId" type="Id" />
  <aura:attribute name="hospital" type="string" default="" />
@@ -19,151 +15,43 @@
  <aura:attribute name="OTHAmount" type="string" default="0.00" />
  <aura:attribute name="OCMTerm" type="string" default="" />
  <aura:attribute name="button_text" type="string" default="新建" />
  <aura:handler
    name="change"
    value="{!v.record.Agency_Hospital__c}"
    action="{!c.hosChange}"
  />
    <aura:handler name="change" value="{!v.record.Agency_Hospital__c}" action="{!c.hosChange}"/>
  <aura:attribute name="hospitalList" type="sobject[]" />
  <aura:attribute
    name="record"
    type="Agency_Opportunity__c"
    default="{'sobjectType':'Agency_Opportunity__c'}"
  />
  <aura:handler
    name="change"
    value="{!v.recordET.Product_Category1__c}"
    action="{!c.productcategoryETChange1}"
  />
  <aura:handler
    name="change"
    value="{!v.recordET.Product_Category2__c}"
    action="{!c.productcategoryETChange2}"
  />
  <aura:handler
    name="change"
    value="{!v.recordET.Product_Category3__c}"
    action="{!c.productcategoryETChange3}"
  />
    <aura:attribute name="record" type="Agency_Opportunity__c" default="{'sobjectType':'Agency_Opportunity__c'}"/>
    <aura:handler name="change" value="{!v.recordET.Product_Category1__c}" action="{!c.productcategoryETChange1}"/>
    <aura:handler name="change" value="{!v.recordET.Product_Category2__c}" action="{!c.productcategoryETChange2}"/>
    <aura:handler name="change" value="{!v.recordET.Product_Category3__c}" action="{!c.productcategoryETChange3}"/>
  <aura:handler
    name="change"
    value="{!v.recordBF.Product_Category1__c}"
    action="{!c.productcategoryBFChange1}"
  />
  <aura:handler
    name="change"
    value="{!v.recordBF.Product_Category2__c}"
    action="{!c.productcategoryBFChange2}"
  />
  <aura:handler
    name="change"
    value="{!v.recordBF.Product_Category3__c}"
    action="{!c.productcategoryBFChange3}"
  />
  <aura:handler
    name="change"
    value="{!v.recordGS.Product_Category1__c}"
    action="{!c.productcategoryGSChange1}"
  />
  <aura:handler
    name="change"
    value="{!v.recordGS.Product_Category2__c}"
    action="{!c.productcategoryGSChange2}"
  />
  <aura:handler
    name="change"
    value="{!v.recordGS.Product_Category3__c}"
    action="{!c.productcategoryGSChange3}"
  />
  <aura:handler
    name="change"
    value="{!v.recordURO.Product_Category1__c}"
    action="{!c.productcategoryUROChange1}"
  />
  <aura:handler
    name="change"
    value="{!v.recordURO.Product_Category2__c}"
    action="{!c.productcategoryUROChange2}"
  />
  <aura:handler
    name="change"
    value="{!v.recordURO.Product_Category3__c}"
    action="{!c.productcategoryUROChange3}"
  />
  <aura:handler
    name="change"
    value="{!v.recordGYN.Product_Category1__c}"
    action="{!c.productcategoryGYNChange1}"
  />
  <aura:handler
    name="change"
    value="{!v.recordGYN.Product_Category2__c}"
    action="{!c.productcategoryGYNChange2}"
  />
  <aura:handler
    name="change"
    value="{!v.recordGYN.Product_Category3__c}"
    action="{!c.productcategoryGYNChange3}"
  />
  <aura:handler
    name="change"
    value="{!v.recordENT.Product_Category1__c}"
    action="{!c.productcategoryENTChange1}"
  />
  <aura:handler
    name="change"
    value="{!v.recordENT.Product_Category2__c}"
    action="{!c.productcategoryENTChange2}"
  />
  <aura:handler
    name="change"
    value="{!v.recordENT.Product_Category3__c}"
    action="{!c.productcategoryENTChange3}"
  />
  <aura:handler
    name="change"
    value="{!v.recordOTH.Product_Category1__c}"
    action="{!c.productcategoryOTHChange1}"
  />
  <aura:handler
    name="change"
    value="{!v.recordOTH.Product_Category2__c}"
    action="{!c.productcategoryOTHChange2}"
  />
  <aura:handler
    name="change"
    value="{!v.recordOTH.Product_Category3__c}"
    action="{!c.productcategoryOTHChange3}"
  />
    <aura:handler name="change" value="{!v.recordBF.Product_Category1__c}" action="{!c.productcategoryBFChange1}"/>
    <aura:handler name="change" value="{!v.recordBF.Product_Category2__c}" action="{!c.productcategoryBFChange2}"/>
    <aura:handler name="change" value="{!v.recordBF.Product_Category3__c}" action="{!c.productcategoryBFChange3}"/>
    <aura:handler name="change" value="{!v.recordGS.Product_Category1__c}" action="{!c.productcategoryGSChange1}"/>
    <aura:handler name="change" value="{!v.recordGS.Product_Category2__c}" action="{!c.productcategoryGSChange2}"/>
    <aura:handler name="change" value="{!v.recordGS.Product_Category3__c}" action="{!c.productcategoryGSChange3}"/>
    <aura:handler name="change" value="{!v.recordURO.Product_Category1__c}" action="{!c.productcategoryUROChange1}"/>
    <aura:handler name="change" value="{!v.recordURO.Product_Category2__c}" action="{!c.productcategoryUROChange2}"/>
    <aura:handler name="change" value="{!v.recordURO.Product_Category3__c}" action="{!c.productcategoryUROChange3}"/>
    <aura:handler name="change" value="{!v.recordGYN.Product_Category1__c}" action="{!c.productcategoryGYNChange1}"/>
    <aura:handler name="change" value="{!v.recordGYN.Product_Category2__c}" action="{!c.productcategoryGYNChange2}"/>
    <aura:handler name="change" value="{!v.recordGYN.Product_Category3__c}" action="{!c.productcategoryGYNChange3}"/>
    <aura:handler name="change" value="{!v.recordENT.Product_Category1__c}" action="{!c.productcategoryENTChange1}"/>
    <aura:handler name="change" value="{!v.recordENT.Product_Category2__c}" action="{!c.productcategoryENTChange2}"/>
    <aura:handler name="change" value="{!v.recordENT.Product_Category3__c}" action="{!c.productcategoryENTChange3}"/>
    <aura:handler name="change" value="{!v.recordOTH.Product_Category1__c}" action="{!c.productcategoryOTHChange1}"/>
    <aura:handler name="change" value="{!v.recordOTH.Product_Category2__c}" action="{!c.productcategoryOTHChange2}"/>
    <aura:handler name="change" value="{!v.recordOTH.Product_Category3__c}" action="{!c.productcategoryOTHChange3}"/>
  <div class="button_area">
    <ui:button label="{!v.button_text}" press="{!c.toggle_report}" />
  </div>
  <div
    aura:id="modal_window"
    role="dialog"
    tabindex="-1"
    class="disp_none slds-modal slds-fade-in-open slds-modal--large"
    aria-labelledby="headerTarget"
  >
    <div aura:id="modal_window" role="dialog" tabindex="-1" class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget">
    <div class="slds-modal__container">
      <div class="slds-modal__header">
        <button
          class="slds-button slds-modal__close slds-button--icon-inverse"
          title="Close"
          onclick="{!c.toggle_report}"
        >
          <lightning:icon
            iconName="utility:close"
            size="medium"
            alternative-text="close"
            variant="inverse"
          />
                <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.toggle_report}">
                    <lightning:icon iconName="utility:close" size="medium" alternative-text="close" variant="inverse"/>
          <span class="slds-assistive-text">Close</span>
        </button>
        <h2 id="headerTarget" class="slds-text-heading--medium">
          目标({!v.OCMTerm})
        </h2>
                <h2 id="headerTarget" class="slds-text-heading--medium">目标({!v.OCMTerm})</h2>
      </div>
      <div class="slds-modal__content slds-grow slds-p-around--medium">
        <div class="slds-box slds-theme--shade">
@@ -171,19 +59,10 @@
            <div class="slds-form-element__group">
              <div class="slds-form-element__row">
                <div class="slds-form-element slds-size--1-of-2">
                  <label class="slds-form-element__label" for="input-hos"
                    >医院</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">医院</label>
                  <!-- <force:inputField value="{!v.record.Agency_Hospital__c}" aura:id="input-hos"/> -->
                  <lightning:recordEditForm
                    objectApiName="Agency_Opportunity__c"
                  >
                    <lightning:inputField
                      variant="label-hidden"
                      fieldName="Agency_Hospital__c"
                      value="{!v.record.Agency_Hospital__c}"
                      aura:id="input-hos"
                    />
                                    <lightning:recordEditForm objectApiName="Agency_Opportunity__c">
                                        <lightning:inputField variant="label-hidden" fieldName="Agency_Hospital__c" value="{!v.record.Agency_Hospital__c}" aura:id="input-hos"/>
                  </lightning:recordEditForm>
                </div>
              </div>
@@ -197,425 +76,233 @@
              <h4 class="slds-section__title">产品目标</h4>
              <div class="slds-form-element__row">
                <div class="slds-size--1-of-7 slds-grid--align-center">
                  <div style="margin-top: 32px">消化科</div>
                                    <div style="margin-top: 32px;">消化科</div>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分1</label
                  >
                  <ui:inputSelect
                    aura:id="select_GI1"
                    class="slds-select"
                    change="{!c.productcategoryGIChange1}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分1</label>
                                    <ui:inputSelect aura:id="select_GI1" class="slds-select" change="{!c.productcategoryGIChange1}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_GI4_1" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分2</label
                  >
                  <ui:inputSelect
                    aura:id="select_GI2"
                    class="slds-select"
                    change="{!c.productcategoryGIChange2}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分2</label>
                                    <ui:inputSelect aura:id="select_GI2" class="slds-select" change="{!c.productcategoryGIChange2}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_GI4_2" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分3</label
                  >
                  <ui:inputSelect
                    aura:id="select_GI3"
                    class="slds-select"
                    change="{!c.productcategoryGIChange3}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分3</label>
                                    <ui:inputSelect aura:id="select_GI3" class="slds-select" change="{!c.productcategoryGIChange3}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_GI4_3" class="slds-select" />
                </div>
              </div>
              <div class="slds-form-element__row">
                <div class="slds-size--1-of-7 slds-grid--align-center">
                  <div style="margin-top: 32px">ET耗材</div>
                                    <div style="margin-top: 32px;">ET耗材</div>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分1</label
                  >
                  <ui:inputSelect
                    aura:id="select_ET1"
                    class="slds-select"
                    change="{!c.productcategoryETChange1}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分1</label>
                                    <ui:inputSelect aura:id="select_ET1" class="slds-select" change="{!c.productcategoryETChange1}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_ET4_1" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分2</label
                  >
                  <ui:inputSelect
                    aura:id="select_ET2"
                    class="slds-select"
                    change="{!c.productcategoryETChange2}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分2</label>
                                    <ui:inputSelect aura:id="select_ET2" class="slds-select" change="{!c.productcategoryETChange2}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_ET4_2" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分3</label
                  >
                  <ui:inputSelect
                    aura:id="select_ET3"
                    class="slds-select"
                    change="{!c.productcategoryETChange3}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分3</label>
                                    <ui:inputSelect aura:id="select_ET3" class="slds-select" change="{!c.productcategoryETChange3}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_ET4_3" class="slds-select" />
                </div>
              </div>
              <div class="slds-form-element__row">
                <div class="slds-size--1-of-7 slds-grid--align-center">
                  <div style="margin-top: 32px">呼吸科</div>
                                    <div style="margin-top: 32px;">呼吸科</div>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分1</label
                  >
                  <ui:inputSelect
                    aura:id="select_BF1"
                    class="slds-select"
                    change="{!c.productcategoryBFChange1}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分1</label>
                                    <ui:inputSelect aura:id="select_BF1" class="slds-select" change="{!c.productcategoryBFChange1}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_BF4_1" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分2</label
                  >
                  <ui:inputSelect
                    aura:id="select_BF2"
                    class="slds-select"
                    change="{!c.productcategoryBFChange2}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分2</label>
                                    <ui:inputSelect aura:id="select_BF2" class="slds-select" change="{!c.productcategoryBFChange2}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_BF4_2" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分3</label
                  >
                  <ui:inputSelect
                    aura:id="select_BF3"
                    class="slds-select"
                    change="{!c.productcategoryBFChange3}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分3</label>
                                    <ui:inputSelect aura:id="select_BF3" class="slds-select" change="{!c.productcategoryBFChange3}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_BF4_3" class="slds-select" />
                </div>
              </div>
              <div class="slds-form-element__row">
                <div class="slds-size--1-of-7 slds-grid--align-center">
                  <div style="margin-top: 32px">普外科</div>
                                    <div style="margin-top: 32px;">普外科</div>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分1</label
                  >
                  <ui:inputSelect
                    aura:id="select_GS1"
                    class="slds-select"
                    change="{!c.productcategoryGSChange1}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分1</label>
                                    <ui:inputSelect aura:id="select_GS1" class="slds-select" change="{!c.productcategoryGSChange1}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_GS4_1" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分2</label
                  >
                  <ui:inputSelect
                    aura:id="select_GS2"
                    class="slds-select"
                    change="{!c.productcategoryGSChange2}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分2</label>
                                    <ui:inputSelect aura:id="select_GS2" class="slds-select" change="{!c.productcategoryGSChange2}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_GS4_2" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分3</label
                  >
                  <ui:inputSelect
                    aura:id="select_GS3"
                    class="slds-select"
                    change="{!c.productcategoryGSChange3}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分3</label>
                                    <ui:inputSelect aura:id="select_GS3" class="slds-select" change="{!c.productcategoryGSChange3}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_GS4_3" class="slds-select" />
                </div>
              </div>
              <div class="slds-form-element__row">
                <div class="slds-size--1-of-7 slds-grid--align-center">
                  <div style="margin-top: 32px">泌尿科</div>
                                    <div style="margin-top: 32px;">泌尿科</div>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分1</label
                  >
                  <ui:inputSelect
                    aura:id="select_URO1"
                    class="slds-select"
                    change="{!c.productcategoryUROChange1}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分1</label>
                                    <ui:inputSelect aura:id="select_URO1" class="slds-select" change="{!c.productcategoryUROChange1}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_URO4_1" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分2</label
                  >
                  <ui:inputSelect
                    aura:id="select_URO2"
                    class="slds-select"
                    change="{!c.productcategoryUROChange2}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分2</label>
                                    <ui:inputSelect aura:id="select_URO2" class="slds-select" change="{!c.productcategoryUROChange2}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_URO4_2" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分3</label
                  >
                  <ui:inputSelect
                    aura:id="select_URO3"
                    class="slds-select"
                    change="{!c.productcategoryUROChange3}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分3</label>
                                    <ui:inputSelect aura:id="select_URO3" class="slds-select" change="{!c.productcategoryUROChange3}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_URO4_3" class="slds-select" />
                </div>
              </div>
              <div class="slds-form-element__row">
                <div class="slds-size--1-of-7 slds-grid--align-center">
                  <div style="margin-top: 32px">妇科</div>
                                    <div style="margin-top: 32px;">妇科</div>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分1</label
                  >
                  <ui:inputSelect
                    aura:id="select_GYN1"
                    class="slds-select"
                    change="{!c.productcategoryGYNChange1}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分1</label>
                                    <ui:inputSelect aura:id="select_GYN1" class="slds-select" change="{!c.productcategoryGYNChange1}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_GYN4_1" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分2</label
                  >
                  <ui:inputSelect
                    aura:id="select_GYN2"
                    class="slds-select"
                    change="{!c.productcategoryGYNChange2}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分2</label>
                                    <ui:inputSelect aura:id="select_GYN2" class="slds-select" change="{!c.productcategoryGYNChange2}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_GYN4_2" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分3</label
                  >
                  <ui:inputSelect
                    aura:id="select_GYN3"
                    class="slds-select"
                    change="{!c.productcategoryGYNChange3}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分3</label>
                                    <ui:inputSelect aura:id="select_GYN3" class="slds-select" change="{!c.productcategoryGYNChange3}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_GYN4_3" class="slds-select" />
                </div>
              </div>
              <div class="slds-form-element__row">
                <div class="slds-size--1-of-7 slds-grid--align-center">
                  <div style="margin-top: 32px">耳鼻喉科</div>
                                    <div style="margin-top: 32px;">耳鼻喉科</div>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分1</label
                  >
                  <ui:inputSelect
                    aura:id="select_ENT1"
                    class="slds-select"
                    change="{!c.productcategoryENTChange1}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分1</label>
                                    <ui:inputSelect aura:id="select_ENT1" class="slds-select" change="{!c.productcategoryENTChange1}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_ENT4_1" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分2</label
                  >
                  <ui:inputSelect
                    aura:id="select_ENT2"
                    class="slds-select"
                    change="{!c.productcategoryENTChange2}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分2</label>
                                    <ui:inputSelect aura:id="select_ENT2" class="slds-select" change="{!c.productcategoryENTChange2}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_ENT4_2" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分3</label
                  >
                  <ui:inputSelect
                    aura:id="select_ENT3"
                    class="slds-select"
                    change="{!c.productcategoryENTChange3}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分3</label>
                                    <ui:inputSelect aura:id="select_ENT3" class="slds-select" change="{!c.productcategoryENTChange3}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_ENT4_3" class="slds-select" />
                </div>
              </div>
              <div class="slds-form-element__row">
                <div class="slds-size--1-of-7 slds-grid--align-center">
                  <div style="margin-top: 32px">其他</div>
                                    <div style="margin-top: 32px;">其他</div>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分1</label
                  >
                  <ui:inputSelect
                    aura:id="select_OTH1"
                    class="slds-select"
                    change="{!c.productcategoryOTHChange1}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分1</label>
                                    <ui:inputSelect aura:id="select_OTH1" class="slds-select" change="{!c.productcategoryOTHChange1}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_OTH4_1" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分2</label
                  >
                  <ui:inputSelect
                    aura:id="select_OTH2"
                    class="slds-select"
                    change="{!c.productcategoryOTHChange2}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分2</label>
                                    <ui:inputSelect aura:id="select_OTH2" class="slds-select" change="{!c.productcategoryOTHChange2}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_OTH4_2" class="slds-select" />
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >产品区分3</label
                  >
                  <ui:inputSelect
                    aura:id="select_OTH3"
                    class="slds-select"
                    change="{!c.productcategoryOTHChange3}"
                  />
                                    <label class="slds-form-element__label" for="input-hos">产品区分3</label>
                                    <ui:inputSelect aura:id="select_OTH3" class="slds-select" change="{!c.productcategoryOTHChange3}"/>
                </div>
                <div class="slds-form-element slds-size--1-of-7">
                  <label class="slds-form-element__label" for="input-hos"
                    >金额目标(不含税)</label
                  >
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                  <ui:inputText aura:id="select_OTH4_3" class="slds-select" />
                </div>
              </div>
@@ -625,18 +312,10 @@
      </div>
      <div class="slds-modal__footer slds-grid slds-grid--align-spread">
        <div class="slds-order--1" />
        <ui:button
          aura:id="save_button"
          label="保存"
          class="slds-button slds-button--brand slds-order--2"
          press="{!c.createTarget}"
        />
                <ui:button aura:id="save_button" label="保存" class="slds-button slds-button--brand slds-order--2" press="{!c.createTarget}"/>
        <div class="slds-order--3" />
      </div>
    </div>
  </div>
  <div
    aura:id="modal_bg"
    class="disp_none slds-backdrop slds-backdrop--open"
  ></div>
    <div aura:id="modal_bg" class="disp_none slds-backdrop slds-backdrop--open"></div>
</aura:component>
force-app/main/default/aura/CreateTarget/CreateTarget.cmp-meta.xml
force-app/main/default/aura/CreateTarget/CreateTarget.css
force-app/main/default/aura/CreateTarget/CreateTargetHelper.js
@@ -19,53 +19,41 @@
          agency.Agency_Hospital__c = select_ah;
          // component.set("v.record", agency);
          // alert(JSON.stringify(component.find('input-hos').get("v.body")[0].get('v.values')));
          if ($A.get("$Browser.formFactor") == "DESKTOP") {
                    if ($A.get("$Browser.formFactor") == 'DESKTOP') {
            console.log("flag1");
            var values = [
              {
                type: "Agency_Hospital_Link__c",
                        var values = [{
                            type: 'Agency_Hospital_Link__c',
                id: select_ah,
                label: select_ah_name,
                icon: {
                  url: "/img/icon/t4v35/custom/custom24_120.png",
                  backgroundColor: "dc71d1",
                  alt: "Agency_Hospital_Link__c"
                                url:'/img/icon/t4v35/custom/custom24_120.png',
                                backgroundColor:'dc71d1',
                                alt:'Agency_Hospital_Link__c'
                }
              }
            ];
                        }];
            // component.find('input-hos').get("v.body")[0].set('v.values', values);
            //add by Deloitte 2023-6-8
            if (
              component.find("input-hos").get("v.body") &&
              component.find("input-hos").get("v.body").length > 0
            ) {
              component
                .find("input-hos")
                .get("v.body")[0]
                .set("v.values", values);
                        if(component.find('input-hos').get("v.body") && component.find('input-hos').get("v.body").length>0){
                            component.find('input-hos').get("v.body")[0].set('v.values', values);
            }
          } else {
            // component.find('input-hos').get("v.body")[0].set('v.selectedLabel', select_ah_name);
            //add by Deloitte 2023-6-8
            if (
              component.find("input-hos").get("v.body") &&
              component.find("input-hos").get("v.body").length > 0
            ) {
              component
                .find("input-hos")
                .get("v.body")[0]
                .set("v.selectedLabel", select_ah_name);
                        if(component.find('input-hos').get("v.body") && component.find('input-hos').get("v.body").length>0){
                            component.find('input-hos').get("v.body")[0].set('v.selectedLabel', select_ah_name);
            }
          }
        } else if (state === "ERROR") {
          var errors = response.getError();
          var toastEvent = $A.get("e.force:showToast");
          toastEvent.setParams({
            title: "错误",
            type: "error",
            message: errors[0].message
                        "title": "错误",
                        "type":"error",
                        "message": errors[0].message
          });
          toastEvent.fire();
        }
      });
      $A.enqueueAction(action);
@@ -78,85 +66,37 @@
      if (state === "SUCCESS") {
        var opts = response.getReturnValue();
        // alert(JSON.stringify(opts["GI"]));
        component
          .find("select_GI1")
          .set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
        component
          .find("select_GI2")
          .set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
        component
          .find("select_GI3")
          .set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
                component.find("select_GI1").set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
                component.find("select_GI2").set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
                component.find("select_GI3").set("v.options", JSON.parse(JSON.stringify(opts["GI"])));
        component
          .find("select_GS1")
          .set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
        component
          .find("select_GS2")
          .set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
        component
          .find("select_GS3")
          .set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
                component.find("select_GS1").set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
                component.find("select_GS2").set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
                component.find("select_GS3").set("v.options", JSON.parse(JSON.stringify(opts["GS"])));
        component
          .find("select_GYN1")
          .set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
        component
          .find("select_GYN2")
          .set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
        component
          .find("select_GYN3")
          .set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
                component.find("select_GYN1").set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
                component.find("select_GYN2").set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
                component.find("select_GYN3").set("v.options", JSON.parse(JSON.stringify(opts["GYN"])));
        component
          .find("select_URO1")
          .set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
        component
          .find("select_URO2")
          .set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
        component
          .find("select_URO3")
          .set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
                component.find("select_URO1").set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
                component.find("select_URO2").set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
                component.find("select_URO3").set("v.options", JSON.parse(JSON.stringify(opts["URO"])));
        component
          .find("select_ENT1")
          .set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
        component
          .find("select_ENT2")
          .set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
        component
          .find("select_ENT3")
          .set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
                component.find("select_ENT1").set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
                component.find("select_ENT2").set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
                component.find("select_ENT3").set("v.options", JSON.parse(JSON.stringify(opts["ENT"])));
        component
          .find("select_OTH1")
          .set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
        component
          .find("select_OTH2")
          .set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
        component
          .find("select_OTH3")
          .set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
                component.find("select_OTH1").set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
                component.find("select_OTH2").set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
                component.find("select_OTH3").set("v.options", JSON.parse(JSON.stringify(opts["OTH"])));
        component
          .find("select_ET1")
          .set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
        component
          .find("select_ET2")
          .set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
        component
          .find("select_ET3")
          .set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
                component.find("select_ET1").set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
                component.find("select_ET2").set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
                component.find("select_ET3").set("v.options", JSON.parse(JSON.stringify(opts["ET"])));
        component
          .find("select_BF1")
          .set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
        component
          .find("select_BF2")
          .set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
        component
          .find("select_BF3")
          .set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
                component.find("select_BF1").set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
                component.find("select_BF2").set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
                component.find("select_BF3").set("v.options", JSON.parse(JSON.stringify(opts["BF"])));
      } else if (state === "ERROR") {
        var errors = response.getError();
        var toastEvent = $A.get("e.force:showToast");
@@ -166,63 +106,56 @@
          message: errors[0].message
        });
        toastEvent.fire();
      }
    });
    $A.enqueueAction(action);
  },
  toggle_report: function (component, event, helper) {
    var modal_window = component.find("modal_window");
    var modal_bg = component.find("modal_bg");
    $A.util.toggleClass(modal_window, "disp_none");
    $A.util.toggleClass(modal_bg, "disp_none");
        var modal_window = component.find('modal_window');
        var modal_bg = component.find('modal_bg');
        $A.util.toggleClass(modal_window, 'disp_none');
        $A.util.toggleClass(modal_bg, 'disp_none');
    if (
      $A.util.hasClass(modal_window, "disp_none") &&
      !component.get("v.recordId")
    ) {
      $A.get("e.force:refreshView").fire();
        if ($A.util.hasClass(modal_window, 'disp_none') && !component.get("v.recordId")) {
            $A.get('e.force:refreshView').fire();
    }
  },
  productcategoryChange: function (component, event, helper, dept, index) {
    var cmpId = "select_" + dept;
        var cmpId = 'select_'+dept;
    var myId;
    var o1Id;
    var o2Id;
    if (index == 1) {
      myId = cmpId + "1";
      o1Id = cmpId + "2";
      o2Id = cmpId + "3";
            myId = cmpId + '1';
            o1Id = cmpId + '2';
            o2Id = cmpId + '3';
    } else if (index == 2) {
      myId = cmpId + "2";
      o1Id = cmpId + "1";
      o2Id = cmpId + "3";
            myId = cmpId + '2';
            o1Id = cmpId + '1';
            o2Id = cmpId + '3';
    } else {
      myId = cmpId + "3";
      o1Id = cmpId + "1";
      o2Id = cmpId + "2";
            myId = cmpId + '3';
            o1Id = cmpId + '1';
            o2Id = cmpId + '2';
    }
    var product_category_id = component.find(myId).get("v.value");
    var pcId1 = component.find(o1Id).get("v.value");
    var pcId2 = component.find(o2Id).get("v.value");
    var p1bool = pcId1 != "" && pcId1 != null && pcId1 != undefined;
    var p2bool = pcId2 != "" && pcId2 != null && pcId2 != undefined;
    var p0bool =
      product_category_id != "" &&
      product_category_id != null &&
      product_category_id != undefined;
    if (
      (p1bool && p0bool && product_category_id == pcId1) ||
      (p2bool && p0bool && product_category_id == pcId2)
    ) {
      this.warning("不能选择同样的产品区分");
      component.find(myId).set("v.value", "");
        var product_category_id = component.find(myId).get('v.value');
        var pcId1 = component.find(o1Id).get('v.value');
        var pcId2 = component.find(o2Id).get('v.value');
        var p1bool = pcId1 != '' && pcId1 != null && pcId1 != undefined;
        var p2bool = pcId2 != '' && pcId2 != null && pcId2 != undefined;
        var p0bool = product_category_id != '' && product_category_id != null && product_category_id != undefined;
        if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) {
            this.warning('不能选择同样的产品区分');
            component.find(myId).set('v.value','');
    }
  },
  selectHos: function (component, event, helper) {
    var accid = component.get("v.record.Agency_Hospital__c");
    var action = component.get("c.getDeptAmount");
    action.setParams({ hospitalId: accid });
@@ -230,12 +163,12 @@
      var state = response.getState();
      if (state === "SUCCESS") {
        var amountMap = response.getReturnValue();
        var GIProduct_Category1 = "";
        var GIProduct_Category2 = "";
        var GIProduct_Category3 = "";
        var GIAim_Price__c1 = "";
        var GIAim_Price__c2 = "";
        var GIAim_Price__c3 = "";
                var GIProduct_Category1 = '';
                var GIProduct_Category2 = '';
                var GIProduct_Category3 = '';
                var GIAim_Price__c1 = '';
                var GIAim_Price__c2 = '';
                var GIAim_Price__c3 = '';
        if (amountMap.GI.length > 0) {
          GIProduct_Category1 = amountMap.GI[0].Product_Category__c;
          if (amountMap.GI.length > 1) {
@@ -247,23 +180,23 @@
          GIAim_Price__c1 = amountMap.GI[0].Aim_Price__c;
          GIAim_Price__c2 = amountMap.GI[1].Aim_Price__c;
          GIAim_Price__c3 = amountMap.GI[2].Aim_Price__c;
          console.warn(
            GIAim_Price__c1 + "-" + GIAim_Price__c2 + "-" + GIAim_Price__c3
          );
        }
        component.find("select_GI1").set("v.value", GIProduct_Category1);
        component.find("select_GI2").set("v.value", GIProduct_Category2);
        component.find("select_GI3").set("v.value", GIProduct_Category3);
        component.find("select_GI4_1").set("v.value", GIAim_Price__c1);
        component.find("select_GI4_2").set("v.value", GIAim_Price__c2);
        component.find("select_GI4_3").set("v.value", GIAim_Price__c3);
                    console.warn(GIAim_Price__c1+"-"+GIAim_Price__c2+"-"+GIAim_Price__c3);
        var ETProduct_Category1 = "";
        var ETProduct_Category2 = "";
        var ETProduct_Category3 = "";
        var ETAim_Price__c1 = "";
        var ETAim_Price__c2 = "";
        var ETAim_Price__c3 = "";
                }
                component.find('select_GI1').set('v.value',GIProduct_Category1);
                component.find('select_GI2').set('v.value',GIProduct_Category2);
                component.find('select_GI3').set('v.value',GIProduct_Category3);
                component.find('select_GI4_1').set('v.value',GIAim_Price__c1);
                component.find('select_GI4_2').set('v.value',GIAim_Price__c2);
                component.find('select_GI4_3').set('v.value',GIAim_Price__c3);
                var ETProduct_Category1 = '';
                var ETProduct_Category2 = '';
                var ETProduct_Category3 = '';
                var ETAim_Price__c1 = '';
                var ETAim_Price__c2 = '';
                var ETAim_Price__c3 = '';
        if (amountMap.ET.length > 0) {
          ETProduct_Category1 = amountMap.ET[0].Product_Category__c;
          if (amountMap.ET.length > 1) {
@@ -276,19 +209,20 @@
          ETAim_Price__c2 = amountMap.ET[1].Aim_Price__c;
          ETAim_Price__c3 = amountMap.ET[2].Aim_Price__c;
        }
        component.find("select_ET1").set("v.value", ETProduct_Category1);
        component.find("select_ET2").set("v.value", ETProduct_Category2);
        component.find("select_ET3").set("v.value", ETProduct_Category3);
        component.find("select_ET4_1").set("v.value", ETAim_Price__c1);
        component.find("select_ET4_2").set("v.value", ETAim_Price__c2);
        component.find("select_ET4_3").set("v.value", ETAim_Price__c3);
                component.find('select_ET1').set('v.value',ETProduct_Category1);
                component.find('select_ET2').set('v.value',ETProduct_Category2);
                component.find('select_ET3').set('v.value',ETProduct_Category3);
                component.find('select_ET4_1').set('v.value',ETAim_Price__c1);
                component.find('select_ET4_2').set('v.value',ETAim_Price__c2);
                component.find('select_ET4_3').set('v.value',ETAim_Price__c3);
        var BFProduct_Category1 = "";
        var BFProduct_Category2 = "";
        var BFProduct_Category3 = "";
        var BFAim_Price__c1 = "";
        var BFAim_Price__c2 = "";
        var BFAim_Price__c3 = "";
                var BFProduct_Category1 = '';
                var BFProduct_Category2 = '';
                var BFProduct_Category3 = '';
                var BFAim_Price__c1 = '';
                var BFAim_Price__c2 = '';
                var BFAim_Price__c3 = '';
        if (amountMap.BF.length > 0) {
          BFProduct_Category1 = amountMap.BF[0].Product_Category__c;
          if (amountMap.BF.length > 1) {
@@ -301,20 +235,22 @@
          BFAim_Price__c2 = amountMap.BF[1].Aim_Price__c;
          BFAim_Price__c3 = amountMap.BF[2].Aim_Price__c;
        }
        component.find("select_BF1").set("v.value", BFProduct_Category1);
        component.find("select_BF2").set("v.value", BFProduct_Category2);
        component.find("select_BF3").set("v.value", BFProduct_Category3);
        component.find("select_BF4_1").set("v.value", BFAim_Price__c1);
        component.find("select_BF4_2").set("v.value", BFAim_Price__c2);
        component.find("select_BF4_3").set("v.value", BFAim_Price__c3);
                component.find('select_BF1').set('v.value',BFProduct_Category1);
                component.find('select_BF2').set('v.value',BFProduct_Category2);
                component.find('select_BF3').set('v.value',BFProduct_Category3);
                component.find('select_BF4_1').set('v.value',BFAim_Price__c1);
                component.find('select_BF4_2').set('v.value',BFAim_Price__c2);
                component.find('select_BF4_3').set('v.value',BFAim_Price__c3);
        var OTHProduct_Category1 = "";
        var OTHProduct_Category2 = "";
        var OTHProduct_Category3 = "";
        var OTHAim_Price__c1 = "";
        var OTHAim_Price__c2 = "";
        var OTHAim_Price__c3 = "";
                var OTHProduct_Category1 = '';
                var OTHProduct_Category2 = '';
                var OTHProduct_Category3 = '';
                var OTHAim_Price__c1 = '';
                var OTHAim_Price__c2 = '';
                var OTHAim_Price__c3 = '';
        if (amountMap.OTH.length > 0) {
          OTHProduct_Category1 = amountMap.OTH[0].Product_Category__c;
          if (amountMap.OTH.length > 1) {
            OTHProduct_Category2 = amountMap.OTH[1].Product_Category__c;
@@ -326,19 +262,19 @@
          OTHAim_Price__c2 = amountMap.OTH[1].Aim_Price__c;
          OTHAim_Price__c3 = amountMap.OTH[2].Aim_Price__c;
        }
        component.find("select_OTH1").set("v.value", OTHProduct_Category1);
        component.find("select_OTH2").set("v.value", OTHProduct_Category2);
        component.find("select_OTH3").set("v.value", OTHProduct_Category3);
        component.find("select_OTH4_1").set("v.value", OTHAim_Price__c1);
        component.find("select_OTH4_2").set("v.value", OTHAim_Price__c2);
        component.find("select_OTH4_3").set("v.value", OTHAim_Price__c3);
                component.find('select_OTH1').set('v.value',OTHProduct_Category1);
                component.find('select_OTH2').set('v.value',OTHProduct_Category2);
                component.find('select_OTH3').set('v.value',OTHProduct_Category3);
                component.find('select_OTH4_1').set('v.value',OTHAim_Price__c1);
                component.find('select_OTH4_2').set('v.value',OTHAim_Price__c2);
                component.find('select_OTH4_3').set('v.value',OTHAim_Price__c3);
        var GSProduct_Category1 = "";
        var GSProduct_Category2 = "";
        var GSProduct_Category3 = "";
        var GSPAim_Price__c1 = "";
        var GSPAim_Price__c2 = "";
        var GSPAim_Price__c3 = "";
                var GSProduct_Category1 = '';
                var GSProduct_Category2 = '';
                var GSProduct_Category3 = '';
                var GSPAim_Price__c1 = '';
                var GSPAim_Price__c2 = '';
                var GSPAim_Price__c3 = '';
        if (amountMap.GS.length > 0) {
          GSProduct_Category1 = amountMap.GS[0].Product_Category__c;
          if (amountMap.GS.length > 1) {
@@ -351,20 +287,21 @@
          GSPAim_Price__c2 = amountMap.GS[1].Aim_Price__c;
          GSPAim_Price__c3 = amountMap.GS[2].Aim_Price__c;
        }
        component.find("select_GS1").set("v.value", GSProduct_Category1);
        component.find("select_GS2").set("v.value", GSProduct_Category2);
        component.find("select_GS3").set("v.value", GSProduct_Category3);
        component.find("select_GS4_1").set("v.value", GSPAim_Price__c1);
        component.find("select_GS4_2").set("v.value", GSPAim_Price__c2);
        component.find("select_GS4_3").set("v.value", GSPAim_Price__c3);
                component.find('select_GS1').set('v.value',GSProduct_Category1);
                component.find('select_GS2').set('v.value',GSProduct_Category2);
                component.find('select_GS3').set('v.value',GSProduct_Category3);
                component.find('select_GS4_1').set('v.value',GSPAim_Price__c1);
                component.find('select_GS4_2').set('v.value',GSPAim_Price__c2);
                component.find('select_GS4_3').set('v.value',GSPAim_Price__c3);
        var UROProduct_Category1 = "";
        var UROProduct_Category2 = "";
        var UROProduct_Category3 = "";
        var UROAim_Price__c1 = "";
        var UROAim_Price__c2 = "";
        var UROAim_Price__c3 = "";
                var UROProduct_Category1 = '';
                var UROProduct_Category2 = '';
                var UROProduct_Category3 = '';
                var UROAim_Price__c1 = '';
                var UROAim_Price__c2 = '';
                var UROAim_Price__c3 = '';
        if (amountMap.URO.length > 0) {
          UROProduct_Category1 = amountMap.URO[0].Product_Category__c;
          if (amountMap.URO.length > 1) {
            UROProduct_Category2 = amountMap.URO[1].Product_Category__c;
@@ -376,20 +313,22 @@
          UROAim_Price__c2 = amountMap.URO[1].Aim_Price__c;
          UROAim_Price__c3 = amountMap.URO[2].Aim_Price__c;
        }
        component.find("select_URO1").set("v.value", UROProduct_Category1);
        component.find("select_URO2").set("v.value", UROProduct_Category2);
        component.find("select_URO3").set("v.value", UROProduct_Category3);
        component.find("select_URO4_1").set("v.value", UROAim_Price__c1);
        component.find("select_URO4_2").set("v.value", UROAim_Price__c2);
        component.find("select_URO4_3").set("v.value", UROAim_Price__c3);
                component.find('select_URO1').set('v.value',UROProduct_Category1);
                component.find('select_URO2').set('v.value',UROProduct_Category2);
                component.find('select_URO3').set('v.value',UROProduct_Category3);
                component.find('select_URO4_1').set('v.value',UROAim_Price__c1);
                component.find('select_URO4_2').set('v.value',UROAim_Price__c2);
                component.find('select_URO4_3').set('v.value',UROAim_Price__c3);
        var GYNProduct_Category1 = "";
        var GYNProduct_Category2 = "";
        var GYNProduct_Category3 = "";
        var GYNAim_Price__c1 = "";
        var GYNAim_Price__c2 = "";
        var GYNAim_Price__c3 = "";
                var GYNProduct_Category1 = '';
                var GYNProduct_Category2 = '';
                var GYNProduct_Category3 = '';
                var GYNAim_Price__c1 = '';
                var GYNAim_Price__c2 = '';
                var GYNAim_Price__c3 = '';
        if (amountMap.GYN.length > 0) {
          GYNProduct_Category1 = amountMap.GYN[0].Product_Category__c;
          if (amountMap.GYN.length > 1) {
            GYNProduct_Category2 = amountMap.GYN[1].Product_Category__c;
@@ -401,20 +340,22 @@
          GYNAim_Price__c2 = amountMap.GYN[1].Aim_Price__c;
          GYNAim_Price__c3 = amountMap.GYN[2].Aim_Price__c;
        }
        component.find("select_GYN1").set("v.value", GYNProduct_Category1);
        component.find("select_GYN2").set("v.value", GYNProduct_Category2);
        component.find("select_GYN3").set("v.value", GYNProduct_Category3);
        component.find("select_GYN4_1").set("v.value", GYNAim_Price__c1);
        component.find("select_GYN4_2").set("v.value", GYNAim_Price__c2);
        component.find("select_GYN4_3").set("v.value", GYNAim_Price__c3);
                component.find('select_GYN1').set('v.value',GYNProduct_Category1);
                component.find('select_GYN2').set('v.value',GYNProduct_Category2);
                component.find('select_GYN3').set('v.value',GYNProduct_Category3);
                component.find('select_GYN4_1').set('v.value',GYNAim_Price__c1);
                component.find('select_GYN4_2').set('v.value',GYNAim_Price__c2);
                component.find('select_GYN4_3').set('v.value',GYNAim_Price__c3);
        var ENTProduct_Category1 = "";
        var ENTProduct_Category2 = "";
        var ENTProduct_Category3 = "";
        var ENTAim_Price__c1 = "";
        var ENTAim_Price__c2 = "";
        var ENTAim_Price__c3 = "";
                var ENTProduct_Category1 = '';
                var ENTProduct_Category2 = '';
                var ENTProduct_Category3 = '';
                var ENTAim_Price__c1 = '';
                var ENTAim_Price__c2 = '';
                var ENTAim_Price__c3 = '';
        if (amountMap.ENT.length > 0) {
          ENTProduct_Category1 = amountMap.ENT[0].Product_Category__c;
          if (amountMap.ENT.length > 1) {
            ENTProduct_Category2 = amountMap.ENT[1].Product_Category__c;
@@ -426,18 +367,17 @@
          ENTAim_Price__c2 = amountMap.ENT[1].Aim_Price__c;
          ENTAim_Price__c3 = amountMap.ENT[2].Aim_Price__c;
        }
        component.find("select_ENT1").set("v.value", ENTProduct_Category1);
        component.find("select_ENT2").set("v.value", ENTProduct_Category2);
        component.find("select_ENT3").set("v.value", ENTProduct_Category3);
        component.find("select_ENT4_1").set("v.value", ENTAim_Price__c1);
        component.find("select_ENT4_2").set("v.value", ENTAim_Price__c2);
        component.find("select_ENT4_3").set("v.value", ENTAim_Price__c3);
                component.find('select_ENT1').set('v.value',ENTProduct_Category1);
                component.find('select_ENT2').set('v.value',ENTProduct_Category2);
                component.find('select_ENT3').set('v.value',ENTProduct_Category3);
                component.find('select_ENT4_1').set('v.value',ENTAim_Price__c1);
                component.find('select_ENT4_2').set('v.value',ENTAim_Price__c2);
                component.find('select_ENT4_3').set('v.value',ENTAim_Price__c3);
      }
    });
    $A.enqueueAction(action);
    console.log(
      JSON.stringify(component.find("input-hos").get("v.body")[0].get("v"))
    );
        console.log(JSON.stringify(component.find('input-hos').get("v.body")[0].get('v')));
  },
  getOCMTerm: function () {
@@ -446,7 +386,7 @@
    var month = today.getMonth();
    if (month < 3) year -= 1;
    var thisYearOCMPeriod = String(year - 1867) + "P";
        var thisYearOCMPeriod = String(year - 1867) + 'P';
    return thisYearOCMPeriod;
  },
@@ -455,9 +395,11 @@
    var action = component.get("c.createSFTarget");
    // alert(component.get("v.GIAmount"));
    var p1_1 = component.find("select_GI4_1").get("v.value");
    var p1_2 = component.find("select_GI4_2").get("v.value");
    var p1_3 = component.find("select_GI4_3").get("v.value");
        var  p1_1 = component.find('select_GI4_1').get('v.value') ;
        var  p1_2 = component.find('select_GI4_2').get('v.value') ;
        var  p1_3 = component.find('select_GI4_3').get('v.value') ;
    if (p1_1 == undefined || p1_1 == "") {
      p1_1 = 0;
@@ -470,9 +412,9 @@
    }
    console.warn(p1_1 + "-" + p1_2 + "-" + p1_3);
    var p2_1 = component.find("select_ET4_1").get("v.value");
    var p2_2 = component.find("select_ET4_2").get("v.value");
    var p2_3 = component.find("select_ET4_3").get("v.value");
        var  p2_1 = component.find('select_ET4_1').get('v.value') ;
        var  p2_2 = component.find('select_ET4_2').get('v.value') ;
        var  p2_3 = component.find('select_ET4_3').get('v.value') ;
    if (p2_1 == undefined || p2_1 == "") {
      p2_1 = 0;
    }
@@ -483,9 +425,10 @@
      p2_3 = 0;
    }
    var p3_1 = component.find("select_BF4_1").get("v.value");
    var p3_2 = component.find("select_BF4_2").get("v.value");
    var p3_3 = component.find("select_BF4_3").get("v.value");
        var  p3_1 = component.find('select_BF4_1').get('v.value') ;
        var  p3_2 = component.find('select_BF4_2').get('v.value') ;
        var  p3_3 = component.find('select_BF4_3').get('v.value') ;
    if (p3_1 == undefined || p3_1 == "") {
      p3_1 = 0;
    }
@@ -496,9 +439,11 @@
      p3_3 = 0;
    }
    var p4_1 = component.find("select_OTH4_1").get("v.value");
    var p4_2 = component.find("select_OTH4_2").get("v.value");
    var p4_3 = component.find("select_OTH4_3").get("v.value");
        var  p4_1 = component.find('select_OTH4_1').get('v.value') ;
        var  p4_2 = component.find('select_OTH4_2').get('v.value') ;
        var  p4_3 = component.find('select_OTH4_3').get('v.value') ;
    if (p4_1 == undefined || p4_1 == "") {
      p4_1 = 0;
    }
@@ -509,9 +454,11 @@
      p4_3 = 0;
    }
    var p5_1 = component.find("select_GS4_1").get("v.value");
    var p5_2 = component.find("select_GS4_2").get("v.value");
    var p5_3 = component.find("select_GS4_3").get("v.value");
        var  p5_1 = component.find('select_GS4_1').get('v.value') ;
        var  p5_2 = component.find('select_GS4_2').get('v.value') ;
        var  p5_3 = component.find('select_GS4_3').get('v.value') ;
    if (p5_1 == undefined || p5_1 == "") {
      p5_1 = 0;
    }
@@ -522,9 +469,11 @@
      p5_3 = 0;
    }
    var p6_1 = component.find("select_URO4_1").get("v.value");
    var p6_2 = component.find("select_URO4_2").get("v.value");
    var p6_3 = component.find("select_URO4_3").get("v.value");
        var  p6_1 = component.find('select_URO4_1').get('v.value') ;
        var  p6_2 = component.find('select_URO4_2').get('v.value') ;
        var  p6_3 = component.find('select_URO4_3').get('v.value') ;
    if (p6_1 == undefined || p6_1 == "") {
      p6_1 = 0;
    }
@@ -535,9 +484,9 @@
      p6_3 = 0;
    }
    var p7_1 = component.find("select_GYN4_1").get("v.value");
    var p7_2 = component.find("select_GYN4_2").get("v.value");
    var p7_3 = component.find("select_GYN4_3").get("v.value");
        var  p7_1 = component.find('select_GYN4_1').get('v.value') ;
        var  p7_2 = component.find('select_GYN4_2').get('v.value') ;
        var  p7_3 = component.find('select_GYN4_3').get('v.value') ;
    if (p7_1 == undefined || p7_1 == "") {
      p7_1 = 0;
    }
@@ -548,9 +497,11 @@
      p7_3 = 0;
    }
    var p8_1 = component.find("select_ENT4_1").get("v.value");
    var p8_2 = component.find("select_ENT4_2").get("v.value");
    var p8_3 = component.find("select_ENT4_3").get("v.value");
        var  p8_1 = component.find('select_ENT4_1').get('v.value') ;
        var  p8_2 = component.find('select_ENT4_2').get('v.value') ;
        var  p8_3 = component.find('select_ENT4_3').get('v.value') ;
    if (p8_1 == undefined || p8_1 == "") {
      p8_1 = 0;
    }
@@ -561,82 +512,29 @@
      p8_3 = 0;
    }
    action.setParams({
      hospitalId: component.get("v.record.Agency_Hospital__c"),
      GIProduct: [
        component.find("select_GI1").get("v.value"),
        component.find("select_GI2").get("v.value"),
        component.find("select_GI3").get("v.value"),
        p1_1,
        p1_2,
        p1_3
      ],
      ETProduct: [
        component.find("select_ET1").get("v.value"),
        component.find("select_ET2").get("v.value"),
        component.find("select_ET3").get("v.value"),
        p2_1,
        p2_2,
        p2_3
      ],
      BFProduct: [
        component.find("select_BF1").get("v.value"),
        component.find("select_BF2").get("v.value"),
        component.find("select_BF3").get("v.value"),
        p3_1,
        p3_2,
        p3_3
      ],
      OTHProduct: [
        component.find("select_OTH1").get("v.value"),
        component.find("select_OTH2").get("v.value"),
        component.find("select_OTH3").get("v.value"),
        p4_1,
        p4_2,
        p4_3
      ],
      GSProduct: [
        component.find("select_GS1").get("v.value"),
        component.find("select_GS2").get("v.value"),
        component.find("select_GS3").get("v.value"),
        p5_1,
        p5_2,
        p5_3
      ],
      UROProduct: [
        component.find("select_URO1").get("v.value"),
        component.find("select_URO2").get("v.value"),
        component.find("select_URO3").get("v.value"),
        p6_1,
        p6_2,
        p6_2
      ],
      GYNProduct: [
        component.find("select_GYN1").get("v.value"),
        component.find("select_GYN2").get("v.value"),
        component.find("select_GYN3").get("v.value"),
        p7_1,
        p7_2,
        p7_3
      ],
      ENTProduct: [
        component.find("select_ENT1").get("v.value"),
        component.find("select_ENT2").get("v.value"),
        component.find("select_ENT3").get("v.value"),
        p8_1,
        p8_2,
        p8_3
      ],
      OCMTerm: component.get("v.OCMTerm")
                            "hospitalId" : component.get("v.record.Agency_Hospital__c"),
                            "GIProduct" : [component.find('select_GI1').get('v.value'),component.find('select_GI2').get('v.value'),component.find('select_GI3').get('v.value'),p1_1,p1_2,p1_3],
                            "ETProduct" : [component.find('select_ET1').get('v.value'),component.find('select_ET2').get('v.value'),component.find('select_ET3').get('v.value'),p2_1, p2_2,p2_3 ],
                            "BFProduct" : [component.find('select_BF1').get('v.value'),component.find('select_BF2').get('v.value'),component.find('select_BF3').get('v.value'),p3_1 ,p3_2 ,p3_3 ],
                            "OTHProduct" : [component.find('select_OTH1').get('v.value'),component.find('select_OTH2').get('v.value'),component.find('select_OTH3').get('v.value'),p4_1,p4_2 ,p4_3],
                            "GSProduct" : [component.find('select_GS1').get('v.value'),component.find('select_GS2').get('v.value'),component.find('select_GS3').get('v.value'),p5_1,p5_2,p5_3],
                            "UROProduct" : [component.find('select_URO1').get('v.value'),component.find('select_URO2').get('v.value'),component.find('select_URO3').get('v.value'),p6_1,p6_2 ,p6_2 ],
                            "GYNProduct" : [component.find('select_GYN1').get('v.value'),component.find('select_GYN2').get('v.value'),component.find('select_GYN3').get('v.value'),p7_1,p7_2 ,p7_3 ],
                            "ENTProduct" : [component.find('select_ENT1').get('v.value'),component.find('select_ENT2').get('v.value'),component.find('select_ENT3').get('v.value'),p8_1 ,p8_2 ,p8_3],
                            "OCMTerm" : component.get("v.OCMTerm")
    });
    action.setCallback(this, function (response) {
      console.warn(response);
      var state = response.getState();
      if (state === "SUCCESS") {
        var modal_window = component.find("modal_window");
        var modal_bg = component.find("modal_bg");
        $A.util.toggleClass(modal_window, "disp_none");
        $A.util.toggleClass(modal_bg, "disp_none");
                var modal_window = component.find('modal_window');
                var modal_bg = component.find('modal_bg');
                $A.util.toggleClass(modal_window, 'disp_none');
                $A.util.toggleClass(modal_bg, 'disp_none');
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
@@ -646,7 +544,7 @@
        });
        toastEvent.fire();
        $A.get("e.force:refreshView").fire();
                $A.get('e.force:refreshView').fire();
      } else if (state === "INCOMPLETE") {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
@@ -664,6 +562,7 @@
          message: errors[0].message
        });
        toastEvent.fire();
      }
    });
    $A.enqueueAction(action);
@@ -689,5 +588,6 @@
      duration: "10000"
    });
    toastEvent.fire();
  }
});
    },
})
force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImport.cmp
@@ -1,3 +1,11 @@
<!--
 * @Author: Thhto 997058689@qq.com
 * @Date: 2022-07-08 10:47:25
 * @LastEditors: Thhto 997058689@qq.com
 * @LastEditTime: 2023-02-03 15:25:46
 * @FilePath: \ceshihuanj\force-app\main\default\aura\DealerPersonnelInformationImport\DealerPersonnelInformationImport.cmp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<aura:component controller="DealerPersonnelController"
    implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,forceCommunity:availableForAllPageTypes"
    access="global">
@@ -35,7 +43,7 @@
    </aura:renderIf>
    <!-- 批量添加周报 start-->
    <div class="slds-modal slds-fade-in-open slds-hide" aura:id="errorDiv" style="z-index: 10001">
        <ui:inputText aura:id="articleURL" />
        <!-- <ui:inputText aura:id="articleURL" /> -->
        <div class="demo-only" style="height: 8rem;">
            <div class="slds-notify_container slds-is-relative">
                <div class="slds-notify slds-notify_toast slds-theme_error" role="status">
@@ -44,7 +52,10 @@
                            class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large">
                            <lightning:icon alternativeText="error" iconName="utility:error" size="small"
                                class="buttonColor slds-m-right_small" />
                            <h2 class="slds-text-heading_small ">{!v.errorMessage}</h2>
                            <!-- DB202301262139 SFDC经销商人员导入功能改进 start -->
                            <!-- <h2 class="slds-text-heading_small ">{!v.errorMessage}</h2> -->
                            <pre class="slds-text-heading_small ">{!v.errorMessage}</pre>
                            <!-- DB202301262139 SFDC经销商人员导入功能改进 end -->
                        </div>
                    </div>
                </div>
@@ -52,7 +63,7 @@
        </div>
    </div>
    <div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv01">
        <ui:inputText aura:id="articleURL" />
        <!-- <ui:inputText aura:id="articleURL" /> -->
        <div class="demo-only" style="height: 8rem;">
            <div class="slds-notify_container slds-is-relative">
                <div class="slds-notify slds-notify_toast slds-theme_success" role="alert">
@@ -83,7 +94,7 @@
                <aura:set attribute="else">
                    <ui:outputRichText class="uiOutputRichText slds-m--around-large" value="{!v.TableContent}" />
                    <div class="slds-p-around--large slds-align--absolute-center">
                        <lightning:button label="保存" variant="brand" onclick="{!c.processFileContent}" />
                        <lightning:button aura:id="save_con" label="保存" variant="brand" onclick="{!c.processFileContent}" disabled="false" />
                        <lightning:button label="取消" variant="brand" onclick="{!c.cancel}" />
                    </div>
                    <aura:if isTrue="{!v.showErrorInfo}">
@@ -93,7 +104,7 @@
                        <div class="slds-p-around--large slds-align--absolute-center">
                            <div style="height: 300px;overflow-x:scroll">
                                <lightning:datatable keyField="id" data="{! v.errorData }" columns="{! v.errorColumns }"
                                    hideCheckboxColumn="true"  minColumnWidth="120"/>
                                    hideCheckboxColumn="true"/>
                            </div>
                        </div>
                    </aura:if>
force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js
@@ -77,6 +77,9 @@
        };
        reader.readAsDataURL(file);
    },
    isNumber: function(str) {
        return /^\d+$/.test(str);
    },
    saveRecords: function (component, event, helper) {
        component.set('v.login', true);
        var action = component.get("c.processData");
@@ -101,34 +104,44 @@
                        res1 += ress[i].substr(7) + '\n';
                        if (ress[i] != '') {
                            let errorData = {}
                            if(!this.isNumber(ress[i].substr(7).substring(1, 2))){
                                continue
                            }
                            let index = errorDataRow.indexOf(ress[i].substr(7).substring(1, 2));
                            if (index == -1) {
                                errorData.errorRow = ress[i].substr(7).substring(1, 2);
                                errorDataRow.push(errorData.errorRow);
                                errorData.errorInfo = ress[i].substr(7).substring(6);
                                errorData.errorInfo = ress[i].substr(7).substring(5);
                                errorDatas.push(errorData);
                            } else {
                                errorDatas[index].errorInfo += '; ' + ress[i].substr(7).substring(6);
                                errorDatas[index].errorInfo += '; ' + ress[i].substr(7).substring(5);
                            }
                        }
                    }
                    var fileContentData = component.get("v.fileContentData").split('\n');
                    let errorColumns = [
                        { label: '错误行', fieldName: 'errorRow', type: 'text', hideDefaultActions: true, initialWidth: 50 },
                        { label: '错误行', fieldName: 'errorRow', type: 'text', hideDefaultActions: true, initialWidth: 100 },
                        { label: '错误信息', fieldName: 'errorInfo', type: 'text', hideDefaultActions: true,initialWidth: 300,wrapText: true }
                    ];
                    for (var i = 0; i < fileContentData[0].split(',').length - 1; i++) {
                        errorColumns.push({
                            label: fileContentData[0].split(',')[i], fieldName: 'field' + i, type: 'text', hideDefaultActions: true,wrapText: true
                            label: fileContentData[0].split(',')[i],
                            fieldName: 'field' + i,
                            type: 'text',
                            hideDefaultActions: true,
                            wrapText: true,
                            initialWidth: 120
                        });
                    }
                    
                    for(var i = 0; i < errorDatas.length; i++){
                        let data = fileContentData[errorDatas[i].errorRow];
                        console.log('data = ' + JSON.stringify(data));
                        if(data){
                        for(var j = 0; j < data.split(',').length; j++){
                            let label = 'field' + j;
                            errorDatas[i][label] = data.split(',')[j];
                            }
                        }
                    }
                    console.log('errorDatas = ' + JSON.stringify(errorDatas))
@@ -142,12 +155,14 @@
                    component.set('v.errorMessage', res1 + "请修改后重新上传");
                    this.showErrorToast(component);
                    component.set('v.login', false);
                    component.find('save_con').set('v.disabled', true);
                } else {
                    // this.success('导入成功');
                    component.set('v.successMessage', '导入成功');
                    this.showSuccessToast01(component);
                    component.set("v.showMain", true);
                    component.set('v.login', false);
                    component.find('save_con').set('v.disabled', false);
                }
            }
            else if (state === "INCOMPLETE") {
@@ -195,7 +210,7 @@
        window.setTimeout($A.getCallback(function () {
            $A.util.addClass(component.find('errorDiv'), 'slds-hide');
        }),
            4000
            7000
        );
    },
    success: function (message) {
@@ -283,8 +298,9 @@
    downloadCSV: function (component, csv) {
        var link = document.createElement('a');
        // 设置字符集和文件头
        let bom = "\uFEFF";
        var bom = "\uFEFF";
        link.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(bom+csv);
        //link.href = URL.createObjectURL(csvFile);
        link.download = 'data.csv';
        document.body.appendChild(link);
        link.click();
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.auradoc
New file
@@ -0,0 +1,6 @@
<aura:documentation>
    <aura:description>Documentation</aura:description>
    <aura:example name="ExampleName" ref="exampleComponentName" label="Label">
        Example Description
    </aura:example>
</aura:documentation>
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp
New file
@@ -0,0 +1,71 @@
<!--
  @description       :
  @author            : ChangeMeIn@UserSettingsUnder.SFDoc
  @group             :
  @last modified on  : 07-08-2022
  @last modified by  : ChangeMeIn@UserSettingsUnder.SFDoc
-->
<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId,lightning:actionOverride,lightning:isUrlAddressable" access="global"
                controller="NewAgencyContactController">
    <aura:attribute name = "recordId" type = "Id" default = ""/>
    <aura:attribute name="title" type="string"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="layout" type="LayoutDescriberHelper.LayoutWrapper"/>
    <aura:attribute name="record_data" type="Map"/>
    <aura:attribute name="section_names" type="List"/>
    <aura:attribute name="showSpinner" type="Boolean" default = "False"/>
    <aura:attribute name="staticResource" type="Map"/>
    <aura:attribute name="pi_fields_map" type="Map"/>
    <aura:attribute name="isClone" type="Boolean" default = "False"/>
    <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" />
    <ltng:require scripts="{! $Resource.jquery183minjs }" />
    <aura:registerEvent name="NewAgencyContactEvent" type="c:NewAgencyContactEvent"/>
    <aura:attribute name="agencyHospitalId" type="String"/>
    <div class="slds-modal__container">
        <!-- header -->
        <header class="slds-modal__header">
            <h2 id="modal-heading-01" class="slds-modal__title slds-hyphenate">
                {!v.title}
            </h2>
        </header>
        <div class="slds-modal__content slds-p-around_medium">
            <aura:if isTrue="{!v.showSpinner}">
                <lightning:spinner alternativeText="Loading" size="medium" />
            </aura:if>
            <lightning:recordEditForm objectApiName="Agency_Contact__c" onload="{!c.handleLoad}">
                <lightning:accordion activeSectionName="{! v.section_names }" allowMultipleSectionsOpen="true" class="greyyyy" >
                    <aura:iteration items="{!v.layout}" var="section">
                        <aura:if isTrue="{! section.editHeading }">
                            <lightning:accordionSection name="{! section.label }" label="{! section.label }">
                                <aura:iteration items="{! section.layoutColumns}" var="col">
                                    <aura:iteration items="{! col.layoutItems}" var="field">
                                        <aura:if isTrue="{! field.behavior != 'Readonly' }">
                                            <lightning:inputField required="{! field.behavior == 'Required' }" aura:id="field" fieldName="{! field.field}" value="{! field.value}" />
                                        </aura:if>
                                    </aura:iteration>
                                </aura:iteration>
                            </lightning:accordionSection>
                        </aura:if>
                    </aura:iteration>
                </lightning:accordion>
            </lightning:recordEditForm>
            <div  style="text-align:center;margin: 5px;">
                <lightning:button class="slds-button slds-button_neutral" label="取消" onclick="{! c.cancelClick }" />
                <lightning:button class="slds-button slds-button_brand" variant="brand" label="保存" onclick="{! c.saveClick }" />
            </div>
        </div>
    </div>
</aura:component>
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.cmp-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>55.0</apiVersion>
    <description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.css
New file
@@ -0,0 +1,15 @@
.THIS {
}
.THIS .greyyyy .slds-button_reset{
 display: flex;
    align-items: center;
 background: var(--lwc-colorBackground,rgb(243, 242, 242));
 cursor: pointer;
    width: 100%;
    height: 2rem;
    text-align: left;
    color: currentColor;
    font-size: inherit;
    padding: 0 var(--lwc-spacingXSmall,0.5rem);
}
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.design
New file
@@ -0,0 +1,3 @@
<design:component >
</design:component>
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2.svg
New file
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E" />
        <path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF" />
    </g>
</svg>
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Controller.js
New file
@@ -0,0 +1,396 @@
({
    doInit : function(component, event, helper) {
        let rid = component.get('v.recordId');
        let pid = null;
        if(!rid){
            pid = window.location.href.replace("https://","").split("/")[4];
        }
        let isClone = component.get('v.isClone');
        if(!rid || isClone){
            component.set('v.title',$A.get("$Label.c.New")+'.客户人员');
        }else{
            component.set('v.title',$A.get("$Label.c.Edit")+'.客户人员');
        }
        let record_type_id = null;
        let pageref = component.get("v.pageReference")
        if(!record_type_id && pageref){
           record_type_id = pageref.state.recordTypeId
        }
        component.set("v.showSpinner", true);
        helper.CallBackAction(component,'Init',{
            rid : rid,
            pid : null,
            //rid : component.get('v.recordId'),
            record_type_id : record_type_id,
        },function(data){
            debugger
            console.log('data = ' + JSON.stringify(data));
            if(data.getState() == "SUCCESS"){
                var rv = data.getReturnValue();
                console.log(rv);
                if(rv.IsSuccess){
                    let layout = JSON.parse(rv.Data.layout);
                    let fields = rv.Data.fields;
                    let staticResource = JSON.parse(rv.Data.staticResource);
                    let staticResourceV2 = JSON.parse(rv.Data.staticResourceV2);
                    let section_names = [];
                    section_names = layout.map(s=>s.label);
                    component.set('v.section_names',section_names);
                    let m = {};
                    for(let f of staticResource.PIDetails){
                        m[f.SF_Field_API_Name__c] = f;
                    }
                    component.set('v.pi_fields_map',m);
                    var agencyHospitalId = component.get("v.agencyHospitalId");
                    console.log('agencyHospitalId = ' + agencyHospitalId);
                    if(rv.Data && rv.Data.data && rv.Data.data.AWS_Data_Id__c){
                        helper.AwsGet(staticResource.queryUrl, {
                            dataId : rv.Data.data.AWS_Data_Id__c
                        }, function(data){
                            console.log('data = ' + data);
                            for(let f of staticResource.PIDetails){
                                if(data.object && data.object.hasOwnProperty(f.AWS_Field_API__c)){
                                    rv.Data.data[f.SF_Field_API_Name__c] = data.object[f.AWS_Field_API__c];
                                    if(data.object.hasOwnProperty(f.AWS_Encrypted_Field_API__c) && data.object[f.AWS_Encrypted_Field_API__c]){
                                        rv.Data.data[f.SF_Field_Encrypted_API__c] = data.object[f.AWS_Encrypted_Field_API__c];
                                    }
                                }
                            }
                            for(let s of layout){
                                for(let c of s.layoutColumns){
                                    for(let item of c.layoutItems){
                                        if(rv.Data.data.hasOwnProperty(item.field)){
                                            item.value = rv.Data.data[item.field];
                                        }
                                        if(fields.hasOwnProperty(item.field)){
                                            item.fi = fields[item.field];
                                        }
                                        if(item.field == 'Agency_Hospital__c'){
                                            item.value = agencyHospitalId;
                                        }
                                    }
                                }
                            }
                            component.set('v.record_data',rv.Data.data);
                            component.set('v.layout',layout);
                        }, staticResource.token);
                    }else{
                        for(let s of layout){
                            for(let c of s.layoutColumns){
                                for(let item of c.layoutItems){
                                    if(rv.Data && fields.hasOwnProperty(item.field) && fields[item.field].References && fields[item.field].References.map(m=>m.value).indexOf(rv.Data.pidType) > -1){
                                        item.value = pid;
                                    }
                                    if(item.field == 'Agency_Hospital__c'){
                                        item.value = agencyHospitalId;
                                    }
                                }
                            }
                        }
                        component.set('v.layout',layout);
                    }
                    component.set('v.fields',fields);
                    component.set('v.staticResource',staticResource);
                    component.set('v.staticResourceV2',staticResourceV2);
                }else{
                    helper.ShowToast({
                        "message" : rv.Message,
                        "type" : "error"
                    });
                }
            }else{
                helper.ShowToast({
                    "message" : "Init error",
                    "type" : "error"
                });
            }
        });
    },
    handleLoad: function(component, event, helper) {
        console.log('recordEditForm handleSuccess')
        component.set("v.showSpinner", false);
    },
    saveClick : function(component, event, helper){
        let staticResource = component.get('v.staticResource');
        //let staticResourceV2 = component.get('v.staticResourceV2');
        let record_id = component.get('v.recordId');
        let record_type_id = component.get('v.recordTypeId');
        let isClone = component.get('v.isClone');
        let url = staticResource.newUrl;
        //let urlV2 = staticResourceV2.newUrl;
        let payloadPi = {};
        if (record_id && !isClone) {
            url = staticResource.updateUrl;
            //urlV2 = staticResourceV2.updateUrl;
            payloadPi['dataId'] = component.get('v.record_data').AWS_Data_Id__c;
        }
        let layout = component.get('v.layout');
        let pi_fields_map = component.get('v.pi_fields_map');
        let hospitalId = '';
        for(let s of layout){
            for(let c of s.layoutColumns){
                for(let item of c.layoutItems){
                    if(item.field == 'Agency_Hospital__c'){
                        hospitalId = item.value;
                    }
                    if(pi_fields_map.hasOwnProperty(item.field)){
                        payloadPi[pi_fields_map[item.field].AWS_Field_API__c] = item.value;
                    }
                    if (item.behavior == "Required" && !item.value ) {
                        let fs = component.find("field");
                        for(let fi in fs){
                            let f = fs[fi];
                            if(!f.get('v.value')){
                                f.reset();
                            }
                        }
                        return;
                    }
                }
            }
        }
        component.set("v.showSpinner", true);
        //zhj MEBG新方案改造 2022-11-29 start
        debugger
        let hospitalName = '';
        //调用后端searchAgencyDataId方法查询出医院下面所有客户人员dataid
        helper.CallBackAction(component,'searchAgencyDataId',{
            hospitalId : hospitalId
        },function(data){
            if(data.getState() == "SUCCESS"){
                var data = data.getReturnValue();
                if(data.IsSuccess == true){
                    let agencyContactIds = ''
                    if(data.Message == '' && data.Data && data.Data.length > 0){
                        hospitalName = data.Data[0].Agency_Hospital__r.Name;
                        for(var i=0;i<data.Data.length;i++){
                            if(data.Data[i].AWS_Data_Id__c)
                                agencyContactIds += ','+data.Data[i].AWS_Data_Id__c;
                        }
                        agencyContactIds = agencyContactIds.substring(1);
                        payloadPi['agencyContactIds'] = agencyContactIds;
                    }else{
                        payloadPi['agencyContactIds'] = agencyContactIds;
                    }
                    helper.AwsPost(url+'V2', [payloadPi], function(result){
                        //如果返回是129表示重复了,报错
                        if(result.status == '129'){
                            helper.ShowToast({
                                "message" : '该客户人员名字已存在,在'+hospitalName+'医院,请修改',
                                "type" : "error"
                            });
                            component.set("v.showSpinner", false);
                            return
                        }
                        let obj = result.object[0];
                        let data = {};
                        if(record_id && !isClone){
                            data.Id = record_id;
                        }else{
                            data.AWS_Data_Id__c = obj.dataId;
                        }
                        for(let s of layout){
                            for(let c of s.layoutColumns){
                                for(let item of c.layoutItems){
                                    if(item.field && item.behavior != "Readonly"){
                                        if(pi_fields_map.hasOwnProperty(item.field)){
                                            data[item.field] = obj[pi_fields_map[item.field].AWS_Field_API__c];
                                            //data[pi_fields_map[item.field].SF_Field_Encrypted_API__c] = obj[pi_fields_map[item.field].AWS_Encrypted_Field_API__c];
                                        }else{
                                            data[item.field] = item.value;
                                        }
                                    }
                                }
                            }
                        }
                        $A.getCallback(function(){
                            helper.CallBackAction(component,'Save',{
                                data : data,
                                transId : result.txId
                            },function(data){
                                component.set("v.showSpinner", false);
                                if(data.getState() == "SUCCESS"){
                                    var rv = data.getReturnValue();
                                    console.log(rv);
                                    var sfId = null;
                                    if(rv.IsSuccess){
                                        sfId = rv.Data.recordId;
                                    }
                                    helper.AwsPost(staticResource.transactionUrl,{
                                        txId: result.txId,
                                        sfRecordId:sfId,
                                        isSuccess: rv.IsSuccess ? 1 : 0
                                    },function(data){
                                        if(rv.IsSuccess){
                                            helper.ShowToast({
                                                "message" : "成功",
                                                "type" : "success"
                                            });
                                            helper.closeAgencyContact(component);
                                            // if (record_id && !isClone){
                                            //     helper.closeAgencyContact(component);
                                            //     //$A.get('e.force:refreshView').fire();
                                            // }else{
                                            //     var sObjectEvent = $A.get("e.force:navigateToSObject");
                                            //     sObjectEvent.setParams({
                                            //         "recordId": sfId
                                            //     })
                                            //     sObjectEvent.fire();
                                            // }
                                        }else{
                                            helper.ShowToast({
                                                "message" : rv.Message,
                                                "type" : "error"
                                            });
                                        }
                                    },staticResource.token);
                                }else{
                                    helper.ShowToast({
                                        "message" : "Init error",
                                        "type" : "error"
                                    });
                                }
                            });
                        })();
                    }, staticResource.token);
                }else{
                    helper.ShowToast({
                        "message" : data.message,
                        "type" : "error"
                    });
                    component.set("v.showSpinner", false);
                }
            }else{
                helper.ShowToast({
                    "message" : 'searchAgency失败',
                    "type" : "error"
                });
                component.set("v.showSpinner", false);
            }
        });
        //zhj MEBG新方案改造 2022-11-29 end
        // helper.AwsPost(urlV2, [payloadPi], function(result){
        //     let obj = result.object[0];
        //     let data = {};
        //     if(record_id && !isClone){
        //         data.Id = record_id;
        //     }else{
        //         data.AWS_Data_Id__c = obj.dataId;
        //     }
        //     for(let s of layout){
        //         for(let c of s.layoutColumns){
        //             for(let item of c.layoutItems){
        //                 if(item.field && item.behavior != "Readonly"){
        //                     if(pi_fields_map.hasOwnProperty(item.field)){
        //                         data[item.field] = obj[pi_fields_map[item.field].AWS_Field_API__c];
        //                         data[pi_fields_map[item.field].SF_Field_Encrypted_API__c] = obj[pi_fields_map[item.field].AWS_Encrypted_Field_API__c];
        //                     }else{
        //                         data[item.field] = item.value;
        //                     }
        //                 }
        //             }
        //         }
        //     }
        //     $A.getCallback(function(){
        //         helper.CallBackAction(component,'Save',{
        //             data : data,
        //             transId : result.txId
        //         },function(data){
        //             component.set("v.showSpinner", false);
        //             if(data.getState() == "SUCCESS"){
        //                 var rv = data.getReturnValue();
        //                 console.log(rv);
        //                 var sfId = null;
        //                 if(rv.IsSuccess){
        //                     sfId = rv.Data.recordId;
        //                 }
        //                 helper.AwsPost(staticResource.transactionUrl,{
        //                     txId: result.txId,
        //                     sfRecordId:sfId,
        //                     isSuccess: rv.IsSuccess ? 1 : 0
        //                 },function(data){
        //                     if(rv.IsSuccess){
        //                         helper.ShowToast({
        //                             "message" : "成功",
        //                             "type" : "success"
        //                         });
        //                         helper.closeAgencyContact(component);
        //                         // if (record_id && !isClone){
        //                         //     helper.closeAgencyContact(component);
        //                         //     //$A.get('e.force:refreshView').fire();
        //                         // }else{
        //                         //     var sObjectEvent = $A.get("e.force:navigateToSObject");
        //                         //     sObjectEvent.setParams({
        //                         //         "recordId": sfId
        //                         //     })
        //                         //     sObjectEvent.fire();
        //                         // }
        //                     }else{
        //                         helper.ShowToast({
        //                             "message" : rv.Message,
        //                             "type" : "error"
        //                         });
        //                     }
        //                 },staticResource.token);
        //             }else{
        //                 helper.ShowToast({
        //                     "message" : "Init error",
        //                     "type" : "error"
        //                 });
        //             }
        //         });
        //     })();
        // }, staticResource.token);
    },
    cancelClick : function(component, event, helper){
        helper.closeAgencyContact(component);
    },
    scriptsLoaded : function(component, event, helper){}
})
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Helper.js
New file
@@ -0,0 +1,56 @@
({
    CallBackAction  : function(component,action_name,para,callback) {
        var action = component.get("c." + action_name.trimStart().replace("c.",""));
        if(para){
            action.setParams(para);
        }
        if(callback){
            action.setCallback(this,function(data){
                callback(data);
            });
        }
        $A.enqueueAction(action);
    },
    ShowToast : function(paras){
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams(paras);
        toastEvent.fire();
    },
    AwsPost : function(postURL, data ,callback,token){
        let payloadForNewPI = '';
        if(typeof(data) == 'string'){
            payloadForNewPI = data;
        }else{
            payloadForNewPI = JSON.stringify(data);
        }
        AWSService.post(postURL,payloadForNewPI,function(result) {
            //this.insertCalloutLog(this.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),this.successStatus);
            if(callback) callback(result);
        },token);
    },
    AwsGet : function(url, data ,callback,token){
        if(typeof(data) == 'string'){
            url += data;
        }else{
            let i = 0;
            for(let p in data){
                url += (i++) ? '&' : '?';
                url += p + '=' + data[p];
            }
        }
        AWSService.get(url,function(result){
            //this.insertCalloutLog(this.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),this.successStatus);
            if(callback) callback(result);
        },token);
    },
    closeAgencyContact : function(component){
        var cmpEvent = component.getEvent("NewAgencyContactEvent");
        cmpEvent.setParams({
            "showNewAgencyContact":false});
        cmpEvent.fire();
    }
})
force-app/main/default/aura/NewAgencyContact2/NewAgencyContact2Renderer.js
New file
@@ -0,0 +1,5 @@
({
// Your renderer method overrides go here
})
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.cmp
@@ -30,6 +30,7 @@
    <aura:attribute name="show" type="Boolean" default="false"/>
    <aura:attribute name="showNewAgencyContact" type="Boolean" default="false"/>
    <aura:handler name="NewAgencyContactEvent" event="c:NewAgencyContactEvent" action="{!c.closeAgencyContact}"/>
    <aura:attribute name="agencyHospitalId" type="String" default = ""/>
    
    
@@ -45,7 +46,7 @@
            <aura:if isTrue="{!v.showSpinner}">
                <lightning:spinner alternativeText="Loading" size="medium" />
            </aura:if>
            <lightning:recordEditForm objectApiName="Agency_Opportunity__c">
            <lightning:recordEditForm objectApiName="Agency_Opportunity__c" onload="{!c.handleLoad}">
                <lightning:accordion activeSectionName="{! v.section_names }" allowMultipleSectionsOpen="true" class="greyyyy" >
                    <aura:iteration items="{!v.layout}" var="section">
                        <aura:if isTrue="{! section.editHeading }">
@@ -130,10 +131,19 @@
                        </div>
                    </div>
                        
                        <aura:if isTrue="{!v.showNewAgencyContact}">
                        <!-- <aura:if isTrue="{!v.showNewAgencyContact}">
                            <section role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="modal-heading-01" class="slds-modal slds-fade-in-open"  aura:id="NewAgencyContact" id="NewAgencyContact">
                                <c:NewAgencyContact2 />
                            </section>
                        </aura:if> -->
                        <aura:if isTrue="{!v.showNewAgencyContact}">
                            <section role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="modal-heading-01"
                                class="slds-modal slds-fade-in-open" aura:id="NewAgencyContact"
                                id="NewAgencyContact" aria-describedby="modal-content-id-2" style="z-index: 9999;">
                                <c:NewAgencyContact2 agencyHospitalId="{!v.agencyHospitalId}"/>
                            </section>
                            <div class="slds-backdrop2 slds-backdrop_open2"></div>
                        </aura:if>
                        
                    </div>                               
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunity.css
@@ -65,3 +65,15 @@
.THIS .slds-spinner_container{
    position: revert;
}
.THIS .slds-backdrop2 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* 遮罩层的半透明背景色 */
}
.THIS .slds-backdrop_open2 {
    z-index: 9003; /* 遮罩层的层级,需要确保比模态框的层级高 */
}
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityController.js
@@ -106,7 +106,7 @@
                    }
                    // component.set('v.fields',fields);
                    // component.set('v.staticResource',staticResource);
                    component.set("v.showSpinner", false);
                    //component.set("v.showSpinner", false);
                }else{
                    component.set("v.showSpinner", false);
                    helper.ShowToast({
@@ -124,6 +124,10 @@
                
            }
        });
    },
    handleLoad: function(component, event, helper) {
        console.log('recordEditForm handleSuccess')
        component.set("v.showSpinner", false);
    },
    saveClick : function(component, event, helper){
        
@@ -264,6 +268,9 @@
                            "type" : "warning"
                        });
                        return
                    }else if(item.field == 'Agency_Hospital__c' && item.value){
                        component.set('v.agencyHospitalId',item.value)
                        console.log('v.agencyHospitalId item.value = ' + item.value)
                    }
                }
            }
force-app/main/default/aura/NewAgencyOpportunity/NewAgencyOpportunityHelper.js
@@ -52,13 +52,13 @@
        let myTableDiv = document.getElementById("QueryResult");
        let table = document.createElement('TABLE');
        table.border = '1';
        table.id = 'table';
        table.id = 'customTable';
        table.setAttribute('class','slds-table slds-table_cell-buffer slds-table_bordered');
        let tableBody = document.createElement('TBODY');
        table.appendChild(tableBody);
        let headerTR = document.createElement('TR');
        headerTR.setAttribute('class','slds-line-height_reset');
        let colsHeader = ['姓名','医院', '医生区分(职务)','分类'];
        let colsHeader = [' ','姓名','医院', '医生区分(职务)','分类'];
        tableBody.appendChild(headerTR);
        for (let i = 0; i < colsHeader.length; i++) {
            let td = document.createElement('TH');
@@ -71,7 +71,27 @@
        for (let i = 0; i < contactInfoList.length; i++) {
            let tr = document.createElement('TR');
            tableBody.appendChild(tr);
            let contactInfoTemp = contactInfoList[i]
            let contactInfoTemp = contactInfoList[i];
            //再加一列选择button
            debugger
            let td = document.createElement('TD');
            td.width = '75';
            td.id = contactsInfo[contactInfoTemp.AWSDataId].Id;
            console.log('contactInfoTemp = ' + JSON.stringify(contactInfoTemp))
            // 创建按钮元素
            var button = document.createElement('button');
            button.classList.add('slds-button','slds-button_neutral');
            button.id = contactInfoTemp.sfRecordId != null ? contactInfoTemp.sfRecordId : '';
            // 设置按钮的文本内容
            var buttonText = document.createTextNode('选择');
            button.appendChild(buttonText);
            button.addEventListener("click", function (obj) {
                that.redirectToParentPage(component, event, helper, obj);
            });
            button.value = contactInfoTemp[cols[0]] != null ? contactInfoTemp[cols[0]] : ''
            td.appendChild(button);
            tr.appendChild(td);
            for (let j = 0; j < cols.length; j++) {
                let td = document.createElement('TD');
                td.width = '75';
@@ -86,19 +106,20 @@
                    td.id = contactInfoTemp.sfRecordId;
                }              
                td.appendChild(document.createTextNode(contactInfoTemp[cols[j]]!=null?contactInfoTemp[cols[j]]:''));
                if (cols[j] == 'Name') {
                    td.addEventListener("click", function (obj) {
                        that.redirectToParentPage(component, event, helper,obj);
                    });
                }
                // if (cols[j] == 'Name') {
                //     td.addEventListener("click", function (obj) {
                //         that.redirectToParentPage(component, event, helper,obj);
                //     });
                // }
                tr.appendChild(td);
            }
        }
        that.resetTable();
        myTableDiv.appendChild(table);
        component.find('button').set('v.disabled', false);
    },
    redirectToParentPage : function(component, event, helper,obj){
        let agencyContactName = obj.currentTarget.innerText;
        let agencyContactName = obj.currentTarget.value;
        let id = obj.currentTarget.id;
        component.set('v.ac_name',agencyContactName);
        let layout = component.get('v.layout');
@@ -114,15 +135,17 @@
        component.set("v.isModalOpen", false);
    },
    resetTable : function(){
        let queryResult = document.getElementById('QueryResult');
        let table = document.getElementsByTagName('table');
        debugger;
        console.log('table:' + table);
        debugger;
        if(table.length > 1){
            for(var i=1;i<table.length;i++){
                queryResult.removeChild(table[i])
            }
        // let queryResult = document.getElementById('QueryResult');
        // let table = document.getElementById('customTable');
        // console.log('table:' + table);
        // if(table.length > 1){
        //     for(var i=1;i<table.length;i++){
        //         queryResult.removeChild(table[i])
        //     }
        // }
        let customTable = document.getElementById('customTable');
        if(customTable){
            customTable.parentNode.removeChild(customTable);
        }
    },
    preparePayloadForSearchAgencyContact : function(component, event, helper){
@@ -159,6 +182,7 @@
                    });
                    return
                }
                component.set('v.showSpinner',true);
                let searchPayload = new Object();
                let searchAgencyContactName = component.get('v.searchKeyWord');
                searchPayload.dataIds = rv.Data;
@@ -178,6 +202,7 @@
                                "message" : '没有查询到该客户人员',
                                "type" : "warning"
                            });
                            component.set('v.showSpinner',false);
                            return
                        }
                        for(var i=0;i<data.object.length;i++){
@@ -196,13 +221,30 @@
                            }                    
                        }
                        //let AWSIdToSFIdMapValue = {};
                        debugger
                        var searchAgencyContacts = component.get('c.searchAgencyContacts');
                        searchAgencyContacts.setParams({
                            "awsAgencyContactIds" : JSON.stringify(awsDataIds),
                            "agencyHospitalId" : agencyHospitalId,
                            "accountId" : accountId                            
                        });
                        searchAgencyContacts.setCallback(this,function(response){
                        // 延迟执行一段代码
                        setTimeout(function() {
                            // 需要延迟执行的代码
                           // 创建一个鼠标点击事件
                            var event = new MouseEvent('click', {
                                bubbles: true,
                                cancelable: true,
                                view: window
                            });
                            // 触发元素的点击事件
                            var element = document.getElementById('NewAgencyContact');
                            for(var i = 0;i<100;i++){
                                element.dispatchEvent(event);
                            }
                        }, 1000); // 延迟 1000 毫秒(即 1 秒)
                        searchAgencyContacts.setCallback(that,function(response){
                            var state = response.getState();
                            if(state == 'SUCCESS'){
                                var rv = response.getReturnValue();
@@ -226,10 +268,13 @@
                                        }
                                    }
                                    that.refreshTable(component, event, helper,cols,contactInfoList,contactsInfo);
                                    component.set('v.showSpinner',false);
                                }
                            }
                        });
                        $A.enqueueAction(searchAgencyContacts);
                    }else{
                        component.set('v.showSpinner',false);
                    }
                },token);
            }
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.cmp
@@ -1,31 +1,13 @@
<aura:component
  controller="RetrospectiveWeeklyReportController"
<aura:component controller="RetrospectiveWeeklyReportController"
  implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,forceCommunity:availableForAllPageTypes,lightning:availableForFlowScreens"
  access="global"
>
    access="global">
  <ltng:require styles="{!$Resource.multilineToastCSS}" /> 
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
  <aura:handler
    event="c:strike_evt"
    action="{!c.createAopp}"
    name="strike_evt_addNewRecord"
  />
  <aura:attribute
    name="data"
    type="Agency_Report__c"
    default="{sobjectType:'Agency_Report__c'}"
  />
  <aura:attribute
    name="oppdata"
    type="Agency_Opportunity__c"
    default="{sobjectType:'Agency_Opportunity__c'}"
  />
  <aura:attribute
    name="acondata"
    type="Agency_Contact__c"
    default="{sobjectType:'Ag
    ency_Contact__c'}"
  />
    <aura:handler event="c:strike_evt" action="{!c.createAopp}" name="strike_evt_addNewRecord" />
    <aura:attribute name="data" type="Agency_Report__c" default="{sobjectType:'Agency_Report__c'}" />
    <aura:attribute name="oppdata" type="Agency_Opportunity__c" default="{sobjectType:'Agency_Opportunity__c'}" />
    <aura:attribute name="acondata" type="Agency_Contact__c" default="{sobjectType:'Ag
    ency_Contact__c'}" />
  <aura:attribute name="successMessage" type="String" />
  <aura:attribute name="etEng" type="String" />
  <aura:attribute name="errorMessage" type="String" />
@@ -64,31 +46,19 @@
  <!-- 使用产品1(产品型号) -->
  <aura:attribute name="UseProduct1" type="string" default="" />
  <aura:attribute name="UseProduct1s" type="string" default="" />
  <aura:handler
    name="change"
    value="{!v.UseProduct1}"
    action="{!c.UseProduct1Change}"
  />
    <aura:handler name="change" value="{!v.UseProduct1}" action="{!c.UseProduct1Change}" />
  <aura:attribute name="UseProduct1List" type="Map" />
  <aura:attribute name="UseProduct1Id" type="string" default="" />
  <!-- 使用产品2 -->
  <aura:attribute name="UseProduct2" type="string" default="" />
  <aura:attribute name="UseProduct2s" type="string" default="" />
  <aura:handler
    name="change"
    value="{!v.UseProduct2}"
    action="{!c.UseProduct2Change}"
  />
    <aura:handler name="change" value="{!v.UseProduct2}" action="{!c.UseProduct2Change}" />
  <aura:attribute name="UseProduct2List" type="Map" />
  <aura:attribute name="UseProduct2Id" type="string" default="" />
  <!-- 使用产品3 -->
  <aura:attribute name="UseProduct3" type="string" default="" />
  <aura:attribute name="UseProduct3s" type="string" default="" />
  <aura:handler
    name="change"
    value="{!v.UseProduct3}"
    action="{!c.UseProduct3Change}"
  />
    <aura:handler name="change" value="{!v.UseProduct3}" action="{!c.UseProduct3Change}" />
  <aura:attribute name="UseProduct3List" type="Map" />
  <aura:attribute name="UseProduct3Id" type="string" default="" />
  <!--SWAG-CF58C3 fy start -->
@@ -101,6 +71,7 @@
  <aura:attribute name="contactawsurl" type="Map" />
  <aura:attribute name="allselectlistAgencyPerson" type="Map" />
  <!--SWAG-CF58C3 fy end -->
  <aura:attribute name="doctor_list" type="Map" />
  <!-- <aura:attribute name="doctor_title" type="String" /> -->
@@ -128,28 +99,12 @@
  <aura:attribute name="UserProType" type="String" />
  <!-- 科室 -->
  <aura:attribute name="opportunity_cfilter" type="String" />
  <aura:attribute
    name="update_select_report_data_id"
    type="String"
    default=""
  />
    <aura:attribute name="update_select_report_data_id" type="String" default="" />
  <!-- 批量添加日报 start-->
  <aura:attribute name="reports_date" type="List" />
  <aura:attribute
    name="TableContent"
    type="String"
    description=" Show the Result class"
  />
  <aura:attribute
    name="TableContent2"
    type="String"
    description=" Show the Result class"
  />
  <aura:attribute
    name="TargetFileName"
    type="String"
    description="Name of the file"
  />
    <aura:attribute name="TableContent" type="String" description=" Show the Result class" />
    <aura:attribute name="TableContent2" type="String" description=" Show the Result class" />
    <aura:attribute name="TargetFileName" type="String" description="Name of the file" />
  <aura:attribute name="tableheaders" type="Object[]" />
  <aura:attribute name="fileContentData" type="String" />
  <aura:attribute name="filename" type="String" />
@@ -179,11 +134,7 @@
                        <div class="slds-spinner__dot-b"></div>
                </div>
            </div> -->
      <div
        class="slds-spinner_container"
        id="spinner"
        style="position: fixed; top: 123px"
      >
            <div class="slds-spinner_container" id="spinner" style="position: fixed;top:123px;">
        <div
          role="status"
          class="slds-spinner slds-spinner_medium slds-spinner_brand"
@@ -197,118 +148,61 @@
  </aura:renderIf>
  <div aura:id="report" id="report">
    <div class="slds-grid slds-wrap slds-grid--pull-padded">
      <div style="width: 150px"></div>
            <div style="width: 150px;"></div>
      <div
        class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12 fontSize"
      >
                class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12 fontSize">
        周
      </div>
      <div
        class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 fontSize"
      >
        <ui:inputSelect
          aura:id="select_date"
          class="slds-select"
          change="{!c.select_date_change}"
        />
                class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 fontSize">
                <ui:inputSelect aura:id="select_date" class="slds-select" change="{!c.select_date_change}" />
      </div>
      <!-- 代理店担当者 -->
      <div
        class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"
        style="display: none"
      >
            <div class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"
                style="display: none;">
        {!v.fieldsmap.Person_In_Charge2__c}
      </div>
      <div
        class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12"
        style="display: none"
      >
        <ui:inputSelect
          aura:id="select_agency_person"
          class="slds-select agency_person_select"
          change="{!c.select_agency_change}"
        />
            <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12"
                style="display: none;">
                <ui:inputSelect aura:id="select_agency_person" class="slds-select agency_person_select"
                    change="{!c.select_agency_change}" />
      </div>
      <div style="width: 100px"></div>
      <div
        class="tr slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
        style="display: contents"
      >
        <ui:button
          aura:id="new_button"
          label="新建"
          press="{!c.new_report}"
          class="buttonFontSize"
        />
            <div style="width: 100px;">
      </div>
      <div
        style="width: 400px"
        class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--4-of-12 slds-large-size--4-of-12"
      >
        <ui:button
          aura:id="copy_button"
          label="复制"
          press="{!c.copy_button}"
          disabled="true"
          class="buttonFontSize"
        />
        <ui:button
          aura:id="delete_button"
          label="删除"
          press="{!c.delete_button}"
          disabled="true"
          class="buttonFontSize"
        />
        <ui:button
          aura:id="import"
          label="导入"
          press="{!c.import}"
          class="buttonFontSize"
        />
        <ui:button
          aura:id="export"
          label="导出"
          press="{!c.export_condition}"
          class="buttonFontSize"
        />
            <div class="tr slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
                style="display: contents;">
                <ui:button aura:id="new_button" label="新建" press="{!c.new_report}" class="buttonFontSize" />
            </div>
            <div style="width: 400px;"
                class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--4-of-12 slds-large-size--4-of-12">
                <ui:button aura:id="copy_button" label="复制" press="{!c.copy_button}" disabled="true"
                    class="buttonFontSize" />
                <ui:button aura:id="delete_button" label="删除" press="{!c.delete_button}" disabled="true"
                    class="buttonFontSize" />
                <ui:button aura:id="import" label="导入" press="{!c.import}" class="buttonFontSize" />
                <ui:button aura:id="export" label="导出" press="{!c.export_condition}" class="buttonFontSize" />
        <!-- <ui:button aura:id="returnbutton" label="返回" press="{!c.return_main_page}" /> -->
      </div>
    </div>
  </div>
  <div aura:id="report_list" class="report_list_area">
    <div
      class="slds-table--edit_container slds-is-relative"
      style="padding-left: 50px"
    >
      <table
        class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus"
        role="grid"
        style="width: 66.75rem"
      >
        <div class="slds-table--edit_container slds-is-relative" style="padding-left: 50px;">
            <table class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus"
                role="grid" style="width:66.75rem;">
        <thead>
          <tr class="slds-line-height--reset">
            <th
              class="table_header slds-text-title--caps fontSize"
              style="width: 250px"
            >
                        <th class="table_header slds-text-title--caps fontSize" style="width:250px">
              <span class="slds-truncate" title="Name">日报编号</span>
            </th>
            <th class="table_header slds-text-title--caps fontSize">
              <span class="slds-truncate" title="Name"
                >{!v.fieldsmap.Person_In_Charge2__c}</span
              >
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.Person_In_Charge2__c}</span>
              <!-- {!v.fieldsmap.Person_In_Charge2__c}  担当-->
            </th>
            <th
              class="table_header slds-text-title--caps fontSize"
              style="width: 250px"
            >
                        <th class="table_header slds-text-title--caps fontSize" style="width:250px">
              <span class="slds-truncate" title="Name">医院</span>
            </th>
            <th class="table_header slds-text-title--caps fontSize">
              <span class="slds-truncate" title="Name"
                >{!v.fieldsmap.Department_Cateogy__c}</span
              >
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.Department_Cateogy__c}</span>
              <!-- {!v.fieldsmap.Department_Cateogy__c}    科室-->
            </th>
            <th class="table_header slds-text-title--caps fontSize">
@@ -316,15 +210,11 @@
              <!-- {!v.fieldsmap.doctor2__c}    拜访人 -->
            </th>
            <th class="table_header slds-text-title--caps fontSize">
              <span class="slds-truncate" title="Name"
                >{!v.fieldsmap.DealerPersonnel__c}</span
              >
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.DealerPersonnel__c}</span>
              <!-- {!v.fieldsmap.visitor_title__c}   职位-->
            </th>
            <th class="table_header slds-text-title--caps fontSize">
              <span class="slds-truncate" title="Name"
                >{!v.fieldsmap.WorkMark__c}</span
              >
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.WorkMark__c}</span>
              <!-- {!v.fieldsmap.visitor_title__c}   职位-->
            </th>
          </tr>
@@ -333,45 +223,27 @@
          <aura:iteration items="{!v.reports}" var="item" indexVar="index">
            <tr class="slds-hint-parent">
              <td role="gridcell" class="slds-cell-edit fontSize">
                <ui:inputRadio
                  class="report_radio"
                  name="report_radio"
                  label="{!item.Name}"
                  change="{!c.change_report_radio}"
                />
                <lightning:buttonIcon
                  class="edit_button"
                  iconName="utility:edit"
                  size="small"
                  alternativeText="edit"
                  value="{!index}"
                  onclick="{!c.edit_button}"
                />
                                <ui:inputRadio class="report_radio" name="report_radio" label="{!item.Name}"
                                    change="{!c.change_report_radio}" />
                                <lightning:buttonIcon class="edit_button" iconName="utility:edit" size="small"
                                    alternativeText="edit" value="{!index}" onclick="{!c.edit_button}" />
              </td>
              <td role="gridcell" class="slds-cell-edit fontSize">
                <span class="slds-grid slds-grid--align-spread">
                  <span
                    class="slds-truncate"
                    title="{!item.Person_In_Charge2__r.Name}"
                    >{!item.Person_In_Charge2__r.Name}</span
                  >
                                    <span class="slds-truncate"
                                        title="{!item.Person_In_Charge2__r.Name}">{!item.Person_In_Charge2__r.Name}</span>
                </span>
              </td>
              <td scope="row" tabindex="0" class="slds-cell-edit fontSize">
                <div
                  class="slds-grid slds-grid--align-spread"
                  style="word-wrap: break-word"
                >
                                <div class="slds-grid slds-grid--align-spread" style="word-wrap: break-word;">
                  {!item.Agency_Hospital__r.Name}
                </div>
              </td>
              <td role="gridcell" class="slds-cell-edit fontSize">
                <span class="slds-grid slds-grid--align-spread">
                  <span
                    class="slds-truncate"
                    title="{!item.Department_Cateogy_text__c}"
                    >{!item.Department_Cateogy_text__c}</span
                  >
                                    <span class="slds-truncate"
                                        title="{!item.Department_Cateogy_text__c}">{!item.Department_Cateogy_text__c}</span>
                </span>
              </td>
              <td role="gridcell" class="slds-cell-edit fontSize">
@@ -384,21 +256,15 @@
              </td>
              <td role="gridcell" class="slds-cell-edit fontSize">
                <span class="slds-grid slds-grid--align-spread">
                  <span
                    class="slds-truncate"
                    title="{!item.DealerPersonnel__r.Name}"
                    >{!item.DealerPersonnel__r.Name}</span
                  >
                                    <span class="slds-truncate"
                                        title="{!item.DealerPersonnel__r.Name}">{!item.DealerPersonnel__r.Name}</span>
                </span>
              </td>
              <td role="gridcell" class="slds-cell-edit fontSize">
                <span class="slds-grid slds-grid--align-spread">
                  <span class="slds-truncate" title="{!item.WorkMark__c}">
                    <lightning:input
                      type="checkbox"
                      checked="{!item.WorkMark__c}"
                      disabled="true"
                    />
                                        <lightning:input type="checkbox" checked="{!item.WorkMark__c}"
                                            disabled="true" />
                  </span>
                </span>
              </td>
@@ -409,39 +275,28 @@
    </div>
    <aura:renderIf isTrue="{!v.report_count > 0}">
      <aura:set attribute="else">
        <div class="no_data_area">{!v.list_message}</div>
                <div class="no_data_area">
                    {!v.list_message}
                </div>
      </aura:set>
    </aura:renderIf>
  </div>
  <!-- 批量添加日报 start-->
  <div
    aura:id="modal_import"
    role="dialog"
    tabindex="-1"
    class="disp_none slds-modal slds-fade-in-open slds-modal--large"
    aria-labelledby="headerTarget"
  >
    <div aura:id="modal_import" role="dialog" tabindex="-1"
        class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget">
    <aura:renderIf isTrue="{!v.modal_import_spinner}">
      <lightning:spinner alternativeText="Loading" size="medium" />
    </aura:renderIf>
    <div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv01">
      <!-- <ui:inputText aura:id="articleURL" /> -->
      <div class="demo-only" style="height: 8rem">
            <div class="demo-only" style="height: 8rem;">
        <div class="slds-notify_container slds-is-relative">
          <div
            class="slds-notify slds-notify_toast slds-theme_success"
            role="alert"
          >
                    <div class="slds-notify slds-notify_toast slds-theme_success" role="alert">
            <div class="slds-m-left_xx-large">
              <div
                class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large"
              >
                <lightning:icon
                  alternativeText="Success"
                  iconName="utility:success"
                  size="small"
                  class="buttonColor slds-m-right_small"
                />
                                class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large">
                                <lightning:icon alternativeText="Success" iconName="utility:success" size="small"
                                    class="buttonColor slds-m-right_small" />
                <h2 class="slds-text-heading_small">{!v.successMessage}</h2>
              </div>
            </div>
@@ -470,194 +325,106 @@
    <div class="slds-modal__container">
      <div class="slds-modal__header">
        <h4 id="headerTarget" class="slds-float--left"></h4>
        <h2 id="headerTarget" class="slds-text-heading--medium">
          日报批量导入
        </h2>
        <ui:button
          aura:id="close_button"
          label="关闭"
                <h2 id="headerTarget" class="slds-text-heading--medium">日报批量导入</h2>
                <ui:button aura:id="close_button" label="关闭"
          class="close_button slds-button slds-button--neutral slds-order--1 buttonFontSize"
          press="{!c.close_import}"
        />
                    press="{!c.close_import}" />
      </div>
      <div
        class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium fontSize"
      >
            <div class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium fontSize">
        <aura:if isTrue="{!v.showMain}">
          <div>
            <lightning:input
              type="file"
              class="file"
              uara:id="file"
              onchange="{!c.CreateRecord}"
            />
                        <lightning:input type="file" class="file" uara:id="file" onchange="{!c.CreateRecord}" />
          </div>
          <aura:set attribute="else">
            <ui:outputRichText
              class="uiOutputRichText slds-m--around-large fontSize"
              value="{!v.TableContent}"
            />
                        <ui:outputRichText class="uiOutputRichText slds-m--around-large fontSize"
                            value="{!v.TableContent}" />
            <div class="slds-p-around--large slds-align--absolute-center">
              <lightning:button
                label="保存"
                variant="brand"
                onclick="{!c.processFileContent}"
                class="buttonFontSize"
              />
              <lightning:button
                label="取消"
                variant="brand"
                onclick="{!c.cancel}"
                class="buttonFontSize"
              />
                            <lightning:button label="保存" variant="brand" onclick="{!c.processFileContent}"
                                class="buttonFontSize" />
                            <lightning:button label="取消" variant="brand" onclick="{!c.cancel}" class="buttonFontSize" />
            </div>
            <aura:if isTrue="{!v.showErrorInfo}">
              <div class="slds-p-around--large slds-align--absolute-center">
                <lightning:button
                  label="导出错误信息"
                  variant="brand"
                  onclick="{!c.exportErrorInfo}"
                />
                                <lightning:button label="导出错误信息" variant="brand" onclick="{!c.exportErrorInfo}" />
              </div>
              <div class="slds-p-around--large slds-align--absolute-center">
                <div style="height: 300px; overflow-x: scroll">
                  <lightning:datatable
                    keyField="id"
                    data="{! v.errorData }"
                    columns="{! v.errorColumns }"
                    hideCheckboxColumn="true"
                  />
                                    <lightning:datatable keyField="id" data="{! v.errorData }"
                                        columns="{! v.errorColumns }" hideCheckboxColumn="true" />
                </div>
              </div>
            </aura:if>
          </aura:set>
        </aura:if>
      </div>
    </div>
  </div>
  <div
    aura:id="modal_importbg"
    class="disp_none slds-backdrop slds-backdrop--open"
  ></div>
    <div aura:id="modal_importbg" class="disp_none slds-backdrop slds-backdrop--open"></div>
  <!-- 批量添加日报 end-->
  <!-- 批量导出日报 start-->
  <div
    aura:id="modal_export"
    role="dialog"
    tabindex="-1"
    class="disp_none slds-modal slds-fade-in-open slds-modal--large"
  >
    <div aura:id="modal_export" role="dialog" tabindex="-1"
        class="disp_none slds-modal slds-fade-in-open slds-modal--large">
    <div class="slds-modal__container">
      <div class="slds-modal__header">
        <h4 id="headerTarget" class="slds-float--left"></h4>
        <h2 id="headerTarget" class="slds-text-heading--medium">
          日报批量导出
        </h2>
        <ui:button
          aura:id="close_button"
          label="关闭"
          class="close_button slds-button slds-button--neutral slds-order--1"
          press="{!c.close_export}"
        />
                <h2 id="headerTarget" class="slds-text-heading--medium">日报批量导出</h2>
                <ui:button aura:id="close_button" label="关闭"
                    class="close_button slds-button slds-button--neutral slds-order--1" press="{!c.close_export}" />
      </div>
      <div
        class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium"
      >
            <div class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium">
        <aura:if isTrue="{!v.showMain}">
          <div class="slds-grid slds-wrap slds-grid--pull-padded">
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
            ></div>
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
                        </div>
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
            >
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
              活动日开始日期
              <lightning:input
                type="Date"
                class="slds-input slds-input_bare"
                aura:id="input-report-date1"
              />
                            <lightning:input type="Date" class="slds-input slds-input_bare "
                                aura:id="input-report-date1" />
            </div>
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
            >
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
              活动日结束日期
              <lightning:input
                type="Date"
                class="slds-input slds-input_bare"
                aura:id="input-report-date2"
              />
                            <lightning:input type="Date" class="slds-input slds-input_bare "
                                aura:id="input-report-date2" />
            </div>
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
            ></div>
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
                        </div>
            <div class="slds-p-around--large slds-align--absolute-center">
              <lightning:button
                label="确认"
                variant="brand"
                onclick="{!c.select_repores_date}"
              />
              <lightning:button
                label="取消"
                variant="brand"
                onclick="{!c.close_export}"
              />
                            <lightning:button label="确认" variant="brand" onclick="{!c.select_repores_date}" />
                            <lightning:button label="取消" variant="brand" onclick="{!c.close_export}" />
            </div>
          </div>
          <aura:set attribute="else">
            <ui:outputRichText
              class="uiOutputRichText slds-m--around-large"
              value="{!v.TableContent2}"
            />
                        <ui:outputRichText class="uiOutputRichText slds-m--around-large" value="{!v.TableContent2}" />
            <div class="slds-p-around--large slds-align--absolute-center">
              <lightning:button
                label="确认"
                variant="brand"
                onclick="{!c.exportDate}"
              />
              <lightning:button
                label="取消"
                variant="brand"
                onclick="{!c.close_export}"
              />
                            <lightning:button label="确认" variant="brand" onclick="{!c.exportDate}" />
                            <lightning:button label="取消" variant="brand" onclick="{!c.close_export}" />
            </div>
          </aura:set>
        </aura:if>
      </div>
    </div>
  </div>
  <div
    aura:id="modal_exportbg"
    class="disp_none slds-backdrop slds-backdrop--open"
  ></div>
    <div aura:id="modal_exportbg" class="disp_none slds-backdrop slds-backdrop--open"></div>
  <!-- 批量导出日报 end-->
  <div
    aura:id="modal_window"
    role="dialog"
    tabindex="-1"
    class="disp_none slds-modal slds-fade-in-open slds-modal--large"
    aria-labelledby="headerTarget"
  >
    <div aura:id="modal_window" role="dialog" tabindex="-1"
        class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget">
    <div class="slds-modal__container">
      <div class="slds-modal slds-fade-in-open slds-hide" aura:id="successDiv">
        <!-- <ui:inputText aura:id="articleURL" /> -->
        <div class="demo-only" style="height: 8rem">
                <div class="demo-only" style="height: 8rem;">
          <div class="slds-notify_container slds-is-relative">
            <div
              class="slds-notify slds-notify_toast slds-theme_success"
              role="alert"
            >
                        <div class="slds-notify slds-notify_toast slds-theme_success" role="alert">
              <div class="slds-m-left_xx-large">
                <div
                  class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large"
                >
                  <lightning:icon
                    alternativeText="Success"
                    iconName="utility:success"
                    size="small"
                    class="buttonColor slds-m-right_small"
                  />
                                    class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large">
                                    <lightning:icon alternativeText="Success" iconName="utility:success" size="small"
                                        class="buttonColor slds-m-right_small" />
                  <h2 class="slds-text-heading_small">{!v.successMessage}</h2>
                </div>
              </div>
@@ -665,28 +432,16 @@
          </div>
        </div>
      </div>
      <div
        class="slds-modal slds-fade-in-open slds-hide"
        aura:id="errorDiv"
        style="z-index: 10001"
      >
            <div class="slds-modal slds-fade-in-open slds-hide" aura:id="errorDiv" style="z-index: 10001">
        <!-- <ui:inputText aura:id="articleURL" /> -->
        <div class="demo-only" style="height: 8rem">
                <div class="demo-only" style="height: 8rem;">
          <div class="slds-notify_container slds-is-relative">
            <div
              class="slds-notify slds-notify_toast slds-theme_error"
              role="status"
            >
                        <div class="slds-notify slds-notify_toast slds-theme_error" role="status">
              <div class="slds-m-left_xx-large">
                <div
                  class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large"
                >
                  <lightning:icon
                    alternativeText="error"
                    iconName="utility:error"
                    size="small"
                    class="buttonColor slds-m-right_small"
                  />
                                    class="slds-notify__content slds-m-left_small slds-align_absolute-center slds-m-left_xx-large">
                                    <lightning:icon alternativeText="error" iconName="utility:error" size="small"
                                        class="buttonColor slds-m-right_small" />
                  <h2 class="slds-text-heading_small">{!v.errorMessage}</h2>
                </div>
              </div>
@@ -695,74 +450,44 @@
        </div>
      </div>
      <div
        class="slds-modal__content slds-grow slds-p-around--medium"
        style="position: relative"
      >
            <div class="slds-modal__content slds-grow slds-p-around--medium" style="position: relative;">
        <aura:renderIf isTrue="{!v.loginEdit}">
          <lightning:spinner
            alternativeText="Loading"
            size="medium"
            style="width: 100%; height: 100%"
          />
                    <lightning:spinner alternativeText="Loading" size="medium" style="width: 100%; height: 100%;" />
        </aura:renderIf>
        <div class="slds-modal__header">
          <h2 id="headerTarget" class="slds-text-heading--medium">
            日报({!v.selected_date}&nbsp;{!v.selected_agency_person})
          </h2>
          <ui:button
            aura:id="close_button"
            label="关闭"
                        日报({!v.selected_date}&nbsp;{!v.selected_agency_person})</h2>
                    <ui:button aura:id="close_button" label="关闭"
            class="close_button slds-button slds-button--neutral slds-order--1"
            press="{!c.toggle_report}"
          />
                        press="{!c.toggle_report}" />
        </div>
        <div class="slds-box slds-theme--shade">
          <div class="slds-grid slds-wrap slds-grid--pull-padded">
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
            >
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7">
              活动日
              <lightning:input
                type="date"
                value="{!v.data.Report_Date__c}"
                aura:id="input-report-date"
                variant="label-hidden"
              />
                            <lightning:input type="date" value="{!v.data.Report_Date__c}" aura:id="input-report-date"
                                variant="label-hidden" />
            </div>
            <!-- 医院 -->
            <div
              aura:id="hospital_list"
                        <div aura:id="hospital_list"
              class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
              data-select="single"
            >
                            data-select="single">
              <!-- label="医院" -->
              医院
              <lightning:input
                aura:id="hospital_input_text"
                class="field"
                value="{!v.hospital}"
                updateOn="keyup"
                variant="label-hidden"
              />
                            <lightning:input aura:id="hospital_input_text" class="field" value="{!v.hospital}"
                                updateOn="keyup" variant="label-hidden" />
              <div class="slds-lookup__menu" id="lookup-66">
                <ul class="slds-lookup__list" role="listbox">
                  <aura:iteration var="hospital" items="{!v.hospitalList}">
                    <li
                      role="presentation"
                      onclick="{!c.selectHos}"
                                        <li role="presentation" onclick="{!c.selectHos}"
                      data-accName="{!hospital.Hospital_Name_readonly__c}"
                      data-accId="{!hospital.Hospital__c}"
                    >
                      <span
                        class="slds-lookup__item-action slds-media"
                        id="lookup-option-498"
                        role="option"
                      >
                                            data-accId="{!hospital.Hospital__c}">
                                            <span class="slds-lookup__item-action slds-media" id="lookup-option-498"
                                                role="option">
                        <div class="slds-media__body">
                          <div class="slds-lookup__result-text">
                            {!hospital.Hospital_Name_readonly__c}
                          </div>
                                                        {!hospital.Hospital_Name_readonly__c}</div>
                        </div>
                      </span>
                    </li>
@@ -772,120 +497,69 @@
            </div>
            <!-- 科室分类 -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
            >
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7">
              {!v.fieldsmap.Department_Cateogy__c}
              <!-- <ui:inputText aura:id="select_department" class="slds-select"
                                change="{!c.select_department}"/> -->
              <lightning:input
                type="text"
                onchange="{!c.select_department}"
                aura:id="select_department"
                variant="label-hidden"
              />
                            <lightning:input type="text" onchange="{!c.select_department}" aura:id="select_department"
                                variant="label-hidden" />
            </div>
            <!-- 经销商人员  change="{!c.select_DealerPersonnel}" -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
              style="width: 145px"
            >
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
                            style="width: 145px;">
              {!v.fieldsmap.DealerPersonnel__c}
              <ui:inputSelect
                aura:id="select_DealerPersonnel"
                class="slds-select"
              />
                            <ui:inputSelect aura:id="select_DealerPersonnel" class="slds-select" />
            </div>
            <!-- 活动区分   -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
            >
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7">
              {!v.fieldsmap.WorkRecord__c}
              <ui:inputSelect
                aura:id="select_purpose_type"
                class="slds-select"
                change="{!c.select_purpose_type}"
              />
                            <ui:inputSelect aura:id="select_purpose_type" class="slds-select"
                                change="{!c.select_purpose_type}" />
            </div>
            <!-- 拜访人 {!v.fieldsmap.doctor2__c}-->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
              style="width: 145px"
            >
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
                            style="width: 145px;">
              拜访人
              <ui:inputSelect
                aura:id="select_doctor"
                class="slds-select"
                change="{!c.doctor_change}"
              />
                            <ui:inputSelect aura:id="select_doctor" class="slds-select" change="{!c.doctor_change}" />
            </div>
            <!-- <p hidden="hidden"> -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7"
            >
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-7 slds-large-size--1-of-7">
              <br />
              <ui:button
                label="新建"
                class="slds-button"
                press="{!c.createCon}"
                disabled="true"
                aura:id="new_con"
              />
                            <ui:button label="新建" class="slds-button" press="{!c.createCon}" disabled="true"
                                aura:id="new_con" />
            </div>
            <!-- </p> -->
            <hr />
            <!-- 产品分类(第三分类) change="{!c.select_ProductClassification}" -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
            >
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5">
              产品分类(第三分类)
              <ui:inputSelect
                aura:id="select_ProductClassification"
                class="slds-select"
                change="{!c.selectProductClassification}"
              />
                            <ui:inputSelect aura:id="select_ProductClassification" class="slds-select"
                                change="{!c.selectProductClassification}" />
            </div>
            <!-- 使用产品1(产品型号)   UseProduct1__c  -->
            <div
              aura:id="UseProduct1_List"
                        <div aura:id="UseProduct1_List"
              class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
              data-select="single"
            >
                            data-select="single">
              <!-- label="使用产品1(产品型号)" -->
              使用产品1(产品型号)
              <lightning:input
                aura:id="UseProduct1_TEXT"
                class="field"
                value="{!v.UseProduct1}"
                updateOn="keyup"
                variant="label-hidden"
              />
                            <lightning:input aura:id="UseProduct1_TEXT" class="field" value="{!v.UseProduct1}"
                                updateOn="keyup" variant="label-hidden" />
              <div class="slds-lookup__menu" id="lookup-11">
                <ul
                  class="slds-lookup__list"
                  role="listbox"
                  style="max-height: 230px"
                >
                  <aura:iteration
                    var="UseProduct1"
                    items="{!v.UseProduct1List}"
                  >
                    <li
                      role="presentation"
                      onclick="{!c.seletUseProduct1Change}"
                                <ul class="slds-lookup__list" role="listbox" style="max-height:230px;">
                                    <aura:iteration var="UseProduct1" items="{!v.UseProduct1List}">
                                        <li role="presentation" onclick="{!c.seletUseProduct1Change}"
                      data-accid="{!UseProduct1.Id}"
                      data-accName="{!UseProduct1.Asset_Model_No__c}"
                    >
                      <span
                        class="slds-lookup__item-action slds-media"
                        id="lookup-option-498"
                        role="option"
                      >
                                            data-accName="{!UseProduct1.Asset_Model_No__c}">
                                            <span class="slds-lookup__item-action slds-media" id="lookup-option-498"
                                                role="option">
                        <div class="slds-media__body">
                          <div class="slds-lookup__result-text">
                            {!UseProduct1.Asset_Model_No__c}
                          </div>
                                                        {!UseProduct1.Asset_Model_No__c}</div>
                        </div>
                      </span>
                    </li>
@@ -894,45 +568,24 @@
              </div>
            </div>
            <!-- 使用产品2   UseProduct2__c  -->
            <div
              aura:id="UseProduct2_List"
                        <div aura:id="UseProduct2_List"
              class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
              data-select="single"
            >
                            data-select="single">
              <!-- label="使用产品2" -->
              使用产品2
              <lightning:input
                aura:id="UseProduct2_TEXT"
                class="field"
                value="{!v.UseProduct2}"
                updateOn="keyup"
                variant="label-hidden"
              />
                            <lightning:input aura:id="UseProduct2_TEXT" class="field" value="{!v.UseProduct2}"
                                updateOn="keyup" variant="label-hidden" />
              <div class="slds-lookup__menu" id="lookup-22">
                <ul
                  class="slds-lookup__list"
                  role="listbox"
                  style="max-height: 230px"
                >
                  <aura:iteration
                    var="UseProduct2"
                    items="{!v.UseProduct2List}"
                  >
                    <li
                      role="presentation"
                      onclick="{!c.seletUseProduct2Change}"
                                <ul class="slds-lookup__list" role="listbox" style="max-height:230px;">
                                    <aura:iteration var="UseProduct2" items="{!v.UseProduct2List}">
                                        <li role="presentation" onclick="{!c.seletUseProduct2Change}"
                      data-accid="{!UseProduct2.Id}"
                      data-accName="{!UseProduct2.Asset_Model_No__c}"
                    >
                      <span
                        class="slds-lookup__item-action slds-media"
                        id="lookup-option-498"
                        role="option"
                      >
                                            data-accName="{!UseProduct2.Asset_Model_No__c}">
                                            <span class="slds-lookup__item-action slds-media" id="lookup-option-498"
                                                role="option">
                        <div class="slds-media__body">
                          <div class="slds-lookup__result-text">
                            {!UseProduct2.Asset_Model_No__c}
                          </div>
                                                        {!UseProduct2.Asset_Model_No__c}</div>
                        </div>
                      </span>
                    </li>
@@ -941,45 +594,24 @@
              </div>
            </div>
            <!-- 使用产品3   UseProduct3__c  -->
            <div
              aura:id="UseProduct3_List"
                        <div aura:id="UseProduct3_List"
              class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
              data-select="single"
            >
                            data-select="single">
              <!-- label="使用产品3" -->
              使用产品3
              <lightning:input
                aura:id="UseProduct3_TEXT"
                class="field"
                value="{!v.UseProduct3}"
                updateOn="keyup"
                variant="label-hidden"
              />
                            <lightning:input aura:id="UseProduct3_TEXT" class="field" value="{!v.UseProduct3}"
                                updateOn="keyup" variant="label-hidden" />
              <div class="slds-lookup__menu" id="lookup-33">
                <ul
                  class="slds-lookup__list"
                  role="listbox"
                  style="max-height: 230px"
                >
                  <aura:iteration
                    var="UseProduct3"
                    items="{!v.UseProduct3List}"
                  >
                    <li
                      role="presentation"
                      onclick="{!c.seletUseProduct3Change}"
                                <ul class="slds-lookup__list" role="listbox" style="max-height:230px;">
                                    <aura:iteration var="UseProduct3" items="{!v.UseProduct3List}">
                                        <li role="presentation" onclick="{!c.seletUseProduct3Change}"
                      data-accid="{!UseProduct3.Id}"
                      data-accName="{!UseProduct3.Asset_Model_No__c}"
                    >
                      <span
                        class="slds-lookup__item-action slds-media"
                        id="lookup-option-498"
                        role="option"
                      >
                                            data-accName="{!UseProduct3.Asset_Model_No__c}">
                                            <span class="slds-lookup__item-action slds-media" id="lookup-option-498"
                                                role="option">
                        <div class="slds-media__body">
                          <div class="slds-lookup__result-text">
                            {!UseProduct3.Asset_Model_No__c}
                          </div>
                                                        {!UseProduct3.Asset_Model_No__c}</div>
                        </div>
                      </span>
                    </li>
@@ -988,137 +620,91 @@
              </div>
            </div>
            <!-- 效果/进度  EffectProgress__c-->
            <div
              aura:id="product_category_select1"
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
            >
                        <div aura:id="product_category_select1"
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5">
              {!v.fieldsmap.EffectProgress__c}
              <ui:inputSelect
                aura:id="select_EffectProgress"
                class="slds-select"
              />
                            <ui:inputSelect aura:id="select_EffectProgress" class="slds-select" />
            </div>
            <hr />
            <!-- 产品1同类耗材科室月使用量  ConsumptionOfConsumables__c-->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5"
            >
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5">
              {!v.fieldsmap.ConsumptionOfConsumables__c}
              <!-- <ui:inputText aura:id="select_ConsumptionOfConsumables" class="slds-select"
                                change="{!c.select_ConsumptionOfConsumables}" /> -->
              <lightning:input
                type="text"
                onchange="{!c.select_ConsumptionOfConsumables}"
                aura:id="select_ConsumptionOfConsumables"
                variant="label-hidden"
              />
                            <lightning:input type="text" onchange="{!c.select_ConsumptionOfConsumables}"
                                aura:id="select_ConsumptionOfConsumables" variant="label-hidden" />
            </div>
            <!-- 术士分类   WarlockClassification__c   -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"
            >
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6">
              {!v.fieldsmap.WarlockClassification__c}
              <ui:inputSelect
                aura:id="select_OtherBrandConsumables"
                class="slds-select"
              />
                            <ui:inputSelect aura:id="select_OtherBrandConsumables" class="slds-select" />
            </div>
            <!-- 已采用其他品牌   ProductCcategory__c -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"
            >
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6">
              {!v.fieldsmap.ProductCcategory__c}
              <ui:inputSelect
                aura:id="select_ProductCcategory"
                class="slds-select"
                change="{!c.selectpurposetype}"
              />
                            <ui:inputSelect aura:id="select_ProductCcategory" class="slds-select"
                                change="{!c.selectpurposetype}" />
            </div>
            <!-- 其他品牌产品类别  -->
            <div
              aura:id="result"
              class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"
            >
                        <div aura:id="result"
                            class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6">
              {!v.fieldsmap.productCategories__c}
              <ui:inputSelect
                aura:id="select_productCategories"
                class="slds-select"
              />
                            <ui:inputSelect aura:id="select_productCategories" class="slds-select" />
            </div>
            <!-- 产品用量   warlocksNumber__c   -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"
            >
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6">
              {!v.fieldsmap.warlocksNumber__c}
              <!-- <ui:inputText aura:id="select_warlocksNumber" class="slds-select"
                                change="{!c.select_warlocksNumber}" /> -->
              <lightning:input
                type="text"
                onchange="{!c.select_warlocksNumber}"
                aura:id="select_warlocksNumber"
                variant="label-hidden"
              />
                            <lightning:input type="text" onchange="{!c.select_warlocksNumber}"
                                aura:id="select_warlocksNumber" variant="label-hidden" />
            </div>
            <!-- 支援需求      WorkMark__c-->
            <div style="padding-left: 12px">
                        <div style="padding-left: 12px;">
              {!v.fieldsmap.WorkMark__c}
              <lightning:input type="checkbox" aura:id="select_WorkMark" />
            </div>
            <div
              aura:id="input-opportunity-stage"
              class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
            >
                        <div aura:id="input-opportunity-stage"
                            class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12">
              {!v.fieldsmap.StageName__c}
              <ui:inputSelect aura:id="select_stageName" class="slds-select" />
            </div>
            <div
              aura:id="input-opportunity-amount1"
              class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
            >
                        <div aura:id="input-opportunity-amount1"
                            class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12">
              {!v.fieldsmap.Amount__c}
              <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/>  医院采购预算(不含税,元)-->
              <lightning:inputField value="{!v.oppdata.Amount__c}" class="" />
            </div>
            <div
              aura:id="input-opportunity-amount2"
              class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
            >
                        <div aura:id="input-opportunity-amount2"
                            class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12">
              {!v.fieldsmap.OCMSale_Price__c}
              <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/>      订货金额(不含税,元)  -->
              <lightning:inputField
                value="{!v.oppdata.OCMSale_Price__c}"
                class=""
              />
                            <lightning:inputField value="{!v.oppdata.OCMSale_Price__c}" class="" />
            </div>
            <div
              aura:id="input-opportunity-date"
              class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12"
            >
                        <div aura:id="input-opportunity-date"
                            class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12">
              {!v.fieldsmap.Close_Forecasted_Date__c}
              <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/>    预测与OCSM签约日 -->
              <lightning:inputField
                value="{!v.oppdata.Close_Forecasted_Date__c}"
                class=""
              />
                            <lightning:inputField value="{!v.oppdata.Close_Forecasted_Date__c}" class="" />
            </div>
            <hr />
          </div>
        </div>
        <div class="save_button_area">
          <ui:button
            aura:id="save_button"
            label="保存并新建"
            class="save_button slds-button slds-button--brand slds-order--3"
            press="{!c.save_report}"
          />
                    <ui:button aura:id="save_button" label="保存并新建"
                        class="save_button slds-button slds-button--brand slds-order--3" press="{!c.save_report}" />
        </div>
        <aura:renderIf isTrue="{!v.reports_now_count > 0}">
          <div class="mt40 slds-box slds-theme--shade">
            <div class="slds-table--edit_container slds-is-relative">
              <table
                class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus"
                role="grid"
              >
                                role="grid">
                <thead>
                  <tr class="slds-line-height--reset">
                    <th class="table_header slds-text-title--caps">
@@ -1128,87 +714,59 @@
                      <span class="slds-truncate" title="Name">医院</span>
                    </th>
                    <th class="table_header slds-text-title--caps">
                      <span class="slds-truncate" title="Name"
                        >{!v.fieldsmap.Department_Cateogy__c}</span
                      >
                                            <span class="slds-truncate"
                                                title="Name">{!v.fieldsmap.Department_Cateogy__c}</span>
                    </th>
                    <th class="table_header slds-text-title--caps">
                      <span class="slds-truncate" title="Name"
                        >{!v.fieldsmap.doctor2__c}</span
                      >
                                            <span class="slds-truncate" title="Name">{!v.fieldsmap.doctor2__c}</span>
                      <!-- 客户人员 -->
                    </th>
                    <th class="table_header slds-text-title--caps">
                      <span class="slds-truncate" title="Name"
                        >{!v.fieldsmap.visitor_title__c}</span
                      >
                                            <span class="slds-truncate"
                                                title="Name">{!v.fieldsmap.visitor_title__c}</span>
                    </th>
                    <th class="table_header slds-text-title--caps">
                      <span class="slds-truncate" title="Name"
                        >{!v.fieldsmap.WorkRecord__c}</span
                      >
                                            <span class="slds-truncate" title="Name">{!v.fieldsmap.WorkRecord__c}</span>
                    </th>
                  </tr>
                </thead>
                <tbody>
                  <aura:iteration
                    items="{!v.reports_now}"
                    var="item"
                    indexVar="index"
                  >
                                    <aura:iteration items="{!v.reports_now}" var="item" indexVar="index">
                    <tr aura:id="modal_data_list_tr" class="slds-hint-parent">
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.Department_Cateogy_text__c}"
                            >{!item.Name}</span
                          >
                                                    <span class="slds-truncate"
                                                        title="{!item.Department_Cateogy_text__c}">{!item.Name}</span>
                        </span>
                      </td>
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.Agency_Hospital__r.Name}"
                            >{!item.Agency_Hospital__r.Name}</span
                          >
                                                    <span class="slds-truncate"
                                                        title="{!item.Agency_Hospital__r.Name}">{!item.Agency_Hospital__r.Name}</span>
                        </span>
                      </td>
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.Department_Cateogy_text__c}"
                            >{!item.Department_Cateogy_text__c}</span
                          >
                                                    <span class="slds-truncate"
                                                        title="{!item.Department_Cateogy_text__c}">{!item.Department_Cateogy_text__c}</span>
                        </span>
                      </td>
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.doctor2__r.Name}"
                            >{!item.doctor2__r.Name}</span
                          >
                                                    <span class="slds-truncate"
                                                        title="{!item.doctor2__r.Name}">{!item.doctor2__r.Name}</span>
                        </span>
                      </td>
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.visitor_title__c}"
                            >{!item.visitor_title__c}</span
                          >
                                                    <span class="slds-truncate"
                                                        title="{!item.visitor_title__c}">{!item.visitor_title__c}</span>
                        </span>
                      </td>
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.WorkRecord__c}"
                            >{!item.WorkRecord__c}</span
                          >
                                                    <span class="slds-truncate"
                                                        title="{!item.WorkRecord__c}">{!item.WorkRecord__c}</span>
                        </span>
                      </td>
                    </tr>
@@ -1222,80 +780,42 @@
    </div>
  </div>
  <div
    aura:id="modal_bg"
    class="disp_none slds-backdrop slds-backdrop--open"
  ></div>
  <div
    aura:id="modal_confirm"
    role="dialog"
    tabindex="-2"
    aria-labelledby="header43"
    class="disp_none slds-modal slds-fade-in-open"
  >
    <div aura:id="modal_bg" class="disp_none slds-backdrop slds-backdrop--open"></div>
    <div aura:id="modal_confirm" role="dialog" tabindex="-2" aria-labelledby="header43"
        class="disp_none slds-modal slds-fade-in-open">
    <div class="slds-modal__container">
      <div class="slds-modal__header">
        <h2 id="header43" class="slds-text-heading--medium">
          {!v.modal_confirm_title}
        </h2>
                <h2 id="header43" class="slds-text-heading--medium">{!v.modal_confirm_title}</h2>
      </div>
      <div class="slds-modal__content slds-p-around--medium">
        <p>{!v.modal_confirm_text}</p>
      </div>
      <div class="slds-modal__footer">
        <ui:button
          label="是"
          class="slds-button slds-button--brand"
          press="{!c.yes_button}"
        />
        <ui:button
          label="否"
          class="slds-button slds-button--neutral"
          press="{!c.no_button}"
        />
                <ui:button label="是" class="slds-button slds-button--brand" press="{!c.yes_button}" />
                <ui:button label="否" class="slds-button slds-button--neutral" press="{!c.no_button}" />
      </div>
    </div>
  </div>
  <div
    aura:id="modal_confirm_bg"
    class="disp_none slds-backdrop slds-backdrop--open"
  ></div>
    <div aura:id="modal_confirm_bg" class="disp_none slds-backdrop slds-backdrop--open"></div>
  <div
    aura:id="modal_newAC"
    role="dialog"
    tabindex="-3"
    aria-labelledby="headertest"
    class="disp_none slds-modal slds-fade-in-open"
  >
    <div aura:id="modal_newAC" role="dialog" tabindex="-3" aria-labelledby="headertest"
        class="disp_none slds-modal slds-fade-in-open">
    <div class="slds-modal__container">
      <div class="slds-modal__header">
        <h2 id="headertest" class="slds-text-heading--medium">新建.拜访人</h2>
      </div>
      <div class="slds-modal__content slds-p-around--medium">
        <lightning:recordEditForm
          aura:id="recordEditForm"
          objectApiName="Agency_Contact__c"
          onsuccess="{!c.handleSuccess}"
          onload="{!c.showRequiredFields}"
          onsubmit="{!c.handleSubmit}"
        >
                <lightning:recordEditForm aura:id="recordEditForm" objectApiName="Agency_Contact__c"
                    onsuccess="{!c.handleSuccess}" onload="{!c.showRequiredFields}" onsubmit="{!c.handleSubmit}">
          <lightning:messages aura:id="OppMessage" />
          <!-- onload="{!c.showRequiredFields}" -->
          <aura:renderIf isTrue="{!v.truthy}">
            <lightning:inputField
              fieldName="Name"
              aura:id="newOpportunityField"
            />
            <lightning:inputField
              fieldName="Type__c"
              aura:id="newOpportunityField"
            />
            <lightning:inputField
              fieldName="Doctor_Division1__c"
              aura:id="newOpportunityField"
            />
                        <lightning:inputField fieldName="Name" aura:id="newOpportunityField" />
                        <lightning:inputField fieldName="Type__c" aura:id="newOpportunityField" />
                        <lightning:inputField fieldName="Doctor_Division1__c" aura:id="newOpportunityField" />
          </aura:renderIf>
          <br />
          <br />
@@ -1303,21 +823,15 @@
          <br />
          <br />
          <div class="save_button_area">
            <lightning:button
              class="slds-m-top_small"
              type="button"
              label="取消"
              onclick="{!c.createCancel}"
            />
            <lightning:button
              class="slds-m-top_small"
              type="button"
              label="保存"
              onclick="{!c.handleSubmit}"
            />
                        <lightning:button class="slds-m-top_small" type="button" label="取消"
                            onclick="{!c.createCancel}" />
                        <lightning:button class="slds-m-top_small" type="button" label="保存"
                            onclick="{!c.handleSubmit}" />
          </div>
        </lightning:recordEditForm>
      </div>
    </div>
  </div>
</aura:component>
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.css
@@ -1,4 +1,4 @@
@import "c/lexCssUtility";
@import 'c/lexCssUtility';
.THIS .bcolor {
  color: #333;
@@ -28,7 +28,7 @@
.THIS .no_data_area {
  text-align: center;
  margin: 0.5em 0;
    margin: .5em 0;
}
.THIS.report_list_area {
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportController.js
@@ -4,21 +4,21 @@
  },
  createAopp: function (component, event, helper) {
    var addRecordEvent = $A.get("e.force:createRecord");
        var addRecordEvent = $A.get('e.force:createRecord');
    addRecordEvent.setParams({
      entityApiName: "Agency_Opportunity__c",
      recordTypeId: "012100000006KW7"
            entityApiName: 'Agency_Opportunity__c',
            recordTypeId: '012100000006KW7'
    });
    addRecordEvent.fire();
  },
  new_report: function (component, event, helper) {
    component.find("save_button").set("v.label", "保存并新建");
        component.find('save_button').set('v.label', '保存并新建');
    helper.new_report(component, event, helper);
  },
  copy_button: function (component, event, helper) {
    component.find("save_button").set("v.label", "保存并新建");
        component.find('save_button').set('v.label', '保存并新建');
    helper.copy_button(component, event, helper);
  },
  delete_button: function (component, event, helper) {
@@ -29,7 +29,7 @@
  },
  edit_button: function (component, event, helper) {
    component.find("save_button").set("v.label", "保存");
        component.find('save_button').set('v.label', '保存');
    helper.edit_button(component, event, helper);
  },
@@ -50,97 +50,79 @@
    event.preventDefault(); // stop form submission
    var showValidationError = false;
    var fields = component.find("newOpportunityField");
    var vaildationFailReason = "";
        var vaildationFailReason = '';
    let agencyReport = Object.create(null);
    fields.forEach(function (field) {
      if (
        field.get("v.fieldName") === "Type__c" &&
        $A.util.isEmpty(field.get("v.value"))
      ) {
            if (field.get("v.fieldName") === 'Type__c' && $A.util.isEmpty(field.get("v.value"))) {
        showValidationError = true;
        vaildationFailReason = "分类不能为空!";
      } else if (
        field.get("v.fieldName") === "Doctor_Division1__c" &&
        $A.util.isEmpty(field.get("v.value"))
      ) {
            } else if (field.get("v.fieldName") === 'Doctor_Division1__c' && $A.util.isEmpty(field.get("v.value"))) {
        showValidationError = true;
        if (vaildationFailReason != "") {
                if (vaildationFailReason != '') {
          vaildationFailReason += "医生区分(职务)不能为空!";
        } else {
          vaildationFailReason = "医生区分(职务)不能为空!";
        }
      }
      //SWAG-CF58C3 fy start
      if (field.get("v.fieldName") === "Name") {
        agencyReport["name"] = field.get("v.value");
      } else if (field.get("v.fieldName") === "Type__c") {
        agencyReport["type"] = field.get("v.value");
      } else if (field.get("v.fieldName") === "Doctor_Division1__c") {
        agencyReport["doctorDivision1"] = field.get("v.value");
            if (field.get("v.fieldName") === 'Name') {
                agencyReport['name'] = field.get("v.value");
            } else if (field.get("v.fieldName") === 'Type__c') {
                agencyReport['type'] = field.get("v.value");
            } else if (field.get("v.fieldName") === 'Doctor_Division1__c') {
                agencyReport['doctorDivision1'] = field.get("v.value");
      }
      //SWAG-CF58C3 fy end
    });
    if (!showValidationError) {
      //SWAG-CF58C3 fy start
      var agencyHospitalid = component.get("v.hospitalLinkId");
            var agencyHospitalid = component.get('v.hospitalLinkId');
      //zhj MEBG新方案改造 2022-11-29 start
      debugger;
      let hospitalName = "";
            debugger
            let hospitalName = '';
      //调用后端searchAgencyDataId方法查询出医院下面所有客户人员dataid
      helper.CallBackAction(
        component,
        "searchAgencyDataId",
        {
            helper.CallBackAction(component, 'searchAgencyDataId', {
          hospitalId: agencyHospitalid
        },
        function (data) {
            }, function (data) {
          if (data.getState() == "SUCCESS") {
            var data = data.getReturnValue();
            if (data.IsSuccess == true) {
              let agencyContactIds = "";
              if (data.Message == "" && data.Data && data.Data.length > 0) {
                        let agencyContactIds = ''
                        if (data.Message == '' && data.Data && data.Data.length > 0) {
                hospitalName = data.Data[0].Agency_Hospital__r.Name;
                for (var i = 0; i < data.Data.length; i++) {
                  if (data.Data[i].AWS_Data_Id__c)
                    agencyContactIds += "," + data.Data[i].AWS_Data_Id__c;
                                    agencyContactIds += ',' + data.Data[i].AWS_Data_Id__c;
                }
                agencyContactIds = agencyContactIds.substring(1);
                agencyReport["agencyContactIds"] = agencyContactIds;
                            agencyReport['agencyContactIds'] = agencyContactIds;
              } else {
                agencyReport["agencyContactIds"] = agencyContactIds;
                            agencyReport['agencyContactIds'] = agencyContactIds;
              }
              var arr = new Array();
              arr.push(agencyReport);
              var requestData = JSON.stringify(arr);
              // helper.set_aws_url(component,data,agencyHospitalid);
              var token = component.get("v.AWStoken");
              var newUrl = component.get("v.AWSinsert") + "V2";
                        var token = component.get('v.AWStoken');
                        var newUrl = component.get('v.AWSinsert') + 'V2';
              component.set("v.login", true);
              helper.insert_agencycontact(
                component,
                token,
                newUrl,
                requestData,
                agencyHospitalid,
                helper,
                hospitalName
              );
                        component.set('v.login', true);
                        helper.insert_agencycontact(component, token, newUrl, requestData, agencyHospitalid, helper, hospitalName);
            } else {
              helper.ShowToast({
                message: data.message,
                type: "error"
                            "message": data.message,
                            "type": "error"
              });
            }
          } else {
            helper.ShowToast({
              message: "searchAgency失败",
              type: "error"
                        "message": 'searchAgency失败',
                        "type": "error"
            });
          }
        }
      );
            })
      //zhj MEBG新方案改造 2022-11-29 end
      // var arr = new Array();
      // arr.push(agencyReport);
@@ -152,7 +134,7 @@
      //SWAG-CF58C3 fy end
      // helper.newlyBuild(component, event, helper);
    } else {
      component.find("OppMessage").setError(vaildationFailReason);
            component.find('OppMessage').setError(vaildationFailReason);
    }
  },
@@ -161,21 +143,13 @@
  },
  yes_button: function (component, event, helper) {
    component.set("v.confirm_status", 1);
    helper.close_confirm(
      component,
      component.get("v.modal_confirm_title"),
      component.get("v.modal_confirm_text")
    );
        component.set('v.confirm_status', 1);
        helper.close_confirm(component, component.get('v.modal_confirm_title'), component.get('v.modal_confirm_text'));
  },
  no_button: function (component, event, helper) {
    component.set("v.confirm_status", 2);
    helper.close_confirm(
      component,
      component.get("v.modal_confirm_title"),
      component.get("v.modal_confirm_text")
    );
        component.set('v.confirm_status', 2);
        helper.close_confirm(component, component.get('v.modal_confirm_title'), component.get('v.modal_confirm_text'));
  },
  toggle_report: function (component, event, helper) {
@@ -191,7 +165,7 @@
  },
  select_agency_change: function (component, event, helper) {
    debugger;
        debugger
    helper.select_agency_change(component, event, helper);
  },
@@ -203,7 +177,7 @@
        helper.searchHos(component, event, helper);
      }
    } else {
      if (hospital_name == "") {
            if (hospital_name == '') {
        helper.hideSearchs(component, event, helper);
      } else {
        helper.hideSearch(component, event, helper);
@@ -218,13 +192,13 @@
  UseProduct1Change: function (component, event, helper) {
    var UseProduct1Name = event.getParam("value");
    var UseProduct1Nameold = component.get("v.UseProduct1s");
    debugger;
        debugger
    if (UseProduct1Name.match(/(\S+\s)+/)) {
      if (UseProduct1Name != UseProduct1Nameold) {
        helper.searchUseProduct1(component, event, helper);
      }
    } else {
      if (UseProduct1Name == "") {
            if (UseProduct1Name == '') {
        helper.hideSearchUseProduct1s(component, event, helper);
      } else {
        helper.hideSearchUseProduct1(component, event, helper);
@@ -243,7 +217,7 @@
        helper.searchUseProduct2(component, event, helper);
      }
    } else {
      if (UseProduct2Name == "") {
            if (UseProduct2Name == '') {
        helper.hideSearchUseProduct2s(component, event, helper);
      } else {
        helper.hideSearchUseProduct2(component, event, helper);
@@ -265,7 +239,7 @@
        helper.searchUseProduct3(component, event, helper);
      }
    } else {
      if (UseProduct3Name == "") {
            if (UseProduct3Name == '') {
        helper.hideSearchUseProduct3s(component, event, helper);
      } else {
        helper.hideSearchUseProduct3(component, event, helper);
@@ -275,6 +249,7 @@
  seletUseProduct3Change: function (component, event, helper) {
    helper.seletUseProduct3Change(component, event, helper);
  },
  select_department: function (component, event, helper) {
    helper.setOpportunity_cfilter(component);
@@ -292,7 +267,7 @@
  onDrop: function (component, event, helper) {
    event.stopPropagation();
    event.preventDefault();
    event.dataTransfer.dropEffect = "copy";
        event.dataTransfer.dropEffect = 'copy';
    var files = event.dataTransfer.files;
    helper.readFile(component, helper, files[0]);
  },
@@ -316,20 +291,18 @@
  },
  exportDate: function (component, event, helper) {
    var stockData = component.get("v.reports_date");
    console.log("导出数据" + stockData);
        console.log('导出数据' + stockData);
    var csv = helper.convertArrayOfObjectsToCSV(component, stockData);
    if (csv == null) {
      return;
    }
        if (csv == null) { return; }
    var universalBOM = "\uFEFF";
    var hiddenElement = document.createElement("a");
    hiddenElement.href =
      "data:text/csv;charset=utf-8," + encodeURI(universalBOM + csv);
    hiddenElement.target = "_self"; //
    hiddenElement.download = "ExportData.csv"; // CSV file Name* you can change it.[only name not .csv]
        var hiddenElement = document.createElement('a');
        hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(universalBOM + csv);
        hiddenElement.target = '_self'; //
        hiddenElement.download = 'ExportData.csv';  // CSV file Name* you can change it.[only name not .csv]
    document.body.appendChild(hiddenElement); // Required for FireFox browser
    hiddenElement.click(); // using click() js function to download csv file
  },
  export_condition: function (component, event, helper) {
    helper.showExport(component);
@@ -339,9 +312,9 @@
    helper.select_repores_date(component, event, helper);
  },
  export: function (component, event, helper) {
    console.log("进入export");
        console.log('进入export');
    var stockData = component.get("v.reports_date");
    console.log("查出的数据" + stockData);
        console.log('查出的数据' + stockData);
  },
  close_import: function (component, event, helper) {
    component.set("v.showMain", true);
@@ -367,13 +340,13 @@
    helper.selectpurposetype(component, event, helper);
  },
  return_main_page: function (component, event, helper) {
    window.open("/customer/", "_self");
        window.open('/customer/', '_self');
  },
  exportErrorInfo: function (component, event, helper) {
    helper.exportErrorInfoHelper(component);
  },
  closeErrorDiv: function (component, event, helper) {
    var errorDiv01 = component.find("errorDiv01");
    $A.util.addClass(errorDiv01, "slds-hide");
        var errorDiv01 = component.find('errorDiv01');
        $A.util.addClass(errorDiv01, 'slds-hide');
  }
});
})
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js
Diff too large
force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp
@@ -1,30 +1,10 @@
<aura:component
  controller="WeeklyReportCmp"
  implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,forceCommunity:availableForAllPageTypes"
  access="global"
>
<aura:component controller="WeeklyReportCmp" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,forceCommunity:availableForAllPageTypes" access="global" >
  <ltng:require styles="{!$Resource.multilineToastCSS}" /> 
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
  <aura:handler
    event="c:strike_evt"
    action="{!c.createAopp}"
    name="strike_evt_addNewRecord"
  />
  <aura:attribute
    name="data"
    type="Agency_Report__c"
    default="{sobjectType:'Agency_Report__c'}"
  />
  <aura:attribute
    name="oppdata"
    type="Agency_Opportunity__c"
    default="{sobjectType:'Agency_Opportunity__c'}"
  />
  <aura:attribute
    name="acondata"
    type="Agency_Contact__c"
    default="{sobjectType:'Agency_Contact__c'}"
  />
    <aura:handler event="c:strike_evt" action="{!c.createAopp}" name="strike_evt_addNewRecord"/>
    <aura:attribute name="data" type="Agency_Report__c" default="{sobjectType:'Agency_Report__c'}"/>
    <aura:attribute name="oppdata" type="Agency_Opportunity__c" default="{sobjectType:'Agency_Opportunity__c'}"/>
    <aura:attribute name="acondata" type="Agency_Contact__c" default="{sobjectType:'Agency_Contact__c'}"/>
  <!-- <aura:attribute name="oppdata_old" type="Agency_Opportunity__c" default="{sobjectType:'Agency_Opportunity__c'}"/> -->
  <aura:attribute name="Close_Forecasted_Date__c_o" type="Date" />
  <aura:attribute name="Amount__c_o" type="String" />
@@ -54,11 +34,7 @@
  <aura:attribute name="doctor_list" type="Map" />
  <aura:attribute name="doctor_title" type="String" />
  <aura:attribute name="opportunity_list" type="Map" />
  <aura:handler
    name="change"
    value="{!v.data.Opportunity__c}"
    action="{!c.opportunityChange}"
  />
    <aura:handler name="change" value="{!v.data.Opportunity__c}" action="{!c.opportunityChange}"/>
  <aura:attribute name="edit_copy_select_report_id" type="String" />
  <aura:attribute name="create_agency_report_id" type="String" />
  <aura:attribute name="reports" type="List" />
@@ -81,31 +57,15 @@
    <aura:handler name="change" value="{!v.data.Product_Category2__c}" action="{!c.productcategoryChange2}"/>
    <aura:handler name="change" value="{!v.data.Product_Category3__c}" action="{!c.productcategoryChange3}"/> -->
  <!-- <aura:handler name="change" value="{!v.oppdata.StageName__c}" action="{!c.stageNameChange}"/> -->
  <aura:attribute
    name="update_select_report_data_id"
    type="String"
    default=""
  />
    <aura:attribute name="update_select_report_data_id" type="String" default=""/>
  <!-- 批量添加周报 start-->
  <aura:attribute name="reports_date" type="List" />
  <!-- <aura:attribute name="reports_date1" type="Date" />
    <aura:attribute name="reports_date2" type="Date" /> -->
  <aura:attribute
    name="TableContent"
    type="String"
    description=" Show the Result class"
  />
  <aura:attribute
    name="TableContent2"
    type="String"
    description=" Show the Result class"
  />
  <aura:attribute
    name="TargetFileName"
    type="String"
    description="Name of the file"
  />
    <aura:attribute name="TableContent" type="String"  description=" Show the Result class"/>
    <aura:attribute name="TableContent2" type="String"  description=" Show the Result class"/>
    <aura:attribute name="TargetFileName" type="String"  description="Name of the file"/>
  <aura:attribute name="tableheaders" type="Object[]" />
  <aura:attribute name="fileContentData" type="String" />
  <aura:attribute name="filename" type="String" />
@@ -140,10 +100,7 @@
      <!-- add by Deloitte-Link 2023-6-19 -->
      <div class="weeklyReportSpinner">
        <div class="slds-spinner_container">
          <div
            class="slds-spinner--brand slds-spinner slds-spinner--medium"
            role="alert"
          >
                    <div class="slds-spinner--brand slds-spinner slds-spinner--medium" role="alert">
            <span id="aa" class="slds-assistive-text">Loading</span>
            <div class="slds-spinner__dot-a"></div>
            <div class="slds-spinner__dot-b"></div>
@@ -155,135 +112,65 @@
  <div aura:id="report" id="report" class="contents_wrapper">
    <div class="slds-grid slds-wrap slds-grid--pull-padded">
      <div
        class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"
      >
            <div class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12">
        周
      </div>
      <div
        class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12"
      >
        <ui:inputSelect
          aura:id="select_date"
          class="slds-select"
          change="{!c.select_date_change}"
        />
            <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12">
                <ui:inputSelect aura:id="select_date" class="slds-select" change="{!c.select_date_change}"/>
      </div>
      <!-- 代理店担当者 -->
      <div
        class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"
      >
            <div class="tr mt5 slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12">
        {!v.fieldsmap.Person_In_Charge2__c}
      </div>
      <div
        class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12"
      >
        <ui:inputSelect
          aura:id="select_agency_person"
          class="slds-select agency_person_select"
          change="{!c.select_agency_change}"
        />
            <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12">
                <ui:inputSelect aura:id="select_agency_person" class="slds-select agency_person_select" change="{!c.select_agency_change}"/>
      </div>
      <div
        class="tr slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12"
      >
        <ui:button
          aura:id="new_button"
          label="新建"
          press="{!c.new_report}"
          disabled="true"
        />
            <div class="tr slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-12 slds-large-size--1-of-12">
                <ui:button aura:id="new_button" label="新建" press="{!c.new_report}" disabled="true"/>
      </div>
      <div
        class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12"
      >
        <ui:button
          aura:id="copy_button"
          label="复制"
          press="{!c.copy_button}"
          disabled="true"
        />
            <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12">
                <ui:button aura:id="copy_button" label="复制" press="{!c.copy_button}" disabled="true"/>
        <!-- <ui:button aura:id="import" label="导入" press="{!c.import}" /> -->
        <ui:button aura:id="import" label="导入" press="{!c.import}" />
        <!-- <input type="file" class="file" aura:id="file" onchange="{!c.CreateRecord}"  style="position:absolute;filter:alpha(opacity=0);" size="1" hidden="true" />  -->
        <!-- <ui:button aura:id="import" label="导出" press="{!c.export}"/> -->
        <ui:button
          aura:id="export"
          label="导出"
          press="{!c.export_condition}"
        />
                <ui:button aura:id="export" label="导出" press="{!c.export_condition}"/>
      </div>
    </div>
  </div>
  <div aura:id="report_list" class="report_list_area">
    <div class="slds-table--edit_container slds-is-relative">
      <table
        class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus"
        role="grid"
        style="width: 66.75rem"
      >
            <table class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus" role="grid" style="width:66.75rem;">
        <thead>
          <tr class="slds-line-height--reset">
            <th
              class="table_header slds-text-title--caps"
              style="width: 250px; font-size: 13px"
            >
                        <th class="table_header slds-text-title--caps" style="width: 250px;font-size: 13px;">
              <span class="slds-truncate" title="Name">周报编号</span>
            </th>
            <th
              class="table_header slds-text-title--caps"
              style="width: 100px; font-size: 13px"
            >
              <span class="slds-truncate" title="Name"
                >{!v.fieldsmap.Person_In_Charge2__c}</span
              >
                        <th class="table_header slds-text-title--caps" style="width: 100px;font-size: 13px;">
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.Person_In_Charge2__c}</span>
            </th>
            <th
              class="table_header slds-text-title--caps"
              style="width: 250px; font-size: 13px"
            >
                        <th class="table_header slds-text-title--caps" style="width: 250px;font-size: 13px;">
              <span class="slds-truncate" title="Name">医院</span>
            </th>
            <th
              class="table_header slds-text-title--caps"
              style="width: 100px; font-size: 13px"
            >
              <span class="slds-truncate" title="Name"
                >{!v.fieldsmap.Department_Cateogy__c}</span
              >
                        <th class="table_header slds-text-title--caps" style="width: 100px;font-size: 13px;">
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.Department_Cateogy__c}</span>
            </th>
            <th
              class="table_header slds-text-title--caps"
              style="width: 100px; font-size: 13px"
            >
                        <th class="table_header slds-text-title--caps" style="width: 100px;font-size: 13px;">
              <!-- PIPL update Yin Mingjie 21/02/2022 start
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.doctor2__r}</span>
                            PIPL update Yin Mingjie 21/02/2022 end-->
              <span
                class="slds-truncate"
                title="Name"
                style="width: 100px; font-size: 13px"
                >{!v.fieldsmap.Agency_Contact__c}</span
              >
                            <span class="slds-truncate" title="Name" style="width: 100px;font-size: 13px;">{!v.fieldsmap.Agency_Contact__c}</span>
            </th>
            <th
              class="table_header slds-text-title--caps"
              style="width: 100px; font-size: 13px"
            >
              <span class="slds-truncate" title="Name"
                >{!v.fieldsmap.visitor_title__c}</span
              >
                        <th class="table_header slds-text-title--caps" style="width: 100px;font-size: 13px;">
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.visitor_title__c}</span>
            </th>
            <th
              class="table_header slds-text-title--caps"
              style="width: 100px; font-size: 13px"
            >
              <span class="slds-truncate" title="Name"
                >{!v.fieldsmap.Purpose_Type__c}</span
              >
                        <th class="table_header slds-text-title--caps" style="width: 100px;font-size: 13px;">
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.Purpose_Type__c}</span>
            </th>
          </tr>
        </thead>
@@ -291,27 +178,12 @@
          <aura:iteration items="{!v.reports}" var="item" indexVar="index">
            <tr class="slds-hint-parent">
              <td role="gridcell" class="slds-cell-edit">
                <ui:inputRadio
                  class="report_radio"
                  name="report_radio"
                  label="{!item.Name}"
                  change="{!c.change_report_radio}"
                />
                <lightning:buttonIcon
                  class="edit_button"
                  iconName="utility:edit"
                  size="small"
                  alternativeText="edit"
                  value="{!index}"
                  onclick="{!c.edit_button}"
                />
                                <ui:inputRadio class="report_radio" name="report_radio" label="{!item.Name}" change="{!c.change_report_radio}"/>
                                <lightning:buttonIcon class="edit_button" iconName="utility:edit" size="small" alternativeText="edit" value="{!index}" onclick="{!c.edit_button}"/>
              </td>
              <td role="gridcell" class="slds-cell-edit">
                <span class="slds-grid slds-grid--align-spread">
                  <span
                    class="slds-truncate"
                    title="{!item.Person_In_Charge2__r.Name}"
                  >
                                    <span class="slds-truncate" title="{!item.Person_In_Charge2__r.Name}">
                    {!item.Person_In_Charge2__r.Name}
                    <!-- <span class="decrypt">{!item.Person_In_Charge2__r.awsdata.lastName}</span> -->
                  </span>
@@ -324,11 +196,7 @@
              </th>
              <td role="gridcell" class="slds-cell-edit">
                <span class="slds-grid slds-grid--align-spread">
                  <span
                    class="slds-truncate"
                    title="{!item.Department_Cateogy__c}"
                    >{!item.Department_Cateogy__c}</span
                  >
                                    <span class="slds-truncate" title="{!item.Department_Cateogy__c}">{!item.Department_Cateogy__c}</span>
                </span>
              </td>
              <td role="gridcell" class="slds-cell-edit">
@@ -343,17 +211,13 @@
                <span class="slds-grid slds-grid--align-spread">
                  <span class="slds-truncate" title="{!item.visitor_title__c}">
                    <span class="encrypt">{!item.visitor_title__c}</span>
                    <span class="decrypt"
                      >{!item.doctor2__r.awsdata.doctorDivision1}</span
                    >
                                        <span class="decrypt">{!item.doctor2__r.awsdata.doctorDivision1}</span>
                  </span>
                </span>
              </td>
              <td role="gridcell" class="slds-cell-edit">
                <span class="slds-grid slds-grid--align-spread">
                  <span class="slds-truncate" title="{!item.Purpose_Type__c}"
                    >{!item.Purpose_Type__c}</span
                  >
                                    <span class="slds-truncate" title="{!item.Purpose_Type__c}">{!item.Purpose_Type__c}</span>
                </span>
              </td>
            </tr>
@@ -363,89 +227,50 @@
    </div>
    <aura:renderIf isTrue="{!v.report_count > 0}">
      <aura:set attribute="else">
        <div class="no_data_area">{!v.list_message}</div>
                <div class="no_data_area">
                    {!v.list_message}
                </div>
      </aura:set>
    </aura:renderIf>
  </div>
  <!--    <ui:button aura:id="test_button" label="test" class="fade animation_on" press="{!c.test}"/>-->
  <!-- 批量添加周报 start-->
  <div
    aura:id="modal_import"
    role="dialog"
    tabindex="-1"
    class="disp_none slds-modal slds-fade-in-open slds-modal--large"
    aria-labelledby="headerTarget"
  >
    <div aura:id="modal_import" role="dialog" tabindex="-1" class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget">
    <div class="slds-modal__container">
      <aura:renderIf isTrue="{!v.loginEdit}">
        <lightning:spinner
          alternativeText="Loading"
          size="medium"
          style="width: 100%; height: 80%; top: 50px"
        />
                <lightning:spinner alternativeText="Loading" size="medium" style="width: 100%; height: 80%;top:50px;" />
      </aura:renderIf>
      <div class="slds-modal__header">
        <h4 id="headerTarget" class="slds-float--left"></h4>
        <h2 id="headerTarget" class="slds-text-heading--medium">
          周报批量导入
        </h2>
        <ui:button
          aura:id="close_button"
          label="关闭"
          class="close_button slds-button slds-button--neutral slds-order--1"
          press="{!c.close_import}"
        />
                <h2 id="headerTarget" class="slds-text-heading--medium">周报批量导入</h2>
                <ui:button aura:id="close_button" label="关闭" class="close_button slds-button slds-button--neutral slds-order--1" press="{!c.close_import}"/>
      </div>
      <div
        class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium"
      >
            <div class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium " >
        <aura:if isTrue="{!v.showMain}">
          <div>
            <!-- <input type="file" class="file" aura:id="file" onchange="{!c.CreateRecord}" value="导入" /> -->
            <lightning:input
              type="file"
              class="file"
              uara:id="file"
              onchange="{!c.CreateRecord}"
            />
                        <lightning:input type="file" class="file" uara:id="file" onchange="{!c.CreateRecord}" />
            <!-- <ui:button label="Create Accounts" press="{!c.CreateRecord}"/> -->
          </div>
          <aura:set attribute="else">
            <!-- <ui:outputRichText class="uiOutputRichText slds-m-around-large" value="{!v.TargetFileName}"/>  -->
            <ui:outputRichText
              class="uiOutputRichText slds-m--around-large"
              value="{!v.TableContent}"
            />
                        <ui:outputRichText class="uiOutputRichText slds-m--around-large" value="{!v.TableContent}"/>
            <div class="slds-p-around--large slds-align--absolute-center">
              <lightning:button
                label="保存"
                variant="brand"
                onclick="{!c.processFileContent}"
                            <lightning:button label="保存" variant="brand" onclick="{!c.processFileContent}"
              />
              <lightning:button
                label="取消"
                variant="brand"
                onclick="{!c.cancel}"
              />
                            <lightning:button label="取消" variant="brand"
                                              onclick="{!c.cancel}" />
            </div>
            <!-- start DTT-zhj 增加错误信息table 2023-05-16-->
            <aura:if isTrue="{!v.showErrorInfo}">
              <div class="slds-p-around--large slds-align--absolute-center">
                <lightning:button
                  label="导出错误信息"
                  variant="brand"
                  onclick="{!c.exportErrorInfo}"
                />
                                <lightning:button label="导出错误信息" variant="brand" onclick="{!c.exportErrorInfo}" />
              </div>
              <div class="slds-p-around--large slds-align--absolute-center">
                <div style="height: 300px; overflow-x: scroll">
                  <lightning:datatable
                    keyField="id"
                    data="{! v.errorData }"
                    columns="{! v.errorColumns }"
                    hideCheckboxColumn="true"
                  />
                                    <lightning:datatable keyField="id" data="{! v.errorData }"
                                        columns="{! v.errorColumns }" hideCheckboxColumn="true" />
                </div>
              </div>
            </aura:if>
@@ -455,76 +280,39 @@
      </div>
    </div>
  </div>
  <div
    aura:id="modal_importbg"
    class="disp_none slds-backdrop slds-backdrop--open"
  ></div>
    <div aura:id="modal_importbg" class="disp_none slds-backdrop slds-backdrop--open"></div>
  <!-- 批量添加周报 end-->
  <!-- 批量导出周报 start-->
  <div
    aura:id="modal_export"
    role="dialog"
    tabindex="-1"
    class="disp_none slds-modal slds-fade-in-open slds-modal--large"
  >
    <div aura:id="modal_export" role="dialog" tabindex="-1" class="disp_none slds-modal slds-fade-in-open slds-modal--large" >
    <div class="slds-modal__container">
      <div class="slds-modal__header">
        <h4 id="headerTarget" class="slds-float--left"></h4>
        <h2 id="headerTarget" class="slds-text-heading--medium">
          周报批量导出
        </h2>
        <ui:button
          aura:id="close_button"
          label="关闭"
          class="close_button slds-button slds-button--neutral slds-order--1"
          press="{!c.close_export}"
        />
                <h2 id="headerTarget" class="slds-text-heading--medium">周报批量导出</h2>
                <ui:button aura:id="close_button" label="关闭" class="close_button slds-button slds-button--neutral slds-order--1" press="{!c.close_export}"/>
      </div>
      <div
        class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium"
      >
            <div class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium">
        <aura:if isTrue="{!v.showMain}">
          <div class="slds-grid slds-wrap slds-grid--pull-padded">
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
            ></div>
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
            >
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
                        </div>
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
              活动日开始日期
              <lightning:input
                type="Date"
                class="slds-input slds-input_bare"
                aura:id="input-report-date1"
              />
                            <lightning:input type="Date" class="slds-input slds-input_bare " aura:id="input-report-date1" />
            </div>
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
            >
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
              活动日结束日期
              <lightning:input
                type="Date"
                class="slds-input slds-input_bare"
                aura:id="input-report-date2"
              />
                            <lightning:input type="Date" class="slds-input slds-input_bare " aura:id="input-report-date2" />
            </div>
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4"
            ></div>
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-4">
                        </div>
            <div class="slds-p-around--large slds-align--absolute-center">
              <lightning:button
                label="确认"
                variant="brand"
                onclick="{!c.select_repores_date}"
                            <lightning:button label="确认" variant="brand" onclick="{!c.select_repores_date}"
              />
              <lightning:button
                label="取消"
                variant="brand"
                onclick="{!c.close_export}"
              />
                            <lightning:button label="取消" variant="brand"
                                                  onclick="{!c.close_export}" />
            </div>
          </div>
          <!-- <div>
@@ -537,109 +325,54 @@
                                              onclick="{!c.close_export}" /> 
                    </div> -->
          <aura:set attribute="else">
            <ui:outputRichText
              class="uiOutputRichText slds-m--around-large"
              value="{!v.TableContent2}"
            />
                        <ui:outputRichText class="uiOutputRichText slds-m--around-large" value="{!v.TableContent2}"/>
            <div class="slds-p-around--large slds-align--absolute-center">
              <lightning:button
                label="确认"
                variant="brand"
                onclick="{!c.exportDate}"
                            <lightning:button label="确认" variant="brand" onclick="{!c.exportDate}"
              />
              <lightning:button
                label="取消"
                variant="brand"
                onclick="{!c.close_export}"
              />
                            <lightning:button label="取消" variant="brand"
                                              onclick="{!c.close_export}" />
            </div>
          </aura:set>
        </aura:if>
      </div>
    </div>
  </div>
  <div
    aura:id="modal_exportbg"
    class="disp_none slds-backdrop slds-backdrop--open"
  ></div>
    <div aura:id="modal_exportbg" class="disp_none slds-backdrop slds-backdrop--open"></div>
  <!-- 批量导出周报 end-->
  <div
    aura:id="modal_window"
    role="dialog"
    tabindex="-1"
    class="disp_none slds-modal slds-fade-in-open slds-modal--large"
    aria-labelledby="headerTarget"
  >
    <div aura:id="modal_window" role="dialog" tabindex="-1" class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget">
    <div class="slds-modal__container">
      <aura:renderIf isTrue="{!v.loginEdit}">
        <lightning:spinner
          alternativeText="Loading"
          size="medium"
          style="width: 100%; height: 80%; top: 50px"
        />
                <lightning:spinner alternativeText="Loading" size="medium" style="width: 100%; height: 80%;top:50px;" />
      </aura:renderIf>
      <div class="slds-modal__header">
        <h4 id="headerTarget" class="slds-float--left"></h4>
        <h2 id="headerTarget" class="slds-text-heading--medium">
          周报({!v.selected_date}&nbsp;{!v.selected_agency_person})
        </h2>
        <ui:button
          aura:id="close_button"
          label="关闭"
          class="close_button slds-button slds-button--neutral slds-order--1"
          press="{!c.toggle_report}"
        />
                <h2 id="headerTarget" class="slds-text-heading--medium">周报({!v.selected_date}&nbsp;{!v.selected_agency_person})</h2>
                <ui:button aura:id="close_button" label="关闭" class="close_button slds-button slds-button--neutral slds-order--1" press="{!c.toggle_report}"/>
      </div>
      <div class="slds-modal__content slds-grow slds-p-around--medium">
        <div class="slds-box slds-theme--shade">
          <div class="slds-grid slds-wrap slds-grid--pull-padded">
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop"
            >
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop" >
              活动日
              <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
              <!-- <force:inputField value="{!v.data.Report_Date__c}" aura:id="input-report-date"/> -->
              <lightning:input
                type="date"
                value="{!v.data.Report_Date__c}"
                aura:id="input-report-date"
                variant="label-hidden"
              />
                            <lightning:input type="date" value="{!v.data.Report_Date__c}" aura:id="input-report-date"
                                variant="label-hidden" />
            </div>
            <!-- 医院 -->
            <div
              aura:id="hospital_list"
              class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5 marginTop"
              data-select="single"
            >
                        <div aura:id="hospital_list" class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5 marginTop" data-select="single">
              <!-- <ui:inputText aura:id="hospital_input_text" label="医院" class="field" value="{!v.hospital}" updateOn="keyup"/> -->
              医院
              <lightning:input
                aura:id="hospital_input_text"
                class="field"
                value="{!v.hospital}"
                variant="label-hidden"
                updateOn="keyup"
              />
                            <lightning:input aura:id="hospital_input_text" class="field" value="{!v.hospital}" variant="label-hidden" updateOn="keyup"/>
              <div class="slds-lookup__menu" id="lookup-66">
                <ul class="slds-lookup__list" role="listbox">
                  <aura:iteration var="hospital" items="{!v.hospitalList}">
                    <li
                      role="presentation"
                      onclick="{!c.selectHos}"
                      data-accName="{!hospital.Hospital_Name_readonly__c}"
                      data-accId="{!hospital.Hospital__c}"
                    >
                      <span
                        class="slds-lookup__item-action slds-media"
                        id="lookup-option-498"
                        role="option"
                      >
                                        <li role="presentation" onclick="{!c.selectHos}" data-accName="{!hospital.Hospital_Name_readonly__c}" data-accId="{!hospital.Hospital__c}">
                                            <span class="slds-lookup__item-action slds-media" id="lookup-option-498" role="option">
                        <div class="slds-media__body">
                          <div class="slds-lookup__result-text">
                            {!hospital.Hospital_Name_readonly__c}
                          </div>
                                                    <div class="slds-lookup__result-text">{!hospital.Hospital_Name_readonly__c}</div>
                        </div>
                      </span>
                    </li>
@@ -649,70 +382,38 @@
            </div>
            <!-- 科室分类 -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop"
            >
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop">
              {!v.fieldsmap.Department_Cateogy__c}
              <ui:inputSelect
                aura:id="select_department"
                class="slds-select"
                change="{!c.select_department}"
              />
                            <ui:inputSelect aura:id="select_department" class="slds-select" change="{!c.select_department}"/>
            </div>
            <!-- 先生 -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop"
            >
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop">
              {!v.fieldsmap.doctor2__c}
              <ui:inputSelect
                aura:id="select_doctor"
                class="slds-select"
                change="{!c.doctor_change}"
              />
                            <ui:inputSelect aura:id="select_doctor" class="slds-select" change="{!c.doctor_change}"/>
            </div>
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-12 marginTop"
            >
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-12 marginTop">
              <br />
              <ui:button
                label="新建"
                class="slds-button"
                press="{!c.createCon}"
                disabled="true"
                aura:id="new_con"
              />
                            <ui:button label="新建" class="slds-button" press="{!c.createCon}" disabled="true" aura:id="new_con"/>
            </div>
            <!-- 职位 -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop"
            >
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8 marginTop">
              {!v.fieldsmap.visitor_title__c}
              <div>{!v.doctor_title}</div>
            </div>
            <!-- 活动区分 -->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop"
            >
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop">
              {!v.fieldsmap.Purpose_Type__c}
              <ui:inputSelect
                aura:id="select_purpose_type"
                class="slds-select"
                change="{!c.select_purpose_type}"
              />
                            <ui:inputSelect aura:id="select_purpose_type" class="slds-select" change="{!c.select_purpose_type}"/>
            </div>
            <!-- 询价 -->
            <div
              aura:id="input-opportunity-opp"
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--4-of-12 slds-large-size--4-of-12 marginTop"
            >
                        <div aura:id="input-opportunity-opp" class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--4-of-12 slds-large-size--4-of-12 marginTop">
              {!v.fieldsmap.Opportunity__c}
              <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
              <!-- <force:inputField value="{!v.data.Opportunity__c}" aura:id="input-opportunity"/> -->
              <c:strike_lookup
                label=""
                            <c:strike_lookup label=""
                object="Agency_Opportunity__c"
                searchField="Name"
                placeholder="搜索经销商询价..."
@@ -727,102 +428,55 @@
                showRecentRecords="true"
                value="{!v.data.Opportunity__c}"
                filter="{!v.opportunity_cfilter}"
                subTitleFormat="{0}+{1}+{2}"
              />
                                    subTitleFormat="{0}+{1}+{2}"/>
            </div>
            <div
              aura:id="input-opportunity-blank"
              class="lds-p-horizontal--small slds-size--1-of-1 slds-medium-size--8-of-12 slds-large-size--8-of-12 marginTop"
            ></div>
            <div
              aura:id="input-opportunity-stage"
              class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop"
            >
                        <div aura:id="input-opportunity-blank" class="lds-p-horizontal--small slds-size--1-of-1 slds-medium-size--8-of-12 slds-large-size--8-of-12 marginTop">
                        </div>
                        <div aura:id="input-opportunity-stage" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop">
              {!v.fieldsmap.StageName__c}
              <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
              <ui:inputSelect aura:id="select_stageName" class="slds-select" />
              <!-- <force:inputField value="{!v.oppdata.StageName__c}" aura:id="input-oppstage" /> -->
            </div>
            <div
              aura:id="input-opportunity-amount1"
              class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop"
            >
                        <div aura:id="input-opportunity-amount1" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop">
              {!v.fieldsmap.Amount__c}
              <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
              <force:inputField value="{!v.oppdata.Amount__c}" class="" />
            </div>
            <div
              aura:id="input-opportunity-amount2"
              class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop"
            >
                        <div aura:id="input-opportunity-amount2" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop">
              {!v.fieldsmap.OCMSale_Price__c}
              <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
              <force:inputField
                value="{!v.oppdata.OCMSale_Price__c}"
                class=""
              />
                            <force:inputField value="{!v.oppdata.OCMSale_Price__c}" class=""/>
            </div>
            <div
              aura:id="input-opportunity-date"
              class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop"
            >
                        <div aura:id="input-opportunity-date" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12 marginTop">
              {!v.fieldsmap.Close_Forecasted_Date__c}
              <!-- <ui:inputSelect aura:id="select_opportunity" class="slds-select"/> -->
              <force:inputField
                value="{!v.oppdata.Close_Forecasted_Date__c}"
                class=""
              />
                            <force:inputField value="{!v.oppdata.Close_Forecasted_Date__c}" class=""/>
            </div>
            <!-- 製品分類 -->
            <div
              aura:id="product_category_select1"
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop"
            >
                        <div aura:id="product_category_select1" class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop">
              {!v.fieldsmap.Product_Category1__c}
              <!-- <force:inputField value="{!v.data.Product_Category1__c}" aura:id="input-product-category1"/> -->
              <ui:inputSelect
                aura:id="select_Product1"
                class="slds-select"
                change="{!c.productcategoryChange1}"
              />
                            <ui:inputSelect aura:id="select_Product1" class="slds-select" change="{!c.productcategoryChange1}"/>
            </div>
            <div
              aura:id="product_category_select2"
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop"
            >
                        <div aura:id="product_category_select2" class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop">
              {!v.fieldsmap.Product_Category2__c}
              <!-- <force:inputField value="{!v.data.Product_Category2__c}" aura:id="input-product-category2"/> -->
              <ui:inputSelect
                aura:id="select_Product2"
                class="slds-select"
                change="{!c.productcategoryChange2}"
              />
                            <ui:inputSelect aura:id="select_Product2" class="slds-select" change="{!c.productcategoryChange2}"/>
            </div>
            <div
              aura:id="product_category_select3"
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop"
            >
                        <div aura:id="product_category_select3" class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop">
              {!v.fieldsmap.Product_Category3__c}
              <!-- <force:inputField value="{!v.data.Product_Category3__c}" aura:id="input-product-category3"/> -->
              <ui:inputSelect
                aura:id="select_Product3"
                class="slds-select"
                change="{!c.productcategoryChange3}"
              />
                            <ui:inputSelect aura:id="select_Product3" class="slds-select" change="{!c.productcategoryChange3}"/>
            </div>
            <!--SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start-->
            <!-- 支援需求 change="{!c.SupportNeeds__c}"-->
            <div
              class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop"
            >
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6 marginTop">
              {!v.fieldsmap.SupportNeeds__c}
              <ui:inputSelect aura:id="SupportNeeds__c" class="slds-select" />
            </div>
            <!--SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end-->
            <div
              aura:id="result"
              class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop"
            >
                        <div aura:id="result" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12 marginTop">
              {!v.fieldsmap.Result__c}
              <ui:inputSelect aura:id="select_result" class="slds-select" />
              <!-- <ui:inputText label="结果" class="bcolor" value="{!v.result}"/> -->
@@ -830,21 +484,13 @@
          </div>
        </div>
        <div class="save_button_area">
          <ui:button
            aura:id="save_button"
            label="保存并新建"
            class="save_button slds-button slds-button--brand slds-order--3"
            press="{!c.save_report}"
          />
                    <ui:button aura:id="save_button" label="保存并新建" class="save_button slds-button slds-button--brand slds-order--3" press="{!c.save_report}"/>
        </div>
        <aura:renderIf isTrue="{!v.reports_now_count > 0}">
          <div class="mt40 slds-box slds-theme--shade">
            <div class="slds-table--edit_container slds-is-relative">
              <table
                class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus"
                role="grid"
              >
                            <table class="slds-table slds-table--edit slds-table--bordered slds-table--fixed-layout slds-no-cell-focus" role="grid">
                <thead>
                  <tr class="slds-line-height--reset">
                    <th class="table_header slds-text-title--caps">
@@ -854,96 +500,56 @@
                      <span class="slds-truncate" title="Name">医院</span>
                    </th>
                    <th class="table_header slds-text-title--caps">
                      <span class="slds-truncate" title="Name"
                        >{!v.fieldsmap.Department_Cateogy__c}</span
                      >
                                            <span class="slds-truncate" title="Name">{!v.fieldsmap.Department_Cateogy__c}</span>
                    </th>
                    <th class="table_header slds-text-title--caps">
                      <span class="slds-truncate" title="Name"
                        >{!v.fieldsmap.doctor2__c}</span
                      >
                                            <span class="slds-truncate" title="Name">{!v.fieldsmap.doctor2__c}</span>
                    </th>
                    <th class="table_header slds-text-title--caps">
                      <span class="slds-truncate" title="Name"
                        >{!v.fieldsmap.visitor_title__c}</span
                      >
                                            <span class="slds-truncate" title="Name">{!v.fieldsmap.visitor_title__c}</span>
                    </th>
                    <th class="table_header slds-text-title--caps">
                      <span class="slds-truncate" title="Name"
                        >{!v.fieldsmap.Purpose_Type__c}</span
                      >
                                            <span class="slds-truncate" title="Name">{!v.fieldsmap.Purpose_Type__c}</span>
                    </th>
                  </tr>
                </thead>
                <tbody>
                  <aura:iteration
                    items="{!v.reports_now}"
                    var="item"
                    indexVar="index"
                  >
                                    <aura:iteration items="{!v.reports_now}" var="item" indexVar="index">
                    <tr aura:id="modal_data_list_tr" class="slds-hint-parent">
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.Department_Cateogy__c}"
                            >{!item.Name}</span
                          >
                                                    <span class="slds-truncate" title="{!item.Department_Cateogy__c}">{!item.Name}</span>
                        </span>
                      </td>
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.Agency_Hospital__r.Name}"
                            >{!item.Agency_Hospital__r.Name}</span
                          >
                                                    <span class="slds-truncate" title="{!item.Agency_Hospital__r.Name}">{!item.Agency_Hospital__r.Name}</span>
                        </span>
                      </td>
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.Department_Cateogy__c}"
                            >{!item.Department_Cateogy__c}</span
                          >
                                                    <span class="slds-truncate" title="{!item.Department_Cateogy__c}">{!item.Department_Cateogy__c}</span>
                        </span>
                      </td>
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.doctor2__r.Name}"
                          >
                                                    <span class="slds-truncate" title="{!item.doctor2__r.Name}">
                            <span class="encrypt">{!item.doctor2__r.Name}</span>
                            <span class="decrypt"
                              >{!item.doctor2NameOrigin}</span
                            >
                                                        <span class="decrypt">{!item.doctor2NameOrigin}</span>
                          </span>
                        </span>
                      </td>
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.visitor_title__c}"
                          >
                            <span class="encrypt"
                              >{!item.visitor_title__c}</span
                            >
                            <span class="decrypt"
                              >{!item.visitorTitleOrigin}</span
                            >
                                                    <span class="slds-truncate" title="{!item.visitor_title__c}">
                                                        <span class="encrypt">{!item.visitor_title__c}</span>
                                                        <span class="decrypt">{!item.visitorTitleOrigin}</span>
                          </span>
                        </span>
                      </td>
                      <td role="gridcell" class="slds-cell-edit">
                        <span class="slds-grid slds-grid--align-spread">
                          <span
                            class="slds-truncate"
                            title="{!item.Purpose_Type__c}"
                            >{!item.Purpose_Type__c}</span
                          >
                                                    <span class="slds-truncate" title="{!item.Purpose_Type__c}">{!item.Purpose_Type__c}</span>
                        </span>
                      </td>
                    </tr>
@@ -956,87 +562,40 @@
      </div>
    </div>
  </div>
  <div
    aura:id="modal_bg"
    class="disp_none slds-backdrop slds-backdrop--open"
  ></div>
    <div aura:id="modal_bg" class="disp_none slds-backdrop slds-backdrop--open"></div>
  <div
    aura:id="modal_confirm"
    role="dialog"
    tabindex="-2"
    aria-labelledby="header43"
    class="disp_none slds-modal slds-fade-in-open"
  >
    <div aura:id="modal_confirm" role="dialog" tabindex="-2" aria-labelledby="header43" class="disp_none slds-modal slds-fade-in-open">
    <div class="slds-modal__container">
      <div class="slds-modal__header">
        <h2 id="header43" class="slds-text-heading--medium">
          {!v.modal_confirm_title}
        </h2>
                <h2 id="header43" class="slds-text-heading--medium">{!v.modal_confirm_title}</h2>
      </div>
      <div class="slds-modal__content slds-p-around--medium">
        <p>{!v.modal_confirm_text}</p>
      </div>
      <div class="slds-modal__footer">
        <ui:button
          label="是"
          class="slds-button slds-button--brand"
          press="{!c.yes_button}"
        />
        <ui:button
          label="否"
          class="slds-button slds-button--neutral"
          press="{!c.no_button}"
        />
                <ui:button label="是" class="slds-button slds-button--brand" press="{!c.yes_button}"/>
                <ui:button label="否" class="slds-button slds-button--neutral" press="{!c.no_button}" />
      </div>
    </div>
  </div>
  <div
    aura:id="modal_confirm_bg"
    class="disp_none slds-backdrop slds-backdrop--open"
  ></div>
    <div aura:id="modal_confirm_bg" class="disp_none slds-backdrop slds-backdrop--open"></div>
  <div
    aura:id="modal_newAC"
    role="dialog"
    tabindex="-3"
    aria-labelledby="headertest"
    class="disp_none slds-modal slds-fade-in-open"
  >
    <div aura:id="modal_newAC" role="dialog" tabindex="-3" aria-labelledby="headertest" class="disp_none slds-modal slds-fade-in-open">
    <div class="slds-modal__container">
      <aura:renderIf isTrue="{!v.loginEdit}">
        <lightning:spinner
          alternativeText="Loading"
          size="medium"
          style="width: 100%; height: 80%; top: 50px"
        />
                <lightning:spinner alternativeText="Loading" size="medium" style="width: 100%; height: 80%;top:50px;" />
      </aura:renderIf>
      <div class="slds-modal__header">
        <h2 id="headertest" class="slds-text-heading--medium">新建.客户人员</h2>
      </div>
      <div class="slds-modal__content slds-p-around--medium">
        <lightning:recordEditForm
          aura:id="recordEditForm"
          objectApiName="Agency_Contact__c"
          onsuccess="{!c.handleSuccess}"
          onload="{!c.showRequiredFields}"
          onsubmit="{!c.handleSubmit}"
        >
                <lightning:recordEditForm aura:id="recordEditForm"  objectApiName="Agency_Contact__c" onsuccess="{!c.handleSuccess}" onload="{!c.showRequiredFields}" onsubmit="{!c.handleSubmit}">
          <lightning:messages aura:id="OppMessage" />
          <!-- onload="{!c.showRequiredFields}" -->
          <aura:renderIf isTrue="{!v.truthy}">
            <lightning:inputField
              fieldName="Name"
              aura:id="newOpportunityField"
            />
            <lightning:inputField
              fieldName="Type__c"
              aura:id="newOpportunityField"
            />
            <lightning:inputField
              fieldName="Doctor_Division1__c"
              aura:id="newOpportunityField"
            />
                        <lightning:inputField fieldName="Name" aura:id="newOpportunityField" />
                        <lightning:inputField fieldName="Type__c" aura:id="newOpportunityField" />
                        <lightning:inputField fieldName="Doctor_Division1__c" aura:id="newOpportunityField" />
            <!-- <lightning:inputField class="customRequired none" aura:id="Input_type__c" fieldName="Type__c"/>
                        <lightning:inputField class="customRequired none" aura:id="Input_Doctor_Division1__c" fieldName="Doctor_Division1__c"/> -->
          </aura:renderIf>
@@ -1046,20 +605,15 @@
          <br />
          <br />
          <div class="save_button_area">
            <lightning:button
              class="slds-m-top_small"
              type="button"
              label="取消"
              onclick="{!c.createCancel}"
            />
            <lightning:button
              class="slds-m-top_small"
              type="submit"
              label="保存"
            />
                        <lightning:button class="slds-m-top_small" type="button" label="取消" onclick="{!c.createCancel}"/>
                        <lightning:button class="slds-m-top_small" type="submit" label="保存" />
          </div>
        </lightning:recordEditForm>
      </div>
    </div>
  </div>
</aura:component>
force-app/main/default/aura/WeeklyReport/WeeklyReport.css
@@ -21,7 +21,7 @@
}
.THIS .no_data_area {
  text-align: center;
  margin: 0.5em 0;
    margin: .5em 0;
}
.THIS.report_list_area {
  margin: 40px 0 20px 0px;
@@ -111,8 +111,7 @@
  display: none;
}
.THIS .slds-input:focus,
.THIS .slds-input:active {
.THIS .slds-input:focus, .THIS .slds-input:active {
  border-color: rgb(216, 221, 230);
  box-shadow: none;
}
force-app/main/default/aura/WeeklyReport/WeeklyReportController.js
@@ -1,6 +1,6 @@
({
  doInit: function (component, event, helper) {
    console.log("zhj 新方案weeklyReport");
        console.log('zhj 新方案weeklyReport');
    if (window.location.href.endsWith("weekly-report")) {
      helper.doinit(component, event, helper);
    } else {
@@ -10,23 +10,23 @@
  },
  createAopp: function (component, event, helper) {
    var addRecordEvent = $A.get("e.force:createRecord");
        var addRecordEvent = $A.get('e.force:createRecord');
    addRecordEvent.setParams({
      entityApiName: "Agency_Opportunity__c",
      recordTypeId: "012100000006KW7"
            entityApiName: 'Agency_Opportunity__c',
            recordTypeId: '012100000006KW7'
    });
    addRecordEvent.fire();
    component.set("v.showErrorInfo", false);
  },
  new_report: function (component, event, helper) {
    component.find("save_button").set("v.label", "保存并新建");
    component.set("v.data.Report_Date__c", "");
        component.find('save_button').set('v.label', '保存并新建');
        component.set('v.data.Report_Date__c', '');
    helper.new_report(component, event, helper);
  },
  copy_button: function (component, event, helper) {
    component.find("save_button").set("v.label", "保存并新建");
        component.find('save_button').set('v.label', '保存并新建');
    helper.copy_button(component, event, helper);
  },
@@ -35,7 +35,7 @@
  },
  edit_button: function (component, event, helper) {
    component.find("save_button").set("v.label", "保存");
        component.find('save_button').set('v.label', '保存');
    helper.edit_button(component, event, helper);
  },
@@ -64,7 +64,7 @@
    // helper.handleFormSubmit(component);
    var showValidationError = false;
    var fields = component.find("newOpportunityField");
    var vaildationFailReason = "";
        var vaildationFailReason = '';
    // var vaildationFailReason2 = '';
    // var currentDate = new Date().toJSON().slice(0,10);
@@ -73,30 +73,25 @@
    // PIPL update Yin Mingjie 21/02/2022 end
    fields.forEach(function (field) {
      if (
        field.get("v.fieldName") === "Type__c" &&
        $A.util.isEmpty(field.get("v.value"))
      ) {
            if(field.get("v.fieldName") === 'Type__c' && $A.util.isEmpty(field.get("v.value"))){
        showValidationError = true;
        vaildationFailReason = "分类不能为空!";
      } else if (
        field.get("v.fieldName") === "Doctor_Division1__c" &&
        $A.util.isEmpty(field.get("v.value"))
      ) {
            }else if(field.get("v.fieldName") === 'Doctor_Division1__c' && $A.util.isEmpty(field.get("v.value"))){
        showValidationError = true;
        if (vaildationFailReason != "") {
                if(vaildationFailReason != ''){
          vaildationFailReason += "医生区分(职务)不能为空!";
        } else {
          vaildationFailReason = "医生区分(职务)不能为空!";
        }
      }
      // PIPL update Yin Mingjie 21/02/2022 start
      if (field.get("v.fieldName") === "Name") {
        agencyReport["name"] = field.get("v.value");
      } else if (field.get("v.fieldName") === "Type__c") {
        agencyReport["type"] = field.get("v.value");
      } else if (field.get("v.fieldName") === "Doctor_Division1__c") {
        agencyReport["doctorDivision1"] = field.get("v.value");
            if(field.get("v.fieldName") === 'Name'){
                agencyReport['name'] = field.get("v.value");
            }else if(field.get("v.fieldName") === 'Type__c'){
                agencyReport['type'] = field.get("v.value");
            }else if(field.get("v.fieldName") === 'Doctor_Division1__c'){
                agencyReport['doctorDivision1'] = field.get("v.value");
      }
      // PIPL update Yin Mingjie 21/02/2022 end
    });
@@ -109,65 +104,52 @@
            component.find('recordEditForm').submit(eventFields);
            */
      var agencyHospitalid = component.get("v.hospitalLinkId");
            var agencyHospitalid = component.get('v.hospitalLinkId');
      //zhj MEBG新方案改造 2022-11-29 start
      debugger;
      let hospitalName = "";
            debugger
            let hospitalName = '';
      //调用后端searchAgencyDataId方法查询出医院下面所有客户人员dataid
      helper.CallBackAction(
        component,
        "searchAgencyDataId",
        {
            helper.CallBackAction(component,'searchAgencyDataId',{
          hospitalId: agencyHospitalid
        },
        function (data) {
            },function(data){
          if (data.getState() == "SUCCESS") {
            var data = data.getReturnValue();
            if (data.IsSuccess == true) {
              let agencyContactIds = "";
              if (data.Message == "" && data.Data && data.Data.length > 0) {
                        let agencyContactIds = ''
                        if(data.Message == '' && data.Data && data.Data.length > 0){
                hospitalName = data.Data[0].Agency_Hospital__r.Name;
                for (var i = 0; i < data.Data.length; i++) {
                  if (data.Data[i].AWS_Data_Id__c)
                    agencyContactIds += "," + data.Data[i].AWS_Data_Id__c;
                                    agencyContactIds += ','+data.Data[i].AWS_Data_Id__c;
                }
                agencyContactIds = agencyContactIds.substring(1);
                agencyReport["agencyContactIds"] = agencyContactIds;
                            agencyReport['agencyContactIds'] = agencyContactIds;
              } else {
                agencyReport["agencyContactIds"] = agencyContactIds;
                            agencyReport['agencyContactIds'] = agencyContactIds;
              }
              var arr = new Array();
              arr.push(agencyReport);
              var requestData = JSON.stringify(arr);
              // helper.set_aws_url(component,data,agencyHospitalid);
              var token = component.get("v.AWStoken");
              var newUrl = component.get("v.AWSinsert") + "V2";
                        var token = component.get('v.AWStoken');
                        var newUrl = component.get('v.AWSinsert') + 'V2';
              component.set("v.loginEdit", true);
              helper.insert_agencycontact(
                component,
                token,
                newUrl,
                requestData,
                agencyHospitalid,
                helper,
                hospitalName
              );
                        component.set('v.loginEdit',true);
                        helper.insert_agencycontact(component,token,newUrl,requestData,agencyHospitalid,helper,hospitalName);
            } else {
              helper.ShowToast({
                message: data.message,
                type: "error"
                            "message" : data.message,
                            "type" : "error"
              });
            }
          } else {
            helper.ShowToast({
              message: "searchAgency失败",
              type: "error"
                        "message" : 'searchAgency失败',
                        "type" : "error"
            });
          }
        }
      );
            })
      //zhj MEBG新方案改造 2022-11-29 end
      // var arr = new Array();
      // arr.push(agencyReport);
@@ -182,7 +164,7 @@
      // PIPL update Yin Mingjie 21/02/2022 end
    } else {
      component.find("OppMessage").setError(vaildationFailReason);
            component.find('OppMessage').setError(vaildationFailReason);
    }
    // var eventFields = event.getParam("fields");
    // eventFields["Agency_Hospital__c"] = component.get('v.hospitalLinkId');
@@ -195,21 +177,13 @@
  },
  yes_button: function (component, event, helper) {
    component.set("v.confirm_status", 1);
    helper.close_confirm(
      component,
      component.get("v.modal_confirm_title"),
      component.get("v.modal_confirm_text")
    );
        component.set('v.confirm_status', 1);
        helper.close_confirm(component, component.get('v.modal_confirm_title'), component.get('v.modal_confirm_text'));
  },
  no_button: function (component, event, helper) {
    component.set("v.confirm_status", 2);
    helper.close_confirm(
      component,
      component.get("v.modal_confirm_title"),
      component.get("v.modal_confirm_text")
    );
        component.set('v.confirm_status', 2);
        helper.close_confirm(component, component.get('v.modal_confirm_title'), component.get('v.modal_confirm_text'));
  },
  toggle_report: function (component, event, helper) {
@@ -276,7 +250,7 @@
  onDrop: function (component, event, helper) {
    event.stopPropagation();
    event.preventDefault();
    event.dataTransfer.dropEffect = "copy";
        event.dataTransfer.dropEffect='copy';
    var files = event.dataTransfer.files;
    helper.readFile(component, helper, files[0]);
  },
@@ -304,22 +278,20 @@
  },
  exportDate: function (component, event, helper) {
    var stockData = component.get("v.reports_date");
    console.log("导出数据" + stockData);
        console.log('导出数据'+stockData);
    var csv = helper.convertArrayOfObjectsToCSV(component, stockData);
    if (csv == null) {
      return;
    }
        if (csv == null){return;}
    // ####--code for create a temp. <a> html tag [link tag] for download the CSV file--####
    var universalBOM = "\uFEFF";
    var hiddenElement = document.createElement("a");
    hiddenElement.href =
      "data:text/csv;charset=utf-8," + encodeURI(universalBOM + csv);
    hiddenElement.target = "_self"; //
    hiddenElement.download = "ExportData.csv"; // CSV file Name* you can change it.[only name not .csv]
        var hiddenElement = document.createElement('a');
        hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(universalBOM+csv);
        hiddenElement.target = '_self'; //
        hiddenElement.download = 'ExportData.csv';  // CSV file Name* you can change it.[only name not .csv]
    document.body.appendChild(hiddenElement); // Required for FireFox browser
    hiddenElement.click(); // using click() js function to download csv file
    // helper.showExport(component);
  },
  export_condition: function (component, event, helper) {
@@ -334,9 +306,9 @@
    // this.export(component,event,helper);
  },
  export: function (component, event, helper) {
    console.log("进入export");
        console.log('进入export');
    var stockData = component.get("v.reports_date");
    console.log("查出的数据" + stockData);
        console.log('查出的数据'+stockData);
    // helper.showExportDate(component,stockData);
    // helper.showExport(component);
  },
@@ -350,5 +322,5 @@
  },
  exportErrorInfo: function (component, event, helper) {
    helper.exportErrorInfoHelper(component);
  }
});
    },
})
force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js
Diff too large
force-app/main/default/classes/ArriveGoodsController.cls
Diff too large
force-app/main/default/classes/ArriveGoodsControllerTest.cls
@@ -1,57 +1,25 @@
@isTest
private class ArriveGoodsControllerTest {
  //选择等待入库,包括01 和241
  @isTest
  static void arriveWithID() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -60,37 +28,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'N3047730',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'N3047731',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
@@ -126,9 +70,7 @@
      insert Orderdet1;
      PageReference page = new PageReference(
        '/apex/ArriveGoods?ESetid=' + Order1.Id
      );
            PageReference page = new PageReference('/apex/ArriveGoods?ESetid=' + Order1.Id);
      System.Test.setCurrentPage(page);
      ArriveGoodsController Controller = new ArriveGoodsController();
      //初始化测试
@@ -139,67 +81,32 @@
      // System.assertEquals(1, Controller.ConsumableorderdetailsRecords.size());
      // System.assertEquals(2, Controller.consumableInventory.size());
      Controller.ArriveGoodsConfim();
      List<Consumable_order_details2__c> ins = [
        SELECT Id, Name
        FROM Consumable_order_details2__c
      ];
            List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c];
      // System.assertEquals(3, ins.size());
      System.Test.stopTest();
    }
  }
  //产品直接入库,包括01 和241
  @isTest
  static void arriveWithoutID() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -208,37 +115,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',ProductCode_Ext__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='N3047731',ProductCode_Ext__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test01',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'N3047731',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test01',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
      System.Test.setCurrentPage(page);
      ArriveGoodsController Controller = new ArriveGoodsController();
@@ -251,15 +134,7 @@
      Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n241N30477311115120017181000105ZK250BXJRA\n241Test021115120017181000105ZK250\n01049531702003111115120017181000105ZK250';
      Controller.SearchPro();
      Controller.ArriveGoodsConfim();
      List<Consumable_order_details2__c> ins = [
        SELECT Id, Name
        FROM Consumable_order_details2__c
        WHERE
          Bar_Code__c IN (
            '01049531702003111115120017181000105ZK250BXJRF',
            '241N30477311115120017181000105ZK250BXJRA'
          )
      ];
            List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c WHERE Bar_Code__c in ('01049531702003111115120017181000105ZK250BXJRF','241N30477311115120017181000105ZK250BXJRA')];
      // System.assertEquals(2, ins.size());
      System.Test.stopTest();
    }
@@ -268,54 +143,20 @@
  @isTest
  static void ArriveTest() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Oly_TriggerHandler.bypass('ConsumableAssetHander');
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -324,32 +165,12 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      insert new List<Product2__c>{ pro1 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            insert new Product2__c[] {pro1};
      // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
      // insert myAccount1;
      Consumable_order__c Order2 = new Consumable_order__c();
@@ -431,6 +252,7 @@
      Orderdet3.SerialLotNo__c = '5ZK';
      //Orderdet3.Box_Piece__c = '个';
      //出库产品
      Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
      Orderdet4.Name = 'OCM_01_001005';
@@ -461,13 +283,9 @@
      Orderdet5.Box_Piece__c = '盒';
      Orderdet5.TracingCode__c = 'BXJRE';
      Orderdet5.SerialLotNo__c = '5ZK';
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4,
        Orderdet5
      };
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5};
      ArriveGoodsController Controller = new ArriveGoodsController();
      PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
@@ -479,12 +297,11 @@
      Controller.barcode = '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BXsys';
      Controller.SearchPro();
      System.assertEquals(
        'OCM_01_001002',
        controller.ConsumableorderdetailsRecords[0].esd.Name
      );
            System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecords[0].esd.Name);
      // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size());
      System.Test.stopTest();
    }
  }
@@ -492,55 +309,21 @@
  @isTest
  static void ArriveTest1() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Oly_TriggerHandler.bypass('ConsumableAssetHander');
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -549,37 +332,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
      // insert myAccount1;
      Consumable_order__c Order2 = new Consumable_order__c();
@@ -659,6 +418,7 @@
      Orderdet3.TracingCode__c = 'BXJRC';
      Orderdet3.SerialLotNo__c = '5ZK';
      //出库产品
      Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
      Orderdet4.Name = 'OCM_01_001005';
@@ -687,13 +447,9 @@
      Orderdet5.Box_Piece__c = '盒';
      Orderdet5.TracingCode__c = 'BXJRE';
      Orderdet5.SerialLotNo__c = '5ZK';
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4,
        Orderdet5
      };
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5};
      ArriveGoodsController Controller = new ArriveGoodsController();
      PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
@@ -705,67 +461,36 @@
      Controller.barcode = '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BXsys';
      Controller.SearchPro();
      System.assertEquals(
        'OCM_01_001002',
        controller.ConsumableorderdetailsRecords[0].esd.Name
      );
            System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecords[0].esd.Name);
      // System.assertEquals(1, controller.ConsumableorderdetailsRecordserror.size());
      System.Test.stopTest();
    }
  }
  //返品
  @isTest
  static void productReturn() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -774,37 +499,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
@@ -910,14 +611,7 @@
      Orderdet6.Box_Piece__c = '个';
      Orderdet6.TracingCode__c = 'BXJRF';
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4,
        Orderdet5,
        Orderdet6
      };
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6};
      PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
      System.Test.setCurrentPage(page);
      ArriveGoodsController Controller = new ArriveGoodsController();
@@ -942,6 +636,7 @@
      Controller.ToReturnGoodsPage();
      Controller.geterrorsize();
      System.Test.stopTest();
    }
  }
@@ -949,54 +644,21 @@
  @isTest
  static void productReturn_new() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -1005,37 +667,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
      Order1.Name = 'OCM_01_001';
@@ -1127,11 +765,7 @@
      Orderdet5.Box_Piece__c = '个';
      Orderdet5.TracingCode__c = 'BXJRZ';
      Orderdet5.SerialLotNo__c = '5ZK';
      insert new List<Consumable_order_details2__c>{
        Orderdet3,
        Orderdet4,
        Orderdet5
      };
            insert new Consumable_order_details2__c[] {Orderdet3,Orderdet4,Orderdet5};
      PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
      System.Test.setCurrentPage(page);
@@ -1149,7 +783,7 @@
      controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c = 1;
      Controller.UpdateGoodsOfReturn();
      list<String> list1 = new List<String>();
            list<String> list1 = new list<String>();
      list1.add(Controller.barcode = '01234567898');
      Controller.inventoryEntryNoESetId(list1);
@@ -1212,6 +846,7 @@
      list1.add(Controller.barcode = '0112345678901231106789012105625001234');
      Controller.inventoryEntryNoESetId(list1);
      System.Test.stopTest();
    }
  }
@@ -1219,54 +854,21 @@
  @isTest
  static void arrivedirect() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -1275,43 +877,18 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = '2344',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = '82324',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='2344',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='82324',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //产品注册证
      Product_Register__c prc = new Product_Register__c(
        Name = '国械注进20162220210',
            Product_Register__c prc = new Product_Register__c(Name = '国械注进20162220210',
        MedPrdClass__c = '3',
        ValidFrom__c = date.newinstance(2018, 7, 22),
        ValidTo__c = date.newinstance(2028, 7, 22),
                                                              ValidFrom__c = date.newinstance(2018, 07, 22),
                                                              ValidTo__c = date.newinstance(2028, 07, 22),
        RegisterNoClass_Old__c = '6815',
        RegisterNoClass_New__c = '6815',
        RegisterNoStatus__c = '有效'
@@ -1400,15 +977,8 @@
      //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id];
      //System.assertEquals('○', proList[0].Estimation_Entry_Possibility__c);
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4
      };
      PageReference page = new PageReference(
        '/apex/ArriveGoods?Esetid=' + Order1.Id
      );
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4};
            PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id);
      System.Test.setCurrentPage(page);
      ArriveGoodsController Controller = new ArriveGoodsController();
      //初始化测试
@@ -1426,53 +996,20 @@
  @isTest
  static void arrivedirect241() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -1481,43 +1018,18 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //产品注册证
      Product_Register__c prc = new Product_Register__c(
        Name = '国械注进20162220210',
            Product_Register__c prc = new Product_Register__c(Name = '国械注进20162220210',
        MedPrdClass__c = '3',
        ValidFrom__c = date.newinstance(2018, 7, 22),
        ValidTo__c = date.newinstance(2028, 7, 22),
                                                              ValidFrom__c = date.newinstance(2018, 07, 22),
                                                              ValidTo__c = date.newinstance(2028, 07, 22),
        RegisterNoClass_Old__c = '6815',
        RegisterNoClass_New__c = '6815',
        RegisterNoStatus__c = '有效'
@@ -1809,23 +1321,8 @@
      //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id];
      //System.assertEquals('○', proList[0].Estimation_Entry_Possibility__c);
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4,
        Orderdet5,
        Orderdet6,
        Orderdet7,
        Orderdet8,
        Orderdet9,
        lose,
        lose1,
        lose2
      };
      PageReference page = new PageReference(
        '/apex/ArriveGoods?Esetid=' + Order1.Id
      );
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet7,Orderdet8,Orderdet9,lose,lose1,lose2};
            PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id);
      System.Test.setCurrentPage(page);
      ArriveGoodsController Controller = new ArriveGoodsController();
      //初始化测试
@@ -1840,58 +1337,26 @@
    }
  }
  //返品 明细2不存在的对应的到货订单明细
  @isTest
  static void productReturn_oldbarcode() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -1900,37 +1365,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
@@ -2043,15 +1484,7 @@
      Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BX333';
      Orderdet7.TracingCode__c = 'BXSYS';
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4,
        Orderdet5,
        Orderdet6,
        Orderdet7
      };
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet7};
      PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
      System.Test.setCurrentPage(page);
      ArriveGoodsController Controller = new ArriveGoodsController();
@@ -2075,59 +1508,27 @@
      controller.getinventorysize();
      System.Test.stopTest();
    }
  }
  @isTest
  static void barcodecheck() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -2135,40 +1536,16 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = '2344',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = '8232',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='2344',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='8232',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      ArriveGoodsController Controller = new ArriveGoodsController();
      //初始化测试
      list<String> list1 = new List<String>();
            list<String> list1 = new list<String>();
      list1.clear();
      list1.add(Controller.barcode = '2413456250BBBBA');
      Controller.inventoryEntry(list1);
@@ -2229,141 +1606,80 @@
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '011234567890123411789012175678901234250BBBBM'
      );
            list1.add(Controller.barcode = '011234567890123411789012175678901234250BBBBM');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '01123456789012340138901217aaa8001234250BBBBN'
      );
            list1.add(Controller.barcode = '01123456789012340138901217aaa8001234250BBBBN');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '011234567890123456789012104567890250BBBBO'
      );
            list1.add(Controller.barcode = '011234567890123456789012104567890250BBBBO');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '01123456789012341778910034567890250BBBBP'
      );
            list1.add(Controller.barcode = '01123456789012341778910034567890250BBBBP');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '011234567890123417aa910034567890250BBBBQ'
      );
            list1.add(Controller.barcode = '011234567890123417aa910034567890250BBBBQ');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '01123456789012341778911134567890250BBBBR'
      );
            list1.add(Controller.barcode = '01123456789012341778911134567890250BBBBR');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '011234567890123417789121105678900000250BBBBS'
      );
            list1.add(Controller.barcode = '011234567890123417789121105678900000250BBBBS');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '011234567890123410789121105678900000250BBBBT'
      );
            list1.add(Controller.barcode = '011234567890123410789121105678900000250BBBBT');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '011234567890123411789012171a780012250BBBBU'
      );
            list1.add(Controller.barcode = '011234567890123411789012171a780012250BBBBU');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '0112345678901234110890121012789000250BBBBV'
      );
            list1.add(Controller.barcode = '0112345678901234110890121012789000250BBBBV');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '011234567890123417120506105678901234250BBBBW'
      );
            list1.add(Controller.barcode = '011234567890123417120506105678901234250BBBBW');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '0112345678901234111202121712050212250BBBBX'
      );
            list1.add(Controller.barcode = '0112345678901234111202121712050212250BBBBX');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '0112345678901234111202121712a50212250BBBBY'
      );
            list1.add(Controller.barcode = '0112345678901234111202121712a50212250BBBBY');
      Controller.inventoryEntry(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '0112345678901234111202121012050212250BBBBZ'
      );
            list1.add(Controller.barcode = '0112345678901234111202121012050212250BBBBZ');
      Controller.inventoryEntry(list1);
    }
  }
  @isTest
  static void barcodechkeck_2() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -2371,43 +1687,18 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = '2344',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = '82324',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='2344',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='82324',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //产品注册证
      Product_Register__c prc = new Product_Register__c(
        Name = '国械注进20162220210',
            Product_Register__c prc = new Product_Register__c(Name = '国械注进20162220210',
        MedPrdClass__c = '3',
        ValidFrom__c = date.newinstance(2018, 7, 22),
        ValidTo__c = date.newinstance(2028, 7, 22),
                                                              ValidFrom__c = date.newinstance(2018, 07, 22),
                                                              ValidTo__c = date.newinstance(2028, 07, 22),
        RegisterNoClass_Old__c = '6815',
        RegisterNoClass_New__c = '6815',
        RegisterNoStatus__c = '有效'
@@ -2438,22 +1729,13 @@
      ArriveGoodsController Controller = new ArriveGoodsController();
      //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id];
      //System.assertEquals('○', proList[0].Estimation_Entry_Possibility__c);
      List<Product2__c> product2InStore = [
        SELECT
          Id,
          Name,
          Name__c,
          Intra_Trade_List_RMB__c,
          Asset_Model_No__c,
          OT_CODE__c
            List<Product2__c> product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c
        FROM Product2__c
        WHERE
          Estimation_Entry_Possibility__c = '○'
          AND Pro2_Dealer_Object__c = TRUE
          AND OT_CODE__c = 'test'
      ];
                                                 WHERE Estimation_Entry_Possibility__c = '○'
                                                                                         AND Pro2_Dealer_Object__c = true
                                                                                                                     AND OT_CODE__c ='test' ];
      //System.assertEquals(1, product2InStore.size());
      list<String> list1 = new List<String>();
            list<String> list1 = new list<String>();
      list1.clear();
      list1.add(Controller.barcode = '2413456250BBBBA');
      Controller.inventoryEntryNoESetId(list1);
@@ -2532,33 +1814,27 @@
      list1.add(Controller.barcode = '241test111204121778900034567890250BBBBQ');
      Controller.inventoryEntryNoESetId(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '0111234101204120118901231712a4001234250BBBBR'
      );
            list1.add(Controller.barcode = '0111234101204120118901231712a4001234250BBBBR');
      Controller.inventoryEntryNoESetId(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '011123410120412011890123171204011234250BBBBS'
      );
            list1.add(Controller.barcode = '011123410120412011890123171204011234250BBBBS');
      Controller.inventoryEntryNoESetId(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '011test10120412011890123171a04011234250BBBBT'
      );
            list1.add(Controller.barcode = '011test10120412011890123171a04011234250BBBBT');
      Controller.inventoryEntryNoESetId(list1);
      list1.clear();
      list1.add(
        Controller.barcode = '0111234101204120118901231012040112342222250BBBBU'
      );
            list1.add(Controller.barcode = '0111234101204120118901231012040112342222250BBBBU');
      Controller.inventoryEntryNoESetId(list1);
      list1.clear();
      list1.add(Controller.barcode = '011123410120412017120100250AAAAA');
      Controller.inventoryEntryNoESetId(list1);
    }
  }
@@ -2566,54 +1842,21 @@
  @isTest
  static void addSaleOrderAuto() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -2621,32 +1864,12 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      insert new List<Product2__c>{ pro1 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            insert new Product2__c[] {pro1};
      // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
      // insert myAccount1;
      Consumable_order__c Order2 = new Consumable_order__c();
@@ -2689,54 +1912,21 @@
  @isTest
  static void methodTest1() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -2744,37 +1934,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'N3047730',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'N3047731',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
@@ -2825,9 +1991,7 @@
      Orderdet2.SerialLotNo__c = '5ZK';
      insert Orderdet2;
      PageReference page = new PageReference(
        '/apex/ArriveGoods?ESetid=' + Order1.Id
      );
            PageReference page = new PageReference('/apex/ArriveGoods?ESetid=' + Order1.Id);
      System.Test.setCurrentPage(page);
      ArriveGoodsController Controller = new ArriveGoodsController();
      //初始化测试
@@ -2838,67 +2002,32 @@
      // System.assertEquals(1, Controller.ConsumableorderdetailsRecords.size());
      // System.assertEquals(2, Controller.consumableInventory.size());
      Controller.ArriveGoodsConfim();
      List<Consumable_order_details2__c> ins = [
        SELECT Id, Name
        FROM Consumable_order_details2__c
      ];
            List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c];
      // System.assertEquals(3, ins.size());
      System.Test.stopTest();
    }
  }
  //返品
  @isTest
  static void methodTest2() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -2906,37 +2035,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
      Order1.Name = 'OCM_01_001';
@@ -3028,12 +2133,7 @@
      Orderdet5.Box_Piece__c = '个';
      Orderdet5.TracingCode__c = 'BXJRZ';
      Orderdet5.SerialLotNo__c = '5ZK';
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet3,
        Orderdet4,
        Orderdet5
      };
            insert new Consumable_order_details2__c[] {Orderdet1,Orderdet3,Orderdet4,Orderdet5};
      PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
      System.Test.setCurrentPage(page);
@@ -3044,17 +2144,14 @@
      //排序
      Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRN\n01049531702003111115120017181000105ZK250BXJRZ\n01049531702003111115120017181000105ZK250BXJRR';
      Controller.SearchPro();
      System.assertEquals(
        1,
        controller.ConsumableorderdetailsRecordserror.size()
      );
            System.assertEquals(1, controller.ConsumableorderdetailsRecordserror.size());
      // System.assertEquals(2, controller.ShowGoodsofReturnList.size());
      controller.ShowGoodsofReturnList[0].esd.Return_reason__c = '多发';
      // controller.ShowGoodsofReturnList[1].esd.Return_reason__c='多发';
      // controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c =1;
      Controller.UpdateGoodsOfReturn();
      list<String> list1 = new List<String>();
            list<String> list1 = new list<String>();
      list1.add(Controller.barcode = '01234567898');
      Controller.inventoryEntryNoESetId(list1);
@@ -3117,6 +2214,7 @@
      list1.add(Controller.barcode = '0112345678901231106789012105625001234');
      Controller.inventoryEntryNoESetId(list1);
      System.Test.stopTest();
    }
  }
@@ -3124,54 +2222,20 @@
  @isTest
  static void ArrivejancodeTest() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Oly_TriggerHandler.bypass('ConsumableAssetHander');
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -3180,32 +2244,12 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      insert new List<Product2__c>{ pro1 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            insert new Product2__c[] {pro1};
      // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
      // insert myAccount1;
      Consumable_order__c Order2 = new Consumable_order__c();
@@ -3287,6 +2331,7 @@
      Orderdet3.SerialLotNo__c = '5ZK';
      //Orderdet3.Box_Piece__c = '个';
      //出库产品
      Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
      Orderdet4.Name = 'OCM_01_001005';
@@ -3317,13 +2362,9 @@
      Orderdet5.Box_Piece__c = '盒';
      Orderdet5.TracingCode__c = 'BXJRE';
      Orderdet5.SerialLotNo__c = '5ZK';
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4,
        Orderdet5
      };
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5};
      ArriveGoodsController Controller = new ArriveGoodsController();
      PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
@@ -3335,12 +2376,11 @@
      Controller.barcode = '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BXsys';
      Controller.SearchPro();
      System.assertEquals(
        'OCM_01_001002',
        controller.ConsumableorderdetailsRecords[0].esd.Name
      );
            System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecords[0].esd.Name);
      // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size());
      System.Test.stopTest();
    }
  }
@@ -3348,54 +2388,20 @@
  @isTest
  static void ArriveotheragencyTest() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Oly_TriggerHandler.bypass('ConsumableAssetHander');
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -3404,37 +2410,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      insert new List<Product2__c>{ pro1 };
      Account myAccount3 = new Account(
        name = 'Testaccount003',
        Dealer_discount__c = 30,
        RecordTypeId = rectCo[0].Id
      );
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            insert new Product2__c[] {pro1};
            Account myAccount3 = new Account(name='Testaccount003',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
      insert myAccount3;
      Consumable_order__c Order2 = new Consumable_order__c();
      Order2.Name = 'OCM_02_001';
@@ -3532,6 +2514,7 @@
      // Orderdet3.SerialLotNo__c = '5ZK';
      // //Orderdet3.Box_Piece__c = '个';
      // //出库产品
      // Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
      // Orderdet4.Name = 'OCM_01_001005';
@@ -3564,6 +2547,8 @@
      // Orderdet5.SerialLotNo__c = '5ZK';
      // insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5};
      ArriveGoodsController Controller = new ArriveGoodsController();
      PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
      System.Test.setCurrentPage(page);
@@ -3577,6 +2562,8 @@
      // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size());
      System.Test.stopTest();
    }
  }
@@ -3584,54 +2571,21 @@
  @isTest
  static void addInventoryDetails1() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -3640,37 +2594,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Oly_TriggerHandler.bypass('ConsumableAssetHander');
      Consumable_order__c Order1 = new Consumable_order__c();
@@ -3790,15 +2720,7 @@
      Orderdet7.Box_Piece__c = '个';
      Orderdet7.TracingCode__c = 'BXJQT';
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4,
        Orderdet5,
        Orderdet6,
        Orderdet7
      };
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet7};
      PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG');
      System.Test.setCurrentPage(page);
      ArriveGoodsController Controller = new ArriveGoodsController();
@@ -3823,6 +2745,7 @@
      Controller.ToReturnGoodsPage();
      Controller.geterrorsize();
      System.Test.stopTest();
    }
  }
@@ -3847,86 +2770,28 @@
  @isTest
  static void searchProTest1() {
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'N3047730',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'N3047731',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      Consumable_order__c Order1 = new Consumable_order__c();
      Order1.Name = 'OCM_01_001';
@@ -3975,10 +2840,7 @@
      Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF';
      Controller.SearchPro();
      Controller.ArriveGoodsConfim();
      List<Consumable_order_details2__c> ins = [
        SELECT Id, Name
        FROM Consumable_order_details2__c
      ];
            List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c];
      System.Test.stopTest();
    }
  }
force-app/main/default/classes/ArriveGoodsControllerTestV2.cls
@@ -3,54 +3,20 @@
  @isTest
  static void myUnitTest() {
    // // TO DO: implement unit test
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -59,37 +25,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
      Order1.Name = 'OCM_01_001';
@@ -149,6 +91,7 @@
      Orderdet3.TracingCode__c = 'BXJRC';
      //Orderdet3.Box_Piece__c = '盒';
      //出库产品
      Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
      Orderdet4.Name = 'OCM_01_001005';
@@ -194,26 +137,12 @@
      Orderdets8.Box_Piece__c = '盒';
      Orderdets8.TracingCode__c = 'BXsys';
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4,
        Orderdet5,
        Orderdet6,
        Orderdets8
      };
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdets8};
      List<Consumable_orderdetails__c> cod1 = [
        SELECT Id
        FROM Consumable_orderdetails__c
        WHERE Consumable_order__c = :Order1.Id
      ];
            List<Consumable_orderdetails__c> cod1 = [select Id from Consumable_orderdetails__c WHERE Consumable_order__c = :Order1.Id];
      System.assertEquals(1, cod1.size());
      PageReference page = new PageReference(
        '/apex/ArriveGoods?Esetid=' + Order1.Id
      );
            PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id);
      System.Test.setCurrentPage(page);
      ArriveGoodsController Controller = new ArriveGoodsController();
force-app/main/default/classes/ArriveGoodsControllerTestV2.cls-meta.xml
force-app/main/default/classes/Batch_FixAttachmentToFiles.cls
@@ -4,11 +4,7 @@
  private Datetime creEndDate = null;
  private String objectApiName = null;
  private Set<String> parentIds = new Set<String>(); //Add by Li Jun 20230703
  public Batch_FixAttachmentToFiles(
    String objectType,
    Datetime startTime,
    Datetime endTime
  ) {
    public Batch_FixAttachmentToFiles(String objectType, Datetime startTime, Datetime endTime) {
    creStartDate = startTime;
    creEndDate = endTime;
    objectApiName = objectType;
@@ -45,20 +41,13 @@
      return;
    }
    //Insert insertContents;
    List<Database.SaveResult> saveResultsContents = Database.insert(
      insertContents,
      false
    );
        List<Database.SaveResult> saveResultsContents = Database.insert(insertContents, false);
    insertLog(saveResultsContents, attachmentIds);
    set<Id> contentIds = new Set<Id>();
        set<Id> contentIds = new set<Id>();
    for (ContentVersion cv : insertContents) {
      contentIds.add(cv.id);
    }
    List<ContentVersion> conDocuments = [
      SELECT ContentDocumentId, Title, PathOnClient
      FROM ContentVersion
      WHERE Id IN :contentIds
    ];
        List<ContentVersion> conDocuments = [SELECT ContentDocumentId, Title,PathOnClient FROM ContentVersion WHERE Id in: contentIds];
    List<ContentDocumentLink> insertDocLinks = new List<ContentDocumentLink>();
    for (ContentVersion cv : conDocuments) {
      ContentDocumentLink cDocLink = new ContentDocumentLink();
@@ -69,17 +58,11 @@
      insertDocLinks.add(cDocLink);
    }
    //Insert insertDocLinks;
    List<Database.SaveResult> saveResultsLinks = Database.insert(
      insertDocLinks,
      false
    );
        List<Database.SaveResult> saveResultsLinks = Database.insert(insertDocLinks, false);
    insertLog(saveResultsLinks, attachmentIds);
  }
  global void insertLog(
    List<Database.SaveResult> saveResults,
    Set<String> attachmentIds
  ) {
    global void insertLog(List<Database.SaveResult> saveResults,Set<String> attachmentIds) {
    Transaction_Log__c traLog = new Transaction_Log__c();
    List<Map<String, String>> logMapList = new List<Map<String, String>>();
    for (Database.SaveResult result : saveResults) {
@@ -100,10 +83,13 @@
      logMapList.add(attachmentIdMap);
      traLog.Response__c = JSON.serialize(logMapList);
      traLog.Module__c = 'Attachment COnvert Transaction ';
      insert traLog;
            Insert traLog;
    }
  }
  global void finish(Database.BatchableContext BC) {
  }
}
force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls
@@ -1,14 +1,10 @@
@isTest(SeeAllData=true)
private class Batch_FixAttachmentToFilesTest {
  @isTest(SeeAllData=true)
  static void testInit() {
    String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
      .get('Agency')
      .getRecordTypeId();
    Account accountItem1 = new Account(
      Name = 'Testaccount001',
      RecordTypeId = rectCo
    );
        String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
        Account accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo);
    insert accountItem1;
    Consumable_order__c consOrder = new Consumable_order__c();
@@ -36,22 +32,11 @@
    Datetime creStartDate;
    Datetime creEndDate;
    List<Attachment> attachmentList = [
      SELECT
        Id,
        Name,
        OwnerId,
        ParentId,
        Parent.Name,
        Parent.Type,
        Body,
        CreatedDate,
        CreatedById
      FROM Attachment
      WHERE Id = :attachList[0].Id
      ORDER BY CreatedDate ASC
      LIMIT 1
    ];
        List<Attachment> attachmentList = [Select Id, Name, OwnerId, ParentId, Parent.Name, Parent.Type, Body, CreatedDate, CreatedById
                                             From Attachment
                                            Where Id =:attachList[0].Id
                                            Order by CreatedDate ASC
                                            Limit 1];
    for (Attachment att : attachmentList) {
      Id.add(att.ParentId);
      objectType = att.Parent.Name;
@@ -59,10 +44,7 @@
      creEndDate = att.CreatedDate.addDays(1);
    }
    System.Test.startTest();
    Database.executeBatch(
      new Batch_FixAttachmentToFiles(objectType, creStartDate, creEndDate),
      1
    );
        Database.executeBatch(new Batch_FixAttachmentToFiles(objectType,creStartDate,creEndDate),1);
    Database.executeBatch(new Batch_FixAttachmentToFiles(Id), 1);
    System.Test.stopTest();
  }
force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls-meta.xml
force-app/main/default/classes/DealerInquiryModifyStateController.cls
@@ -1,7 +1,7 @@
public with sharing class DealerInquiryModifyStateController {
  public List<OpportunityInfo> oppRecords { get; set; }
  // ページレイアウトの情報を取得
  private Map<String, Map<String, String>> editLayoutItemRWMap = new Map<String, Map<String, String>>();
    private Map<String, Map<String, String>> editLayoutItemRWMap = New Map<String, Map<String, String>>();
  // private Map<String, Map<String, String>> editLayoutItemRWMapRt = null;
  public List<OpportunityInfo> OPPORTList { get; set; }
  /*****************検索用******************/
@@ -34,7 +34,7 @@
  public String preSortKey { get; set; }
  public Boolean sortOrderAsc { get; set; }
  public String[] sortOrder { get; set; }
  public String[] columus = new List<String>{ 'Id' };
    public String[] columus = new String[] {'Id'};
  public String[] selColumus = null;
  public Set<String> columusSet = new Set<String>{ 'Id' };
@@ -54,8 +54,7 @@
  //add by Link 2023-6-2
  public String remindMsg { get; set; }
  @TestVisible
  private String accTypeForSort = null;
    @TestVisible private String accTypeForSort = null;
  private static Integer oppLimit = 500;
  public DealerInquiryModifyStateController() {
@@ -69,9 +68,7 @@
    //数据字段下拉列表
    textOpts = new List<SelectOption>();
    textOpts.add(new SelectOption('', '--无--'));
    textOpts.add(
      new SelectOption('Agency_Opportunity_No__c', '经销商询价编码')
    );
        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', '科室分类'));
@@ -95,9 +92,7 @@
    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', '预测与OLY签约日')
    );
        timeOpts.add(new SelectOption('Close_Forecasted_Date__c', '预测与OLY签约日'));
    timeOpts.add(new SelectOption('Lost_Opportunity_Date__c', '失单日期'));
    timeOpts.add(new SelectOption('Deleted_Reason_Date__c', '取消日期'));
    //数据字段中间连接符号
@@ -136,9 +131,7 @@
    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() + '/partner/services/Soap/u/33.0';
    // soap.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/u/33.0';
    PartnerSoapSforceCom.DescribeLayoutResult dlr = new PartnerSoapSforceCom.DescribeLayoutResult();
@@ -180,19 +173,12 @@
      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
      ) {
            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
            ) {
                        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');
@@ -213,20 +199,14 @@
    return null;
  }
  //用于获取经销商询价字段集和询价字段集以及相应的读写权限
  @TestVisible
  private void setLayoutRWInfo() {
    @TestVisible private void setLayoutRWInfo() {
    if (this.sortOrder == null) {
      selColumus = new List<String>{};
            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();
            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>();
@@ -300,14 +280,14 @@
          strRtColumus = strRtColumus + ',' + s;
        }
        columnRightCss.add(s.replace('.', '_'));
      }
      strColumus = String.join(columus, ',');
      System.debug('======-======-======strColumus' + strColumus);
      System.debug('======-======-======strRtColumus' + strRtColumus);
      this.sortOrderAsc = true;
      this.sortOrder = new List<String>(selColumus.size());
      for (Integer i = 0; i < selColumus.size(); i++)
        this.sortOrder[i] = ' ';
            this.sortOrder = new String[selColumus.size()];
            for (Integer i = 0; i < selColumus.size(); i++) this.sortOrder[i] = ' ';
    }
  }
  //用于拼接SOQL语句 根据不同检索条件拼接不同SOQL语句。
@@ -329,31 +309,20 @@
    // 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 +
        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 += '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 +
        '%\' ';
            soql += 'AND Agency_PersonName__c ' + '  LIKE  \'%' + newAooSearch + '%\' ';
    }
    //数据字段:03 手动填写项 准备调用makeTextSql;
    if (!String.isBlank(numtext)) {
@@ -365,25 +334,12 @@
    //点击排序
    // System.debug('==-=-=-=-=-=this.sortKey'+Integer.valueOf(this.sortKey)+'===titleLeft.size'+titleLeft.size()+7);
    if (String.isBlank(this.sortKey)) {
      soql +=
        ' order by LastModifiedDate desc limit ' + Integer.valueOf(limits);
            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);
                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);
                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);
@@ -407,6 +363,7 @@
          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) {
@@ -418,65 +375,39 @@
    oppCount = oppRecords.size();
    //显示提示操作信息
    if (String.isBlank(this.saveType) && String.isBlank(this.sortKey)) {
      ApexPages.addmessage(
        new ApexPages.message(
          ApexPages.severity.INFO,
          '取得最近的 ' + oppCount + ' 条数据'
        )
      );
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '取得最近的 ' + oppCount + ' 条数据'));
      //add by Link 2023-6-2
      remindMsg = '取得最近的 ' + oppCount + ' 条数据';
    } else if (!String.isBlank(this.sortKey)) {
      if (oppCount > oppLimit) {
        ApexPages.addmessage(
          new ApexPages.message(
            ApexPages.severity.INFO,
            '数据超过' + oppLimit + '件,只显示前' + oppLimit + '件'
          )
        );
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '数据超过' + oppLimit + '件,只显示前' + oppLimit + '件'));
        //add by Link 2023-6-2
        remindMsg = '数据超过' + oppLimit + '件,只显示前' + oppLimit + '件';
      } else {
        ApexPages.addmessage(
          new ApexPages.message(
            ApexPages.severity.INFO,
            '共有 ' + oppCount + ' 条数据'
          )
        );
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共有 ' + oppCount + ' 条数据'));
        //add by Link 2023-6-2
        remindMsg = '共有 ' + oppCount + ' 条数据';
      }
    } else {
      ApexPages.addmessage(
        new ApexPages.message(
          ApexPages.severity.INFO,
          '共有 ' + oppCount + ' 条数据'
        )
      );
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共有 ' + oppCount + ' 条数据'));
      //add by Link 2023-6-2
      remindMsg = '共有 ' + oppCount + ' 条数据';
    }
  }
  //检索条件:数据字段1,数据字段2,数据字段3均满足进入此方法 判断多种情况
  private String makeTextSql(
    String textOpts,
    String equalOpts,
    String numtext
  ) {
    private 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(',')
      ) {
            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') {
@@ -493,8 +424,10 @@
              soql += ' AND ';
            }
          }
        }
        //精琢科技   zxk    2021-08-25   end
        //     String val = vals[icount];
        //     cSql = this.makeTextSqlStr(textOpts, equalOpts, val);
@@ -507,9 +440,7 @@
        soql += ')';
      }
      //寻找检索条件包含‘,’ 逗号的多重检索条件
      else if (
        (equalOpts == '=' || equalOpts == '<>') && numtext.contains(',')
      ) {
            else if ((equalOpts == '=' || equalOpts == '<>') && numtext.contains(',')) {
        String[] vals = numtext.split(',');
        soql += ' AND ( ';
        for (Integer icount = 0; icount < vals.size(); icount++) {
@@ -529,9 +460,7 @@
        soql += ')';
      }
      //检索连接符为包含以及不包含
      else if (
        equalOpts.equals('contains') || equalOpts.equals('notcontains')
      ) {
            else if (equalOpts.equals('contains') || equalOpts.equals('notcontains')) {
        if (equalOpts.equals('contains')) {
          soql += ' AND ' + textOpts + ' LIKE \'%' + numtext + '%\'';
        } else if (equalOpts.equals('notcontains')) {
@@ -542,6 +471,7 @@
      else if (equalOpts == '=' || equalOpts == '<>') {
        soql += 'AND ' + textOpts + equalOpts + '\'' + numtext + '\'';
      }
      //精琢科技   zxk    2021-08-25   start
      //起始字符
      else if (equalOpts == 'starts with' && numtext.contains(' ')) {
@@ -553,10 +483,12 @@
            soql += ' ' + textOpts + '  LIKE  \'%' + val + '%\'';
            if (icount < vals.size() - 1) {
              soql += ' OR ';
            }
          }
        }
        soql += ')';
      }
      //精琢科技   zxk    2021-08-25   end
@@ -577,8 +509,7 @@
    return soql;
  }
  //检索条件:数据字段1,数据字段2,数据字段3均满足,并且进入makeTextSql()之后,内含数据字段包含多种时进入此方法。
  @TestVisible
  private String makeTextSqlStr(String textOpts, String equalOpts, String val) {
    @TestVisible private String makeTextSqlStr(String textOpts, String equalOpts, String val) {
    String soql = '';
    if (!String.isBlank(textOpts)) {
      String tmpVal = val;
@@ -603,20 +534,11 @@
        } else if (equalOpts == '<>') {
          soql += ' <> ' + tmpVal;
        } else if (equalOpts == 'contains') {
          soql +=
            ' like \'%' +
            String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) +
            '%\'';
                    soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\'';
        } else if (equalOpts == 'notcontains') {
          soql +=
            ' like \'%' +
            String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) +
            '%\'';
                    soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\'';
        } else if (equalOpts == 'starts with') {
          soql +=
            ' like \'%' +
            String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) +
            '%\'';
                    soql += ' like \'%' + String.escapeSingleQuotes(tmpVal.replaceAll('%', '\\%')) + '%\'';
        } else {
          soql += ' ' + equalOpts + ' ' + tmpVal;
        }
@@ -641,6 +563,7 @@
        if (oi.changeFlg == '1') {
          oi.changeFlg = '0';
          updTarget.add(oi.AgcOpp);
        }
        // if (oi.changeFlgRt == '1' && oi.opp.id != null) {
        //     oi.changeFlgRt = '0';
@@ -654,9 +577,7 @@
      // if (updOpps.size() > 0) {
      //     update updOpps;
      // }
      ApexPages.addmessage(
        new ApexPages.message(ApexPages.severity.INFO, '保存完了')
      );
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '保存完了'));
      //add by Link 2023-6-2
      remindMsg = '保存完了';
    } catch (Exception e) {
@@ -679,19 +600,14 @@
      if (String.isBlank(this.sortKey) == false) {
        // 方向が変わるのみ
        this.sortOrderAsc = !this.sortOrderAsc;
        this.sortOrder[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc ==
          true
          ? '↑'
          : '↓');
                this.sortOrder[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc == true ? '↑' : '↓');
      }
    } else {
      this.sortOrderAsc = true;
      if (String.isBlank(this.preSortKey) == false) {
        this.sortOrder[Integer.valueOf(this.preSortKey)] = ' ';
      }
      this.sortOrder[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc == true
        ? '↑'
        : '↓');
            this.sortOrder[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc == true ? '↑' : '↓');
    }
    this.preSortKey = this.sortKey;
@@ -713,10 +629,7 @@
    public Boolean ifLock { get; set; }
    //public String accType { get; private set; }
    public Agency_Opportunity__c AgcOpp { get; set; }
    public OpportunityInfo(
      Agency_Opportunity__c record,
      Agency_Opportunity__c oppo
    ) {
        public OpportunityInfo(Agency_Opportunity__c record, Agency_Opportunity__c oppo) {
      opp = oppo;
      canEdit = true;
      hasError = false;
force-app/main/default/classes/DealerInquiryModifyStateControllerTest.cls
@@ -1,34 +1,15 @@
@isTest
private class DealerInquiryModifyStateControllerTest {
  @TestSetup
  static void init() {
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
    ];
    @TestSetup static void init() {
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
    if (rectCo.size() == 0) {
      return;
    }
    List<RecordType> rectSct = [
      SELECT Id
      FROM RecordType
      WHERE
        IsActive = TRUE
        AND SobjectType = 'Account'
        AND Name = '戦略科室分類 呼吸科'
    ];
        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
    if (rectSct.size() == 0) {
      return;
    }
    List<RecordType> rectDpt = [
      SELECT Id
      FROM RecordType
      WHERE
        IsActive = TRUE
        AND SobjectType = 'Account'
        AND Name = '診療科 消化科'
    ];
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
    if (rectDpt.size() == 0) {
      return;
    }
@@ -79,16 +60,17 @@
    contact1.LastName = 'test1医院';
    contact1.Agency_User__c = true;
    insert contact1;
    List<Contact> contactlist = [
      SELECT Id, FirstName
      FROM Contact
        List<Contact> contactlist = [select Id, FirstName
                                     from Contact
    ];
    System.assertEquals('責任者', contactlist[0].FirstName);
    //
    User user = new User();
    Profile p = [SELECT Id FROM Profile WHERE Name = '901_经销商活动系统'];
        Profile p = [select Id from Profile where Name = '901_经销商活动系统'];
    user.ProfileId = p.Id;
    user.ContactId = contact1.Id;
    user.FirstName = 'ユーザー';
@@ -105,11 +87,7 @@
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert user;
    }
    List<user> users = [
      SELECT Id, Name, LastName, FirstName
      FROM User
      WHERE LastName = 'テスト'
    ];
        List<user> users = [select Id, Name, LastName, FirstName from User where LastName = 'テスト'];
    //
    Agency_Hospital_Link__c agency_hospital_link = new Agency_Hospital_Link__c();
@@ -124,15 +102,7 @@
    //System.assertEquals('テスト',users[0].LastName);
    System.assertEquals('ユーザー', users[0].FirstName);
    Id rtId = [
      SELECT Id, DeveloperName
      FROM RecordType
      WHERE
        IsActive = TRUE
        AND SobjectType = 'Agency_Opportunity__c'
        AND DeveloperName = 'Opportunity'
    ]
    .Id;
        Id rtId = [select Id, DeveloperName from RecordType where IsActive = true and SobjectType = 'Agency_Opportunity__c' and DeveloperName = 'Opportunity'].Id;
    // Schema.SobjectType.Agency_Opportunity__c.getRecordTypeInfosByName().get('询价').getRecordTypeId();
    Agency_opportunity__c agency_opportunity = new Agency_opportunity__c();
    agency_opportunity.RecordTypeId = rtId;
@@ -147,6 +117,7 @@
    insert agency_opportunity;
    Test.stopTest();
  }
  static testMethod void myUnitTest_SortKey() {
@@ -156,8 +127,10 @@
    PageReference page = new PageReference('/apex/DealerInquiryModifyState');
    System.Test.setCurrentPage(page);
    // 初始化测试
    DealerInquiryModifyStateController controller = new DealerInquiryModifyStateController();
    controller.init();
    //System.assertEquals(1, controller.oppRecords.size());验证预期值和结果值正确性
@@ -371,6 +344,7 @@
    controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
    controller.chick();
    Test.stopTest();
  }
  static testMethod void myUnitTestTime02() {
    PageReference page = new PageReference('/apex/DealerInquiryModifyState');
@@ -405,6 +379,7 @@
    controller.tmpBO.MaxActivityDate__c = date.valueOf('2018-02-09');
    controller.chick();
    Test.stopTest();
  }
  static testMethod void myUnitTestTimeSave() {
    PageReference page = new PageReference('/apex/DealerInquiryModifyState');
force-app/main/default/classes/LexArriveGoodsControllerTest.cls
@@ -4,56 +4,20 @@
  static void test1() {
    NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
    insert n;
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount1 = new Account(
      Name = 'Testaccount001',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999996'
    );
    Account myAccount2 = new Account(
      Name = 'Testaccount002',
      Dealer_discount__c = 10,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900',
      Product_Limit_Date__c = 'Test01|2|4,Test02|3|5'
    );
    insert new List<Account>{ myAccount1, myAccount2 };
        Account myAccount1 = new Account(Name='Testaccount001',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999996');
        Account myAccount2 = new Account(Name='Testaccount002',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900',Product_Limit_Date__c = 'Test01|2|4,Test02|3|5');
        insert new Account[]{myAccount1,myAccount2};
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -62,39 +26,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        RecordTypeId = '01210000000aMAFAA2',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        RecordTypeId = '01210000000aMAFAA2',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
      Order1.Name = 'OCM_01_001';
@@ -153,6 +91,7 @@
      Orderdet3.TracingCode__c = 'BXJRC';
      //Orderdet3.Box_Piece__c = '盒';
      //出库产品
      Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
      Orderdet4.Name = 'OCM_01_001005';
@@ -198,41 +137,21 @@
      Orderdets8.Box_Piece__c = '盒';
      Orderdets8.TracingCode__c = 'BXsys';
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4,
        Orderdet5,
        Orderdet6,
        Orderdets8
      };
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdets8};
      List<Consumable_orderdetails__c> cod1 = [
        SELECT Id
        FROM Consumable_orderdetails__c
        WHERE Consumable_order__c = :Order1.Id
      ];
            List<Consumable_orderdetails__c> cod1 = [select Id from Consumable_orderdetails__c WHERE Consumable_order__c = :Order1.Id];
      System.assertEquals(1, cod1.size());
      PageReference page = new PageReference(
        '/apex/ArriveGoods?Esetid=' + Order1.Id
      );
            PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id);
      System.Test.setCurrentPage(page);
      ArriveGoodsController Controller = new ArriveGoodsController();
      //初始化测试
      System.Test.startTest();
      LexArriveGoodsController.Results re = LexArriveGoodsController.init(
        'Arr',
        Order1.Id
      );
            LexArriveGoodsController.Results re =  LexArriveGoodsController.init('Arr', Order1.Id);
      String arrControllerStr = re.arrGoodCon;
      LexArriveGoodsController.searchProduct('', arrControllerStr);
      re = LexArriveGoodsController.searchProduct(
        '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXsys\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BX123',
        arrControllerStr
      );
            re = LexArriveGoodsController.searchProduct('01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXsys\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BX123', arrControllerStr);
      arrControllerStr = re.arrGoodCon;
      LexArriveGoodsController.arriveGoodsConfim(arrControllerStr);
      System.Test.stopTest();
@@ -243,54 +162,21 @@
  static void test2() {
    NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
    insert n;
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount2 = new Account(
      name = 'Testaccount002',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900'
    );
    Account myAccount1 = new Account(
      name = 'Testaccount001',
      Dealer_discount__c = 30,
      RecordTypeId = rectCo[0].Id
    );
    insert new List<account>{ myAccount1, myAccount2 };
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id);
        insert new account[]{myAccount1,myAccount2};
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -299,39 +185,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        RecordTypeId = '01210000000aMAFAA2',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        RecordTypeId = '01210000000aMAFAA2',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
@@ -441,15 +301,7 @@
      Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
      Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BX333';
      Orderdet7.TracingCode__c = 'BXSYS';
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4,
        Orderdet5,
        Orderdet6,
        Orderdet7
      };
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet7};
      ArriveGoodsController Controller = new ArriveGoodsController();
      System.Test.startTest();
      Controller.init();
@@ -458,21 +310,12 @@
      Controller.ArriveGoodsConfim();
      Controller.UpdateGoodsOfReturn();
      controller.getinventorysize();
      LexArriveGoodsController.Results re = LexArriveGoodsController.init(
        'Arr',
        ''
      );
            LexArriveGoodsController.Results re =  LexArriveGoodsController.init('Arr','');
      String arrControllerStr = re.arrGoodCon;
      re = LexArriveGoodsController.searchProduct(
        '01049531702003111115120017181000105ZK250BXAAA\n01049531702003111115120017181000105ZK250BXJRJ\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BX123\n01049531702003111115120017181000105ZK250BX222',
        arrControllerStr
      );
            re = LexArriveGoodsController.searchProduct('01049531702003111115120017181000105ZK250BXAAA\n01049531702003111115120017181000105ZK250BXJRJ\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BX123\n01049531702003111115120017181000105ZK250BX222', arrControllerStr);
      arrControllerStr = re.arrGoodCon;
      LexArriveGoodsController.arriveGoodsConfim(arrControllerStr);
      LexArriveGoodsController.updateGoodsOfReturn(
        re.arrGoodCon,
        JSON.serialize(re.showGoodsofReturnList)
      );
            LexArriveGoodsController.updateGoodsOfReturn(re.arrGoodCon, JSON.serialize(re.showGoodsofReturnList));
      LexArriveGoodsController.ConsumableorderdetailsInfo con = new LexArriveGoodsController.ConsumableorderdetailsInfo();
      List<LexArriveGoodsController.ConsumableorderdetailsInfo> conList = new List<LexArriveGoodsController.ConsumableorderdetailsInfo>();
      conList.add(con);
force-app/main/default/classes/LexArriveGoodsControllerTest.cls-meta.xml
force-app/main/default/classes/LexArriveGoodsControllerTest1.cls
@@ -3,56 +3,20 @@
  static void test1() {
    NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
    insert n;
    List<RecordType> rectCo = [
      SELECT Id
      FROM RecordType
      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
    ];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
    if (rectCo.size() == 0) {
      return;
    }
    // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
    Profile prof = [
      SELECT Id
      FROM Profile
      WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
    ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
    Account myAccount1 = new Account(
      Name = 'Testaccount001',
      Dealer_discount__c = 20,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999996'
    );
    Account myAccount2 = new Account(
      Name = 'Testaccount002',
      Dealer_discount__c = 10,
      RecordTypeId = rectCo[0].Id,
      AgentCode_Ext__c = '9999900',
      Product_Limit_Date__c = 'Test01|2|4,Test02|3|5'
    );
    insert new List<Account>{ myAccount1, myAccount2 };
        Account myAccount1 = new Account(Name='Testaccount001',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999996');
        Account myAccount2 = new Account(Name='Testaccount002',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900',Product_Limit_Date__c = 'Test01|2|4,Test02|3|5');
        insert new Account[]{myAccount1,myAccount2};
    Contact core = new Contact(
      email = 'jplumber@salesforce.com',
      firstname = 'Joe',
      lastname = 'Plumber',
      accountid = myAccount1.id
    );
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
    insert core;
    user MyUser_Test = new User(
      ContactId = core.id,
      Alias = 'newUser',
      Email = 'newuser@testorg.com',
      EmailEncodingKey = 'UTF-8',
      LastName = 'TestUser',
      LanguageLocaleKey = 'zh_CN',
      LocaleSidKey = 'zh_CN',
      ProfileId = prof.Id,
      TimeZoneSidKey = 'Asia/Shanghai',
      UserName = 'testUser@testorg.com',
      UserPro_Type__c = 'ET'
    );
        user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET');
    System.runAs(new User(Id = UserInfo.getUserId())) {
      insert MyUser_Test;
    }
@@ -61,39 +25,13 @@
    // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
    // insert new Product2[] {prod01,prod02};
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        RecordTypeId = '01210000000aMAFAA2',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        RecordTypeId = '01210000000aMAFAA2',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
        system.runAs(MyUser_Test){
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',RecordTypeId = '01210000000aMAFAA2',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
      Order1.Name = 'OCM_01_001';
@@ -152,6 +90,7 @@
      Orderdet3.TracingCode__c = 'BXJRC';
      //Orderdet3.Box_Piece__c = '盒';
      //出库产品
      Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
      Orderdet4.Name = 'OCM_01_001005';
@@ -197,41 +136,21 @@
      Orderdets8.Box_Piece__c = '盒';
      Orderdets8.TracingCode__c = 'BXsys';
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4,
        Orderdet5,
        Orderdet6,
        Orderdets8
      };
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdets8};
      List<Consumable_orderdetails__c> cod1 = [
        SELECT Id
        FROM Consumable_orderdetails__c
        WHERE Consumable_order__c = :Order1.Id
      ];
            List<Consumable_orderdetails__c> cod1 = [select Id from Consumable_orderdetails__c WHERE Consumable_order__c = :Order1.Id];
      System.assertEquals(1, cod1.size());
      PageReference page = new PageReference(
        '/apex/ArriveGoods?Esetid=' + Order1.Id
      );
            PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id);
      System.Test.setCurrentPage(page);
      ArriveGoodsController Controller = new ArriveGoodsController();
      //初始化测试
      System.Test.startTest();
      LexArriveGoodsController.Results re = LexArriveGoodsController.init(
        'Arr',
        Order1.Id
      );
            LexArriveGoodsController.Results re =  LexArriveGoodsController.init('Arr', Order1.Id);
      String arrControllerStr = re.arrGoodCon;
      LexArriveGoodsController.searchProduct('', arrControllerStr);
      re = LexArriveGoodsController.searchProduct(
        '01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXsys\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BX123',
        arrControllerStr
      );
            re = LexArriveGoodsController.searchProduct('01049531702003111115120017181000105ZK250BXJRA\n01049531702003111115120017181000105ZK250BXsys\n01049531702003111115120017181000105ZK250BXsun\n01049531702003111115120017181000105ZK250BXJRB\n01049531702003111115120017181000105ZK250BXJRC\n01049531702003111115120017181000105ZK250BX111\n01049531702003111115120017181000105ZK250BXJRD\n01049531702003111115120017181000105ZK250BXJRE\n01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRG\n01049531702003111115120017181000105ZK250BX123', arrControllerStr);
      arrControllerStr = re.arrGoodCon;
      LexArriveGoodsController.arriveGoodsConfim(arrControllerStr);
      System.Test.stopTest();
force-app/main/default/classes/LexArriveGoodsControllerTest1.cls-meta.xml
force-app/main/default/classes/LexArriveGoodsMainController.cls
force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls
@@ -9,33 +9,19 @@
    NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
    insert n;
    System.runAs(currentUser) {
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      myAccount1 = new Account(
        name = 'testaccount001',
        RecordTypeId = rectCo[0].Id,
        AgentCode_Ext__c = '9999900'
      );
            myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id ,AgentCode_Ext__c = '9999900');
      insert myAccount1;
      core = new Contact(
        email = 'jplumber@salesforce.com',
            core = new Contact(email='jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount1.id
      );
            accountid=myAccount1.id);
      insert core;
      myUser_test = new User(
            myUser_test = New User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
@@ -46,53 +32,30 @@
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        Work_Location__c = '北京'
      );
                Work_Location__c='北京');
      insert myUser_test;
    }
    System.runAs(myUser_test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Manual_Entry__c = false);
            insert new Product2[]{prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c(
        Name = 'OCM_01_001',
        RecordTypeId = System.Label.RT_ConOrder_Delivery,
        Order_type__c = '订单',
        Dealer_info__c = myAccount1.Id,
        Order_ProType__c = 'ET'
      );
                Order_ProType__c = 'ET');
      Consumable_order__c Order2 = new Consumable_order__c(
        Name = 'OCM_01_002',
        RecordTypeId = System.Label.RT_ConOrder_Delivery,
        Order_type__c = '订单',
        Dealer_info__c = myAccount1.Id,
        Order_ProType__c = 'ET'
      );
      insert new List<Consumable_order__c>{ Order1, Order2 };
                Order_ProType__c = 'ET');
            insert new Consumable_order__c[] {Order1, Order2};
      //明细1
      Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c();
@@ -118,44 +81,29 @@
        Consumable_order_minor__c = Order1.Id,
        Arrive_date__c = Date.today(),
        Consumable_Product__c = pro1.id,
        RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
      );
                RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
      Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(
        Name = 'OCM_01_001002',
        Consumable_order_minor__c = Order2.Id,
        Arrive_date__c = Date.today(),
        Consumable_Product__c = pro2.id,
        RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
      );
                RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
      Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(
        Name = 'OCM_01_001003',
        Consumable_order_minor__c = Order1.Id,
        //Arrive_date__c = Date.today(),
        Consumable_Product__c = pro1.id,
        RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
      );
                RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
      Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(
        Name = 'OCM_01_001004',
        Consumable_order_minor__c = Order2.Id,
        Arrive_date__c = Date.today(),
        Consumable_Product__c = pro2.id,
        RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery
      );
      insert new List<Consumable_order_details2__c>{
        Orderdet1,
        Orderdet2,
        Orderdet3,
        Orderdet4
      };
                RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery);
            insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2, Orderdet3, Orderdet4};
      LexArriveGoodsMainController.init();
      LexArriveGoodsMainController.searchConsumableorderdetails(
        'Too001',
        null,
        myAccount1.Id,
        '北京',
        'ET'
      );
            LexArriveGoodsMainController.searchConsumableorderdetails('Too001', null, myAccount1.Id, '北京', 'ET');
    }
  }
}
force-app/main/default/classes/LexArriveGoodsMainControllerTest.cls-meta.xml
force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls
@@ -10,72 +10,22 @@
    NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
    insert n;
    System.runAs(currentUser) {
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
      myAccount2 = new Account(
        name = 'Testaccount002',
        Dealer_discount__c = 20,
        RecordTypeId = rectCo[0].Id
      );
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[]{prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
            myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id);
      insert myAccount2;
      core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount2.id
      );
            core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
      insert core;
      myUser_Test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com'
      );
            myUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
      insert myUser_Test;
      System.runAs(MyUser_Test) {
        StaticParameter.ConsumableAssetHanderTrigger = true;
@@ -111,14 +61,9 @@
        Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
        Orderdet2.Bar_Code__c = '22222';
        insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2 };
                insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2};
        LexArriveGsDetailsController.init(order1.Id);
        LexArriveGsDetailsController.proSale(
          JSON.serialize(LexArriveGsDetailsController.coc),
          LexArriveGsDetailsController.coc.Arrive_Order__r.Total_num__c,
          LexArriveGsDetailsController.consumableorderdetailsRecords.size(),
          order1.Id
        );
                LexArriveGsDetailsController.proSale(JSON.serialize(LexArriveGsDetailsController.coc), LexArriveGsDetailsController.coc.Arrive_Order__r.Total_num__c, LexArriveGsDetailsController.consumableorderdetailsRecords.size(), order1.Id);
      }
    }
  }
@@ -133,72 +78,22 @@
    NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
    insert n;
    System.runAs(currentUser) {
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
      myAccount2 = new Account(
        name = 'Testaccount002',
        Dealer_discount__c = 20,
        RecordTypeId = rectCo[0].Id
      );
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[]{prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
            myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id);
      insert myAccount2;
      core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount2.id
      );
            core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
      insert core;
      myUser_Test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com'
      );
            myUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
      insert myUser_Test;
      System.runAs(MyUser_Test) {
        StaticParameter.ConsumableAssetHanderTrigger = true;
@@ -219,6 +114,7 @@
        olyorder.IsShipment__c = true;
        insert olyorder;
        //订单明细
        Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
        Orderdet1.Name = 'OCM_01_001001';
@@ -235,14 +131,9 @@
        Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
        Orderdet2.Bar_Code__c = '22222';
        insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2 };
                insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2};
        LexArriveGsDetailsController.init(order1.Id);
        LexArriveGsDetailsController.proSale(
          JSON.serialize(LexArriveGsDetailsController.coc),
          1,
          1,
          order1.Id
        );
                LexArriveGsDetailsController.proSale(JSON.serialize(LexArriveGsDetailsController.coc), 1, 1, order1.Id);
      }
    }
  }
force-app/main/default/classes/LexArriveGsDetailsControllerTest.cls-meta.xml
force-app/main/default/classes/LexCancelRemoveBoxController.cls
@@ -4,23 +4,14 @@
  public static String userPro_Typestr = null;
  public static String barcode { get; set; }
  /*****************画面表示Bean******************/
  public static List<ConsumableorderdetailsInfo> consumableInventory {
    get;
    set;
  }
    public static List<ConsumableorderdetailsInfo> consumableInventory { get; set; }
  //错误明细
  public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror {
    get;
    set;
  }
    public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; }
  //拆盒明细
  public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy {
    get;
    set;
  }
    public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
  public static boolean saveFLGbln { get; set; }
  //错误信息
  public static String alertMessage { get; set; }
    public static String alertMessage {set;get;}
  //拆盒明细件数
  public static Integer getinventorysize() {
    return ConsumableorderdetailsRecordsdummy.size();
@@ -30,7 +21,7 @@
  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 list<String> notInlist = new list<String>();
  public static String baseUrl { get; private set; }
  private static String accountid = null;
  private static String accountName = null;
@@ -43,7 +34,7 @@
    ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
    ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
    consumableInventory = new List<ConsumableorderdetailsInfo>();
    saveFLGbln = false;
        saveFLGbln = FALSE;
  }
  @AuraEnabled
@@ -53,12 +44,8 @@
    res.entity = data;
    String userId = UserInfo.getUserId();
    List<user> Useracc = new List<user>();
    Useracc = [
      SELECT accountid, Work_Location__c, UserPro_Type__c
      FROM user
      WHERE id = :userId
    ];
        List<user> Useracc = New List<user>();
        Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:userId];
    accountid = Useracc[0].accountid;
    userWorkLocation = Useracc[0].Work_Location__c;
    agencyProType = Useracc[0].UserPro_Type__c;
@@ -66,11 +53,7 @@
      agencyProType = 'ET';
    }
    userPro_Typestr = '%' + agencyProType + '%';
    List<account> accountInfo = [
      SELECT Name
      FROM account
      WHERE id = :accountid
    ];
        List<account> accountInfo = [SELECT Name FROM account WHERE id =:accountid];
    //String view_product = accountInfo[0].view_product__c;
    accountName = accountInfo[0].Name;
    //proidList = view_product.split(',');
@@ -81,11 +64,12 @@
    res.code = 200;
    System.debug('res = ' + res);
    return res;
  }
  // 将页面或取得BarCode去掉重复的,转换成List
  public static List<String> ParseBarCode(String Code) {
    String[] Cache = new List<String>{};
        String[] Cache = new String[]{};
    Cache = Code.split('\n');
    Set<String> Buff = new Set<String>();
    for (String A : Cache) {
@@ -101,12 +85,7 @@
  //获取明细
  @AuraEnabled
  public static ResponseBodyLWC searchConsumableorderdetails(
    String barcode,
    String accountName,
    String userWorkLocation,
    String agencyProType
  ) {
    public static ResponseBodyLWC searchConsumableorderdetails(String barcode,String accountName,String userWorkLocation,String agencyProType) {
    ResponseBodyLWC res = new ResponseBodyLWC();
    Map<String, object> data = new Map<String, object>();
    res.entity = data;
@@ -118,13 +97,15 @@
    ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
    ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
    notInlist = new List<String>();
        notInlist = new list<String>();
    BarCodeListP = ParseBarCode(barcode);
    Consumable_order_details2__c p = new Consumable_order_details2__c();
    List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
        List<Consumable_order_details2__c> Ins = New List<Consumable_order_details2__c>();
    List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
    List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
    saveFLGbln = false;
        saveFLGbln = FALSE;
    alertMessage = '';
    //判断barcode是否为空
@@ -141,91 +122,56 @@
    // 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,
        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
                    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
    ];
                    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)
          );
                    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,
        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
                    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  Bar_Code__c in :BarCodeListP
        AND Dealer_Info_text__c = :accountName
      ORDER BY Name
    ]; //没出库,没销售,在库,没有拆盒
                    ORDER BY Name ];  //没出库,没销售,在库,没有拆盒
    if (reSet1.size() > 0) {
      for (Integer i = 0; i < reSet1.size(); i++) {
        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
@@ -233,47 +179,32 @@
          continue;
        } else {
          String str = '该商品没有拆盒';
          ConsumableorderdetailsRecordserror.add(
            new ConsumableorderdetailsInfo(reSet1[i], 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,
        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
                    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  Dealer_Returned__c = false
                    AND  Lose_Flag__c = false
        AND Box_Piece__c = '盒'
        AND Bar_Code__c IN :BarCodeListP
                    AND   Bar_Code__c in :BarCodeListP
        AND Dealer_Info_text__c = :accountName
      ORDER BY Name
    ];
                    ORDER BY Name ];
    if (reSet1.size() > 0) {
      for (Integer i = 0; i < reSet1.size(); i++) {
        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
@@ -281,47 +212,32 @@
          continue;
        } else {
          String str = '该商品还未到货';
          ConsumableorderdetailsRecordserror.add(
            new ConsumableorderdetailsInfo(reSet1[i], 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,
        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
                    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   RemoveBox_date__c != null
                    AND   Bar_Code__c in :BarCodeListP
        AND Dealer_Info_text__c = :accountName
      ORDER BY Name
    ];
                    ORDER BY Name ];
    if (reSet1.size() > 0) {
      for (Integer i = 0; i < reSet1.size(); i++) {
        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
@@ -329,47 +245,32 @@
          continue;
        } else {
          String str = '该商品存在出货履历';
          ConsumableorderdetailsRecordserror.add(
            new ConsumableorderdetailsInfo(reSet1[i], 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,
        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
                    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   RemoveBox_date__c != null
                    AND   Bar_Code__c in :BarCodeListP
        AND Dealer_Info_text__c = :accountName
      ORDER BY Name
    ];
                    ORDER BY Name ];
    if (reSet1.size() > 0) {
      for (Integer i = 0; i < reSet1.size(); i++) {
        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
@@ -377,45 +278,30 @@
          continue;
        } else {
          String str = '该商品存在销售履历';
          ConsumableorderdetailsRecordserror.add(
            new ConsumableorderdetailsInfo(reSet1[i], 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,
        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
                    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   RemoveBox_date__c != null
                    AND   Bar_Code__c in :BarCodeListP
        AND Dealer_Info_text__c = :accountName
      ORDER BY Name
    ];
                    ORDER BY Name ];
    if (reSet1.size() > 0) {
      for (Integer i = 0; i < reSet1.size(); i++) {
        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
@@ -423,44 +309,30 @@
          continue;
        } else {
          String str = '该商品存在返品履历';
          ConsumableorderdetailsRecordserror.add(
            new ConsumableorderdetailsInfo(reSet1[i], 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,
        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
                    WHERE Inventory_date__c != null
        AND Box_Piece__c = '个'
        AND RemoveBox_date__c != NULL
        AND Bar_Code__c IN :BarCodeListP
                    AND   RemoveBox_date__c != null
                    AND   Bar_Code__c in :BarCodeListP
        AND Dealer_Info_text__c = :accountName
      ORDER BY Name
    ];
                    ORDER BY Name ];
    if (reSet1.size() > 0) {
      for (Integer i = 0; i < reSet1.size(); i++) {
        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
@@ -468,65 +340,42 @@
          continue;
        } else {
          String str = '该商品存在盘点履历';
          ConsumableorderdetailsRecordserror.add(
            new ConsumableorderdetailsInfo(reSet1[i], 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,
        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
                    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
    ];
                    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)
          );
                    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,
        reSet = [SELECT Id,
        Name,
        Intra_Trade_List_RMB__c,
        Asset_Model_No__c,
@@ -551,31 +400,30 @@
      /*,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
                    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 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
                    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)) {
                }
                else if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) ){
          // 跳过已经处理的消耗品明细
          continue;
        } else {
          ConsumableorderdetailsRecordsdummy.add(
            new ConsumableorderdetailsInfo(reSet[i])
          );
                }
                else{
                    ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
          ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
        }
      }
@@ -595,36 +443,21 @@
    }
    if (notInlist.size() > 0) {
      // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '不存在。'));
      return new ResponseBodyLWC(
        'Error',
        500,
        'BarCode' + notInlist + '不存在。',
        ''
      );
                return new ResponseBodyLWC('Error',500, 'BarCode'+ notInlist + '不存在。', '');
    }
    data.put(
      'ConsumableorderdetailsRecordsdummy',
      JSON.serialize(ConsumableorderdetailsRecordsdummy)
    );
    data.put(
      'ConsumableorderdetailsRecordserror',
      JSON.serialize(ConsumableorderdetailsRecordserror)
    );
        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
  ) {
    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;
@@ -632,12 +465,10 @@
    userPro_Typestr = '%' + agencyProType + '%';
    accountName = accountName;
    userWorkLocation = userWorkLocation;
    List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
      saveConsumableorderdetailsRecordsdummy,
      List<ConsumableorderdetailsInfo>.class
    );
        List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>)JSON.deserialize(saveConsumableorderdetailsRecordsdummy,List<ConsumableorderdetailsInfo>.class);
    List<Consumable_order_details2__c> ins = new List<Consumable_order_details2__c>();
        List<Consumable_order_details2__c> ins = New List<Consumable_order_details2__c>();
    Savepoint sp = Database.setSavepoint();
    if (ConsumableorderdetailsRecordsdummy.size() < 1) {
@@ -653,8 +484,7 @@
    try {
      //取得通番大于001的在库明细
      List<Consumable_order_details2__c> orderDetails2del = [
        SELECT
            List<Consumable_order_details2__c> orderDetails2del =  [SELECT
          Id,
          Box_Piece__c,
          RemoveBox_date__c,
@@ -665,19 +495,18 @@
        /*,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
                    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_date__c != null
          AND RemoveBox_No__c > 1
          AND Bar_Code__c IN :BarCodeList
                    AND Bar_Code__c in :BarCodeList
          AND Dealer_Info_text__c = :accountName
          AND Arrive_Owner_Work_Location__c = :userWorkLocation
          AND Product_Type__c LIKE :userPro_Typestr
                    AND  Product_Type__c like : userPro_Typestr
      ];
      List<Consumable_order_details2__c> orderlistdel = new List<Consumable_order_details2__c>();
@@ -693,34 +522,32 @@
      }
      //取得通番001的在库明细
      List<Consumable_order_details2__c> orderDetails2 = [
        SELECT
            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_text__c
          /*,ContractNo__c*/
          //add by rebtx 2020-10-13 end
          // tcm start
          Consumable_order_minor__r.ContractNo__c
                    ,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
                    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_date__c !=null
          AND RemoveBox_No__c = 1
          AND Bar_Code__c IN :BarCodeList
                    AND Bar_Code__c in :BarCodeList
          AND Dealer_Info_text__c = :accountName
          AND Arrive_Owner_Work_Location__c = :userWorkLocation
          AND Product_Type__c LIKE :userPro_Typestr
                    AND  Product_Type__c like : userPro_Typestr
      ];
      for (Consumable_order_details2__c detail2tmp : orderDetails2) {
@@ -731,9 +558,7 @@
        updDetails2.RemoveBox_No__c = null;
        // tcm start
        if (
          String.isBlank(detail2tmp.Consumable_order_minor__r.ContractNo__c)
        ) {
                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;
@@ -769,6 +594,7 @@
    }
  }
  @TestVisible
  class ConsumableorderdetailsInfo implements Comparable {
    public Consumable_order_details2__c esd { get; set; }
@@ -781,10 +607,7 @@
    //public String tracingCodeNo { get; set; }
    public String oldConsumableCount { get; set; }
    public String ErrorReason { get; set; }
    public ConsumableorderdetailsInfo(
      Consumable_order_details2__c e,
      string str
    ) {
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) {
      esd = e;
      Prod = e.Consumable_Product__r;
      oldConsumableCount = e.name;
force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls
@@ -5,99 +5,31 @@
    Oly_TriggerHandler.bypass('Oly_TriggerHandler');
    user myUser_test;
    Account myAccount2;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    System.runAs(thisUser) {
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)'
      ];
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
      myAccount2 = new Account(
        name = 'Testaccount002',
        Dealer_discount__c = 20,
        RecordTypeId = rectCo[0].Id,
        AgentCode_Ext__c = '9999900'
      );
            myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
      insert myAccount2;
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount2.id
      );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
      insert core;
      MyUser_Test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com'
      );
            MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
      insert MyUser_Test;
    }
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200311',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 5,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200312',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 5,
        Manual_Entry__c = false
      );
      Product2 prod03 = new Product2(
        Name = 'Test03',
        ProductCode = 'Test03',
        Asset_Model_No__c = 'Test03',
        SFDA_Status__c = '有効',
        JANCODE__c = '04953170200313',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02, prod03 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      Product2__c pro3 = new Product2__c(
        Name = 'Pro003',
        OT_CODE_Text__c = 'Test003',
        Product2__c = prod03.Id
      );
      insert new List<Product2__c>{ pro1, pro2, pro3 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Packing_list_manual__c = 5,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Packing_list_manual__c = 5,Manual_Entry__c = false);
            Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',JANCODE__c = '04953170200313',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
            insert new Product2[]{prod01,prod02,prod03};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            Product2__c pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
            insert new Product2__c[] {pro1, pro2,pro3};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
      Order1.Name = 'OCM_01_001';
@@ -108,6 +40,7 @@
      Order1.Order_ProType__c = 'ET';
      insert Order1;
      List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
      //daoku
      Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
@@ -142,6 +75,8 @@
      conList.add(Orderdet3);
      // insert Orderdet3;
      //sale
      Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
      Orderdet4.Name = 'OCM_01_001004';
@@ -157,6 +92,7 @@
      Orderdet4.Used_date__c = Date.today();
      // insert Orderdet4;
      conList.add(Orderdet4);
      //ProductPacking_list_manual__c=1
      Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c();
@@ -209,29 +145,16 @@
      insert conList;
      // insert Orderdet8;
      System.Test.startTest();
      LexCancelRemoveBoxController.init();
      // LexCancelRemoveBoxController.getinventorysize();
      LexCancelRemoveBoxController.searchConsumableorderdetails(
        '1683272847250250WZIOF',
        '捷尔医疗(海南)有限公司',
        '深圳',
        'ENG'
      );
      LexCancelRemoveBoxController.searchConsumableorderdetails(
        '',
        '捷尔医疗(海南)有限公司',
        '深圳',
        'ENG'
      );
      LexCancelRemoveBoxController.cancelRemoveBoxConfirm(
        JSON.serialize(conList),
        '捷尔医疗(海南)有限公司',
        '深圳',
        'ENG'
      );
            LexCancelRemoveBoxController.searchConsumableorderdetails('1683272847250250WZIOF','捷尔医疗(海南)有限公司','深圳','ENG');
            LexCancelRemoveBoxController.searchConsumableorderdetails('','捷尔医疗(海南)有限公司','深圳','ENG');
            LexCancelRemoveBoxController.cancelRemoveBoxConfirm(JSON.serialize(conList),'捷尔医疗(海南)有限公司','深圳','ENG');
      System.Test.stopTest();
    }
  }
@@ -240,50 +163,20 @@
    Oly_TriggerHandler.bypass('Oly_TriggerHandler');
    user myUser_test;
    Account myAccount2;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    System.runAs(thisUser) {
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)'
      ];
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
      myAccount2 = new Account(
        name = 'Testaccount002',
        Dealer_discount__c = 20,
        RecordTypeId = rectCo[0].Id,
        AgentCode_Ext__c = '9999900'
      );
            myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
      insert myAccount2;
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount2.id
      );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
      insert core;
      MyUser_Test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        Work_Location__c = '重庆'
      );
            MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c ='重庆');
      insert MyUser_Test;
    }
    System.runAs(MyUser_Test) {
@@ -327,18 +220,8 @@
      insert (conList);
      System.debug('conList' + conList);
      System.Test.startTest();
      LexCancelRemoveBoxController.cancelRemoveBoxConfirm(
        JSON.serialize(conList),
        'Testaccount002',
        '重庆',
        'ET'
      );
      LexCancelRemoveBoxController.cancelRemoveBoxConfirm(
        JSON.serialize(conList1),
        'Testaccount002',
        '重庆',
        'ET'
      );
            LexCancelRemoveBoxController.cancelRemoveBoxConfirm(JSON.serialize(conList),'Testaccount002','重庆','ET');
            LexCancelRemoveBoxController.cancelRemoveBoxConfirm(JSON.serialize(conList1),'Testaccount002','重庆','ET');
      System.Test.stopTest();
    }
  }
@@ -347,159 +230,37 @@
    Oly_TriggerHandler.bypass('Oly_TriggerHandler');
    User myUser_test;
    Account myAccount2;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    System.runAs(thisUser) {
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)'
      ];
      myAccount2 = new Account(
        name = 'Testaccount003',
        Dealer_discount__c = 20,
        RecordTypeId = rectCo[0].Id,
        AgentCode_Ext__c = '2'
      );
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
            myAccount2 = new Account(name='Testaccount003',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '2');
      insert myAccount2;
      Contact core = new Contact(
        email = 'wan@salesforce.com',
        firstname = 'wan',
        lastname = 'Plumbers',
        accountid = myAccount2.id
      );
            Contact core = new Contact(email='wan@salesforce.com', firstname='wan',lastname='Plumbers',accountid=myAccount2.id);
      insert core;
      myUser_test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        UserPro_Type__c = 'ENG',
        Work_Location__c = '北京'
      );
            myUser_test = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='北京');
      insert myUser_test;
      System.debug('MyUser_Test' + MyUser_Test);
    }
    System.runAs(MyUser_Test) {
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test01',
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test02',
        Manual_Entry__c = false
      );
      Product2 prod03 = new Product2(
        Name = 'Test03',
        ProductCode = 'Test03',
        Asset_Model_No__c = 'Test03',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test03',
        Manual_Entry__c = false
      );
      Product2 prod04 = new Product2(
        Name = 'Test04',
        ProductCode = 'Test04',
        Asset_Model_No__c = 'Test04',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 2,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test04',
        Manual_Entry__c = false
      );
      Product2 prod05 = new Product2(
        Name = 'Test05',
        ProductCode = 'Test05',
        Asset_Model_No__c = 'Test05',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test05',
        Manual_Entry__c = false
      );
      Product2 prod06 = new Product2(
        Name = 'Test06',
        ProductCode = 'Test06',
        Asset_Model_No__c = 'Test06',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test06',
        Manual_Entry__c = false
      );
      insert new List<Product2>{
        prod01,
        prod02,
        prod03,
        prod04,
        prod05,
        prod06
      };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      Product2__c pro3 = new Product2__c(
        Name = 'Pro004',
        OT_CODE_Text__c = 'Test004',
        Product2__c = prod03.Id
      );
      Product2__c pro4 = new Product2__c(
        Name = 'Pro005',
        OT_CODE_Text__c = 'Test005',
        Product2__c = prod04.Id
      );
      Product2__c pro5 = new Product2__c(
        Name = 'Pro003',
        OT_CODE_Text__c = 'Test003',
        Product2__c = prod05.Id
      );
      Product2__c pro6 = new Product2__c(
        Name = 'Pro006',
        OT_CODE_Text__c = 'Test006',
        Product2__c = prod06.Id
      );
      insert new List<Product2__c>{ pro4, pro5, pro6, pro1, pro2, pro3 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test01',Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test02',Manual_Entry__c = false);
            Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test03',Manual_Entry__c = false);
            Product2 prod04 = new Product2(Name='Test04',ProductCode='Test04',Asset_Model_No__c = 'Test04',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=2,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test04',Manual_Entry__c = false);
            Product2 prod05 = new Product2(Name='Test05',ProductCode='Test05',Asset_Model_No__c = 'Test05',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test05',Manual_Entry__c = false);
            Product2 prod06 = new Product2(Name='Test06',ProductCode='Test06',Asset_Model_No__c = 'Test06',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test06',Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02,prod03,prod04, prod05, prod06};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            Product2__c pro3 = new Product2__c(Name='Pro004',OT_CODE_Text__c='Test004',Product2__c = prod03.Id);
            Product2__c pro4 = new Product2__c(Name='Pro005',OT_CODE_Text__c='Test005',Product2__c = prod04.Id);
            Product2__c pro5 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod05.Id);
            Product2__c pro6 = new Product2__c(Name='Pro006',OT_CODE_Text__c='Test006',Product2__c = prod06.Id);
            insert new Product2__c[] {pro4, pro5,pro6,pro1, pro2, pro3};
      //订单
      Consumable_order__c Order1 = new Consumable_order__c();
      Order1.Name = 'OCM_01';
@@ -588,25 +349,15 @@
      System.Test.startTest();
      LexCancelRemoveBoxController.barcode = '1004\n1003\n1002\n1001';
      LexCancelRemoveBoxController.searchConsumableorderdetails(
        '10061\n10051\n10041\n10031\n10021\n10011',
        'Testaccount003',
        '重庆',
        'ET'
      );
            LexCancelRemoveBoxController.searchConsumableorderdetails('10061\n10051\n10041\n10031\n10021\n10011','Testaccount003','重庆','ET');
      String str = '该商品存在盘点履历';
      String errorReason = '';
      LexCancelRemoveBoxController.ConsumableorderdetailsInfo c2 = new LexCancelRemoveBoxController.ConsumableorderdetailsInfo(
        con,
        str
      );
            LexCancelRemoveBoxController.ConsumableorderdetailsInfo c2 = new LexCancelRemoveBoxController.ConsumableorderdetailsInfo(con,str);
      c2.esd = con;
      c2.Prod = con.Consumable_product__r;
      c2.oldConsumableCount = con.name;
      c2.ErrorReason = str;
      LexCancelRemoveBoxController.ConsumableorderdetailsInfo c1 = new LexCancelRemoveBoxController.ConsumableorderdetailsInfo(
        con2
      );
            LexCancelRemoveBoxController.ConsumableorderdetailsInfo c1 = new LexCancelRemoveBoxController.ConsumableorderdetailsInfo(con2);
      c1.esd = con;
      c1.Prod = con.Consumable_product__r;
      c1.oldConsumableCount = con.name;
@@ -619,158 +370,37 @@
    Oly_TriggerHandler.bypass('Oly_TriggerHandler');
    User myUser_test;
    Account myAccount2;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    System.runAs(thisUser) {
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)'
      ];
      myAccount2 = new Account(
        name = 'Testaccount003',
        Dealer_discount__c = 20,
        RecordTypeId = rectCo[0].Id,
        AgentCode_Ext__c = '2'
      );
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];
            myAccount2 = new Account(name='Testaccount003',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '2');
      insert myAccount2;
      Contact core = new Contact(
        email = 'wan@salesforce.com',
        firstname = 'wan',
        lastname = 'Plumbers',
        accountid = myAccount2.id
      );
            Contact core = new Contact(email='wan@salesforce.com', firstname='wan',lastname='Plumbers',accountid=myAccount2.id);
      insert core;
      MyUser_Test = new User(
        ContactId = core.id,
        Alias = 'newWang',
        Email = 'newWang@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUserWang',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUserWang@testorg.com',
        Work_Location__c = '重庆'
      );
            MyUser_Test = New User(ContactId = core.id,Alias = 'newWang',Email='newWang@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUserWang', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUserWang@testorg.com',Work_Location__c ='重庆');
      insert MyUser_Test;
      System.debug('MyUser_Test' + MyUser_Test);
    }
    System.runAs(MyUser_Test) {
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test01',
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test02',
        Manual_Entry__c = false
      );
      Product2 prod03 = new Product2(
        Name = 'Test03',
        ProductCode = 'Test03',
        Asset_Model_No__c = 'Test03',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test03',
        Manual_Entry__c = false
      );
      Product2 prod04 = new Product2(
        Name = 'Test04',
        ProductCode = 'Test04',
        Asset_Model_No__c = 'Test04',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 2,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test04',
        Manual_Entry__c = false
      );
      Product2 prod05 = new Product2(
        Name = 'Test05',
        ProductCode = 'Test05',
        Asset_Model_No__c = 'Test05',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test05',
        Manual_Entry__c = false
      );
      Product2 prod06 = new Product2(
        Name = 'Test06',
        ProductCode = 'Test06',
        Asset_Model_No__c = 'Test06',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Category5__c = 'test06',
        Manual_Entry__c = false
      );
      insert new List<Product2>{
        prod01,
        prod02,
        prod03,
        prod04,
        prod05,
        prod06
      };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      Product2__c pro3 = new Product2__c(
        Name = 'Pro004',
        OT_CODE_Text__c = 'Test004',
        Product2__c = prod03.Id
      );
      Product2__c pro4 = new Product2__c(
        Name = 'Pro005',
        OT_CODE_Text__c = 'Test005',
        Product2__c = prod04.Id
      );
      Product2__c pro5 = new Product2__c(
        Name = 'Pro003',
        OT_CODE_Text__c = 'Test003',
        Product2__c = prod05.Id
      );
      Product2__c pro6 = new Product2__c(
        Name = 'Pro006',
        OT_CODE_Text__c = 'Test006',
        Product2__c = prod06.Id
      );
      insert new List<Product2__c>{ pro4, pro5, pro6, pro1, pro2, pro3 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test01',Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test02',Manual_Entry__c = false);
            Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test03',Manual_Entry__c = false);
            Product2 prod04 = new Product2(Name='Test04',ProductCode='Test04',Asset_Model_No__c = 'Test04',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=2,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test04',Manual_Entry__c = false);
            Product2 prod05 = new Product2(Name='Test05',ProductCode='Test05',Asset_Model_No__c = 'Test05',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test05',Manual_Entry__c = false);
            Product2 prod06 = new Product2(Name='Test06',ProductCode='Test06',Asset_Model_No__c = 'Test06',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'test06',Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02,prod03,prod04, prod05, prod06};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            Product2__c pro3 = new Product2__c(Name='Pro004',OT_CODE_Text__c='Test004',Product2__c = prod03.Id);
            Product2__c pro4 = new Product2__c(Name='Pro005',OT_CODE_Text__c='Test005',Product2__c = prod04.Id);
            Product2__c pro5 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod05.Id);
            Product2__c pro6 = new Product2__c(Name='Pro006',OT_CODE_Text__c='Test006',Product2__c = prod06.Id);
            insert new Product2__c[] {pro4, pro5,pro6,pro1, pro2, pro3};
      List<Consumable_order__c> orderList = new List<Consumable_order__c>();
      //销售
      Consumable_order__c Order1 = new Consumable_order__c();
@@ -882,6 +512,7 @@
      conList3.add(con3);
      insert conList3;
      //reset
      // Consumable_order_details2__c con1 = new Consumable_order_details2__c();
      // con1.Intra_Trade_List_RMB__c = 1000;
@@ -916,6 +547,8 @@
      // conList3.add(con9);
      // LexCancelRemoveBoxController.searchConsumableorderdetails('100112','Testaccount003','重庆','ET');
      //orderDetails2
      // Consumable_order_details2__c con00 = new Consumable_order_details2__c();
      // con00.Box_Piece__c = '个';
@@ -929,25 +562,12 @@
      // insert conList3;
      System.Test.startTest();
      LexCancelRemoveBoxController CancelRemoveBoxController = new LexCancelRemoveBoxController();
      LexCancelRemoveBoxController.searchConsumableorderdetails(
        '100611\n10078\n10099\n1009999\n100999',
        'Testaccount003',
        '重庆',
        'ET'
      );
      LexCancelRemoveBoxController.searchConsumableorderdetails(
        '100611\n10078\n10061\n10051\n10041\n10031\n10021\n10011',
        'Testaccount003',
        '北京',
        'ET'
      );
      LexCancelRemoveBoxController.searchConsumableorderdetails(
        '100611\n10078\n10061\n10051\n10041\n10031\n10021\n10011',
        'Testaccount003',
        '重庆',
        'ET'
      );
            LexCancelRemoveBoxController.searchConsumableorderdetails('100611\n10078\n10099\n1009999\n100999','Testaccount003','重庆','ET');
            LexCancelRemoveBoxController.searchConsumableorderdetails('100611\n10078\n10061\n10051\n10041\n10031\n10021\n10011','Testaccount003','北京','ET');
            LexCancelRemoveBoxController.searchConsumableorderdetails('100611\n10078\n10061\n10051\n10041\n10031\n10021\n10011','Testaccount003','重庆','ET');
      System.Test.stopTest();
    }
  }
}
force-app/main/default/classes/LexCancelRemoveBoxControllerTest.cls-meta.xml
force-app/main/default/classes/LexConInvoiceListTest.cls
@@ -1,89 +1,34 @@
@isTest
private class LexConInvoiceListTest {
private class LexConInvoiceListTest
{
  static testMethod void conInvoiceListTestinit() {
    user myUser_test;
    Account myAccount2;
    Account myAccount1;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
    System.runAs(thisUser) {
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
        system.runAs(thisUser){
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      List<RecordType> rectHos = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
      ];
            List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
      if (rectHos.size() == 0) {
        return;
      }
      myAccount1 = new Account(
        name = 'testaccount001',
        RecordTypeId = rectCo[0].Id
      );
      myAccount2 = new Account(
        name = 'testaccount002',
        RecordTypeId = rectHos[0].Id
      );
            myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id );
            myAccount2 = new Account(name='testaccount002',RecordTypeId = rectHos[0].Id );
      insert myAccount1;
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount1.id
      );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
      insert core;
      myUser_test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'testUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        Work_Location__c = '北京'
      );
            myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '北京');
      insert myUser_test;
    }
    System.runAs(myUser_test) {
      Consumable_order__c TestList1 = new Consumable_order__c(
        Name = 'Test1',
        Invoice_Date__c = Date.today(),
        Dealer_info__c = myAccount1.Id,
        Invoice_status__c = '草案中',
        Order_ForHospital__c = myAccount2.Id,
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '发票',
        recordtypeid = System.Label.RT_ConOrder_Invoice,
        Order_ProType__c = 'ET'
      );
      Consumable_order__c TestList2 = new Consumable_order__c(
        Name = 'Test2',
        Invoice_Date__c = Date.today(),
        Dealer_info__c = myAccount1.Id,
        Invoice_status__c = '提交',
        Order_ForHospital__c = myAccount2.Id,
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '发票',
        recordtypeid = System.Label.RT_ConOrder_Invoice,
        Order_ProType__c = 'ET'
      );
      insert new List<Consumable_order__c>{ TestList1, TestList2 };
        system.runAs(myUser_test){
            Consumable_order__c TestList1 = new Consumable_order__c(Name='Test1',Invoice_Date__c=Date.today(),Dealer_info__c=myAccount1.Id,Invoice_status__c='草案中',Order_ForHospital__c =myAccount2.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='发票',recordtypeid = System.Label.RT_ConOrder_Invoice,Order_ProType__c = 'ET');
            Consumable_order__c TestList2 = new Consumable_order__c(Name='Test2',Invoice_Date__c=Date.today(),Dealer_info__c=myAccount1.Id,Invoice_status__c='提交',Order_ForHospital__c =myAccount2.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='发票',recordtypeid = System.Label.RT_ConOrder_Invoice,Order_ProType__c = 'ET');
            insert new Consumable_order__c[]{TestList1,TestList2};
      LexConInvoiceList.init();
      // ConInvoiceListController CDC = new ConInvoiceListController();
      // CDC.init();
@@ -99,99 +44,34 @@
    user myUser_test;
    Account myAccount2;
    Account myAccount1;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
    System.runAs(thisUser) {
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
        system.runAs(thisUser){
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      List<RecordType> rectHos = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
      ];
            List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
      if (rectHos.size() == 0) {
        return;
      }
      myAccount1 = new Account(
        name = 'testaccount001',
        RecordTypeId = rectCo[0].Id
      );
      myAccount2 = new Account(
        name = 'testaccount002',
        RecordTypeId = rectHos[0].Id
      );
            myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id );
            myAccount2 = new Account(name='testaccount002',RecordTypeId = rectHos[0].Id );
      insert myAccount1;
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount1.id
      );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
      insert core;
      myUser_test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'testUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        Work_Location__c = '北京'
      );
            myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '北京');
      insert myUser_test;
    }
    System.runAs(myUser_test) {
      Consumable_order__c TestList1 = new Consumable_order__c(
        Name = 'Test1',
        Invoice_Date__c = Date.today(),
        Dealer_info__c = myAccount1.Id,
        Invoice_status__c = '草案中',
        Order_ForHospital__c = myAccount2.Id,
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '发票',
        recordtypeid = System.Label.RT_ConOrder_Invoice,
        Order_ProType__c = 'ET'
      );
      Consumable_order__c TestList2 = new Consumable_order__c(
        Name = 'Test2',
        Invoice_Date__c = Date.today(),
        Dealer_info__c = myAccount1.Id,
        Invoice_status__c = '提交',
        Order_ForHospital__c = myAccount2.Id,
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '发票',
        recordtypeid = System.Label.RT_ConOrder_Invoice,
        Order_ProType__c = 'ET'
      );
      insert new List<Consumable_order__c>{ TestList1, TestList2 };
        system.runAs(myUser_test){
            Consumable_order__c TestList1 = new Consumable_order__c(Name='Test1',Invoice_Date__c=Date.today(),Dealer_info__c=myAccount1.Id,Invoice_status__c='草案中',Order_ForHospital__c =myAccount2.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='发票',recordtypeid = System.Label.RT_ConOrder_Invoice,Order_ProType__c = 'ET');
            Consumable_order__c TestList2 = new Consumable_order__c(Name='Test2',Invoice_Date__c=Date.today(),Dealer_info__c=myAccount1.Id,Invoice_status__c='提交',Order_ForHospital__c =myAccount2.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='发票',recordtypeid = System.Label.RT_ConOrder_Invoice,Order_ProType__c = 'ET');
            insert new Consumable_order__c[]{TestList1,TestList2};
      LexConInvoiceList CDC = new LexConInvoiceList();
      LexConInvoiceList.init();
      LexConInvoiceList.invoiceCodeSearch(
        Date.today(),
        Date.today(),
        '提交',
        'test',
        'test1',
        '0010l00001ajxZ2AAI',
        '北京',
        'ET'
      );
            LexConInvoiceList.invoiceCodeSearch(Date.today(),Date.today(),'提交','test','test1','0010l00001ajxZ2AAI','北京','ET');
      // CDC.init();
      // System.assertEquals('Test1', CDC.raesList[0].name);
      // System.assertEquals('Test2', CDC.raesList[1].name);
force-app/main/default/classes/LexConInvoiceListTest.cls-meta.xml
force-app/main/default/classes/LexConInvoiceViewController.cls
@@ -40,10 +40,7 @@
  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 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; }
@@ -58,11 +55,7 @@
  }
  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[] 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; }
@@ -71,11 +64,7 @@
  //页面初始化
  @AuraEnabled
  public static ResponseBodyLWC init(
    String invoiceId,
    String statusEdit,
    String deliveryId
  ) {
    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;
@@ -104,34 +93,16 @@
    statusEdit = statusEdit;
    deliveryId = deliveryId;
    if (
      invoiceId != null &&
      invoiceId != '' &&
      (statusEdit == '' ||
      statusEdit == null)
    ) {
        if (invoiceId != null && invoiceId != '' && (statusEdit == '' || statusEdit == null)) {
      editAble = false;
    } else if (
      (invoiceId == null || invoiceId == '') &&
      (statusEdit == '' ||
      statusEdit == null)
    ) {
        } else if ((invoiceId == null || invoiceId == '') && (statusEdit == '' || statusEdit == null)) {
      editAble = true;
    } else if (
      invoiceId != null &&
      invoiceId != '' &&
      statusEdit != '' &&
      statusEdit != null
    ) {
        } 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
    ];
        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;
@@ -224,9 +195,7 @@
          ORDER BY Name
        ];
        for (Integer i = 0; i < invoiceOrderSelectedList.size(); i++) {
          invoiceOrderRecoeds.add(
            new InvoiceOrderInfo(invoiceOrderSelectedList[i])
          );
                    invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
        }
      }
    } else {
@@ -289,16 +258,12 @@
          Invoice_total_amount__c,
          Billed_Status__c
        FROM Consumable_order__c
        WHERE
          Id IN :outOrderStringList
          AND Order_Owner_WorkLocal__c = :userWorkLocation
                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])
        );
                invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
      }
      if (String.isNotBlank(deliveryId)) {
        //发票关联出库单取得(出库单)
@@ -320,19 +285,13 @@
            Invoice_total_amount__c,
            Billed_Status__c
          FROM Consumable_order__c
          WHERE
            Id = :deliveryId
            AND Order_Owner_WorkLocal__c = :userWorkLocation
                    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])
            );
                        invoiceOrderRecoeds.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
                        invoiceOrderRecoedschange.add(new InvoiceOrderInfo(invoiceOrderSelectedList[i]));
          }
        }
      }
@@ -362,17 +321,11 @@
      ];
      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)
          ) {
                    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
                            outorderMoneytMap.get(countDel[i].Invoicedet1_OD_link__c) + countDel[i].InvoicedProCost_RMB__c
            );
          }
          invoiceOrderdetail1Recoeds.add(new InvoiceOrderInfo(countDel[i]));
@@ -391,45 +344,25 @@
      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
          )
                    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
        );
                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
          );
                    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
            )
                        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
          );
                    provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
        }
      }
    }
@@ -444,14 +377,8 @@
    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
        );
                consumableaccessoriesMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Accessories_type__c);
                invorceOrderIdMap.put(consumableaccessories[i].Attachment_ID__c, consumableaccessories[i].Id);
      }
    }
@@ -461,11 +388,7 @@
    //         attachmentRecoeds.add(new InvoiceOrderInfo(attachmentinfo[i]));
    //     }
    // }
    List<ContentDocumentLink> links = [
      SELECT Id, ContentDocumentId
      FROM ContentDocumentLink
      WHERE LinkedEntityId = :invoiceId
    ];
        List<ContentDocumentLink> links = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :invoiceId];
    if (links != null && links.size() > 0) {
      List<String> documentIds = new List<String>();
      for (ContentDocumentLink link : links) {
@@ -551,18 +474,12 @@
    SecondDealer = SecondDealerLwc;
    errorMsg = '';
    deliveryId = deliveryIdLwc;
    invoiceOrderRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize(
      invoiceOrderRecoedsLwc,
      List<InvoiceOrderInfo>.class
    );
        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
    );
        invoiceOrderRecoedschange = (List<InvoiceOrderInfo>) JSON.deserialize(invoiceOrderRecoedschangeLwc, List<InvoiceOrderInfo>.class);
    List<String> chukudanID = new List<String>();
    if (coc.Name == '' || coc.Name == null) {
@@ -578,18 +495,9 @@
    if (String.isBlank(HospitalInfo) && String.isBlank(SecondDealer)) {
      // coc.addError('必须输入客户名或者二级经销商');
      // return null;
      return new ResponseBodyLWC(
        'Error',
        500,
        '必须输入客户名或者二级经销商',
        ''
      );
            return new ResponseBodyLWC('Error', 500, '必须输入客户名或者二级经销商', '');
    }
    if (
      HospitalInfo != null &&
      HospitalInfo != '' &&
      String.isNotEmpty(SecondDealer)
    ) {
        if (HospitalInfo != null && HospitalInfo != '' && String.isNotEmpty(SecondDealer)) {
      //coc.addError('请输入客户名、二级经销商只可输入一个');
      errorMsg += '请输入客户名、二级经销商只可输入一个';
    }
@@ -612,9 +520,7 @@
    } else if (String.isNotEmpty(SecondDealer)) {
      shipmentAccountString = SecondDealer;
    } else {
      shipmentAccountString = coc.Order_ForDealerText__c == null
        ? ''
        : coc.Order_ForDealerText__c;
            shipmentAccountString = coc.Order_ForDealerText__c == null ? '' : coc.Order_ForDealerText__c;
    }
    Integer x = 0;
@@ -637,14 +543,9 @@
              invoiceOrderAccountList.add(ass.esd.Name);
            }
          }
                    if (coc.Order_ForDealerText__c != null && (HospitalInfo == null || HospitalInfo == '')) {
          if (
            coc.Order_ForDealerText__c != null &&
            (HospitalInfo == null ||
            HospitalInfo == '')
          ) {
            if (
              (ass.esd.Order_ForDealerText__c != null ||
              ass.esd.Order_ForDealerText__c != '') &&
                            (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') &&
              ass.esd.ShipmentAccount__c != shipmentAccountString
            ) {
              invoiceOrderAccountList.add(ass.esd.Name);
@@ -653,36 +554,22 @@
        }
      } else {
        if (HospitalInfo != null && HospitalInfo != '') {
          System.debug(
            '++++++++++++' +
              ass.esd.Order_ForHospital__c +
              '   ' +
              shipmentAccountString
          );
                    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'
            );
                        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'
            );
                        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 (
          coc.Order_ForDealerText__c != null &&
          (HospitalInfo == null ||
          HospitalInfo == '')
        ) {
          if (
            (ass.esd.Order_ForDealerText__c != null ||
            ass.esd.Order_ForDealerText__c != '') &&
                        (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') &&
            ass.esd.ShipmentAccount__c != shipmentAccountString
          ) {
            System.debug(
@@ -695,16 +582,10 @@
    }
    // invoiceOrderAccountList.add('12345');
    if (invoiceOrderAccountList.size() > 0) {
      orderRemind =
        invoiceOrderAccountList + '出库单客户名与发票客户名不一致!';
            orderRemind = invoiceOrderAccountList + '出库单客户名与发票客户名不一致!';
      // coc.addError(invoiceOrderAccountList + '出库单客户名与发票客户名不一致!');
      // return null;
      return new ResponseBodyLWC(
        'Error',
        500,
        invoiceOrderAccountList + '出库单客户名与发票客户名不一致!',
        ''
      );
            return new ResponseBodyLWC('Error', 500, invoiceOrderAccountList + '出库单客户名与发票客户名不一致!', '');
    } else {
      orderRemind = '';
    }
@@ -712,12 +593,7 @@
      if (x < 1) {
        // coc.addError('请选择需要开发票的出库单!');
        // return null;
        return new ResponseBodyLWC(
          'Error',
          500,
          '请选择需要开发票的出库单!',
          ''
        );
                return new ResponseBodyLWC('Error', 500, '请选择需要开发票的出库单!', '');
      }
    }
    Consumable_order__c invoiceHead = new Consumable_order__c();
@@ -730,9 +606,7 @@
    try {
      if (String.isBlank(invoiceId)) {
        invoiceHead.Name = coc.Name;
        if (
          coc.Invoice_status__c == null || String.isBlank(coc.Invoice_status__c)
        )
                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;
@@ -819,9 +693,7 @@
            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)
                            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();
@@ -833,11 +705,7 @@
          }
          upsert invoiceLinkList;
        }
      } else if (
        String.isNotBlank(reopen) &&
        reopen.equals('isreopen') &&
        String.isNotBlank(invoiceId)
      ) {
            } else if (String.isNotBlank(reopen) && reopen.equals('isreopen') && String.isNotBlank(invoiceId)) {
        System.debug('进入reopen');
        invoiceHead.Name = coc.Name;
        invoiceHead.Order_type__c = '发票';
@@ -902,10 +770,7 @@
        ];
        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
          );
                    tempCocMap.put(cocTemp.Invoicedet1_OD_link__c + cocTemp.Asset_Model_No__c, cocTemp);
        }
        System.debug('tempCountList = ' + tempCountList);
        update tempCountList;
@@ -930,25 +795,15 @@
          WHERE Consumable_order__c IN :updateChukudanId
        ];
        for (Consumable_Orderdetails__c corderc : updateFromList) {
          String tempStr =
            corderc.Consumable_order__c + corderc.Asset_Model_No__c;
                    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.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;
                        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;
                        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;
            }
@@ -979,9 +834,7 @@
          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
                        WHERE Outboundorder_Code_link__c IN :insertDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id
          ];
          //存在没有与发票建立关联关系的出库单
          List<String> templist2 = new List<String>();
@@ -1010,15 +863,10 @@
          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
                        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
            ) {
                        if (deleteDetMap.get(colctemp.Outboundorder_Code_link__c) == colctemp.Invoice_Code_link__c) {
              //存在与该发票关联的出库单
              invoiceLinkdetList.add(colctemp);
            }
@@ -1093,10 +941,7 @@
            WHERE Consumable_order__c = :deliveryId
          ];
          for (Consumable_Orderdetails__c changeOD : detaliFromList) {
            needchangeOrderProcountMap.put(
              changeOD.Asset_Model_No__c,
              changeOD.Shipment_Count__c
            );
                        needchangeOrderProcountMap.put(changeOD.Asset_Model_No__c, changeOD.Shipment_Count__c);
          }
          //发票返品信息
          List<Consumable_Orderdetails__c> returnCountList = [
@@ -1125,14 +970,10 @@
              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
                                    returnProcountMap.get(changeOD.Asset_Model_No__c) + changeOD.RrturnPro_count__c
                );
              } else {
                returnProcountMap.put(
                  changeOD.Asset_Model_No__c,
                  changeOD.RrturnPro_count__c
                );
                                returnProcountMap.put(changeOD.Asset_Model_No__c, changeOD.RrturnPro_count__c);
              }
            }
          }
@@ -1166,10 +1007,7 @@
              AND Consumable_order__c != :deliveryId
          ];
          for (Consumable_Orderdetails__c changeOD : returnCount1List) {
            changeOrderProcountMap.put(
              changeOD.Asset_Model_No__c,
              changeOD.Shipment_Count__c
            );
                        changeOrderProcountMap.put(changeOD.Asset_Model_No__c, changeOD.Shipment_Count__c);
          }
          outOrderchange(insertDetMap);
        } else {
@@ -1190,9 +1028,7 @@
          } else {
            invoiceHead.Order_ForHospital__c = null;
          }
          invoiceHead.Order_ForDealer__c = SecondDealer == ''
            ? null
            : SecondDealer;
                    invoiceHead.Order_ForDealer__c = SecondDealer == '' ? null : SecondDealer;
          invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
          update invoiceHead;
          for (InvoiceOrderInfo ass : invoiceOrderRecoeds) {
@@ -1212,9 +1048,7 @@
            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
                            WHERE Outboundorder_Code_link__c IN :insertDetMap.keySet() AND Invoice_Code_link__c = :invoiceHead.Id
            ];
            //存在没有与发票建立关联关系的出库单
            List<String> templist2 = new List<String>();
@@ -1241,15 +1075,10 @@
            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
                            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
              ) {
                            if (deleteDetMap.get(colctemp.Outboundorder_Code_link__c) == colctemp.Invoice_Code_link__c) {
                //存在与该发票关联的出库单
                invoiceLinkdetList.add(colctemp);
              }
@@ -1324,33 +1153,19 @@
      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;
                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 == '个'
      ) {
            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;
                    detaliFromList[i].Delivery_List_RMB__c / detaliFromList[i].ProductPacking_list_manual__c;
      } else {
        invoiceInsert1.Invoice_Unitprice__c = detaliFromList[i]
          .Delivery_List_RMB__c;
                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;
@@ -1358,15 +1173,12 @@
        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;
            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.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;
            invoiceInsert1.Invoicedet1_OD_link__c = detaliFromList[i].Consumable_order__c;
      invoiceorderList1.add(invoiceInsert1);
    }
    System.debug('invoiceorderList1 +++++' + invoiceorderList1.size());
@@ -1396,22 +1208,12 @@
    // }
  }
  public static void deleteOutboundorder(
    Map<String, String> deleteMap,
    String value
  ) {
    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
            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()
            WHERE Consumable_order__c = :value AND Invoicedet1_OD_link__c = :deleteMap.keySet()
    ];
    System.debug('detInvoicedet1List = ' + detInvoicedet1List);
    delete detInvoicedet1List;
@@ -1478,11 +1280,7 @@
  //上传ContentVersion附件
  @AuraEnabled
  public static String saveFile(
    Id recordId,
    String fileName,
    String base64Data
  ) {
    public static String saveFile(Id recordId, String fileName, String base64Data) {
    base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
    ContentVersion cv = new ContentVersion();
    cv.Title = fileName;
@@ -1497,19 +1295,13 @@
  // 保存附件
  @AuraEnabled
  public static ResponseBodyLWC saveAttachment(
    String attachmentRecoedsLwc,
    String invoiceId
  ) {
    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
    );
        attachmentRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize(attachmentRecoedsLwc, List<InvoiceOrderInfo>.class);
    System.debug('attachmentRecoeds = ' + attachmentRecoeds);
    try {
      Consumable_accessories_invoice__c attachmentdetails = new Consumable_accessories_invoice__c();
@@ -1525,12 +1317,7 @@
        }
      }
    } catch (Exception e) {
      return new ResponseBodyLWC(
        'Error',
        500,
        e.getMessage() + e.getLineNumber(),
        ''
      );
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
    }
    res.status = 'Success';
    res.code = 200;
@@ -1559,10 +1346,7 @@
    HospitalInfo = HospitalInfoLwc;
    SecondDealer = SecondDealerLwc;
    errorMsg = '';
    invoiceOrderRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize(
      invoiceOrderRecoedsLwc,
      List<InvoiceOrderInfo>.class
    );
        invoiceOrderRecoeds = (List<InvoiceOrderInfo>) JSON.deserialize(invoiceOrderRecoedsLwc, List<InvoiceOrderInfo>.class);
    invoiceId = invoiceIdLwc;
    accountid = accountidLwc;
    agencyProType = agencyProTypeLwc;
@@ -1617,10 +1401,7 @@
      soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\'';
    }
    if (coc.Order_ForDealerText__c != null) {
      soql +=
        ' AND ShipmentAccount__c = \'' +
        coc.Order_ForDealerText__c +
        '\'';
            soql += ' AND ShipmentAccount__c = \'' + coc.Order_ForDealerText__c + '\'';
    }
    soql += ' AND InvoiceNotPro_total_amount__c > 0';
    soql += ' AND Onchange_order__c = false limit 1000';
@@ -1643,10 +1424,7 @@
      soql += ' AND Order_ForDealer__c = \'' + SecondDealer + '\'';
    }
    if (coc.Order_ForDealerText__c != null) {
      soql +=
        ' AND ShipmentAccount__c = \'' +
        coc.Order_ForDealerText__c +
        '\'';
            soql += ' AND ShipmentAccount__c = \'' + coc.Order_ForDealerText__c + '\'';
    }
    soql += ' AND InvoiceNotPro_total_amount__c > 0';
    soql += ' AND Onchange_order__c = false limit 1000';
@@ -1655,10 +1433,7 @@
  // 删除按钮
  @AuraEnabled
  public static ResponseBodyLWC deleteButton(
    String invoiceIdLwc,
    Consumable_order__c cocLwc
  ) {
    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>();
@@ -1685,12 +1460,7 @@
    } catch (Exception e) {
      // ApexPages.addMessages(e);
      // return null;
      return new ResponseBodyLWC(
        'Error',
        500,
        e.getMessage() + ' ' + e.getLineNumber(),
        ''
      );
            return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), '');
    }
  }
@@ -1740,99 +1510,61 @@
      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
        )
      ) {
            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
                        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 == '个'
                    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
                                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
              )
                        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;
                    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
              )
                        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
                        outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c
          )
          .Invoice_Unitprice__c;
        System.debug('====>procount' + invoiceUpdte1.Invoiced_Procount__c);
        System.debug('===>RMB' + outOrderdet1List[i].Delivery_List_RMB__c);
        invoiceUpdte1.InvoicedProCost_RMB__c =
          invoiceUpdte1.Invoiced_Procount__c *
          outOrderdet1List[i].Delivery_List_RMB__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 == '个'
                    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
                                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
              )
                        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
            )
                    invoicedProcount = outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)
            .Invoiced_Count__c;
        }
        System.debug(
          '发票数量===>' + outOrderdet1List[i].InvoiceProNot_count__c
        );
                System.debug('发票数量===>' + outOrderdet1List[i].InvoiceProNot_count__c);
        System.debug('还没发票数量===>' + invoicedProcount);
        if (outOrderdet1List[i].InvoiceProNot_count__c < invoicedProcount) {
@@ -1870,13 +1602,7 @@
      }
      //发票状态更新
      cocinfo = [
        SELECT
          Id,
          Name,
          Invoice_status__c,
          Dealer_Info__c,
          Order_ForHospital__c,
          SummonsForDirction__c
                SELECT Id, Name, Invoice_status__c, Dealer_Info__c, Order_ForHospital__c, SummonsForDirction__c
        FROM Consumable_order__c
        WHERE Id = :invoiceId
      ];
@@ -1891,12 +1617,7 @@
      Database.rollback(sp);
      // ApexPages.addMessages(ex);
      // return null;
      return new ResponseBodyLWC(
        'Error',
        500,
        ex.getMessage() + ' ' + ex.getLineNumber(),
        ''
      );
            return new ResponseBodyLWC('Error', 500, ex.getMessage() + ' ' + ex.getLineNumber(), '');
    }
    res.status = 'Success';
    res.code = 200;
force-app/main/default/classes/LexConInvoiceViewControllerTest.cls
@@ -1,5 +1,6 @@
@isTest
private class LexConInvoiceViewControllerTest { //新建发票 以及编辑发票 invoiceId<>null
private class LexConInvoiceViewControllerTest
{     //新建发票 以及编辑发票 invoiceId<>null
  public static user myUser_test;
  public static Account myAccount1;
  public static Account hosp1;
@@ -8,157 +9,64 @@
  public static Account agency2;
  @testSetup
  static void setupTestData() {
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    System.runAs(thisUser) {
      // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证'];
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      List<RecordType> rectHos = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
      ];
        List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
      if (rectHos.size() == 0) {
        return;
      }
      //二级经销商SecondDealer
      agency1 = new Account(
        name = 'Testhosp001',
        Dealer_discount__c = 10,
        RecordTypeId = rectCo[0].Id
      );
      agency2 = new Account(
        name = 'Testhosp002',
        Dealer_discount__c = 10,
        RecordTypeId = rectCo[0].Id
      );
        agency1 = new Account(name='Testhosp001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id);
        agency2 = new Account(name='Testhosp002',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id);
      //经销商
      myAccount1 = new Account(
        name = 'Testaccount002',
        Dealer_discount__c = 20,
        RecordTypeId = rectCo[0].Id
      );
        myAccount1 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id);
      insert agency1;
      insert agency2;
      insert myAccount1;
      //客户名HospitalInfo
      hosp1 = new Account(
        name = 'Testhosp001',
        Dealer_discount__c = 10,
        RecordTypeId = rectHos[0].Id
      );
      Account hosp2 = new Account(
        name = 'Testhosp002',
        Dealer_discount__c = 10,
        RecordTypeId = rectHos[0].Id
      );
        hosp1 = new Account(name='Testhosp001',Dealer_discount__c =10,RecordTypeId = rectHos[0].Id);
        Account hosp2 = new Account(name='Testhosp002',Dealer_discount__c =10,RecordTypeId = rectHos[0].Id);
      insert hosp1;
      Dealer_elationship__c dealerelationship = new Dealer_elationship__c(
        Dealer_principal__c = myAccount1.id,
        Dealer_subordinate__c = agency1.id
      );
       Dealer_elationship__c dealerelationship = new Dealer_elationship__c(Dealer_principal__c = myAccount1.id,Dealer_subordinate__c = agency1.id);
      insert dealerelationship;
      Dealer_elationship__c dealerelationship1 = new Dealer_elationship__c(
        Dealer_principal__c = myAccount1.id,
        Dealer_subordinate__c = agency2.id
      );
        Dealer_elationship__c dealerelationship1 = new Dealer_elationship__c(Dealer_principal__c = myAccount1.id,Dealer_subordinate__c = agency2.id);
      insert dealerelationship1;
      Agency_Hospital_Link__c agencyHospitalLink1 = new Agency_Hospital_Link__c(
        Hospital__c = hosp1.id,
        Agency__c = myAccount1.id
      );
        Agency_Hospital_Link__c agencyHospitalLink1 = new Agency_Hospital_Link__c(Hospital__c = hosp1.id,Agency__c = myAccount1.id);
      insert agencyHospitalLink1;
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount1.id
      );
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
      insert core;
      MyUser_Test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        Work_Location__c = '重庆'
      );
        MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c ='重庆');
      insert MyUser_Test;
    }
  }
  static testMethod void conInvoiceViewTestedit_1() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
    System.runAs(curUser) {
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -172,11 +80,7 @@
      //invoiceorder.Order_ProType__c = 'ET';
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      //出库单
      Consumable_order__c testList1 = new Consumable_order__c(
@@ -186,18 +90,12 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Dealer_info__c=acc.Id);
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
            SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
            Order_status__c='已提交',Order_type__c='传票',
            Dealer_info__c=acc.Id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList1.Deliver_date__c = Date.today();
@@ -205,11 +103,7 @@
      insert testList1;
      insert testList2;
      System.Test.startTest();
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      //出库单1明细1
@@ -237,59 +131,24 @@
      orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
      orderdet3.Consumable_count__c = 1;
      orderdet3.Consumable_product__c = pro1.Id;
      insert new List<Consumable_orderdetails__c>{
        orderdet1,
        orderdet2,
        orderdet3
      };
            insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3};
      LexConInvoiceViewController conTest = new LexConInvoiceViewController();
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.saveAttachment(
        JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),
        invoiceorder.Id
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.saveAttachment(JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),invoiceorder.Id);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
      LexConInvoiceViewController.deleteButton(testList1.Id, testList1);
      LexConInvoiceViewController.deleteButton('234567', testList1);
      // LexConInvoiceViewController.saveFile(invoiceorder.Id,'Test','TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsMjAwMCznm5IsMjAsMjAyMy82Lzgs5Lii5aSx5Y6f5ZugDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSwzMDAwLOebkiwyMCwyMDIzLzYvOCzkuKLlpLHljp%2Flm6ANCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOebtOaOpemUgOWUrue7meWMu%2BmZoiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiwxLDQwMDAs55uSLDIwLDIwMjMvNi84LOS4ouWkseWOn%2BWboA0K');
@@ -297,6 +156,7 @@
        LexConInvoiceViewController.saveFile(invoiceorder.Id, 'Test', '');
      } catch (Exception e) {
        system.debug('Test');
      }
      LexConInvoiceViewController.outbound = testList2;
      LexConInvoiceViewController.getInvoiceName();
@@ -306,19 +166,11 @@
      Map<String, String> deleteMap = new Map<String, String>();
      LexConInvoiceViewController.deleteOutboundorder(deleteMap, '');
      // LexConInvoiceViewController.invoiceOrderRecoedsCount
      LexConInvoiceViewController.orderby = new List<String>{
        'Outbound_Date__c',
        'Name',
        'ShipmentAccount__c'
      };
            LexConInvoiceViewController.orderby = new List<String>{ 'Outbound_Date__c', 'Name', 'ShipmentAccount__c' };
      LexConInvoiceViewController.sortKey = 'test';
      LexConInvoiceViewController.preSortKey = 'test';
      LexConInvoiceViewController.sortOrderAsc = false;
      LexConInvoiceViewController.sortOrder = new List<String>{
        'Outbound_Date__c',
        'Name',
        'ShipmentAccount__c'
      };
            LexConInvoiceViewController.sortOrder = new List<String>{ 'Outbound_Date__c', 'Name', 'ShipmentAccount__c' };
      List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>();
      List<String> chukudanID = new List<String>();
      chukudanID.add(testList2.Id);
@@ -329,34 +181,24 @@
      // LexConInvoiceViewController.outOrderchange(insertDetMap);
      LexConInvoiceViewController.getdefaultMapinfo(chukudanID);
      System.Test.stopTest();
    }
  }
  //新建发票 invoiceId=null
  static testMethod void conInvoiceViewTestedit_2() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -370,11 +212,7 @@
      //invoiceorder.Order_ProType__c = 'ET';
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      Consumable_order__c testList1 = new Consumable_order__c(
        Name = 'Test1',
@@ -383,18 +221,12 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
                Dealer_info__c=acc.Id);
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
            SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
            Order_status__c='已提交',Order_type__c='传票',
            Dealer_info__c=acc.Id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList1.Deliver_date__c = Date.today();
@@ -402,109 +234,48 @@
      insert testList1;
      insert testList2;
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      System.Test.startTest();
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController conTest = new LexConInvoiceViewController();
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
      // LexConInvoiceViewController.HospitalInfo = hosp1.id;
      System.Test.stopTest();
    }
  }
  //新建发票 invoiceId=null error check
  static testMethod void conInvoiceViewTestedit_3() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      insert new List<Product2__c>{ pro1 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            insert new Product2__c[] {pro1};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -518,11 +289,7 @@
      //invoiceorder.Order_ProType__c = 'ET';
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      Consumable_order__c testList1 = new Consumable_order__c(
        Name = 'Test1',
@@ -531,18 +298,12 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
                Dealer_info__c=acc.Id);
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='已提交',Order_type__c='传票',
                Dealer_info__c=acc.Id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList1.Deliver_date__c = Date.today();
@@ -550,18 +311,10 @@
      insert testList1;
      insert testList2;
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      PageReference page = new PageReference(
        '/apex/ConInvoiceView?invoiceId=' +
          invoiceorder.Id +
          '&KeyWords=Redirect'
      );
            PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&KeyWords=Redirect');
      page.setRedirect(true);
      System.Test.setCurrentPage(page);
      System.Test.startTest();
@@ -570,45 +323,18 @@
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
      // LexConInvoiceViewController.init();
@@ -618,63 +344,28 @@
      System.debug('===>hosp1.id' + hosp1.id);
      LexConInvoiceViewController.invoiceId = null;
      System.Test.stopTest();
    }
  }
  //新建发票 以及编辑发票invoiceId== NULL and deliveryId== NULL
  static testMethod void conInvoiceViewTestinit() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
    System.runAs(curUser) {
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -688,33 +379,19 @@
      //invoiceorder.Order_ProType__c = 'ET';
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      //出库单
      //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
      //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='已提交',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
      Consumable_order__c testList1 = new Consumable_order__c(
        Name = 'Test1',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='草案中',Order_type__c='传票',
                Dealer_info__c=acc.Id);
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='已提交',Order_type__c='传票',
                Dealer_info__c=acc.Id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList1.Deliver_date__c = Date.today();
@@ -723,17 +400,9 @@
      insert testList2;
      //insert new Consumable_order__c[]{testList1,testList2};
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable2',
        Outboundorder_Code_link__c = testList2.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable2;
      //出库单1明细1
      Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
@@ -771,21 +440,14 @@
      orderdet4.Consumable_count__c = 1;
      orderdet4.Shipment_Count__c = 1;
      orderdet4.Consumable_product__c = pro2.Id;
      insert new List<Consumable_orderdetails__c>{
        orderdet1,
        orderdet2,
        orderdet3,
        orderdet4
      };
            insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4};
      //附件
      Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c();
      caic.Attachment_ID__c = acc.Id;
      caic.Accessories_type__c = '发票和明细';
      caic.Invoice_code__c = invoiceorder.id;
      insert caic;
      PageReference page = new PageReference(
        '/apex/ConInvoiceView?KeyWords=Redirect'
      );
            PageReference page = new PageReference('/apex/ConInvoiceView?KeyWords=Redirect');
      page.setRedirect(true);
      System.Test.setCurrentPage(page);
@@ -795,45 +457,16 @@
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
      System.Test.stopTest();
    }
  }
@@ -841,56 +474,19 @@
  //新建发票 以及编辑发票invoiceId== NULL and deliveryId<> NULL
  static testMethod void conInvoiceViewTestinit_1() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -903,33 +499,19 @@
      invoiceorder.Dealer_Info__c = acc.Id;
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      //出库单
      //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
      //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='已提交',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
      Consumable_order__c testList1 = new Consumable_order__c(
        Name = 'Test1',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='草案中',Order_type__c='传票',
                Dealer_info__c=acc.Id);
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='已提交',Order_type__c='传票',
                Dealer_info__c=acc.Id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList1.Deliver_date__c = Date.today();
@@ -938,17 +520,9 @@
      insert testList2;
      //insert new Consumable_order__c[]{testList1,testList2};
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable2',
        Outboundorder_Code_link__c = testList2.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable2;
      //出库单1明细1
      Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
@@ -986,131 +560,56 @@
      orderdet4.Consumable_count__c = 1;
      orderdet4.Shipment_Count__c = 1;
      orderdet4.Consumable_product__c = pro2.Id;
      insert new List<Consumable_orderdetails__c>{
        orderdet1,
        orderdet2,
        orderdet3,
        orderdet4
      };
            insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4};
      //附件
      Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c();
      caic.Attachment_ID__c = acc.Id;
      caic.Accessories_type__c = '发票和明细';
      caic.Invoice_code__c = invoiceorder.id;
      insert caic;
      PageReference page = new PageReference(
        '/apex/ConInvoiceView?invoiceId=' + invoiceorder.id
      );
            PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.id);
      page.setRedirect(true);
      System.Test.setCurrentPage(page);
      // contest.deliveryId=testList1.id;
      System.Test.startTest();
      LexConInvoiceViewController.init(
        invoiceorder.id,
        'Redirect',
        testList2.Id
      );
            LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
      LexConInvoiceViewController conTest = new LexConInvoiceViewController();
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
      System.Test.stopTest();
    }
  }
  //新建发票 以及编辑发票invoiceId<> NULL
  static testMethod void conInvoiceViewTestinit_2() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -1123,33 +622,19 @@
      invoiceorder.Dealer_Info__c = acc.Id;
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      //出库单
      //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
      //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='已提交',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
      Consumable_order__c testList1 = new Consumable_order__c(
        Name = 'Test1',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='草案中',Order_type__c='传票',
                Dealer_info__c=acc.Id);
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='已提交',Order_type__c='传票',
                Dealer_info__c=acc.Id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList1.Deliver_date__c = Date.today();
@@ -1158,17 +643,9 @@
      insert testList2;
      //insert new Consumable_order__c[]{testList1,testList2};
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable2',
        Outboundorder_Code_link__c = testList2.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable2;
      //出库单1明细1
      Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
@@ -1206,12 +683,7 @@
      orderdet4.Consumable_count__c = 1;
      orderdet4.Shipment_Count__c = 1;
      orderdet4.Consumable_product__c = pro2.Id;
      insert new List<Consumable_orderdetails__c>{
        orderdet1,
        orderdet2,
        orderdet3,
        orderdet4
      };
            insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4};
      //附件
      Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c();
      caic.Attachment_ID__c = acc.Id;
@@ -1226,54 +698,24 @@
      // contest.deliveryId=testList1.id;
      // conTest.invoiceId =invoiceorder.Id;
      System.Test.startTest();
      LexConInvoiceViewController.init(
        invoiceorder.id,
        'Redirect',
        testList2.Id
      );
            LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
      LexConInvoiceViewController conTest = new LexConInvoiceViewController();
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
      // conTest.init();
@@ -1285,60 +727,24 @@
      // conTest.SortLimited();
      System.Test.stopTest();
    }
  }
  static testMethod void conInvoiceViewTestoutOrderchange() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -1351,11 +757,7 @@
      invoiceorder.Dealer_Info__c = acc.Id;
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      //出库单
      Consumable_order__c testList1 = new Consumable_order__c(
@@ -1365,18 +767,12 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
                Dealer_info__c=acc.Id);
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='已提交',Order_type__c='传票',
                Dealer_info__c=acc.Id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList1.Deliver_date__c = Date.today();
@@ -1385,11 +781,7 @@
      insert testList1;
      insert testList2;
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      //出库单1明细1
@@ -1409,112 +801,43 @@
      orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
      orderdet2.Consumable_count__c = 1;
      orderdet2.Consumable_product__c = pro1.Id;
      insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 };
            insert new Consumable_orderdetails__c[]{orderdet1,orderdet2};
      LexConInvoiceViewController.init(
        invoiceorder.id,
        'Redirect',
        testList2.Id
      );
            LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
      LexConInvoiceViewController conTest = new LexConInvoiceViewController();
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
      System.Test.stopTest();
    }
  }
  static testMethod void conInvoiceViewTestgetdefaultMapinfo() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -1527,11 +850,7 @@
      invoiceorder.Dealer_Info__c = acc.Id;
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      //出库单
      Consumable_order__c testList1 = new Consumable_order__c(
@@ -1541,18 +860,12 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
                Dealer_info__c=acc.Id);
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='已提交',Order_type__c='传票',
                Dealer_info__c=acc.Id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList1.Deliver_date__c = Date.today();
@@ -1561,11 +874,7 @@
      insert testList1;
      insert testList2;
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      //出库单1明细1
@@ -1585,64 +894,28 @@
      orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
      orderdet2.Consumable_count__c = 1;
      orderdet2.Consumable_product__c = pro1.Id;
      insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 };
            insert new Consumable_orderdetails__c[]{orderdet1,orderdet2};
      PageReference page = new PageReference(
        '/apex/ConInvoiceView?invoiceId=' +
          invoiceorder.Id +
          '&KeyWords=Redirect'
      );
            PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&KeyWords=Redirect');
      page.setRedirect(true);
      System.Test.setCurrentPage(page);
      LexConInvoiceViewController.init(
        invoiceorder.id,
        'Redirect',
        testList2.Id
      );
            LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
      LexConInvoiceViewController conTest = new LexConInvoiceViewController();
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
      System.Test.stopTest();
    }
  }
@@ -1650,56 +923,19 @@
  //从出库单直接开票
  static testMethod void conInvoiceViewRedirectTest() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
    Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
    Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
    Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
    system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -1712,33 +948,19 @@
      invoiceorder.Dealer_Info__c = acc.Id;
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      //出库单
      //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
      //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='已提交',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
      Consumable_order__c testList1 = new Consumable_order__c(
        Name = 'Test1',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='草案中',Order_type__c='传票',
                Dealer_info__c=acc.Id);
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='已提交',Order_type__c='传票',
                Dealer_info__c=acc.Id);
      testList1.Order_date__c = Date.today().addDays(2);
      testList2.Order_date__c = Date.today().addDays(2);
      testList1.Deliver_date__c = Date.today();
@@ -1747,17 +969,9 @@
      insert testList2;
      //insert new Consumable_order__c[]{testList1,testList2};
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable2',
        Outboundorder_Code_link__c = testList2.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable2;
      //出库单1明细1
      Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
@@ -1795,136 +1009,57 @@
      orderdet4.Consumable_count__c = 1;
      orderdet4.Shipment_Count__c = 1;
      orderdet4.Consumable_product__c = pro2.Id;
      insert new List<Consumable_orderdetails__c>{
        orderdet1,
        orderdet2,
        orderdet3,
        orderdet4
      };
            insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4};
      //附件
      Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c();
      caic.Attachment_ID__c = acc.Id;
      caic.Accessories_type__c = '发票和明细';
      caic.Invoice_code__c = invoiceorder.id;
      insert caic;
      PageReference page = new PageReference(
        '/apex/ConInvoiceView?deliveryId=' + testList1.Id + '&KeyWords=Redirect'
      );
            PageReference page = new PageReference('/apex/ConInvoiceView?deliveryId='+testList1.Id+'&KeyWords=Redirect');
      page.setRedirect(true);
      System.Test.setCurrentPage(page);
      System.Test.startTest();
      LexConInvoiceViewController.init(
        invoiceorder.id,
        'Redirect',
        testList2.Id
      );
            LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
      LexConInvoiceViewController conTest = new LexConInvoiceViewController();
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
      LexConInvoiceViewController.saveAttachment(
        JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),
        invoiceorder.Id
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
            LexConInvoiceViewController.saveAttachment(JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),invoiceorder.Id);
      // LexConInvoiceViewController.saveAttachment(JSON.serialize(caic),invoiceorder.Id);
      System.Test.stopTest();
    }
  }
  //提交
  static testMethod void conInvoiceViewTestapproval() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false,
        Packing_list_manual__c = 5
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false,Packing_list_manual__c = 5);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -1937,35 +1072,26 @@
      invoiceorder.Dealer_Info__c = acc.Id;
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      //出库单
      //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
      //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='已提交',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
      Consumable_order__c testList1 = new Consumable_order__c(
        Name = 'Test1',
            Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        RecordTypeId = System.Label.RT_ConOrder_Sale,
        Dealer_info__c = acc.Id
      );
                Dealer_info__c=acc.Id);
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
                Name='Test2',Summons_Sale_Status__c='出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
                Order_status__c='已提交',Order_type__c='传票',
        RecordTypeId = System.Label.RT_ConOrder_Sale,
        Dealer_info__c = acc.Id
      );
                Dealer_info__c=acc.Id);
      testList1.Order_date__c = Date.today().addDays(2);
      testList2.Order_date__c = Date.today().addDays(2);
      testList1.Deliver_date__c = Date.today();
@@ -1974,17 +1100,10 @@
      insert testList2;
      //insert new Consumable_order__c[]{testList1,testList2};
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable2',
        Outboundorder_Code_link__c = testList2.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable2;
      //出库单1明细1
      Consumable_Orderdetails__c orderdet1 = new Consumable_Orderdetails__c();
@@ -2001,6 +1120,9 @@
      // orderdet1.Shipment_Count__c = 50;
      // orderdet1.Invoiced_Procount__c = 5;
      // orderdet1.RrturnPro_count__c = 5;
      Consumable_Orderdetails__c orderdet12 = new Consumable_Orderdetails__c();
      orderdet12.Name = 'Test1_001001';
@@ -2038,13 +1160,7 @@
      orderdet4.Consumable_count__c = 1;
      orderdet4.Shipment_Count__c = 1;
      orderdet4.Consumable_product__c = pro2.Id;
      insert new List<Consumable_Orderdetails__c>{
        orderdet1,
        orderdet2,
        orderdet3,
        orderdet4,
        orderdet12
      };
            insert new Consumable_Orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4,orderdet12};
      List<String> conorList = new List<String>();
      conorList.add(testList1.Id);
@@ -2107,18 +1223,12 @@
      Map<String, Consumable_Orderdetails__c> tempCocMap1 = new Map<String, Consumable_Orderdetails__c>();
      for (Consumable_Orderdetails__c cocTemp : outOrderdet1List) {
        if (cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c != null) {
          tempCocMap.put(
            cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c,
            cocTemp
          );
                    tempCocMap.put(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, cocTemp);
        }
      }
      for (Consumable_Orderdetails__c cocTemp : outOrderdet1List1) {
        if (cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c != null) {
          tempCocMap1.put(
            cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c,
            cocTemp
          );
                    tempCocMap1.put(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, cocTemp);
        }
      }
@@ -2130,65 +1240,25 @@
      caic.Invoice_code__c = invoiceorder.id;
      insert caic;
      System.Test.startTest();
      LexConInvoiceViewController.init(
        invoiceorder.id,
        'Redirect',
        testList2.Id
      );
            LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
      LexConInvoiceViewController conTest = new LexConInvoiceViewController();
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
      LexConInvoiceViewController.approval(
        conorList,
        tempCocMap,
        invoiceorder.id
      );
      LexConInvoiceViewController.approval(
        conorList,
        tempCocMap1,
        invoiceorder.id
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
            LexConInvoiceViewController.approval(conorList,tempCocMap,invoiceorder.id);
            LexConInvoiceViewController.approval(conorList,tempCocMap1,invoiceorder.id);
      System.Test.stopTest();
    }
  }
@@ -2196,58 +1266,22 @@
  //提交发票
  static testMethod void conInvoice_approval() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Oly_TriggerHandler.bypass('ConsumableAssetHander');
    Oly_TriggerHandler.bypass('Oly_TriggerHandler');
    System.runAs(curUser) {
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //出库单1
      Consumable_order__c testList1 = new Consumable_order__c(
@@ -2259,8 +1293,7 @@
        Order_status__c = '草案中',
        Order_type__c = '传票',
        // Order_ForHospital__c=hosp1.Id,
        Dealer_Info__c = acc.Id
      );
            Dealer_Info__c = acc.Id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList1.Deliver_date__c = Date.today();
      insert testList1;
@@ -2312,11 +1345,7 @@
      invoicedet1.Invoicedet1_OD_link__c = testList1.Id;
      insert invoicedet1;
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      List<Consumable_Orderdetails__c> outOrderdet1List = [
        SELECT
@@ -2345,75 +1374,42 @@
      Map<String, Consumable_Orderdetails__c> tempCocMap1 = new Map<String, Consumable_Orderdetails__c>();
      for (Consumable_Orderdetails__c cocTemp : outOrderdet1List) {
        if (cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c != null) {
          tempCocMap1.put(
            cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c,
            cocTemp
          );
                    tempCocMap1.put(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, cocTemp);
        }
      }
      System.Test.startTest();
      LexConInvoiceViewController.init(
        invoiceorder.id,
        'Redirect',
        orderdet1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.id,'Redirect',orderdet1.Id);
      LexConInvoiceViewController conTest = new LexConInvoiceViewController();
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = acc.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        acc.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        acc.id,
        invoiceOrderRecoeds
      );
      LexConInvoiceViewController.approval(
        conorList,
        tempCocMap1,
        invoiceorder.id
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,acc.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,acc.id,invoiceOrderRecoeds);
            LexConInvoiceViewController.approval(conorList,tempCocMap1,invoiceorder.id);
      LexConInvoiceViewController.approval(conorList, tempCocMap1, '2345678');
      // conTest.init();
      // System.assertEquals(1, conTest.invoiceOrderRecoeds.size());
      // conTest.approval();
      System.Test.stopTest();
    }
  }
@@ -2421,56 +1417,19 @@
  //新建发票 以及编辑发票 invoiceId<>null
  static testMethod void rentestreopen() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -2484,11 +1443,7 @@
      //invoiceorder.Order_ProType__c = 'ET';
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      //出库单
      Consumable_order__c testList1 = new Consumable_order__c(
@@ -2498,28 +1453,17 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
                Dealer_info__c=acc.Id);
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='已提交',Order_type__c='传票',
                Dealer_info__c=acc.Id);
      Consumable_order__c testList3 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList3 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='已提交',Order_type__c='传票',
                Dealer_info__c=acc.Id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList3.Order_date__c = Date.today().addDays(2);
@@ -2530,21 +1474,9 @@
      insert testList2;
      insert testList3;
      System.Test.startTest();
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
      Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList2.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
      Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList3.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
            Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
            Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList3.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      insert order_LinkTable2;
      insert order_LinkTable3;
@@ -2566,7 +1498,7 @@
      orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
      orderdet2.Consumable_count__c = 1;
      orderdet2.Consumable_product__c = pro1.Id;
      insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 };
            insert new Consumable_orderdetails__c[]{orderdet1,orderdet2};
      //出库单2明细1
      Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
@@ -2588,62 +1520,28 @@
      orderdet4.Consumable_product__c = pro1.Id;
      insert orderdet4;
      PageReference page = new PageReference(
        '/apex/ConInvoiceView?invoiceId=' +
          invoiceorder.Id +
          '&reopen=isreopen&KeyWords=Redirect'
      );
            PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&reopen=isreopen&KeyWords=Redirect');
      page.setRedirect(true);
      System.Test.setCurrentPage(page);
      LexConInvoiceViewController.init(
        invoiceorder.id,
        'Redirect',
        testList2.Id
      );
            LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
      LexConInvoiceViewController conTest = new LexConInvoiceViewController();
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
      // ConInvoiceViewController conTest = new ConInvoiceViewController();
@@ -2659,6 +1557,7 @@
      // conTest.coc.Order_ForHospital__c = hosp1.id;
      // conTest.coc.Invoice_Date__c = Date.today();
      // //conTest.SortLimited();
      // //conTest.InvoiceorderSearch();
      // System.assertEquals(3, conTest.invoiceOrderRecoeds.size());
@@ -2669,6 +1568,7 @@
      // conTest.invoiceOrderRecoeds[1].esd.Order_ForCustomerText__c = 'AA';
      // conTest.invoiceOrderRecoeds[1].esd.Order_ForHospital__c =hosp1.Id;
      // conTest.invoiceOrderRecoeds[1].esd.Order_ForDealer__c = agency1.id;
      // conTest.invoiceOrderRecoeds[2].esd.Order_ForCustomerText__c = 'AA';
      // conTest.invoiceOrderRecoeds[2].esd.Order_ForHospital__c =hosp1.Id;
@@ -2687,6 +1587,7 @@
      // conTest.getExistOutbound();
      // conTest.getInvoiceName();
      System.Test.stopTest();
    }
  }
@@ -2695,56 +1596,19 @@
  //新建发票 以及编辑发票 invoiceId<>null
  static testMethod void rentestreopen001() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -2758,11 +1622,7 @@
      //invoiceorder.Order_ProType__c = 'ET';
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      //出库单
      Consumable_order__c testList1 = new Consumable_order__c(
@@ -2772,28 +1632,17 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
                Dealer_info__c=acc.Id);
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='已提交',Order_type__c='传票',
                Dealer_info__c=acc.Id);
      Consumable_order__c testList3 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Consumable_order__c testList3 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
                SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
                Order_status__c='已提交',Order_type__c='传票',
                Dealer_info__c=acc.Id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList3.Order_date__c = Date.today().addDays(2);
@@ -2804,21 +1653,9 @@
      insert testList2;
      insert testList3;
      System.Test.startTest();
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
      Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList2.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
      Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList3.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
            Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id);
            Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList3.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      insert order_LinkTable2;
      insert order_LinkTable3;
@@ -2840,7 +1677,7 @@
      orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
      orderdet2.Consumable_count__c = 1;
      orderdet2.Consumable_product__c = pro1.Id;
      insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 };
            insert new Consumable_orderdetails__c[]{orderdet1,orderdet2};
      //出库单2明细1
      Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
@@ -2862,122 +1699,49 @@
      orderdet4.Consumable_product__c = pro1.Id;
      insert orderdet4;
      PageReference page = new PageReference(
        '/apex/ConInvoiceView?invoiceId=' +
          invoiceorder.Id +
          '&reopen=isreopen&KeyWords=Redirect'
      );
            PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&reopen=isreopen&KeyWords=Redirect');
      page.setRedirect(true);
      System.Test.setCurrentPage(page);
      LexConInvoiceViewController.init(
        invoiceorder.id,
        'Redirect',
        testList2.Id
      );
            LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id);
      LexConInvoiceViewController conTest = new LexConInvoiceViewController();
      LexConInvoiceViewController.HospitalInfo = hosp1.id;
      LexConInvoiceViewController.SecondDealer = agency1.id;
      LexConInvoiceViewController.invoiceId = invoiceorder.Id;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id);
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        '济宁任城儒济医院',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.InvoiceorderSearch(
        testList1,
        invoiceorder.Id,
        acc.Id,
        '重庆',
        'ET',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds);
      System.Test.stopTest();
    }
  }
  //新建发票 以及编辑发票 invoiceId<>null
  static testMethod void allinit() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //准备数据
      // Consumable_order__c  Id = deliveryId  //出库单
      // Consumable_order__c
      // WHERE Id = :invoiceId AND Order_type__c = '发票'
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -2991,11 +1755,7 @@
      //invoiceorder.Order_ProType__c = 'ET';
      insert invoiceorder;
      invoiceorder = [
        SELECT id, Name
        FROM Consumable_order__c
        WHERE id = :invoiceorder.id
      ];
            invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      //出库单
      Consumable_order__c testList1 = new Consumable_order__c(
@@ -3005,19 +1765,12 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Dealer_info__c=acc.Id);
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id,
        Order_ForCustomerText__c = ''
      );
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',
            SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',
            Order_status__c='已提交',Order_type__c='传票',
            Dealer_info__c=acc.Id,Order_ForCustomerText__c = '');
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList1.Deliver_date__c = Date.today();
@@ -3036,11 +1789,7 @@
      insert testList2;
      insert testList3;
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder.Id
      );
            Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder.Id);
      insert order_LinkTable1;
      //出库单1明细1
@@ -3068,11 +1817,7 @@
      orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
      orderdet3.Consumable_count__c = 1;
      orderdet3.Consumable_product__c = pro1.Id;
      insert new List<Consumable_orderdetails__c>{
        orderdet1,
        orderdet2,
        orderdet3
      };
            insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3};
      //发票附件
      Consumable_accessories_invoice__c cai = new Consumable_accessories_invoice__c();
@@ -3085,75 +1830,18 @@
      LexConInvoiceViewController.init('', '', testList1.Id);
      LexConInvoiceViewController.init(invoiceorder.Id, '', '');
      LexConInvoiceViewController.init('', '', '');
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList1.Id
      );
            LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.init('', 'Redirect', '');
      LexConInvoiceViewController.init('', 'Redirect', testList1.Id);
      System.debug(
        'order==>' + LexConInvoiceViewController.invoiceOrderRecoeds
      );
            System.debug('order==>'+LexConInvoiceViewController.invoiceOrderRecoeds);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
      LexConInvoiceViewController.save(
        testList1,
        'Testhosp001',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.save(
        testList2,
        'Testhosp001',
        '',
        '',
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.save(
        testList3,
        'Testhosp001',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.save(
        testList2,
        'Testhosp001',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
            String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
            String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
            LexConInvoiceViewController.save(testList1,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.save(testList2,'Testhosp001','','',invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.save(testList3,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
            LexConInvoiceViewController.save(testList2,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
      //保存
      // LexConInvoiceViewController.save(testList1,'测试医院',hosp1.Id,agency1.Id,'',testList1.Id,invoiceorder.Id,myAccount1.Id,'ET');
@@ -3162,26 +1850,12 @@
  }
  static testMethod void allsave() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
        Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
        Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
        Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -3195,6 +1869,7 @@
      //invoiceorder.Order_ProType__c = 'ET';
      insert invoiceorder;
      Consumable_order__c testList1 = new Consumable_order__c(
        Name = 'Test1',
        Summons_Sale_Status__c = '出货',
@@ -3203,69 +1878,23 @@
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id,
        Invoice_Date__c = Date.today()
      );
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
        Invoice_Date__c = Date.today());
        String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
        String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
      // LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id);
      LexConInvoiceViewController.save(
        testList1,
        'Testhosp001',
        null,
        null,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.save(
        testList1,
        'Testhosp001',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.saveAttachment(
        JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),
        invoiceorder.Id
      );
        LexConInvoiceViewController.save(testList1,'Testhosp001',null,null,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
        LexConInvoiceViewController.save(testList1,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
        LexConInvoiceViewController.saveAttachment(JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),invoiceorder.Id);
    }
  }
  static testMethod void allsave1() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
    Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
    Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
    Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -3279,6 +1908,7 @@
      //invoiceorder.Order_ProType__c = 'ET';
      insert invoiceorder;
      Consumable_order__c testList1 = new Consumable_order__c(
        Name = 'Test1',
        Summons_Sale_Status__c = '出货',
@@ -3287,9 +1917,7 @@
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id,
        Invoice_Date__c = Date.today(),
        Order_ForCustomerText__c = '消化科'
      );
    Invoice_Date__c = Date.today(),Order_ForCustomerText__c = '消化科');
      insert testList1;
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test1',
@@ -3299,123 +1927,38 @@
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id,
        Invoice_Date__c = Date.today(),
        Order_ForDealerText__c = 'Test'
      );
    Invoice_Date__c = Date.today(),Order_ForDealerText__c = 'Test');
      insert testList2;
      LexConInvoiceViewController.init(
        invoiceorder.Id,
        'Redirect',
        testList2.Id
      );
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      String invoiceOrderRecoeds = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoeds
      );
    LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList2.Id);
    String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
    String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds);
      List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>();
      for (
        LexConInvoiceViewController.InvoiceOrderInfo ass : LexConInvoiceViewController.invoiceOrderRecoeds
      ) {
    for(LexConInvoiceViewController.InvoiceOrderInfo ass:LexConInvoiceViewController.invoiceOrderRecoeds){
        ass.check = true;
        test1.add(ass);
      }
      System.debug('test1==>' + test1);
      System.debug(
        'invoiceOrderRecoedschangeLwc==>' + invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.save(
        testList1,
        'Testhosp001',
        hosp1.id,
        agency1.id,
        invoiceOrderRecoeds,
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.save(
        testList1,
        'Testhosp001',
        '',
        '',
        JSON.serialize(test1),
        testList1.Id,
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.save(
        testList1,
        'Testhosp001',
        '',
        '',
        JSON.serialize(test1),
        '',
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.save(
        testList1,
        '青岛盈海医院',
        hosp1.id,
        agency1.id,
        '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]',
        '',
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.save(
        testList1,
        '青岛盈海医院',
        hosp1.id,
        agency1.id,
        '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]',
        '',
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
    System.debug('invoiceOrderRecoedschangeLwc==>'+invoiceOrderRecoedschangeLwc);
    LexConInvoiceViewController.save(testList1,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
    LexConInvoiceViewController.save(testList1,'Testhosp001','','',JSON.serialize(test1),testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
    LexConInvoiceViewController.save(testList1,'Testhosp001','','',JSON.serialize(test1),'',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
    LexConInvoiceViewController.save(testList1,'青岛盈海医院',hosp1.id,agency1.id,'[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
    LexConInvoiceViewController.save(testList1,'青岛盈海医院',hosp1.id,agency1.id,'[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
    }
  }
  static testMethod void allsave2() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
    Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
    Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
    Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice01';
@@ -3437,9 +1980,7 @@
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id,
        Invoice_Date__c = Date.today(),
        Order_ForDealerText__c = 'Test'
      );
        Invoice_Date__c = Date.today(),Order_ForDealerText__c = 'Test');
      insert testList2;
      Consumable_order__c testList1 = new Consumable_order__c(
        Name = 'Test1',
@@ -3448,81 +1989,31 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
            Dealer_info__c=acc.Id);
      insert testList1;
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
        String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
      //选择开票单
      LexConInvoiceViewController.save(
        testList2,
        '青岛盈海医院',
        '',
        agency2.id,
        '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]',
        '',
        invoiceorder.Id,
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
        LexConInvoiceViewController.save(testList2,'青岛盈海医院','',agency2.id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
    }
  }
  static testMethod void allsave3() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
    Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
    Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
    Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
    system.runAs(curUser){
    Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
    Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
    insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
    Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
    Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
    insert new Product2__c[] {pro1, pro2};
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
@@ -3544,8 +2035,7 @@
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id,
        Invoice_Date__c = Date.today()
      );
        Invoice_Date__c = Date.today());
      insert testList2;
      List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
@@ -3562,83 +2052,30 @@
      orderdet1.RrturnPro_count__c = 2;
      conList.add(orderdet1);
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      LexConInvoiceViewController.save(
        invoiceorder,
        '潍城现代门诊部',
        '0011000001g0uyhAAA',
        '',
        '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',
        '',
        '',
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
      LexConInvoiceViewController.save(
        invoiceorder,
        '潍城现代门诊部',
        '0011000001g0uyhAAA',
        agency1.Id,
        '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',
        testList2.Id,
        '',
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
    String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
    LexConInvoiceViewController.save(invoiceorder,'潍城现代门诊部','0011000001g0uyhAAA','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]','','',acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
    LexConInvoiceViewController.save(invoiceorder,'潍城现代门诊部','0011000001g0uyhAAA',agency1.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,'',acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
      List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>();
      for (
        LexConInvoiceViewController.InvoiceOrderInfo ass : LexConInvoiceViewController.invoiceOrderRecoeds
      ) {
    for(LexConInvoiceViewController.InvoiceOrderInfo ass:LexConInvoiceViewController.invoiceOrderRecoeds){
        ass.check = true;
        test1.add(ass);
      }
      System.debug('test1==>' + test1);
      LexConInvoiceViewController.save(
        invoiceorder,
        '潍城现代门诊部',
        '0011000001g0uyhAAA',
        '',
        JSON.serialize(test1),
        '',
        '',
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
    LexConInvoiceViewController.save(invoiceorder,'潍城现代门诊部','0011000001g0uyhAAA','',JSON.serialize(test1),'','',acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
    }
  }
  static testMethod void allsave4() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
    Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1];
    Account agency1 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp001'
      LIMIT 1
    ];
    Account agency2 = [
      SELECT Id
      FROM Account
      WHERE name = 'Testhosp002'
      LIMIT 1
    ];
    System.runAs(curUser) {
    Account agency1 =  [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1];
    Account agency2 =  [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1];
        system.runAs(curUser){
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = '202306164590';
@@ -3662,6 +2099,8 @@
      // invoiceorder.Order_ForHospital__c = hosp1.Id;
      insert invoiceorder1;
      // invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id];
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test1',
@@ -3671,72 +2110,34 @@
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id,
        Invoice_Date__c = Date.today()
      );
        Invoice_Date__c = Date.today());
      insert testList2;
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
        String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
      //不需要输入科室
      LexConInvoiceViewController.save(
        invoiceorder1,
        '潍城现代门诊部',
        '',
        agency1.Id,
        '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',
        testList2.Id,
        '',
        acc.Id,
        'ET',
        '',
        invoiceOrderRecoedschangeLwc
      );
         LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','',agency1.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,'',acc.Id,'ET','',invoiceOrderRecoedschangeLwc);
      //LexConInvoiceViewController.save(invoiceorder,'潍城现代门诊部','',agency2.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": false,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,invoiceorder.Id,myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc);
      //  LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','',agency2.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": false,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,invoiceorder1.Id,myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc);
    }
  }
  static testMethod void allsave5() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
    System.runAs(curUser) {
    Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
        system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
         Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
         Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
         insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
         Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
         Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
         insert new Product2__c[] {pro1, pro2};
      List<Consumable_order__c> orderList = new List<Consumable_order__c>();
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
@@ -3768,8 +2169,7 @@
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id,
        Invoice_Date__c = Date.today()
      );
        Invoice_Date__c = Date.today());
      orderList.add(testList2);
      //出库单
      Consumable_order__c testList1 = new Consumable_order__c(
@@ -3779,8 +2179,7 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
        Dealer_info__c=acc.Id);
      orderList.add(testList1);
      insert orderList;
      List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
@@ -3797,11 +2196,7 @@
      orderdet1.RrturnPro_count__c = 2;
      conList.add(orderdet1);
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = testList1.Id,
        Invoice_Code_link__c = invoiceorder1.Id
      );
        Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =invoiceorder1.Id);
      insert order_LinkTable1;
      Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c();
      upDateform.Name = 'Test1_001001';
@@ -3812,65 +2207,24 @@
      upDateform.Consumable_order__c = order_LinkTable1.Outboundorder_Code_link__c;
      conList.add(upDateform);
      insert conList;
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      LexConInvoiceViewController.save(
        invoiceorder1,
        '潍城现代门诊部',
        '0011000001k1K9ZAAU',
        '',
        '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',
        testList1.Id,
        invoiceorder1.Id,
        acc.Id,
        'ET',
        'isreopen',
        invoiceOrderRecoedschangeLwc
      );
        String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
        LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',testList1.Id,invoiceorder1.Id,acc.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc);
      // LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',testList1.Id,'',myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc);
    }
  }
  static testMethod void allsave6() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
    System.runAs(curUser) {
    Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
         Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
         Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
         insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
         Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
         Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
         insert new Product2__c[] {pro1, pro2};
      List<Consumable_order__c> orderList = new List<Consumable_order__c>();
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
@@ -3902,8 +2256,7 @@
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id,
        Invoice_Date__c = Date.today()
      );
        Invoice_Date__c = Date.today());
      orderList.add(testList2);
      //出库单
      Consumable_order__c testList1 = new Consumable_order__c(
@@ -3913,8 +2266,7 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
        Dealer_info__c=acc.Id);
      orderList.add(testList1);
      insert orderList;
      List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
@@ -3928,11 +2280,7 @@
      orderdet1.Consumable_product__c = pro1.Id;
      conList.add(orderdet1);
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = invoiceorder1.Id,
        Invoice_Code_link__c = invoiceorder1.Id
      );
        Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c =invoiceorder1.Id,Invoice_Code_link__c =invoiceorder1.Id);
      insert order_LinkTable1;
      Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c();
      upDateform.Name = 'Test1_001001';
@@ -3945,90 +2293,25 @@
      upDateform.RrturnPro_count__c = 10;
      conList.add(upDateform);
      insert conList;
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      LexConInvoiceViewController.save(
        invoiceorder1,
        '潍城现代门诊部',
        '0011000001k1K9ZAAU',
        '',
        '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',
        testList1.Id,
        invoiceorder1.Id,
        acc.Id,
        'ET',
        '',
        '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'
      );
      LexConInvoiceViewController.save(
        invoiceorder1,
        '潍城现代门诊部',
        '0011000001k1K9ZAAU',
        '',
        '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',
        '',
        invoiceorder1.Id,
        acc.Id,
        'ET',
        '',
        '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'
      );
      LexConInvoiceViewController.save(
        invoiceorder1,
        '潍城现代门诊部',
        '0011000001k1K9ZAAU',
        '',
        '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',
        '',
        invoiceorder1.Id,
        acc.Id,
        'ET',
        '',
        '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'
      );
        String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
        LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',testList1.Id,invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]');
        LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]','',invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]');
        LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]','',invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]');
    }
  }
  static testMethod void allsave7() {
    user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1];
    Account acc = [
      SELECT Id
      FROM Account
      WHERE name = 'Testaccount002'
      LIMIT 1
    ];
    System.runAs(curUser) {
    Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1];
    system.runAs(curUser){
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
         Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
         Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false);
         insert new Product2[] {prod01, prod02};
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
         Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
         Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
         insert new Product2__c[] {pro1, pro2};
      List<Consumable_order__c> orderList = new List<Consumable_order__c>();
      //发票信息
      Consumable_order__c invoiceorder = new Consumable_order__c();
@@ -4060,8 +2343,7 @@
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id,
        Invoice_Date__c = Date.today()
      );
        Invoice_Date__c = Date.today());
      orderList.add(testList2);
      //出库单
      Consumable_order__c testList1 = new Consumable_order__c(
@@ -4071,8 +2353,7 @@
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = acc.Id
      );
        Dealer_info__c=acc.Id);
      orderList.add(testList1);
      insert orderList;
      List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>();
@@ -4086,11 +2367,7 @@
      orderdet1.Consumable_product__c = pro1.Id;
      conList.add(orderdet1);
      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
        Name = 'order_LinkTable1',
        Outboundorder_Code_link__c = invoiceorder1.Id,
        Invoice_Code_link__c = invoiceorder1.Id
      );
        Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c =invoiceorder1.Id,Invoice_Code_link__c =invoiceorder1.Id);
      insert order_LinkTable1;
      Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c();
      upDateform.Name = 'Test1_001001';
@@ -4103,23 +2380,11 @@
      upDateform.RrturnPro_count__c = 10;
      conList.add(upDateform);
      insert conList;
      String invoiceOrderRecoedschangeLwc = JSON.serialize(
        LexConInvoiceViewController.invoiceOrderRecoedschange
      );
      LexConInvoiceViewController.save(
        invoiceorder1,
        '潍城现代门诊部',
        '0011000001k1K9ZAAU',
        '',
        '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"},{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]',
        '',
        invoiceorder1.Id,
        acc.Id,
        'ET',
        '',
        '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'
      );
        String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange);
        LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"},{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]');
      // LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]','',invoiceorder1.Id,myAccount1.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]');
    }
  }
}
force-app/main/default/classes/LexConInvoiceViewControllerTest.cls-meta.xml
force-app/main/default/classes/LexConInvoicedetailsController.cls
@@ -13,16 +13,11 @@
  //发票单ID
  private static String invoiceId { get; set; }
  //出库单明细1,画面显示使用
  public static List<ConsumableorderdetailsInfo> consumableorderdetails1Records {
    get;
    set;
  }
    public static List<ConsumableorderdetailsInfo> consumableorderdetails1Records { get; set; }
  //明细数量
  public static Integer invoiceOrderRecoedsCount {
    get {
      return consumableorderdetails1Records == null
        ? 0
        : consumableorderdetails1Records.size();
            return consumableorderdetails1Records == null ? 0 : consumableorderdetails1Records.size();
    }
  }
@@ -39,20 +34,10 @@
    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
    ];
        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
            SELECT Id, Name, ShipmentAccount__c, Order_ForCustomerText__c, Order_ForDealerText__c, Dealer_Info__c
      FROM Consumable_order__c
      WHERE Id = :invoiceId
    ];
@@ -79,15 +64,10 @@
        Invoice_Unit__c,
        Invoicedet1_OD_link__c
      FROM Consumable_Orderdetails__c
      WHERE
        Consumable_order__c = :invoiceId
        AND Invoicedet1_OD_link__c = :orderId
            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]
      );
            invoiceorderdet1CountMap.put(invoiceorderdetails1[i].Asset_Model_No__c, invoiceorderdetails1[i]);
    }
    //出库单明细1,画面显示使用
    List<Consumable_Orderdetails__c> consumableorderdetails1 = [
@@ -123,49 +103,35 @@
    ];
    System.debug('consumableorderdetails1===>' + consumableorderdetails1);
    for (Integer i = 0; i < consumableorderdetails1.size(); i++) {
      consumableorderdetails1Records.add(
        new ConsumableorderdetailsInfo(consumableorderdetails1[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 == ''
                    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;
                    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
                    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;
                    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;
                    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);
                invoiceAllprice = (ass.invoiceCount * ass.esd.Invoice_Unitprice__c).setScale(2);
        ass.invoiceAllprice = invoiceAllprice;
      } else {
        ass.invoiceCount = ass.esd.InvoiceProNot_count__c;
@@ -183,11 +149,7 @@
  }
  @AuraEnabled
  public static ResponseBodyLWC save(
    String consumableorderdetails1RecordsLwc,
    String invoiceIdLwc,
    String orderIdLwc
  ) {
    public static ResponseBodyLWC save(String consumableorderdetails1RecordsLwc, String invoiceIdLwc, String orderIdLwc) {
    ResponseBodyLWC res = new ResponseBodyLWC();
    Map<String, object> data = new Map<String, object>();
    res.entity = data;
@@ -198,9 +160,7 @@
    );
    invoiceId = invoiceIdLwc;
    orderId = orderIdLwc;
    System.debug(
      'consumableorderdetails1Records = ' + consumableorderdetails1Records
    );
        System.debug('consumableorderdetails1Records = ' + consumableorderdetails1Records);
    System.debug('invoiceId = ' + invoiceId);
    System.debug('orderId = ' + orderId);
@@ -245,15 +205,11 @@
          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
                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].Invoicedet1_OD_link__c + invoiceorderdetails1[i].Asset_Model_No__c,
          invoiceorderdetails1[i]
        );
      }
@@ -291,30 +247,16 @@
            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)
            ) {
                        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,
                '发票数量不能超过还没发票数量!',
                ''
              );
                            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,
                '发票数量不能超过还没发票数量!',
                ''
              );
                            return new ResponseBodyLWC('Error', 500, '发票数量不能超过还没发票数量!', '');
            }
          }
@@ -327,60 +269,26 @@
          }
          //}
          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;
                    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
              )
                        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 =
                        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 =
                            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
                )
                            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
              )
            );
                        invoiceorderUpList1.add(invoiceordet1Map.get(ass.esd.Consumable_order__c + ass.esd.Asset_Model_No__c));
            invoiceRecordscon++;
          } else {
            String str = string.valueOf(invoiceRecordscon);
@@ -393,22 +301,15 @@
            invoiceInsert1.Name =
              invoicecode.Name +
              '-' +
              ass.esd.Name.substring(
                ass.esd.Name.length() - 7,
                ass.esd.Name.length()
              );
                            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;
                        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;
            }
@@ -420,24 +321,15 @@
            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.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 (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));
          }
        }
      }
@@ -455,12 +347,7 @@
      ApexPages.addmessages(e);
      // Database.rollback(sp);
      // return null;
      return new ResponseBodyLWC(
        'Error',
        500,
        e.getMessage() + ' ' + e.getLineNumber(),
        ''
      );
            return new ResponseBodyLWC('Error', 500, e.getMessage() + ' ' + e.getLineNumber(), '');
    }
    res.status = 'Success';
    res.code = 200;
force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls
@@ -5,159 +5,42 @@
    User myUser_test;
    Account myAccount1;
    Account myAccount2;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    System.runAs(thisUser) {
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      List<RecordType> rectHos = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
      ];
            List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
      if (rectHos.size() == 0) {
        return;
      }
      myAccount1 = new Account(
        Name = 'testaccount001',
        Dealer_discount__c = 10,
        RecordTypeId = rectCo[0].Id
      );
      myAccount2 = new Account(
        Name = 'testaccount002',
        Dealer_discount__c = 20,
        RecordTypeId = rectHos[0].Id
      );
            myAccount1 = new Account(Name='testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id );
            myAccount2 = new Account(Name='testaccount002',Dealer_discount__c =20,RecordTypeId = rectHos[0].Id );
      insert myAccount1;
      insert myAccount2;
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount1.id
      );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
      insert core;
      myUser_test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        UserPro_Type__c = 'ENG',
        Work_Location__c = '北京'
      );
            myUser_test = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='北京');
      insert myUser_test;
    }
    System.runAs(myUser_test) {
      //产品信息
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        Manual_Entry__c = false
      );
      Product2 prod03 = new Product2(
        Name = 'Test03',
        ProductCode = 'Test03',
        Asset_Model_No__c = 'Test03',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        Manual_Entry__c = false
      );
      Product2 prod04 = new Product2(
        Name = 'Test04',
        ProductCode = 'Test04',
        Asset_Model_No__c = 'Test04',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 2,
        Manual_Entry__c = false
      );
      Product2 prod05 = new Product2(
        Name = 'Test05',
        ProductCode = 'Test05',
        Asset_Model_No__c = 'Test05',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        Manual_Entry__c = false
      );
      Product2 prod06 = new Product2(
        Name = 'Test06',
        ProductCode = 'Test06',
        Asset_Model_No__c = 'Test06',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Packing_list_manual__c = 1,
        Manual_Entry__c = false
      );
      insert new List<Product2>{
        prod01,
        prod02,
        prod03,
        prod04,
        prod05,
        prod06
      };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      Product2__c pro3 = new Product2__c(
        Name = 'Pro004',
        OT_CODE_Text__c = 'Test004',
        Product2__c = prod03.Id
      );
      Product2__c pro4 = new Product2__c(
        Name = 'Pro005',
        OT_CODE_Text__c = 'Test005',
        Product2__c = prod04.Id
      );
      Product2__c pro5 = new Product2__c(
        Name = 'Pro003',
        OT_CODE_Text__c = 'Test003',
        Product2__c = prod05.Id
      );
      Product2__c pro6 = new Product2__c(
        Name = 'Pro006',
        OT_CODE_Text__c = 'Test006',
        Product2__c = prod06.Id
      );
      insert new List<Product2__c>{ pro4, pro5, pro6, pro1, pro2, pro3 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,Manual_Entry__c = false);
            Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,Manual_Entry__c = false);
            Product2 prod04 = new Product2(Name='Test04',ProductCode='Test04',Asset_Model_No__c = 'Test04',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=2,Manual_Entry__c = false);
            Product2 prod05 = new Product2(Name='Test05',ProductCode='Test05',Asset_Model_No__c = 'Test05',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,Manual_Entry__c = false);
            Product2 prod06 = new Product2(Name='Test06',ProductCode='Test06',Asset_Model_No__c = 'Test06',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c=1,Manual_Entry__c = false);
            insert new Product2[] {prod01, prod02,prod03,prod04, prod05, prod06};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            Product2__c pro3 = new Product2__c(Name='Pro004',OT_CODE_Text__c='Test004',Product2__c = prod03.Id);
            Product2__c pro4 = new Product2__c(Name='Pro005',OT_CODE_Text__c='Test005',Product2__c = prod04.Id);
            Product2__c pro5 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod05.Id);
            Product2__c pro6 = new Product2__c(Name='Pro006',OT_CODE_Text__c='Test006',Product2__c = prod06.Id);
            insert new Product2__c[] {pro4, pro5,pro6,pro1, pro2, pro3};
      //发票
      Consumable_order__c invoiceorder = new Consumable_order__c();
      invoiceorder.Name = 'invoice02';
@@ -173,31 +56,13 @@
      //出库单信息
      //出库单
      Consumable_order__c testList1 = new Consumable_order__c(
        Name = 'Test1',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '草案中',
        Order_type__c = '传票',
        Dealer_info__c = myAccount1.Id,
        ConInvoice_Code__c = invoiceorder.id
      );
      Consumable_order__c testList2 = new Consumable_order__c(
        Name = 'Test2',
        Summons_Sale_Status__c = '出货',
        SummonsStatus_c__c = '已完成',
        SummonsForDirction__c = '直接销售给医院',
        Order_status__c = '已提交',
        Order_type__c = '传票',
        Dealer_info__c = myAccount1.Id,
        ConInvoice_Code__c = invoiceorder.id
      );
            Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='传票',Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
            Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院',Order_status__c='已提交',Order_type__c='传票',Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id);
      TestList1.Order_date__c = Date.today().addDays(2);
      TestList2.Order_date__c = Date.today().addDays(2);
      TestList1.Order_date__c = Date.today();
      TestList2.Deliver_date__c = Date.today();
      insert new List<Consumable_order__c>{ testList1, testList2 };
            insert new Consumable_order__c[]{testList1,testList2};
      List<Consumable_Orderdetails__c> invoiceList = new List<Consumable_Orderdetails__c>();
      //发票明细1
@@ -305,6 +170,7 @@
      orderdet3.Invoiced_Count__c = 3;
      codList.add(orderdet3);
      Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
      orderdet4.Name = 'Test1_0010031';
      orderdet4.Consumable_order__c = testList1.Id;
@@ -372,35 +238,22 @@
      LexConInvoicedetailsController.init(testList1.Id, invoiceorder.Id);
      //序列化Json
      System.Test.startTest();
      System.debug(
        '===>数据' +
        LexConInvoicedetailsController.consumableorderdetails1Records
      );
            System.debug('===>数据'+LexConInvoicedetailsController.consumableorderdetails1Records);
      List<LexConInvoicedetailsController.ConsumableorderdetailsInfo> inList = LexConInvoicedetailsController.consumableorderdetails1Records;
      LexConInvoicedetailsController.save(
        JSON.serialize(
          LexConInvoicedetailsController.consumableorderdetails1Records
        ),
        invoiceorder.Id,
        testList1.Id
      );
            LexConInvoicedetailsController.save(JSON.serialize(LexConInvoicedetailsController.consumableorderdetails1Records),invoiceorder.Id,testList1.Id);
      List<LexConInvoicedetailsController.ConsumableorderdetailsInfo> inList1 = new List<LexConInvoicedetailsController.ConsumableorderdetailsInfo>();
      for (
        LexConInvoicedetailsController.ConsumableorderdetailsInfo ass : inList
      ) {
            for(LexConInvoicedetailsController.ConsumableorderdetailsInfo ass:inList){
        ass.check = true;
        ass.invoiceCount = 1;
        ass.esd.Invoice_Unit__c = '个';
        inList1.add(ass);
      }
      LexConInvoicedetailsController.save(
        JSON.serialize(inList1),
        invoiceorder.Id,
        testList1.Id
      );
            LexConInvoicedetailsController.save(JSON.serialize(inList1),invoiceorder.Id,testList1.Id);
      System.Test.stopTest();
    }
  }
}
force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls-meta.xml
force-app/main/default/classes/LexConsumableAccountController.cls
@@ -34,11 +34,7 @@
  //初始化
  @AuraEnabled
  public static ResponseBodyLWC init(
    Integer pageSizeLWC,
    Integer pageTokenLWC,
    String fiscalYear
  ) {
    public static ResponseBodyLWC init(Integer pageSizeLWC, Integer pageTokenLWC, String fiscalYear) {
    try {
      ResponseBodyLWC res = new ResponseBodyLWC();
      Map<String, object> data = new Map<String, object>();
@@ -47,13 +43,8 @@
      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;
            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';
@@ -82,9 +73,7 @@
          id IN (
            SELECT Hospital__c
            FROM Agency_Hospital_Link__c
            WHERE
              Agency__c = :accountId
              AND Hosptial_Type__c LIKE :agencyProTypestr
                        WHERE Agency__c = :accountId AND Hosptial_Type__c LIKE :agencyProTypestr
          )
      ];
      totalCount = allSelectAccount.size();
@@ -110,23 +99,17 @@
          id IN (
            SELECT Hospital__c
            FROM Agency_Hospital_Link__c
            WHERE
              Agency__c = :accountId
              AND Hosptial_Type__c LIKE :agencyProTypestr
                        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.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.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
      paginatedAccounts.totalRecords = totalCount;
      //销量前十的客户
@@ -161,48 +144,30 @@
      Date thisDatetime2 = Date.newInstance(thisYear, 4, 1);
      Date nextDatetime = Date.newInstance(nextYear, 4, 1);
      AggregateResult[] arList = null;
            //AggregateResult[] arList = null;
            AggregateResult[] arList = new List<AggregateResult>();
      System.debug('fiscalYear = ' + fiscalYear);
      if (fiscalYear == 'thisYear') {
        AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
          thisDatetime,
          nextDatetime
        );
        topInfo.saleAmount = Decimal.valueOf(
          String.valueOf(saleAmountList[0].get('saleAmount'))
        );
                AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime, nextDatetime);
                Object saleAmountObject = saleAmountList[0].get('saleAmount');
                topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
                //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
        System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
        arList = LexConsumableAccountSOQL.getAccountBySales(
          thisDatetime,
          nextDatetime
        );
                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'))
        );
                AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, thisDatetime2);
                //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                Object saleAmountObject = saleAmountList[0].get('saleAmount');
                topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
        System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
        arList = LexConsumableAccountSOQL.getAccountBySales(
          lastDatetime,
          thisDatetime2
        );
                arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, thisDatetime2);
      } else {
        AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
          lastDatetime,
          nextDatetime
        );
        topInfo.saleAmount = Decimal.valueOf(
          String.valueOf(saleAmountList[0].get('saleAmount'))
        );
                AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, nextDatetime);
                //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                Object saleAmountObject = saleAmountList[0].get('saleAmount');
                topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
        System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
        arList = LexConsumableAccountSOQL.getAccountBySales(
          lastDatetime,
          nextDatetime
        );
                arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime);
      }
      // Map<String,Decimal> mapTemp = new Map<String,Decimal>();
@@ -233,9 +198,7 @@
        System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount')));
        if (String.valueOf(ar.get('thisAmount')) != '0.0') {
          accountList.add(String.valueOf(ar.get('Order_ForHospital__c')));
          topInfo.deList.add(
            Decimal.valueOf(String.valueOf(ar.get('thisAmount')))
          );
                    topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount'))));
        }
      }
@@ -285,12 +248,7 @@
      res.msg = '';
      return res;
    } catch (Exception e) {
      return new ResponseBodyLWC(
        'Error',
        500,
        e.getMessage() + e.getLineNumber(),
        ''
      );
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
    }
  }
@@ -311,57 +269,40 @@
      Date thisDatetime2 = Date.newInstance(thisYear, 4, 1);
      Date nextDatetime = Date.newInstance(nextYear, 4, 1);
      AggregateResult[] arList = null;
            //AggregateResult[] arList = null;
            AggregateResult[] arList = new List<AggregateResult>();
      System.debug('fiscalYear = ' + fiscalYear);
      System.debug('thisYear = ' + thisYear);
      System.debug('lastYear = ' + lastYear);
      if (fiscalYear == 'thisYear') {
        AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
          thisDatetime,
          nextDatetime
        );
                AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime, nextDatetime);
        if (saleAmountList[0].get('saleAmount') != null) {
          topInfo.saleAmount = Decimal.valueOf(
            String.valueOf(saleAmountList[0].get('saleAmount'))
          );
                    //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                    Object saleAmountObject = saleAmountList[0].get('saleAmount');
                    topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
          System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
        }
        arList = LexConsumableAccountSOQL.getAccountBySales(
          thisDatetime,
          nextDatetime
        );
                arList = LexConsumableAccountSOQL.getAccountBySales(thisDatetime, nextDatetime);
      } else if (fiscalYear == 'lastYear') {
        AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
          lastDatetime,
          thisDatetime2
        );
                AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, thisDatetime2);
        if (saleAmountList[0].get('saleAmount') != null) {
          topInfo.saleAmount = Decimal.valueOf(
            String.valueOf(saleAmountList[0].get('saleAmount'))
          );
                    //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                    Object saleAmountObject = saleAmountList[0].get('saleAmount');
                    topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
          System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
        }
        arList = LexConsumableAccountSOQL.getAccountBySales(
          lastDatetime,
          thisDatetime2
        );
                arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, thisDatetime2);
      } else {
        AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
          lastDatetime,
          nextDatetime
        );
                AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, nextDatetime);
        if (saleAmountList[0].get('saleAmount') != null) {
          topInfo.saleAmount = Decimal.valueOf(
            String.valueOf(saleAmountList[0].get('saleAmount'))
          );
                    //topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                    Object saleAmountObject = saleAmountList[0].get('saleAmount');
                    topInfo.saleAmount = saleAmountObject != null ? Decimal.valueOf(String.valueOf(saleAmountObject)) : Decimal.valueOf('0');
          System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
        }
        arList = LexConsumableAccountSOQL.getAccountBySales(
          lastDatetime,
          nextDatetime
        );
                arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime);
      }
      //查询客户信息(名称,省,县)
      List<String> accountList = new List<String>();
@@ -369,9 +310,7 @@
        System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount')));
        if (String.valueOf(ar.get('thisAmount')) != '0.0') {
          accountList.add(String.valueOf(ar.get('Order_ForHospital__c')));
          topInfo.deList.add(
            Decimal.valueOf(String.valueOf(ar.get('thisAmount')))
          );
                    topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount'))));
        }
      }
      System.debug('accountList = ' + accountList);
@@ -410,12 +349,7 @@
      res.msg = '';
      return res;
    } catch (Exception e) {
      return new ResponseBodyLWC(
        'Error',
        500,
        e.getMessage() + e.getLineNumber(),
        ''
      );
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
    }
  }
@@ -447,9 +381,7 @@
      List<Account> allSelectAccount = Database.query(soql);
      totalCount = allSelectAccount.size();
      String nullFL = sortOrder.toLowerCase() == 'asc'
        ? 'NULLS FIRST'
        : 'NULLS LAST';
            String nullFL = sortOrder.toLowerCase() == 'asc' ? 'NULLS FIRST': 'NULLS LAST';
      if (String.isNotBlank(sortField)) {
        soql += ' order by ' + sortField + ' ' + sortOrder + ' ' + nullFL;
      }
@@ -459,15 +391,11 @@
      System.debug('selectAccList = ' + selectAccList);
      PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
      paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount)
        ? pageToken + pageSize
        : null;
            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.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
      paginatedAccounts.totalRecords = totalCount;
      data.put('pageRecords', selectAccList);
@@ -477,26 +405,14 @@
      res.msg = '';
      return res;
    } catch (Exception e) {
      return new ResponseBodyLWC(
        'Error',
        500,
        e.getMessage() + ' ' + e.getLineNumber(),
        ''
      );
            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
    );
        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';
force-app/main/default/classes/LexConsumableAccountControllerTest.cls
@@ -9,7 +9,7 @@
  public static Agency_Hospital_Link__c agency_hospital_link = new Agency_Hospital_Link__c();
  static testMethod void testMethod1() {
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
    User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    System.runAs(thisUser) {
      List<Account> accList = new List<Account>();
      // 取引先
@@ -39,11 +39,7 @@
      insert contact1;
      // ユーザー
      Profile p = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限'
      ];
          Profile p = [select Id from Profile where Name = '901_经销商社区普通权限'];
      user.ProfileId = p.Id;
      user.ContactId = contact1.Id;
      user.FirstName = 'ユーザー';
@@ -64,6 +60,9 @@
      agency_hospital_link.Agency__c = consumable.Id;
      agency_hospital_link.OwnerId = user.Id;
      insert agency_hospital_link;
    }
    System.runAs(user) {
      //订单
@@ -77,9 +76,12 @@
      Order1.Order_ForHospital__c = account1.Id;
      insert Order1;
      Consumable_Orderdetails__c con = new Consumable_Orderdetails__c();
      con.Consumable_order__c = Order1.Id;
      insert con;
      LexConsumableAccountController.init(2, 1, 'thisYear');
      LexConsumableAccountController.init(2, 1, 'lastYear');
@@ -88,11 +90,15 @@
      LexConsumableAccountController.changeFiscalYearView('lastYear');
      // LexConsumableAccountController.changelistView('62. 医院_Hospital申请中的医院',consumable.Id,'ET',1,0,'Is_Active__c','ASC');
      // LexConsumableAccountController.changelistView('63. 医院_Hospital上周创建的医院',consumable.Id,'ET',1,0,'Is_Active__c','ASC');
    }
  }
  static testMethod void testMethod2() {
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
  User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    System.runAs(thisUser) {
      // 取引先
      account1.Name = 'test1医院';
@@ -120,11 +126,7 @@
      insert contact1;
      // ユーザー
      Profile p = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限'
      ];
        Profile p = [select Id from Profile where Name = '901_经销商社区普通权限'];
      user.ProfileId = p.Id;
      user.ContactId = contact1.Id;
      user.FirstName = 'ユーザー';
@@ -168,24 +170,14 @@
      ca.accsort();
      ca.sortKey = '1';
      LexConsumableAccountController.changelistView(
        '62. 医院_Hospital申请中的医院',
        consumable.Id,
        'ET',
        1,
        0,
        'Is_Active__c',
        'ASC'
      );
      LexConsumableAccountController.changelistView(
        '63. 医院_Hospital上周创建的医院',
        consumable.Id,
        'ET',
        1,
        0,
        'Is_Active__c',
        'ASC'
      );
      LexConsumableAccountController.changelistView('62. 医院_Hospital申请中的医院',consumable.Id,'ET',1,0,'Is_Active__c','ASC');
      LexConsumableAccountController.changelistView('63. 医院_Hospital上周创建的医院',consumable.Id,'ET',1,0,'Is_Active__c','ASC');
    }
  }
}
force-app/main/default/classes/LexConsumableAccountControllerTest.cls-meta.xml
force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls
@@ -1,5 +1,6 @@
@isTest
private class LexConsumableAccountInfoControllerTest {
  @isTest
  public static void test_method_one() {
    // Implement test code
@@ -9,8 +10,10 @@
    //account1.Is_Active__c = '草案中';
    insert account1;
    LexConsumableAccountInfoController cai = new LexConsumableAccountInfoController();
    LexConsumableAccountInfoController.init(account1.Id);
    LexConsumableAccountInfoController.init('');
  }
}
force-app/main/default/classes/LexConsumableAccountInfoControllerTest.cls-meta.xml
force-app/main/default/classes/LexConsumableAccountSOQL.cls
@@ -1,41 +1,30 @@
public with sharing class LexConsumableAccountSOQL {
  public static AggregateResult[] getAccountBySales(
    Datetime thisDatetime,
    Datetime nextDatetime
  ) {
    AggregateResult[] arList = new List<AggregateResult>(
      [
        SELECT
          Consumable_order__r.Order_ForHospital__c,
          Consumable_order__r.Order_ForHospital__r.name hospitalName,
    public static AggregateResult[] getAccountBySales(Datetime thisDatetime ,Datetime nextDatetime){
        AggregateResult[] arList = new List<AggregateResult>([
            SELECT Consumable_order__r.Order_ForHospital__c,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__c,
          Consumable_order__r.Order_ForHospital__r.name
            GROUP BY Consumable_order__r.Order_ForHospital__c,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
  ) {
    public static AggregateResult[] getAccountTotalSales(Datetime thisDatetime ,Datetime nextDatetime){
    AggregateResult[] saleAmountList = [
      SELECT sum(Sale_amount__c) saleAmount
      FROM Consumable_Orderdetails__c
      WHERE
        CreatedDate >= :thisDatetime
            WHERE CreatedDate >= :thisDatetime
        AND CreatedDate < :nextDatetime
        AND Consumable_order__r.Order_ForHospital__r.name != ''
    ];
    return saleAmountList;
  }
}
force-app/main/default/classes/LexConsumableAccountSOQLTest.cls
@@ -6,86 +6,26 @@
    Account accountItem;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
    System.runAs(thisUser) {
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
            List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = true AND SobjectType = 'Account' AND Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      Profile prof = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      accountItem = new Account(
        Name = 'Testaccount002',
        Dealer_discount__c = 20,
        RecordTypeId = rectCo[0].Id,
        Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
        AgentCode_Ext__c = '9999900'
      );
            Profile prof = [SELECT Id FROM Profile WHERE Name ='901_经销商社区普通权限_2重验证(ET)'];
            accountItem = new Account(Name='Testaccount002', Dealer_discount__c = 20, RecordTypeId = rectCo[0].Id, Product_Limit_Date__c = 'Test01|5|55,Test02|2|4', AgentCode_Ext__c = '9999900');
      insert accountItem;
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountId = accountItem.id
      );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem.id);
      insert core;
      userTest = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        UserPro_Type__c = 'ENG',
        Work_Location__c = '北京'
      );
            userTest = New User(ContactId = core.id, Alias = 'newUser', Email='newuser@testorg.com', EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN', LocaleSidKey='zh_CN', ProfileId = prof.Id, TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='北京');
      insert userTest;
    }
    System.runAs(userTest) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        SFDA_Approbation_No__c = '12124',
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        SFDA_Approbation_No__c = '12124',
        Packing_list_manual__c = 1,
        SFDA_Expiration_Date__c = Date.today(),
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      insert new List<Product2__c>{ pro1, pro2 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
            insert new Product2[]{prod01,prod02};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            insert new Product2__c[] {pro1, pro2};
      Consumable_order__c createId = new Consumable_order__c();
      createId.Name = 'testMing1';
@@ -124,25 +64,19 @@
  @isTest
  static void testGetAccountBySales() {
    System.Test.startTest();
    DateTime thisDatetime = DateTime.newInstance(2023, 1, 1, 0, 0, 0);
    DateTime nextDatetime = DateTime.newInstance(2023, 6, 6, 0, 0, 0);
        DateTime thisDatetime = DateTime.newInstance(2023,1,1,00,00,00);
        DateTime nextDatetime = DateTime.newInstance(2023,6,6,00,00,00);
    AggregateResult[] arList = new List<AggregateResult>();
    arList = LexConsumableAccountSOQL.getAccountBySales(
      thisDatetime,
      nextDatetime
    );
        arList = LexConsumableAccountSOQL.getAccountBySales(thisDatetime,nextDatetime);
    System.Test.stopTest();
  }
  @isTest
  static void testGetAccountTotalSales() {
    System.Test.startTest();
    DateTime thisDatetime = DateTime.newInstance(2023, 1, 1, 0, 0, 0);
    DateTime nextDatetime = DateTime.newInstance(2023, 6, 6, 0, 0, 0);
        DateTime thisDatetime = DateTime.newInstance(2023,1,1,00,00,00);
        DateTime nextDatetime = DateTime.newInstance(2023,6,6,00,00,00);
    AggregateResult[] saleAmountList = new List<AggregateResult>();
    saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(
      thisDatetime,
      nextDatetime
    );
        saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime,nextDatetime);
    System.Test.stopTest();
  }
}
force-app/main/default/classes/LexConsumableAccountSOQLTest.cls-meta.xml
force-app/main/default/classes/LexConsumableController.cls
@@ -32,22 +32,15 @@
  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 List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview { get; set; }
  public static Integer ConsumableorderdetailsCount {
    get {
      return consumableorderdetailsRecords == null
        ? 0
        : consumableorderdetailsRecords.size();
            return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size();
    }
  }
  public static Integer ConsumableorderdetailsviewCount {
    get {
      return consumableorderdetailsRecordsview == null
        ? 0
        : consumableorderdetailsRecordsview.size();
            return consumableorderdetailsRecordsview == null ? 0 : consumableorderdetailsRecordsview.size();
    }
  }
  public static List<String> lower = new List<String>();
@@ -167,13 +160,9 @@
      consumableorderdetailsRecordsview = reSet;
    }
    Integer pagestartNo = (con.getPageNumber() * size) - size;
    Integer pageendNo = (con.getPageNumber() * size) > noOfRecords
      ? noOfRecords
      : (con.getPageNumber() * size - 1);
        Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1);
    Integer addNo = 0;
    for (
      Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++
    ) {
        for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) {
      Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
      if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) {
        addNo++;
@@ -218,11 +207,7 @@
    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
      ];
            List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid];
      methodType = oclist.get(0).orderPattern__c;
    }
    statusEdit = keywordStr;
@@ -237,35 +222,17 @@
      decisionCode = '';
      sumPrice = 0;
      specialCampaign = false;
      if (
        ESetId != null &&
        ESetId != '' &&
        statusEdit == '' &&
        statusEdit == null
      ) {
            if (ESetId != null && ESetId != '' && statusEdit == '' && statusEdit == null) {
        editAble = false;
      } else if (
        (ESetId == null || ESetId == '') &&
        (statusEdit == '' ||
        statusEdit == null)
      ) {
            } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) {
        editAble = true;
      } else if (
        ESetId != null &&
        ESetId != '' &&
        statusEdit != '' &&
        statusEdit != null
      ) {
            } 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
      ];
            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;
@@ -282,11 +249,7 @@
        agencyProType = 'ET';
      }
      //错误信息提示
      if (
        String.isNotBlank(methodType) &&
        methodType.equals('hospitalorder') &&
        agencyProType == 'ET'
      ) {
            if (String.isNotBlank(methodType) && methodType.equals('hospitalorder') && agencyProType == 'ET') {
        // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '您没有订货医院特价产品的权限!'));
        errorMsgList.add('您没有订货医院特价产品的权限!');
      }
@@ -310,11 +273,7 @@
      DealerProductMap = new Map<Id, Dealer_Product__c>();
      DealerProductId = getDealerProductId();
      Account accountInfo = [
        SELECT
          Name,
          Dealer_discount__c,
          Product_Limit_Date__c,
          Product_Limit_DateENG__c
                SELECT Name, Dealer_discount__c, Product_Limit_Date__c, Product_Limit_DateENG__c
        FROM account
        WHERE id = :accountid
      ];
@@ -387,29 +346,15 @@
        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])
          );
                    consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(product2Selected[i]));
                    MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
        }
        //只有在协议订货时会走这个for循环 其他两种订货模式都走的searchorderdetails方法
        if (
          String.isBlank(methodType) ||
          (!methodType.equals('promotionorder') &&
          !methodType.equals('hospitalorder'))
        ) {
                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 (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
                );
                                ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
                if (countDel[i].Box_Piece__c == '盒') {
                  Jstage.allnumber = Jstage.allnumber + 1;
                } else {
@@ -424,28 +369,18 @@
        //经销商定价 计算
        for (ConsumableorderdetailsInfo bss : MidMap.values()) {
          bss.sortBy = sortOrderAsc;
          bss.packing_list = Integer.valueOf(
            bss.Prod.Product2__r.Packing_list_manual__c
          );
                    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;
                        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'))
        ) {
                if (methodType != null && methodType != '' && (methodType.equals('hospitalorder') || methodType.equals('promotionorder'))) {
          searchorderdetails(
            methodType,
            accountid,
@@ -462,10 +397,7 @@
      } else {
        if (methodType != null && methodType.equals('hospitalorder')) {
          List<Consumable_order__c> oclist = [
            SELECT
              orderPattern__c,
              Order_ForHospital__c,
              Order_ForHospital__r.Name
                        SELECT orderPattern__c, Order_ForHospital__c, Order_ForHospital__r.Name
            FROM Consumable_order__c
            WHERE id = :ESetid
          ];
@@ -501,11 +433,7 @@
          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 == '附件上传完成'
        ) {
                if (qs[0].Order_status__c == '已提交' || qs[0].Order_status__c == '批准' || qs[0].Order_status__c == '附件上传完成') {
          saveBtnDisabled = true;
          sorderBtnDisabled = true;
          editDelCommitBtnDisabled = false;
@@ -548,22 +476,15 @@
        initStandardController();
        product2Selected = Database.query(soql);
        for (Integer i = 0; i < product2Selected.size(); i++) {
          MidMap.put(
            product2Selected[i].Id,
            new ConsumableorderdetailsInfo(product2Selected[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 (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) {
            if (countDel[i].hospitalSpecialOffer__c == true) {
              //然后循环CountDel去修改map里的allnumber
              if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
                ConsumableorderdetailsInfo Jstage = MidMap.get(
                  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 {
@@ -572,14 +493,10 @@
                MidMap.put(countDel[i].Consumable_Product__c, Jstage);
              }
            }
          } else if (
            String.isBlank(methodType) || methodType.equals('promotionorder')
          ) {
                    } 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
                );
                                ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
                if (countDel[i].Box_Piece__c == '盒') {
                  Jstage.allnumber = Jstage.allnumber + 1;
                } else {
@@ -589,18 +506,11 @@
              }
            }
          } else if (
            String.isBlank(methodType) ||
            (!methodType.equals('promotionorder') &&
            !methodType.equals('hospitalorder'))
                        String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))
          ) {
            if (
              countDel[i].promotionorder__c == false &&
              countDel[i].hospitalSpecialOffer__c == false
            ) {
                        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
                );
                                ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
                if (countDel[i].Box_Piece__c == '盒') {
                  Jstage.allnumber = Jstage.allnumber + 1;
                } else {
@@ -614,26 +524,19 @@
        consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
        //再把map里的值从新赋给ConsumableorderdetailsRecords
        for (ConsumableorderdetailsInfo bss : MidMap.values()) {
          bss.packing_list = Integer.valueOf(
            bss.Prod.Product2__r.Packing_list_manual__c
          );
                    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;
                        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
          ) {
                    for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) {
            sumPrice += cdc1.Sum_of_money__c;
            if (ass.prod.Id == cdc1.Consumable_Product__c) {
              ass.check = true;
@@ -648,24 +551,14 @@
        //         attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
        //     }
        // }
        List<ContentDocumentLink> links = [
          SELECT Id, ContentDocumentId
          FROM ContentDocumentLink
          WHERE LinkedEntityId = :ESetId
        ];
                List<ContentDocumentLink> links = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :ESetId];
        if (links != null && links.size() > 0) {
          List<String> documentIds = new List<String>();
          for (ContentDocumentLink link : links) {
            documentIds.add(link.ContentDocumentId);
          }
          List<ContentVersion> cvInfo = [
            SELECT
              Id,
              Title,
              OwnerId,
              Owner.Name,
              CreatedDate,
              ContentDocumentId
                        SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId
            FROM ContentVersion
            WHERE ContentDocumentId IN :documentIds
          ];
@@ -686,11 +579,7 @@
      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 != 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);
            }
@@ -719,10 +608,7 @@
      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
                WHERE Estimation_Entry_Possibility__c = '○' AND Product_Type__c LIKE :agencyProType AND Category3_text__c != NULL
        GROUP BY Category3_text__c
      ];
      //categoty3
@@ -785,10 +671,7 @@
  }
  @AuraEnabled
  public static Results categoryAllload(
    String agencyProTypeStr,
    String category3Str
  ) {
    public static Results categoryAllload(String agencyProTypeStr, String category3Str) {
    Results results = new Results();
    agencyProType = agencyProTypeStr;
    category3 = category3Str;
@@ -844,11 +727,7 @@
  }
  @AuraEnabled
  public static Results categoryload(
    String agencyProTypeStr,
    String category3Str,
    String category4Str
  ) {
    public static Results categoryload(String agencyProTypeStr, String category3Str, String category4Str) {
    Results results = new Results();
    agencyProType = agencyProTypeStr;
    category3 = category3Str;
@@ -913,17 +792,12 @@
    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 = '○'
            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])
      );
            midMaprecord.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
    }
    List<Consumable_order_details2__c> countDel = [
      SELECT
@@ -958,9 +832,7 @@
        if (countDel[i].hospitalSpecialOffer__c == true) {
          //然后循环CountDel去修改map里的allnumber
          if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) {
            ConsumableorderdetailsInfo Jstage = midMaprecord.get(
              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 {
@@ -970,14 +842,10 @@
            midMaprecord.put(countDel[i].Consumable_Product__c, Jstage);
          }
        }
      } else if (
        String.isBlank(methodType) || methodType.equals('promotionorder')
      ) {
            } 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
            );
                        ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c);
            if (countDel[i].Box_Piece__c == '盒') {
              Jstage.allnumber = Jstage.allnumber + 1;
            } else {
@@ -986,19 +854,10 @@
            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
        ) {
            } 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
            );
                        ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c);
            if (countDel[i].Box_Piece__c == '盒') {
              Jstage.allnumber = Jstage.allnumber + 1;
            } else {
@@ -1037,26 +896,17 @@
    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('|')
            )
                    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
            )
                    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
  ) {
    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++) {
@@ -1070,17 +920,10 @@
    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('|')
            )
                    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
            )
                    productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1)
        );
      }
    }
@@ -1124,10 +967,7 @@
    methodType = methodTypeStr;
    editAble = editAbleStr;
    proLimitAndDate = proLimitAndDateList;
    dealerProductId = (List<String>) JSON.deserialize(
      dealerProductIdStr,
      List<String>.class
    );
        dealerProductId = (List<String>) JSON.deserialize(dealerProductIdStr, List<String>.class);
    consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
      consumableorderdetailsRecordsviewStr,
      List<ConsumableorderdetailsInfo>.class
@@ -1172,35 +1012,20 @@
      ];
      List<Product2__c> product2Selected = new List<Product2__c>();
      consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
      soql = makeSoql(
        category1,
        category_Goods,
        category3,
        category4,
        category5,
        specialCampaign,
        DealerProductId
      );
            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])
        );
                MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
      }
      for (Integer i = 0; i < countDel.size(); i++) {
        //然后循环CountDel去修改map里的allnumber
        if (
          String.isNotBlank(methodType) && methodType.equals('hospitalorder')
        ) {
                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
              );
                            ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
              if (countDel[i].Box_Piece__c == '盒') {
                Jstage.allnumber = Jstage.allnumber + 1;
              } else {
@@ -1209,14 +1034,10 @@
              MidMap.put(countDel[i].Consumable_Product__c, Jstage);
            }
          }
        } else if (
          String.isBlank(methodType) || methodType.equals('promotionorder')
        ) {
                } 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
              );
                            ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
              if (countDel[i].Box_Piece__c == '盒') {
                Jstage.allnumber = Jstage.allnumber + 1;
              } else {
@@ -1225,19 +1046,10 @@
              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
          ) {
                } 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
              );
                            ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c);
              if (countDel[i].Box_Piece__c == '盒') {
                Jstage.allnumber = Jstage.allnumber + 1;
              } else {
@@ -1254,17 +1066,12 @@
          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.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.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);
@@ -1287,10 +1094,7 @@
        getConsumableShowTableFieldValue();
        results.result = 'Success';
        results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
        results.errorMsg =
          '搜索到' +
          consumableorderdetailsRecords.size() +
          '件产品';
                results.errorMsg = '搜索到' + consumableorderdetailsRecords.size() + '件产品';
      } else {
        getConsumableShowTableFieldValue();
        results.result = 'Fail';
@@ -1353,10 +1157,7 @@
        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)
                    WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
        ];
        if (dpclist != null && dpclist.size() > 0) {
          String ids = '(';
@@ -1382,10 +1183,7 @@
      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])
        );
                MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
      }
      List<Consumable_order_details2__c> countDel = [
        SELECT
@@ -1416,9 +1214,7 @@
          if (countDel[i].hospitalSpecialOffer__c == true) {
            //然后循环CountDel去修改map里的allnumber
            if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
              ConsumableorderdetailsInfo Jstage = MidMap.get(
                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 {
@@ -1432,9 +1228,7 @@
          if (countDel[i].promotionorder__c == true) {
            //然后循环CountDel去修改map里的allnumber
            if (MidMap.containsKey(countDel[i].Consumable_Product__c)) {
              ConsumableorderdetailsInfo Jstage = MidMap.get(
                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 {
@@ -1452,17 +1246,12 @@
          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.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.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);
@@ -1483,10 +1272,7 @@
      results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
      if (consumableorderdetailsRecordsview.size() > 0) {
        results.result = 'Success';
        results.errorMsg =
          '共搜索到' +
          consumableorderdetailsRecordsview.size() +
          '条数据';
                results.errorMsg = '共搜索到' + consumableorderdetailsRecordsview.size() + '条数据';
      } else {
        results.result = 'Fail';
        results.errorMsg = '没有搜索到相关数据';
@@ -1507,13 +1293,9 @@
      consumableorderdetailsRecordsview = reSet;
    }
    Integer pagestartNo = (con.getPageNumber() * size) - size;
    Integer pageendNo = (con.getPageNumber() * size) > noOfRecords
      ? noOfRecords
      : (con.getPageNumber() * size - 1);
        Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1);
    Integer addNo = 0;
    for (
      Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++
    ) {
        for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) {
      Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
      if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) {
        addNo++;
@@ -1568,10 +1350,7 @@
        continue;
      } else {
        ProductId.add(dealerProduct.Dealer_Product2__c);
        DealerProductIdMap.put(
          dealerProduct.Dealer_Product2__c,
          dealerProduct.Dealer_Product2__c
        );
                DealerProductIdMap.put(dealerProduct.Dealer_Product2__c, dealerProduct.Dealer_Product2__c);
      }
    }
    return ProductId;
@@ -1628,10 +1407,7 @@
        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)
                    WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
        ];
        if (dpclist != null && dpclist.size() > 0) {
@@ -1703,18 +1479,8 @@
    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;
            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) {
@@ -1733,18 +1499,8 @@
    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;
            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) {
@@ -1756,11 +1512,7 @@
  //上传附件
  @AuraEnabled
  public static Results filesUpload(
    String pId,
    String fileName,
    String base64Data
  ) {
    public static Results filesUpload(String pId, String fileName, String base64Data) {
    Results results = new Results();
    try {
      base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
@@ -1771,11 +1523,7 @@
      cv.VersionData = EncodingUtil.base64Decode(base64Data);
      cv.IsMajorVersion = true;
      insert cv;
      Consumable_order__c c = [
        SELECT Id
        FROM Consumable_order__c
        WHERE Id = :pId
      ];
            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';
@@ -1830,18 +1578,11 @@
        FROM Consumable_Orderdetails__c
        WHERE Consumable_order__c = :ESetId
      ]) {
        prodMap.put(
          cod1.Consumable_product__r.Product2__c,
          cod1.Consumable_product__r.Name__c
        );
                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,
        ''
      );
            Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide(prodMap, accountid, '');
      System.debug(chkMap);
      if (chkMap.size() > 0) {
        if (chkMap.containsKey('agency')) {
@@ -1854,16 +1595,12 @@
              // ApexPages.addmessage(
              //     new ApexPages.message(ApexPages.severity.Error, '产品 ' + prodMap.get(proId) + ' 没有有效的注册证。')
              // );
              errorMsgList.add(
                '产品 ' + 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) + ' 超过经销商经营范围。'
              );
                            errorMsgList.add('产品 ' + prodMap.get(proId) + ' 超过经销商经营范围。');
            }
          }
        }
@@ -1947,18 +1684,9 @@
    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
    );
    System.debug(
      'consumableorderdetailsRecordsviewStr:' +
      consumableorderdetailsRecordsviewStr
    );
        coc = (Consumable_order__c) JSON.deserialize(cocStr, Consumable_order__c.class);
        contactDealer = (List<String>) JSON.deserialize(contactDealerStr, List<String>.class);
        System.debug('consumableorderdetailsRecordsviewStr:' + consumableorderdetailsRecordsviewStr);
    consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
      consumableorderdetailsRecordsviewStr,
      List<ConsumableorderdetailsInfo>.class
@@ -1976,11 +1704,7 @@
        return results;
      }
      List<Account> contract = [
        SELECT
          Id,
          Name,
          Contract_Department_Class__c,
          Contract_Quote_Decide_Flag__c
                SELECT Id, Name, Contract_Department_Class__c, Contract_Quote_Decide_Flag__c
        FROM account
        WHERE
          Name = :contractName
@@ -2009,9 +1733,7 @@
      //add by rentx 2020-11-25
      List<String> tpids = new List<String>();
      //add by rentx 2020-11-25
      for (
        ConsumableorderdetailsInfo CheckCount : consumableorderdetailsRecordsview
      ) {
            for (ConsumableorderdetailsInfo CheckCount : consumableorderdetailsRecordsview) {
        FLG = FLG + 1;
        if (CheckCount.check == false) {
          Count = Count + 1;
@@ -2020,10 +1742,7 @@
          //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
          ) {
                    if (CheckCount.esd.Consumable_Count__c == null || CheckCount.esd.Consumable_Count__c == 0) {
            // CheckCount.esd.Consumable_Count__c.addError('请输入采购数量');
            results.result = 'Fail';
            results.errorMsg = '请输入采购数量';
@@ -2031,10 +1750,7 @@
          }
          if (
            CheckCount.orderGoods_Limit > 0 &&
            math.mod(
              Integer.valueOf(CheckCount.esd.Consumable_Count__c),
              Integer.valueOf(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';
@@ -2053,17 +1769,11 @@
      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
                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
          );
                    dealerHospitalmMap.put('' + dealerProduct.hospital__c + dealerProduct.product__c, dealerProduct.mPrice__c);
        }
      }
      //促销订货 根据经销商产品中的数据计算金额
@@ -2104,25 +1814,18 @@
          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)
                WHERE Dealer_Contact__c IN :contactDealer AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL)
      ];
      for (Dealer_Product__c dealerProduct : DealerProductList) {
        //如果促销价格为null 则设置特殊折扣(百分比)到集合
        if (dealerProduct.Special_Campaign_Price__c == null) {
          dealerPDiscountMap.put(
            '' +
              dealerProduct.Dealer_Contact__c +
              dealerProduct.Dealer_Product2__c,
                        '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
            dealerProduct.Special_Discount__c
          );
        } else {
          dealerMPDiscountMap.put(
            '' +
              dealerProduct.Dealer_Contact__c +
              dealerProduct.Dealer_Product2__c,
                        '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
            dealerProduct.Special_Campaign_Price__c
          );
        }
@@ -2133,40 +1836,22 @@
        for (Dealer_Product__c dealerProduct : haveDateList) {
          if (dealerProduct.Special_Campaign_Price__c == null) {
            dealerPDiscountMap.put(
              '' +
                dealerProduct.Dealer_Contact__c +
                dealerProduct.Dealer_Product2__c,
                            '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
              dealerProduct.Special_Discount__c
            );
            dealerMPDiscountMap.remove(
              '' +
                dealerProduct.Dealer_Contact__c +
                dealerProduct.Dealer_Product2__c
            );
                        dealerMPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c);
          } else {
            dealerMPDiscountMap.put(
              '' +
                dealerProduct.Dealer_Contact__c +
                dealerProduct.Dealer_Product2__c,
                            '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c,
              dealerProduct.Special_Campaign_Price__c
            );
            dealerPDiscountMap.remove(
              '' +
                dealerProduct.Dealer_Contact__c +
                dealerProduct.Dealer_Product2__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
                SELECT id, Name, State_Master__c, State_Master__r.Name, Sales_Section__c, Dealer_discount__c
        FROM Account
        WHERE
          Name = :contractName
@@ -2203,20 +1888,11 @@
          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
        ) {
                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
            ) {
                        if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) {
              // ass.esd.Consumable_Count__c.addError('请输入采购数量');
              results.result = 'Fail';
              results.errorMsg = '请输入采购数量';
@@ -2236,29 +1912,16 @@
              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;
                                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
                  );
                                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
                  )
                ) {
                                } 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) /
@@ -2275,21 +1938,13 @@
                  dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null
                ) {
                  //直接根据促销金额计算
                  InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(
                    '' + hospitalId + ass.Prod.Id
                  );
                                    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.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.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c;
              }
              InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
              i++;
@@ -2309,14 +1964,7 @@
        //修改,获取消耗品订单
        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
                    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
        ];
@@ -2333,32 +1981,21 @@
          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_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
                    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
        ) {
                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
            ) {
                        if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) {
              // ass.esd.Consumable_Count__c.addError('请输入采购数量');
              results.result = 'Fail';
              results.errorMsg = '请输入采购数量';
@@ -2376,26 +2013,13 @@
              //协议订货
              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;
                                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
                  )
                ) {
                                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) /
@@ -2410,20 +2034,12 @@
                  dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null
                ) {
                  //直接根据促销金额计算
                  InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(
                    '' + hospitalId + ass.Prod.Id
                  );
                                    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.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.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c;
              }
              // ==================================================之前的促销订货的逻辑
              InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
@@ -2451,29 +2067,13 @@
  public static Results deleteAtt(String contentVersionId, String cocId) {
    Results results = new Results();
    try {
      List<ContentVersion> cvInfo = [
        SELECT Id
        FROM ContentVersion
        WHERE FirstPublishLocationId = :cocId
      ];
      ContentVersion conVersion = [
        SELECT ContentDocumentId
        FROM ContentVersion
        WHERE Id = :contentVersionId
      ];
            List<ContentVersion> cvInfo = [SELECT Id FROM ContentVersion WHERE FirstPublishLocationId = :cocId];
            ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId];
      String contentDocumentId = conVersion.ContentDocumentId;
      ContentDocument conDocument = [
        SELECT Id
        FROM ContentDocument
        WHERE Id = :contentDocumentId
      ];
            ContentDocument conDocument = [SELECT Id FROM ContentDocument WHERE Id = :contentDocumentId];
      delete conDocument;
      if (cvInfo.size() <= 1) {
        Consumable_order__c c = [
          SELECT Id
          FROM Consumable_order__c
          WHERE Id = :cocId
        ];
                Consumable_order__c c = [SELECT Id FROM Consumable_order__c WHERE Id = :cocId];
        c.Consumable_pdf_insert_day__c = null;
        update c;
      }
force-app/main/default/classes/LexConsumableControllerTest.cls
@@ -5,79 +5,33 @@
    user MyUser_Test;
    Account myAccount1;
    Account contract;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
    insert n;
    System.runAs(thisUser) {
      Profile prof1 = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
      List<RecordType> rectCo1 = [
        SELECT Id
        FROM RecordType
        WHERE
          IsActive = TRUE
          AND SobjectType = 'Account'
          AND DeveloperName = 'AgencyContract'
      ];
            Profile prof1 = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
            List<RecordType> rectCo1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'AgencyContract'];
      if (rectCo.size() == 0) {
        return;
      }
      StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
      myAccount1 = new Account(
        name = 'Testaccount001',
        Dealer_discount__c = 10,
        RecordTypeId = rectCo[0].Id,
        AgentCode_Ext__c = '8888888',
        Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
      );
            myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
      insert myAccount1;
      contract = new Account(
        RecordTypeId = rectCo1[0].Id,
        Name = 'contractName',
        ParentId = myAccount1.id,
        Agent_Ref__c = myAccount1.id,
        Contract_Department_Class__c = 'ET',
        Contract_Decide_Start_Date__c = Date.today().addDays(-2),
        Contract_Decide_End_Date__c = Date.today().addDays(2),
        Dealer_discount__c = 0.8
      );
            contract = new Account(RecordTypeId=rectCo1[0].Id ,Name ='contractName',ParentId = myAccount1.id,Agent_Ref__c =myAccount1.id, Contract_Department_Class__c = 'ET',Contract_Decide_Start_Date__c=Date.today().addDays(-2),
                Contract_Decide_End_Date__c = Date.today().addDays(2),Dealer_discount__c = 0.8);
      insert contract;
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount1.id
      );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
      insert core;
      MyUser_Test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof1.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        Work_Location__c = '重庆'
      );
            MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '重庆');
      insert MyUser_Test;
    }
    System.runAs(MyUser_Test) {
      //产品数据
      Product2 prod01 = new Product2(
        Name = 'Test01',
            Product2 prod01 = new Product2(Name='Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
@@ -94,11 +48,9 @@
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
                                Manual_Entry__c = false);
      Product2 prod02 = new Product2(
        Name = 'Test02',
            Product2 prod02 = new Product2(Name='Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
@@ -115,11 +67,9 @@
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
                                Manual_Entry__c = false);
      Product2 prod03 = new Product2(
        Name = 'Test03',
            Product2 prod03 = new Product2(Name='Test03',
        ProductCode = 'Test03',
        Asset_Model_No__c = 'Test03',
        SFDA_Status__c = '有効',
@@ -132,33 +82,21 @@
        Intra_Trade_List_RMB_1__c = 1000,
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02, prod03 };
                                Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02,prod03};
      //制作产品
      Product2__c proG = new Product2__c(
        Name = 'MH-155:白平衡帽',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
            Product2__c proG = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
      insert proG;
      System.debug('proG:' + proG);
      System.debug('proG1:' + proG.Estimation_Entry_Possibility__c);
      System.debug('prod07:' + prod01);
      System.debug('prod071:' + prod01.Estimation_Entry_Possibility__c);
      Product2__c proH = new Product2__c(
        Name = 'MB-677:BNC电缆',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
            Product2__c proH = new Product2__c(Name='MB-677:BNC电缆',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
      insert proH;
      Product2__c proF = new Product2__c(
        Name = 'TooMAJ-643R:水囊鞘管003',
        OT_CODE_Text__c = 'Test003',
        Product2__c = prod03.Id
      );
            Product2__c proF = new Product2__c(Name='TooMAJ-643R:水囊鞘管003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
      insert proF;
      //订单
      Consumable_order__c order = new Consumable_order__c();
@@ -195,48 +133,13 @@
      insert createDetail2;
      Test.startTest();
      LexConsumableController.ConsumableorderdetailsInfo c1 = new LexConsumableController.ConsumableorderdetailsInfo(
        Orderdet
      );
            LexConsumableController.ConsumableorderdetailsInfo c1 = new LexConsumableController.ConsumableorderdetailsInfo(Orderdet);
      ContentVersion v = new ContentVersion();
      LexConsumableController.ConsumableorderdetailsInfo c2 = new LexConsumableController.ConsumableorderdetailsInfo(
        v
      );
            LexConsumableController.ConsumableorderdetailsInfo c2 = new LexConsumableController.ConsumableorderdetailsInfo(v);
      LexConsumableController l = new LexConsumableController();
      LexConsumableController.Results re = LexConsumableController.init(
        '',
        order.Id,
        ''
      );
      LexConsumableController.searchConsumableorderdetails(
        re.userWorkLocation,
        re.agencyProType,
        re.accountName,
        re.accountid,
        re.hospitalId,
        re.contractId,
        'testMing',
        '',
        '',
        '',
        re.category_Goods,
        re.specialCampaign,
        JSON.serialize(re.dealerProductId),
        re.methodType,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        re.editAble,
        re.proLimitAndDate
      );
      LexConsumableController.searchorderdetails(
        re.methodType,
        re.accountid,
        re.hospitalId,
        re.contractId,
        re.userWorkLocation,
        re.accountName,
        re.proLimitAndDate,
        re.editAble
      );
            LexConsumableController.Results re =  LexConsumableController.init('', order.Id, '');
            LexConsumableController.searchConsumableorderdetails(re.userWorkLocation, re.agencyProType, re.accountName, re.accountid, re.hospitalId, re.contractId, 'testMing', '', '', '', re.category_Goods, re.specialCampaign, JSON.serialize(re.dealerProductId), re.methodType, JSON.serialize(re.consumableorderdetailsRecordsview), re.editAble, re.proLimitAndDate);
            LexConsumableController.searchorderdetails(re.methodType, re.accountid, re.hospitalId, re.contractId, re.userWorkLocation, re.accountName, re.proLimitAndDate, re.editAble);
      LexConsumableController.sorder(order.Id, myAccount1.Id);
      Test.stopTest();
    }
@@ -247,80 +150,34 @@
    user MyUser_Test;
    Account myAccount1;
    Account contract;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
    insert n;
    System.runAs(thisUser) {
      Profile prof1 = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
      List<RecordType> rectCo1 = [
        SELECT Id
        FROM RecordType
        WHERE
          IsActive = TRUE
          AND SobjectType = 'Account'
          AND DeveloperName = 'AgencyContract'
      ];
            Profile prof1 = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
            List<RecordType> rectCo1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'AgencyContract'];
      if (rectCo.size() == 0) {
        return;
      }
      StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
      myAccount1 = new Account(
        name = 'Testaccount001',
        Dealer_discount__c = 10,
        RecordTypeId = rectCo[0].Id,
        AgentCode_Ext__c = '8888888',
        Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
      );
            myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
      insert myAccount1;
      contract = new Account(
        RecordTypeId = rectCo1[0].Id,
        Name = 'contractName',
        ParentId = myAccount1.id,
        Agent_Ref__c = myAccount1.id,
        Contract_Department_Class__c = 'ET',
        Contract_Decide_Start_Date__c = Date.today().addDays(-2),
        Contract_Decide_End_Date__c = Date.today().addDays(2),
        Dealer_discount__c = 0.8
      );
            contract = new Account(RecordTypeId=rectCo1[0].Id ,Name ='contractName',ParentId = myAccount1.id,Agent_Ref__c =myAccount1.id, Contract_Department_Class__c = 'ET',Contract_Decide_Start_Date__c=Date.today().addDays(-2),
                Contract_Decide_End_Date__c = Date.today().addDays(2),Dealer_discount__c = 0.8);
      insert contract;
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount1.id
      );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
      insert core;
      MyUser_Test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof1.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        Work_Location__c = '重庆'
      );
            MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '重庆');
      insert MyUser_Test;
    }
    System.runAs(MyUser_Test) {
      //产品数据
      Product2 prod01 = new Product2(
        Name = 'Test01',
            Product2 prod01 = new Product2(Name='Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
@@ -337,11 +194,9 @@
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
                                Manual_Entry__c = false);
      Product2 prod02 = new Product2(
        Name = 'Test02',
            Product2 prod02 = new Product2(Name='Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
@@ -358,11 +213,9 @@
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
                                Manual_Entry__c = false);
      Product2 prod03 = new Product2(
        Name = 'Test03',
            Product2 prod03 = new Product2(Name='Test03',
        ProductCode = 'Test03',
        Asset_Model_No__c = 'Test03',
        SFDA_Status__c = '有効',
@@ -375,45 +228,24 @@
        Intra_Trade_List_RMB_1__c = 1000,
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02, prod03 };
                                Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02,prod03};
      //制作产品
      Product2__c proG = new Product2__c(
        Name = 'MH-155:白平衡帽',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
            Product2__c proG = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
      insert proG;
      System.debug('proG:' + proG);
      System.debug('proG1:' + proG.Estimation_Entry_Possibility__c);
      System.debug('prod07:' + prod01);
      System.debug('prod071:' + prod01.Estimation_Entry_Possibility__c);
      Product2__c proH = new Product2__c(
        Name = 'MB-677:BNC电缆',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
            Product2__c proH = new Product2__c(Name='MB-677:BNC电缆',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
      insert proH;
      Product2__c proF = new Product2__c(
        Name = 'TooMAJ-643R:水囊鞘管003',
        OT_CODE_Text__c = 'Test003',
        Product2__c = prod03.Id
      );
            Product2__c proF = new Product2__c(Name='TooMAJ-643R:水囊鞘管003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
      insert proF;
      //创建医院
      Account hospital = new Account();
      hospital.recordtypeId = [
        SELECT Id
        FROM RecordType
        WHERE
          IsActive = TRUE
          AND SobjectType = 'Account'
          AND DeveloperName = 'HP'
      ]
      .id;
            hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
      hospital.Name = 'test hospital';
      hospital.Is_Active__c = '有効';
      hospital.Attribute_Type__c = '卫生部';
@@ -467,69 +299,11 @@
      insert createDetail3;
      Test.startTest();
      LexConsumableController.Results re = LexConsumableController.init(
        '',
        order1.Id,
        ''
      );
      LexConsumableController.searchConsumableorderdetails(
        re.userWorkLocation,
        re.agencyProType,
        re.accountName,
        re.accountid,
        re.hospitalId,
        re.contractId,
        'testMing',
        '',
        '',
        '',
        re.category_Goods,
        re.specialCampaign,
        JSON.serialize(re.dealerProductId),
        re.methodType,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        re.editAble,
        re.proLimitAndDate
      );
      LexConsumableController.searchorderdetails(
        re.methodType,
        re.accountid,
        re.hospitalId,
        re.contractId,
        re.userWorkLocation,
        re.accountName,
        re.proLimitAndDate,
        re.editAble
      );
      LexConsumableController.searchConsumableorderdetails(
        re.userWorkLocation,
        re.agencyProType,
        re.accountName,
        re.accountid,
        hospital.Id,
        contract.Id,
        'testMing',
        '',
        '',
        '',
        re.category_Goods,
        re.specialCampaign,
        JSON.serialize(re.dealerProductId),
        re.methodType,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        re.editAble,
        re.proLimitAndDate
      );
      LexConsumableController.searchorderdetails(
        re.methodType,
        re.accountid,
        hospital.Id,
        contract.Id,
        re.userWorkLocation,
        re.accountName,
        re.proLimitAndDate,
        re.editAble
      );
            LexConsumableController.Results re =  LexConsumableController.init('', order1.Id, '');
            LexConsumableController.searchConsumableorderdetails(re.userWorkLocation, re.agencyProType, re.accountName, re.accountid, re.hospitalId, re.contractId, 'testMing', '', '', '', re.category_Goods, re.specialCampaign, JSON.serialize(re.dealerProductId), re.methodType, JSON.serialize(re.consumableorderdetailsRecordsview), re.editAble, re.proLimitAndDate);
            LexConsumableController.searchorderdetails(re.methodType, re.accountid, re.hospitalId, re.contractId, re.userWorkLocation, re.accountName, re.proLimitAndDate, re.editAble);
            LexConsumableController.searchConsumableorderdetails(re.userWorkLocation, re.agencyProType, re.accountName, re.accountid, hospital.Id, contract.Id, 'testMing', '', '', '', re.category_Goods, re.specialCampaign, JSON.serialize(re.dealerProductId), re.methodType, JSON.serialize(re.consumableorderdetailsRecordsview), re.editAble, re.proLimitAndDate);
            LexConsumableController.searchorderdetails(re.methodType, re.accountid, hospital.Id, contract.Id, re.userWorkLocation, re.accountName, re.proLimitAndDate, re.editAble);
      Test.stopTest();
    }
  }
@@ -540,77 +314,30 @@
    Account myAccount1;
    Account contract;
    Consumable_order__c order2;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
    insert n;
    System.runAs(thisUser) {
      Profile prof1 = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
      List<RecordType> rectCo1 = [
        SELECT Id
        FROM RecordType
        WHERE
          IsActive = TRUE
          AND SobjectType = 'Account'
          AND DeveloperName = 'AgencyContract'
      ];
            Profile prof1 = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
            List<RecordType> rectCo1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'AgencyContract'];
      if (rectCo.size() == 0) {
        return;
      }
      StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
      myAccount1 = new Account(
        name = 'Testaccount001',
        Dealer_discount__c = 10,
        RecordTypeId = rectCo[0].Id,
        AgentCode_Ext__c = '8888888',
        Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
      );
            myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
      insert myAccount1;
      contract = new Account(
        RecordTypeId = rectCo1[0].Id,
        Name = 'contractName',
        ParentId = myAccount1.id,
        Agent_Ref__c = myAccount1.id,
        Contract_Department_Class__c = 'ET',
        Contract_Decide_Start_Date__c = Date.today().addDays(-2),
        Contract_Decide_End_Date__c = Date.today().addDays(2),
        Dealer_discount__c = 0.8
      );
            contract = new Account(RecordTypeId=rectCo1[0].Id ,Name ='contractName',ParentId = myAccount1.id,Agent_Ref__c =myAccount1.id, Contract_Department_Class__c = 'ET',Contract_Decide_Start_Date__c=Date.today().addDays(-2),
                Contract_Decide_End_Date__c = Date.today().addDays(2),Dealer_discount__c = 0.8);
      insert contract;
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount1.id
      );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
      insert core;
      MyUser_Test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof1.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        Work_Location__c = '重庆'
      );
            MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '重庆');
      insert MyUser_Test;
      //产品数据
      Product2 prod01 = new Product2(
        Name = 'Test01',
            Product2 prod01 = new Product2(Name='Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
@@ -627,11 +354,9 @@
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
                                Manual_Entry__c = false);
      Product2 prod02 = new Product2(
        Name = 'Test02',
            Product2 prod02 = new Product2(Name='Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
@@ -648,11 +373,9 @@
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
                                Manual_Entry__c = false);
      Product2 prod03 = new Product2(
        Name = 'Test03',
            Product2 prod03 = new Product2(Name='Test03',
        ProductCode = 'Test03',
        Asset_Model_No__c = 'Test03',
        SFDA_Status__c = '有効',
@@ -665,32 +388,19 @@
        Intra_Trade_List_RMB_1__c = 1000,
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02, prod03 };
                                Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02,prod03};
      //制作产品
      Product2__c proG = new Product2__c(
        Name = 'MH-155:白平衡帽',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
            Product2__c proG = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
      insert proG;
      System.debug('proG:' + proG);
      System.debug('proG1:' + proG.Estimation_Entry_Possibility__c);
      System.debug('prod07:' + prod01);
      System.debug('prod071:' + prod01.Estimation_Entry_Possibility__c);
      Product2__c proH = new Product2__c(
        Name = 'MB-677:BNC电缆',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
            Product2__c proH = new Product2__c(Name='MB-677:BNC电缆',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
      insert proH;
      Product2__c proF = new Product2__c(
        Name = 'TooMAJ-643R:水囊鞘管003',
        OT_CODE_Text__c = 'Test003',
        Product2__c = prod03.Id
      );
            Product2__c proF = new Product2__c(Name='TooMAJ-643R:水囊鞘管003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
      insert proF;
      Dealer_Product__c dpc = new Dealer_Product__c();
@@ -747,70 +457,13 @@
    }
    System.runAs(MyUser_Test) {
      Test.startTest();
      LexConsumableController.Results re = LexConsumableController.init(
        '',
        order2.Id,
        ''
      );
      LexConsumableController.searchConsumableorderdetails(
        re.userWorkLocation,
        re.agencyProType,
        re.accountName,
        re.accountid,
        re.hospitalId,
        re.contractId,
        'testMing',
        '',
        '',
        '',
        re.category_Goods,
        re.specialCampaign,
        JSON.serialize(re.dealerProductId),
        re.methodType,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        re.editAble,
        re.proLimitAndDate
      );
      LexConsumableController.searchorderdetails(
        re.methodType,
        re.accountid,
        re.hospitalId,
        re.contractId,
        re.userWorkLocation,
        re.accountName,
        re.proLimitAndDate,
        re.editAble
      );
      LexConsumableController.searchConsumableorderdetails(
        re.userWorkLocation,
        re.agencyProType,
        re.accountName,
        re.accountid,
        re.hospitalId,
        contract.Id,
        'testMing',
        '',
        '',
        '',
        re.category_Goods,
        re.specialCampaign,
        JSON.serialize(re.dealerProductId),
        re.methodType,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        re.editAble,
        re.proLimitAndDate
      );
      LexConsumableController.searchorderdetails(
        re.methodType,
        re.accountid,
        re.hospitalId,
        contract.Id,
        re.userWorkLocation,
        re.accountName,
        re.proLimitAndDate,
        re.editAble
      );
            LexConsumableController.Results re =  LexConsumableController.init('', order2.Id, '');
            LexConsumableController.searchConsumableorderdetails(re.userWorkLocation, re.agencyProType, re.accountName, re.accountid, re.hospitalId, re.contractId, 'testMing', '', '', '', re.category_Goods, re.specialCampaign, JSON.serialize(re.dealerProductId), re.methodType, JSON.serialize(re.consumableorderdetailsRecordsview), re.editAble, re.proLimitAndDate);
            LexConsumableController.searchorderdetails(re.methodType, re.accountid, re.hospitalId, re.contractId, re.userWorkLocation, re.accountName, re.proLimitAndDate, re.editAble);
            LexConsumableController.searchConsumableorderdetails(re.userWorkLocation, re.agencyProType, re.accountName, re.accountid, re.hospitalId, contract.Id, 'testMing', '', '', '', re.category_Goods, re.specialCampaign, JSON.serialize(re.dealerProductId), re.methodType, JSON.serialize(re.consumableorderdetailsRecordsview), re.editAble, re.proLimitAndDate);
            LexConsumableController.searchorderdetails(re.methodType, re.accountid, re.hospitalId, contract.Id, re.userWorkLocation, re.accountName, re.proLimitAndDate, re.editAble);
      Test.stopTest();
    }
  }
@@ -820,92 +473,38 @@
    user MyUser_Test;
    Account myAccount1;
    Account contract;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
    insert n;
    System.runAs(thisUser) {
      Profile prof1 = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
      List<RecordType> rectCo1 = [
        SELECT Id
        FROM RecordType
        WHERE
          IsActive = TRUE
          AND SobjectType = 'Account'
          AND DeveloperName = 'AgencyContract'
      ];
            Profile prof1 = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
            List<RecordType> rectCo1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'AgencyContract'];
      if (rectCo.size() == 0) {
        return;
      }
      StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
      RecordType rectCoO = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
      ];
      Account olympus = new Account(
        RecordTypeId = rectCoO.Id,
        AgentCode_Ext__c = '9999900',
        Name = 'olympus'
      );
            RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
            Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
      insert olympus;
      myAccount1 = new Account(
        name = 'Testaccount001',
        Dealer_discount__c = 10,
        RecordTypeId = rectCo[0].Id,
        AgentCode_Ext__c = '8888888',
        Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
      );
            myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
      insert myAccount1;
      System.debug('account111:' + myAccount1);
      contract = new Account(
        RecordTypeId = rectCo1[0].Id,
        Name = 'contractName',
        ParentId = myAccount1.id,
        Agent_Ref__c = myAccount1.id,
        Contract_Department_Class__c = 'ET',
        Contract_Decide_Start_Date__c = Date.today().addDays(-2),
        Contract_Decide_End_Date__c = Date.today().addDays(2),
        ET_SP_Dealer__c = true
      );
            contract = new Account(RecordTypeId=rectCo1[0].Id ,Name ='contractName',ParentId = myAccount1.id,Agent_Ref__c =myAccount1.id, Contract_Department_Class__c = 'ET',Contract_Decide_Start_Date__c=Date.today().addDays(-2),
                Contract_Decide_End_Date__c = Date.today().addDays(2),ET_SP_Dealer__c = true);
      insert contract;
      System.debug('account111:' + contract);
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount1.id
      );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
      insert core;
      MyUser_Test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof1.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        Work_Location__c = '重庆'
      );
            MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '重庆');
      insert MyUser_Test;
    }
    System.runAs(MyUser_Test) {
      //产品数据
      Product2 prod01 = new Product2(
        Name = 'Test01',
            Product2 prod01 = new Product2(Name='Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
@@ -922,11 +521,9 @@
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
                                Manual_Entry__c = false);
      Product2 prod02 = new Product2(
        Name = 'Test02',
            Product2 prod02 = new Product2(Name='Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
@@ -943,11 +540,9 @@
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
                                Manual_Entry__c = false);
      Product2 prod03 = new Product2(
        Name = 'Test03',
            Product2 prod03 = new Product2(Name='Test03',
        ProductCode = 'Test03',
        Asset_Model_No__c = 'Test03',
        SFDA_Status__c = '有効',
@@ -960,33 +555,21 @@
        Intra_Trade_List_RMB_1__c = 1000,
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02, prod03 };
                                Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02,prod03};
      //制作产品
      Product2__c proG = new Product2__c(
        Name = 'MH-155:白平衡帽',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
            Product2__c proG = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
      insert proG;
      System.debug('proG:' + proG);
      System.debug('proG1:' + proG.Estimation_Entry_Possibility__c);
      System.debug('prod07:' + prod01);
      System.debug('prod071:' + prod01.Estimation_Entry_Possibility__c);
      Product2__c proH = new Product2__c(
        Name = 'MB-677:BNC电缆',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
            Product2__c proH = new Product2__c(Name='MB-677:BNC电缆',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
      insert proH;
      Product2__c proF = new Product2__c(
        Name = 'TooMAJ-643R:水囊鞘管003',
        OT_CODE_Text__c = 'Test003',
        Product2__c = prod03.Id
      );
            Product2__c proF = new Product2__c(Name='TooMAJ-643R:水囊鞘管003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
      insert proF;
      //订单
      Consumable_order__c order = new Consumable_order__c();
@@ -1023,111 +606,17 @@
      insert createDetail2;
      Test.startTest();
      LexConsumableController.Results re = LexConsumableController.init(
        'agreementorder',
        '',
        ''
      );
            LexConsumableController.Results re =  LexConsumableController.init('agreementorder', '', '');
      re.consumableorderdetailsRecordsview[0].check = true;
      re.consumableorderdetailsRecordsview[0].esd.Consumable_count__c = 1;
      String conId = contract.Id;
      LexConsumableController.ordrCopy(
        contract.Name,
        JSON.serialize(re.coc),
        re.agencyProType,
        re.accountid,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        JSON.serialize(re.contactDealer),
        re.methodType,
        '',
        conId,
        re.agencyProType1,
        false
      );
      LexConsumableController.save(
        '',
        JSON.serialize(re.coc),
        re.agencyProType,
        re.accountid,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        JSON.serialize(re.contactDealer),
        re.methodType,
        re.ESetId,
        '',
        conId,
        re.agencyProType1,
        false
      );
      LexConsumableController.save(
        contract.Name,
        JSON.serialize(re.coc),
        re.agencyProType,
        re.accountid,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        JSON.serialize(re.contactDealer),
        re.methodType,
        re.ESetId,
        '',
        '',
        re.agencyProType1,
        false
      );
      LexConsumableController.save(
        ':Testaccount001',
        JSON.serialize(re.coc),
        'ET',
        re.accountid,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        JSON.serialize(re.contactDealer),
        re.methodType,
        re.ESetId,
        '',
        re.contractId,
        'ET',
        false
      );
      LexConsumableController.save(
        ':Testaccount001',
        JSON.serialize(re.coc),
        'ET',
        re.accountid,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        JSON.serialize(re.contactDealer),
        'agreementorder',
        re.ESetId,
        '',
        re.contractId,
        'ET',
        false
      );
      LexConsumableController.save(
        ':Testaccount001',
        JSON.serialize(re.coc),
        'ET',
        re.accountid,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        JSON.serialize(re.contactDealer),
        'promotionorder',
        re.ESetId,
        '',
        re.contractId,
        'ET',
        false
      );
      LexConsumableController.save(
        ':Testaccount001',
        JSON.serialize(re.coc),
        'ET',
        re.accountid,
        JSON.serialize(re.consumableorderdetailsRecordsview),
        JSON.serialize(re.contactDealer),
        'hospitalorder',
        re.ESetId,
        '',
        re.contractId,
        'ET',
        false
      );
            LexConsumableController.ordrCopy(contract.Name,JSON.serialize(re.coc),re.agencyProType,re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),re.methodType,'',conId,re.agencyProType1,false);
            LexConsumableController.save('',JSON.serialize(re.coc),re.agencyProType,re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),re.methodType,re.ESetId,'',conId,re.agencyProType1,false);
            LexConsumableController.save(contract.Name,JSON.serialize(re.coc),re.agencyProType,re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),re.methodType,re.ESetId,'','',re.agencyProType1,false);
            LexConsumableController.save(':Testaccount001',JSON.serialize(re.coc),'ET',re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),re.methodType,re.ESetId,'',re.contractId,'ET',false);
            LexConsumableController.save(':Testaccount001',JSON.serialize(re.coc),'ET',re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),'agreementorder',re.ESetId,'',re.contractId,'ET',false);
            LexConsumableController.save(':Testaccount001',JSON.serialize(re.coc),'ET',re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),'promotionorder',re.ESetId,'',re.contractId,'ET',false);
            LexConsumableController.save(':Testaccount001',JSON.serialize(re.coc),'ET',re.accountid,JSON.serialize(re.consumableorderdetailsRecordsview),JSON.serialize(re.contactDealer),'hospitalorder',re.ESetId,'',re.contractId,'ET',false);
      Test.stopTest();
    }
  }
@@ -1136,65 +625,26 @@
  static void ConsumableOrdertest5() {
    user MyUser_Test;
    Account myAccount1;
    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
    NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true);
    ContentVersion cv;
    Consumable_order__c order;
    insert n;
    System.runAs(thisUser) {
      Profile prof1 = [
        SELECT Id
        FROM Profile
        WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
      ];
      List<RecordType> rectCo = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
      ];
            Profile prof1 = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
      if (rectCo.size() == 0) {
        return;
      }
      StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
      RecordType rectCoO = [
        SELECT Id
        FROM RecordType
        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
      ];
      Account olympus = new Account(
        RecordTypeId = rectCoO.Id,
        AgentCode_Ext__c = '9999900',
        Name = 'olympus'
      );
            RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
            Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
      insert olympus;
      myAccount1 = new Account(
        name = 'Testaccount001',
        Dealer_discount__c = 10,
        RecordTypeId = rectCo[0].Id,
        AgentCode_Ext__c = '8888888',
        Product_Limit_Date__c = 'Test07|3|100,Test08|10|50'
      );
            myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
      insert myAccount1;
      Contact core = new Contact(
        email = 'jplumber@salesforce.com',
        firstname = 'Joe',
        lastname = 'Plumber',
        accountid = myAccount1.id
      );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
      insert core;
      MyUser_Test = new User(
        ContactId = core.id,
        Alias = 'newUser',
        Email = 'newuser@testorg.com',
        EmailEncodingKey = 'UTF-8',
        LastName = 'TestUser',
        LanguageLocaleKey = 'zh_CN',
        LocaleSidKey = 'zh_CN',
        ProfileId = prof1.Id,
        TimeZoneSidKey = 'Asia/Shanghai',
        UserName = 'testUser@testorg.com',
        Work_Location__c = '重庆'
      );
            MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '重庆');
      insert MyUser_Test;
      order = new Consumable_order__c();
@@ -1215,10 +665,10 @@
      cv.VersionData = EncodingUtil.base64Decode('VGVzdA==');
      cv.IsMajorVersion = true;
      insert cv;
    }
    System.runAs(MyUser_Test) {
      Product2 prod01 = new Product2(
        Name = 'Test01',
            Product2 prod01 = new Product2(Name='Test01',
        ProductCode = 'Test01',
        Asset_Model_No__c = 'Test01',
        SFDA_Status__c = '有効',
@@ -1238,8 +688,7 @@
        Manual_Entry__c = false
      );
      Product2 prod02 = new Product2(
        Name = 'Test02',
            Product2 prod02 = new Product2(Name='Test02',
        ProductCode = 'Test02',
        Asset_Model_No__c = 'Test02',
        SFDA_Status__c = '有効',
@@ -1259,8 +708,7 @@
        Manual_Entry__c = false
      );
      Product2 prod03 = new Product2(
        Name = 'Test03',
            Product2 prod03 = new Product2(Name='Test03',
        ProductCode = 'Test03',
        Asset_Model_No__c = 'Test03',
        SFDA_Status__c = '有効',
@@ -1273,13 +721,10 @@
        Intra_Trade_List_RMB_1__c = 1000,
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
                                Manual_Entry__c = false);
      Product2 prod04 = new Product2(
        Name = 'Test04',
        ProductCode = 'Test04',
        Asset_Model_No__c = 'Test04',
            Product2 prod04 = new Product2(Name='Test04',
                ProductCode='Test04',Asset_Model_No__c = 'Test04',
        SFDA_Status__c = '有効',
        Dealer_special_Object__c = true,
        Product_Status__c = '正常销售',
@@ -1290,10 +735,8 @@
        Intra_Trade_List_RMB_1__c = 1000,
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
      Product2 prod05 = new Product2(
        Name = 'Test05',
                                Manual_Entry__c = false);
            Product2 prod05 = new Product2(Name='Test05',
        ProductCode = 'Test05',
        Asset_Model_No__c = 'Test05',
        SFDA_Status__c = '有効',
@@ -1306,64 +749,24 @@
        Intra_Trade_List_RMB_1__c = 1000,
        Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
        Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
        Manual_Entry__c = false
      );
      insert new List<Product2>{ prod01, prod02, prod03, prod04, prod05 };
      Product2__c pro1 = new Product2__c(
        Name = 'Pro001',
        OT_CODE_Text__c = 'Test001',
        Product2__c = prod01.Id
      );
      Product2__c pro2 = new Product2__c(
        Name = 'Pro002',
        OT_CODE_Text__c = 'Test002',
        Product2__c = prod02.Id
      );
      Product2__c pro3 = new Product2__c(
        Name = 'Pro003',
        OT_CODE_Text__c = 'Test003',
        Product2__c = prod03.Id
      );
      Product2__c pro4 = new Product2__c(
        Name = 'Pro004',
        OT_CODE_Text__c = 'Test004',
        Product2__c = prod04.Id
      );
      Product2__c pro5 = new Product2__c(
        Name = 'Pro005',
        OT_CODE_Text__c = 'Test005',
        Product2__c = prod05.Id
      );
      insert new List<Product2__c>{ pro1, pro2, pro3, pro4, pro5 };
                                Manual_Entry__c = false);
            insert new Product2[] {prod01,prod02,prod03, prod04, prod05};
            Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id);
            Product2__c pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id);
            Product2__c pro4 = new Product2__c(Name='Pro004',OT_CODE_Text__c='Test004',Product2__c = prod04.Id);
            Product2__c pro5 = new Product2__c(Name='Pro005',OT_CODE_Text__c='Test005',Product2__c = prod05.Id);
            insert new Product2__c[] {pro1,pro2,pro3,pro4, pro5};
      Test.startTest();
      LexConsumableController.Results re1 = LexConsumableController.categoryAllload(
        'ET',
        'CDS'
      );
      LexConsumableController.Results re2 = LexConsumableController.categoryAllload(
        'ENG',
        'CDS'
      );
      LexConsumableController.Results re3 = LexConsumableController.categoryAllload(
        '',
        'CDS'
      );
      LexConsumableController.Results re4 = LexConsumableController.categoryload(
        'ET',
        'CDS',
        'OER'
      );
      LexConsumableController.Results re5 = LexConsumableController.categoryload(
        'ENG',
        'CDS',
        'OER'
      );
      LexConsumableController.Results re6 = LexConsumableController.categoryload(
        '',
        'CDS',
        'OER'
      );
            LexConsumableController.Results re1 =  LexConsumableController.categoryAllload('ET','CDS');
            LexConsumableController.Results re2 =  LexConsumableController.categoryAllload('ENG','CDS');
            LexConsumableController.Results re3 =  LexConsumableController.categoryAllload('','CDS');
            LexConsumableController.Results re4 =  LexConsumableController.categoryload('ET','CDS','OER');
            LexConsumableController.Results re5 =  LexConsumableController.categoryload('ENG','CDS','OER');
            LexConsumableController.Results re6 =  LexConsumableController.categoryload('','CDS','OER');
      String pid = order.Id;
      LexConsumableController.filesUpload(pid, 'tset.txt', 'VGVzdA==');
      LexConsumableController.deleteAtt(cv.Id, pid);
Diff truncated after the above file
force-app/main/default/classes/LexConsumableControllerTest.cls-meta.xml force-app/main/default/classes/LexConsumableGoodsInfoTest.cls force-app/main/default/classes/LexConsumableGoodsInfoTest.cls-meta.xml force-app/main/default/classes/LexConsumableOrderManageController.cls force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls force-app/main/default/classes/LexConsumableOrderManageControllerTest.cls-meta.xml force-app/main/default/classes/LexInventoryController.cls force-app/main/default/classes/LexInventoryControllerTest.cls force-app/main/default/classes/LexInventoryControllerTest.cls-meta.xml force-app/main/default/classes/LexInventoryListController.cls force-app/main/default/classes/LexInventoryListControllerTest.cls force-app/main/default/classes/LexInventoryListControllerTest.cls-meta.xml force-app/main/default/classes/LexInventoryViewControllerTest.cls force-app/main/default/classes/LexInventoryViewControllerTest.cls-meta.xml force-app/main/default/classes/LexLicenceReminderControllerTest.cls force-app/main/default/classes/LexLicenceReminderControllerTest.cls-meta.xml force-app/main/default/classes/LexOutboundorderImportController.cls force-app/main/default/classes/LexOutboundorderImportControllerTest.cls force-app/main/default/classes/LexOutboundorderImportControllerTest.cls-meta.xml force-app/main/default/classes/LexOverdueStockController.cls force-app/main/default/classes/LexOverdueStockControllerTest.cls force-app/main/default/classes/LexOverdueStockControllerTest.cls-meta.xml force-app/main/default/classes/LexProductLimitEditControllerTest.cls force-app/main/default/classes/LexProductLimitEditControllerTest.cls-meta.xml force-app/main/default/classes/LexRemoveBoxControllerTest.cls force-app/main/default/classes/LexRemoveBoxControllerTest.cls-meta.xml force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls force-app/main/default/classes/LexSaleAndDeliveryControllerTest.cls-meta.xml force-app/main/default/classes/LexSaleOrderController.cls force-app/main/default/classes/LexSaleOrderControllerTest.cls force-app/main/default/classes/LexSaleOrderControllerTest.cls-meta.xml force-app/main/default/classes/LexSearchContractControllerTest.cls force-app/main/default/classes/LexSearchContractControllerTest.cls-meta.xml force-app/main/default/classes/LexSearchHospitalControllerTest.cls force-app/main/default/classes/LexSearchHospitalControllerTest.cls-meta.xml force-app/main/default/classes/LexSummonsCreatController.cls force-app/main/default/classes/LexSummonsCreatControllerTest.cls force-app/main/default/classes/LexSummonsCreatControllerTest.cls-meta.xml force-app/main/default/classes/LexTopPageControllerTest.cls force-app/main/default/classes/LexTopPageControllerTest.cls-meta.xml force-app/main/default/classes/LexUpAccountProLimit.cls force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls force-app/main/default/classes/LexUpAccountProLimitControllerTest.cls-meta.xml force-app/main/default/classes/LexUtilityTest.cls force-app/main/default/classes/LexUtilityTest.cls-meta.xml force-app/main/default/classes/LookupSearchResultTest.cls force-app/main/default/classes/LookupSearchResultTest.cls-meta.xml force-app/main/default/classes/ResponseBodyLWCTest.cls force-app/main/default/classes/ResponseBodyLWCTest.cls-meta.xml force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls-meta.xml force-app/main/default/contentassets/OlympusCommunityLoginBG.asset-meta.xml force-app/main/default/contentassets/OlympusCommunityLogo.asset-meta.xml force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.html force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js-meta.xml force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.html force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js-meta.xml force-app/main/default/lwc/customMydrComp/customMydrComp.html force-app/main/default/lwc/customMydrComp/customMydrComp.js force-app/main/default/lwc/customMydrComp/customMydrComp.js-meta.xml force-app/main/default/lwc/customOutputGood/customOutputGood.html force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js force-app/main/default/lwc/lexConsumable/lexConsumable.html force-app/main/default/lwc/lexConsumable/lexConsumable.js force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html force-app/main/default/lwc/lexInventory/lexInventory.html force-app/main/default/lwc/lexInventory/lexInventory.js force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js force-app/main/default/lwc/lexTopPage/lexTopPage.html force-app/main/default/lwc/lexTopPage/lexTopPage.js force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js force-app/main/default/lwc/paginator/paginator.html force-app/main/default/lwc/paginator/paginator.js force-app/main/default/pages/DealerInquiryModifyState.page force-app/main/default/pages/DealerInquiryModifyState.page-meta.xml force-app/main/default/permissionsets/Community_Consumable_LEX_PS.permissionset-meta.xml force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger-meta.xml force-app/main/default/triggers/ContentDocumentLink.trigger force-app/main/default/triggers/ContentDocumentTrigger.trigger manifest/LEXC02packagelexcommunityupdate.xml