binxie
2023-06-26 00e147ec892cb1e89d0698787a8c60da1014cdb7
Community升级
1个文件已添加
155个文件已修改
34736 ■■■■■ 已修改文件
force-app/main/default/aura/CreateTarget/CreateTarget.cmp 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/CreateTarget/CreateTarget.cmp-meta.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/CreateTarget/CreateTarget.css 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.cmp 150 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.css 105 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportController.js 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js 815 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReport.css 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReportController.js 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js 209 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ArriveGoodsController.cls 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ArriveGoodsControllerTest.cls 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/DealerInquiryModifyStateController.cls 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGoodsController.cls 163 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGoodsMainController.cls 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGsDetailsController.cls 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexCancelRemoveBoxController.cls 814 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoiceViewController.cls 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoicedetailsController.cls 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountController.cls 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountInfoController.cls 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountSOQL.cls 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableController.cls 221 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableGoodsInfo.cls 779 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryController.cls 1763 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryListController.cls 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryViewController.cls 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexLicenceReminderController.cls 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexOutboundorderImportController.cls 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexOverdueStockController.cls 321 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexProductLimitEditController.cls 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexRemoveBoxController.cls 759 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSaleAndDeliveryController.cls 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSaleOrderController.cls 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSearchContractController.cls 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSearchHospitalController.cls 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSummonsCreatController.cls 2247 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexTopPageController.cls 529 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexUpAccountProLimit.cls 119 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexUtility.cls 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LookupSearchResult.cls 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ResponseBodyLWC.cls 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexSearchAgencyHospitalController.cls 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/boxorpieceType/boxorpieceType.html 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/boxorpieceType/boxorpieceType.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/commonToast/commonToast.html 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/commonToast/commonToast.js 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.html 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customOutputGood/customOutputGood.html 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customOutputGood/customOutputGood.js 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.html 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.html 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js 86 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.html 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customUnitComp/customUnitComp.js 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.html 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.css 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.html 188 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.html 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html 363 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js 1025 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html 205 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js 518 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.html 146 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js 299 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html 240 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js 398 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.css 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html 1214 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js 2169 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumable/lexConsumable.html 979 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumable/lexConsumable.js 3036 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.html 465 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js 961 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.html 211 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html 189 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js 213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCssUtility/lexCssUtility.css 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.html 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customAgencyOppInput.html 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customInventoryColor.html 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customOutboundCount.html 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentAmount.html 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customShippingUnitPrice.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customTableCellIcon.html 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customTableInput.html 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customaccountUrl.html 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/customdeleteReason.html 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomDiffReason.html 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.html 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.html 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.html 182 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js 773 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexInventory/lexInventory.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexInventory/lexInventory.html 311 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexInventory/lexInventory.js 1481 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.html 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLookup/lexLookup.html 220 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLookup/lexLookup.js 123 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexNewOrder/lexNewOrder.html 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexNewOrder/lexNewOrder.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.css 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.html 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js 285 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.html 215 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js 704 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.html 141 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js 284 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html 254 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js 446 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.html 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html 300 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js 337 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html 368 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js 318 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.html 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTopPage/lexTopPage.html 147 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTopPage/lexTopPage.js 622 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html 276 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js 1213 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.html 135 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js 212 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/myCustomTypeDatatable/customName.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/myCustomTypeDatatable/customNumber.html 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/myCustomTypeDatatable/customUnit.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.html 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/DealerInquiryModifyState.page 694 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/DealerInquiryModifyState.page-meta.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ContentDocumentLink.trigger 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ContentDocumentTrigger.trigger 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest/LEXC01packagelexcommunitynew.xml 208 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest/LEXC02packagelexcommunityupdate.xml 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/CreateTarget/CreateTarget.cmp
@@ -1,4 +1,4 @@
<aura:component controller="CreateTargetCmp" implements="forceCommunity:availableForAllPageTypes,force:hasRecordId" 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=""/>
@@ -48,7 +48,7 @@
        <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 class="close_icn" iconName="utility:close" size="medium" alternativeText="Indicates approval"/>
                    <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>
@@ -61,6 +61,9 @@
                                <div class="slds-form-element slds-size--1-of-2">
                                    <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 fieldName="Agency_Hospital__c"/>
                                    </lightning:recordEditForm> -->
                                </div>
                            </div>
                            <!-- <h4 class="slds-section__title">访问目标</h4>
@@ -89,7 +92,7 @@
                                </div>
                                <div class="slds-form-element slds-size--1-of-7">
                                    <label class="slds-form-element__label" for="input-hos">金额目标(不含税)</label>
                                    <ui:inputText aura:id="select_GI4_2" class="slds-select" />
                                    <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>
force-app/main/default/aura/CreateTarget/CreateTarget.cmp-meta.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>39.0</apiVersion>
    <apiVersion>42.0</apiVersion>
    <description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>
force-app/main/default/aura/CreateTarget/CreateTarget.css
@@ -3,4 +3,10 @@
}
.THIS.disp_none {
    display: none;
}
.THIS select {
    --lwc-lineHeightButton:36px;
    --lwc-heightInput:36px;
    min-height: 0px !important;
    height: 36px !important;
}
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.cmp
@@ -25,6 +25,8 @@
    <aura:attribute name="doclist" type="List" />
    <aura:attribute name="docmap" type="Map" />
    <aura:attribute name="login" type="Boolean" default="false" />
    <aura:attribute name="loginEdit" type="Boolean" default="false" />
    <aura:attribute name="modal_import_spinner" type="Boolean" default="false" />
    <aura:attribute name="loadOpp" type="Boolean" default="false" />
    <aura:attribute name="reportPageData" type="Map" />
    <aura:attribute name="selectbody" type="String" />
@@ -110,9 +112,6 @@
    <aura:attribute name="showMain" type="Boolean" default="true" />
    <aura:attribute name="IsEventDefault" type="Boolean" default="true" />
    <!-- start DTT-zhj 增加错误信息table 2023-05-16-->
    <!-- Imports -->
    <!-- <aura:import library="lightningcomponentdemo:mockdataFaker" property="mockdataLibrary"/> -->
    <!-- attributes -->
    <aura:attribute name="errorData" type="Object" />
    <aura:attribute name="errorColumns" type="List" />
    <!-- show Error information -->
@@ -127,22 +126,19 @@
    <!-- 批量添加日报 end-->
    <!--ロード中...-->
    <aura:renderIf isTrue="{!v.login}">
        <div class="slds-spinner_container height100vh">
            <div class="slds-spinner--brand slds-spinner slds-spinner--medium" role="alert">
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
            </div>
        </div>
        <aura:renderIf isTrue="{!!v.loginEdit}">
            <lightning:spinner alternativeText="Loading" size="medium" />
        </aura:renderIf>
    </aura:renderIf>
    <div aura:id="report" id="report" class="contents_wrapper">
    <div aura:id="report" id="report">
        <div class="slds-grid slds-wrap slds-grid--pull-padded">
            <div style="width: 200px;"></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">
                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">
            <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}" />
            </div>
            <!-- 代理店担当者 -->
@@ -159,15 +155,17 @@
            </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}" />
                <ui:button aura:id="new_button" label="新建" press="{!c.new_report}" class="buttonFontSize" />
            </div>
            <div style="width: 350px;"
                class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--2-of-12 slds-large-size--2-of-12">
                <ui:button aura:id="copy_button" label="复制" press="{!c.copy_button}" disabled="true" />
                <ui:button aura:id="delete_button" label="删除" press="{!c.delete_button}" disabled="true" />
                <ui:button aura:id="import" label="导入" press="{!c.import}" />
                <ui:button aura:id="export" label="导出" press="{!c.export_condition}" />
                <ui:button aura:id="returnbutton" label="返回" press="{!c.return_main_page}" />
            <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>
@@ -177,28 +175,29 @@
                role="grid" style="width:66.75rem;">
                <thead>
                    <tr class="slds-line-height--reset">
                        <th class="table_header slds-text-title--caps" 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">
                        <th class="table_header slds-text-title--caps fontSize">
                            <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" 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">
                        <th class="table_header slds-text-title--caps fontSize">
                            <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">
                        <th class="table_header slds-text-title--caps fontSize">
                            <span class="slds-truncate" title="Name">拜访人</span>
                            <!-- {!v.fieldsmap.doctor2__c}    拜访人 -->
                        </th>
                        <th class="table_header slds-text-title--caps">
                        <th class="table_header slds-text-title--caps fontSize">
                            <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">
                        <th class="table_header slds-text-title--caps fontSize">
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.WorkMark__c}</span>
                            <!-- {!v.fieldsmap.visitor_title__c}   职位-->
                        </th>
@@ -207,31 +206,31 @@
                <tbody>
                    <aura:iteration items="{!v.reports}" var="item" indexVar="index">
                        <tr class="slds-hint-parent">
                            <td role="gridcell" class="slds-cell-edit">
                            <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}" />
                            </td>
                            <td role="gridcell" class="slds-cell-edit">
                            <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>
                            </td>
                            <th scope="row" tabindex="0" class="slds-cell-edit">
                                <span class="slds-grid slds-grid--align-spread">
                            <td scope="row" tabindex="0" class="slds-cell-edit fontSize">
                                <div class="slds-grid slds-grid--align-spread" style="word-wrap: break-word;">
                                    {!item.Agency_Hospital__r.Name}
                                </span>
                            </th>
                            <td role="gridcell" class="slds-cell-edit">
                                </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>
                            </td>
                            <td role="gridcell" class="slds-cell-edit">
                            <td role="gridcell" class="slds-cell-edit fontSize">
                                <span class="slds-grid slds-grid--align-spread">
                                    <span class="slds-truncate" title="{!item.doctor2__r.Name}">
                                        <span class="encrypt">{!item.doctor2__r.Name}</span>
@@ -239,13 +238,13 @@
                                    </span>
                                </span>
                            </td>
                            <td role="gridcell" class="slds-cell-edit">
                            <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>
                            </td>
                            <td role="gridcell" class="slds-cell-edit">
                            <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}"
@@ -269,6 +268,9 @@
    <!-- 批量添加日报 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">
        <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;">
@@ -286,8 +288,7 @@
                </div>
            </div>
        </div>
        <div class="slds-modal slds-fade-in-open slds-hide" aura:id="errorDiv01" style="z-index: 10001">
            <!-- <ui:inputText aura:id="articleURL" /> -->
        <!-- <div class="slds-modal slds-fade-in-open slds-hide" aura:id="errorDiv01" style="z-index: 10001">
            <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">
@@ -297,36 +298,41 @@
                                <lightning:icon alternativeText="error" iconName="utility:error" size="small"
                                    class="buttonColor slds-m-right_small" />
                                <h2 class="slds-text-heading_small ">{!v.errorMessage}</h2>
                                <lightning:icon alternativeText="Close" iconName="utility:close" size="small"
                                        onclick="{!c.closeErrorDiv}" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        </div> -->
        <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_import}" />
                    class="close_button slds-button slds-button--neutral slds-order--1 buttonFontSize"
                    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 fontSize">
                <aura:if isTrue="{!v.showMain}">
                    <div>
                        <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" 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}" />
                            <lightning:button label="取消" variant="brand" onclick="{!c.cancel}" />
                            <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}" />
                            </div>
                            <div class="slds-p-around--large slds-align--absolute-center">
                                <div style="height: 300px;">
                                <div style="height: 300px;overflow-x:scroll">
                                    <lightning:datatable keyField="id" data="{! v.errorData }"
                                        columns="{! v.errorColumns }" hideCheckboxColumn="true" />
                                </div>
@@ -391,8 +397,8 @@
    <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 class="slds-modal__container">
        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;">
@@ -427,24 +433,28 @@
                    </div>
                </div>
            </div>
            <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="关闭"
                    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-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%;"/>
                </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="关闭"
                        class="close_button slds-button slds-button--neutral slds-order--1" 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-5 slds-large-size--1-of-6">
                            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" />
                        </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-6"
                            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">
                            <!-- label="医院" -->
                            医院
@@ -470,7 +480,7 @@
                        </div>
                        <!-- 科室分类 -->
                        <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-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}"/> -->
@@ -478,20 +488,20 @@
                                variant="label-hidden" />
                        </div>
                        <!-- 经销商人员  change="{!c.select_DealerPersonnel}" -->
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"
                        <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" />
                        </div>
                        <!-- 活动区分   -->
                        <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-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}" />
                        </div>
                        <!-- 拜访人 {!v.fieldsmap.doctor2__c}-->
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6"
                        <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}" />
@@ -499,7 +509,7 @@
                        <!-- <p hidden="hidden"> -->
                        <div
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-12">
                            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" />
@@ -509,14 +519,14 @@
                        <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-6">
                            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}" />
                        </div>
                        <!-- 使用产品1(产品型号)   UseProduct1__c  -->
                        <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-6"
                            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">
                            <!-- label="使用产品1(产品型号)" -->
                            使用产品1(产品型号)
@@ -542,7 +552,7 @@
                        </div>
                        <!-- 使用产品2   UseProduct2__c  -->
                        <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-6"
                            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">
                            <!-- label="使用产品2" -->
                            使用产品2
@@ -568,7 +578,7 @@
                        </div>
                        <!-- 使用产品3   UseProduct3__c  -->
                        <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-6"
                            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">
                            <!-- label="使用产品3" -->
                            使用产品3
@@ -594,14 +604,14 @@
                        </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-6">
                            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" />
                        </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-6">
                            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}" /> -->
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.css
@@ -1,141 +1,202 @@
@import 'c/lexCssUtility';
.THIS .bcolor {
    color: #333;
}
.THIS.height100vh {
    height: 100vh;
}
.THIS.contents_wrapper {
    padding-top: 50px;
}
.THIS .mt5 {
    margin-top: 5px;
}
.THIS .mt40 {
    margin-top: 40px;
}
.THIS .edit_button {
    float: right;
    margin: -1.5em 0.5em 0 0;
    border: 0;
}
.THIS .no_data_area {
    text-align: center;
    margin: .5em 0;
}
.THIS.report_list_area {
    margin: 40px 0 20px 100px;
    height: 60vh;
    overflow-y: scroll;
}
.THIS .report_radio {
    float: left;
}
.THIS .table_header {
    width: 9.4rem;
    height: 2em;
}
.THIS.disp_none {
    display: none;
}
.THIS .disp_none {
    display: none;
}
.THIS .tr {
    text-align: right;
}
.THIS .close_button {
    float: right;
    margin-top: -2em;
}
.THIS .close_icn svg {
    fill: #fefefe;
}
.THIS .slds-progress__marker {
    cursor: default;
}
.THIS .progress_0 {
    width: 0%;
}
.THIS .progress_100 {
    width: 100%;
}
.THIS .new_btn_area {
    text-align: center;
    margin-top: 22px;
}
.THIS .new_btn {
    width: 100%;
}
.THIS .save_button_area {
    margin: 1em 0;
    text-align: right;
}
.THIS .save_button {
    background-color: #ffa500;
    border: 1px solid #ff8c00;
}
.THIS .report_data_header {
    border-bottom: 2px solid #ccc;
}
.THIS .report_data_area {
    border-bottom: 1px solid #ccc;
}
.THIS.fade {
    transition: 5s opacity linear;
}
.THIS.animation_off {
    opacity: 0;
}
.THIS.animation_on {
    opacity: 1;
}
.THIS .fade {
    transition: 5s opacity linear;
}
.THIS .animation_off {
    opacity: 0;
}
.THIS .animation_on {
    opacity: 1;
}
.THIS .divbotuser{
    width:fit-content;
.THIS .divbotuser {
    width: fit-content;
}
.THIS .toastMessage.forceActionsText{
    white-space : pre-line !important;
.THIS .toastMessage.forceActionsText {
    white-space: pre-line !important;
}
.THIS .slds-file-selector__dropzone .slds-file-selector__text{
.THIS .slds-file-selector__dropzone .slds-file-selector__text {
    display: none;
}
.THIS .slds-input:focus, .THIS .slds-input:active {
     border-color: rgb(216, 221, 230);
     box-shadow: none;
.THIS .slds-input:focus,
.THIS .slds-input:active {
    border-color: rgb(216, 221, 230);
    box-shadow: none;
}
.THIS .customRequired{
     font-weight: 400;
}
.THIS .customRequired:before{
     content: "*";
     margin: 0 0.125rem 0 0.125rem;
     color: rgb(194, 57, 52);
     float: left;
}
.THIS .none{
     display:none;
.THIS .customRequired {
    font-weight: 400;
}
.THIS tr .decrypt{
.THIS .customRequired:before {
    content: "*";
    margin: 0 0.125rem 0 0.125rem;
    color: rgb(194, 57, 52);
    float: left;
}
.THIS .none {
    display: none;
}
.THIS tr:hover .decrypt{
.THIS tr .decrypt {
    display: none;
}
.THIS tr:hover .decrypt {
    display: unset;
}
.THIS tr:hover .encrypt{
.THIS tr:hover .encrypt {
    display: none;
}
.THIS tr:hover .encrypt {
    display: none;
}
.THIS .buttonFontSize {
    font-size: 18px;
    min-width: 80px;
    max-width: 110px;
}
.THIS .fontSize {
    font-size: 18px;
}
.THIS thead th {
    font-size: 18px;
}
.THIS table {
    table-layout: fixed;
}
.THIS td {
    white-space: normal;
    overflow-wrap: break-word;
}
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportController.js
@@ -1,10 +1,6 @@
({
    doInit: function (component, event, helper) {
        helper.doinit(component, event, helper);
        component.set('v.errorColumns', [
            { label: '错误行', fieldName: 'errorRow', type: 'text', hideDefaultActions: true, initialWidth: 100},
            { label: '错误信息', fieldName: 'errorInfo', type: 'text', hideDefaultActions: true, },
        ]);
    },
    createAopp: function (component, event, helper) {
@@ -278,6 +274,7 @@
    CreateRecord: function (component, event, helper) {
        var files = event.getSource().get("v.files");
        helper.readFile(component, helper, files[0]);
        component.set("v.showErrorInfo", false);
    },
    processFileContent: function (component, event, helper) {
@@ -345,7 +342,11 @@
    return_main_page: function (component, event, helper) {
        window.open('/customer/', '_self');
    },
    exportErrorInfo: function(component,event,helper){
    exportErrorInfo: function (component, event, helper) {
        helper.exportErrorInfoHelper(component);
    },
    closeErrorDiv: function (component, event, helper) {
        var errorDiv01 = component.find('errorDiv01');
        $A.util.addClass(errorDiv01, 'slds-hide');
    }
})
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js
@@ -1,7 +1,7 @@
({
    doinit: function (component, event, helper) {
        document.title = "追溯日报";
        debugger
        this.report_date_list(component, event, helper, 5);
        component.set('v.login', true);
        var action = component.get('c.getalldata');
@@ -14,7 +14,7 @@
                component.set('v.allselectlist', res.allselectlist);
                component.set('v.doclist', res.doclist);
                //fy
                debugger
                var xx = res.UserProType;
                component.set('v.UserProType', res.UserProType);
                var gg = component.get('v.UserProType');
@@ -32,7 +32,8 @@
                component.set('v.login', false);
            }
            else {
                component.set('v.errorMessage', 'doinit failed.');
                //component.set('v.errorMessage', 'doinit failed.');
                this.error('doinit failed.');
                this.showErrorToast(component);
                component.set('v.login', false);
            }
@@ -58,7 +59,7 @@
    },
    //根据周和担当查询数据给初始页面赋数据
    get_reports: function (component, event, helper, date_str, person_str) {
        debugger
        if (!date_str) {
            return false;
        }
@@ -77,7 +78,7 @@
        });
        component.set('v.login', true);
        action.setCallback(this, function (response) {
            debugger
            var state = response.getState();
            if (state == 'SUCCESS') {
                var res = response.getReturnValue();
@@ -127,7 +128,7 @@
                                            m[data.object[di].dataId] = data.object[di];
                                        }
                                    }
                                    debugger
                                    for (let ri in res.reports) {
                                        if (res.reports[ri] && res.reports[ri].doctor2__r && res.reports[ri].doctor2__r.AWS_Data_Id__c && m.hasOwnProperty(res.reports[ri].doctor2__r.AWS_Data_Id__c)) {
                                            res.reports[ri].doctor2__r.awsdata = m[res.reports[ri].doctor2__r.AWS_Data_Id__c];
@@ -157,7 +158,8 @@
            }
            else {
                component.set('v.errorMessage', 'get_reports failed.');
                //component.set('v.errorMessage', 'get_reports failed.');
                this.error('get_reports failed.');
                this.showErrorToast(component);
                component.set('v.login', false);
            }
@@ -195,7 +197,7 @@
    },
    //复制和编辑回显的位置
    toggle_report: function (component) {
        debugger
        var modal_window = component.find('modal_window');
        var modal_bg = component.find('modal_bg');
        if ($A.util.hasClass(modal_window, 'disp_none')) {
@@ -318,7 +320,7 @@
                if (select_data['WorkMark__c'] != false) {
                    component.find('select_WorkMark').set('v.checked', select_data['WorkMark__c']);
                }
                debugger;
                ;
                var report_id = component.get('v.edit_copy_select_report_id');
                if (report_id != "") {
@@ -454,6 +456,269 @@
            }
        }
    },
    toggle_report_edit: function (component) {
        var modal_window = component.find('modal_window');
        var modal_bg = component.find('modal_bg');
        if ($A.util.hasClass(modal_window, 'disp_none')) {
            // OPEN
            $A.util.removeClass(modal_window, 'disp_none');
            $A.util.removeClass(modal_bg, 'disp_none');
            component.set('v.loginEdit',true);
            //复制  和编辑   回显问题在这里面
            if (component.get('v.mode') == 'edit' || component.get('v.mode') == 'copy') {
                var select_data = '';
                if (component.get('v.mode') == 'edit') {
                    select_data = component.get('v.select_report_data');
                } else if (component.get('v.mode') == 'copy') {
                    select_data = component.get('v.select_report_data_radio');
                }
                var reports = component.get('v.reports');
                var Agency_Hospital_text = '';
                var Agency_Hospital_parent_id = '';
                // 医院名
                if (select_data['Agency_Hospital__c'] != '') {
                    for (var i = 0; i < reports.length; i++) {
                        if (reports[i]['Agency_Hospital__c'] == select_data['Agency_Hospital__c']) {
                            Agency_Hospital_text = reports[i]['Agency_Hospital__r']['Name'];
                            Agency_Hospital_parent_id = reports[i]['Agency_Hospital__r']['Hospital__c'];
                        }
                    }
                    component.set('v.hospital', Agency_Hospital_text);
                    component.set('v.hospitalId', Agency_Hospital_parent_id);
                    component.set('v.hospitalLinkId', select_data['Agency_Hospital__c']);
                    component.find('new_con').set('v.disabled', false);
                }
                //使用产品1(产品型号)
                var UseProduct1Text = '';
                var UseProduct1Id = '';
                if (select_data['UseProduct1__c'] != '' && select_data['UseProduct1__c'] != undefined) {
                    for (var i = 0; i < reports.length; i++) {
                        if (reports[i]['UseProduct1__c'] == select_data['UseProduct1__c']) {
                            UseProduct1Text = reports[i]['UseProduct1__r']['Asset_Model_No__c'];
                            UseProduct1Id = reports[i]['UseProduct1__c'];
                        }
                    }
                    component.set('v.UseProduct1', UseProduct1Text);
                    component.set('v.UseProduct1Id', select_data['UseProduct1__c']);
                }
                //使用产品2
                var UseProduct2Text = '';
                var UseProduct2Id = '';
                if (select_data['UseProduct2__c'] != '' && select_data['UseProduct2__c'] != undefined) {
                    for (var i = 0; i < reports.length; i++) {
                        if (reports[i]['UseProduct2__c'] == select_data['UseProduct2__c']) {
                            UseProduct2Text = reports[i]['UseProduct2__r']['Asset_Model_No__c'];
                            UseProduct2Id = reports[i]['UseProduct2__c'];
                        }
                    }
                    component.set('v.UseProduct2', UseProduct2Text);
                    component.set('v.UseProduct2Id', select_data['UseProduct2__c']);
                }
                //使用产品3
                var UseProduct3Text = '';
                var UseProduct3Id = '';
                if (select_data['UseProduct3__c'] != '' && select_data['UseProduct3__c'] != undefined) {
                    for (var i = 0; i < reports.length; i++) {
                        if (reports[i]['UseProduct3__c'] == select_data['UseProduct3__c']) {
                            UseProduct3Text = reports[i]['UseProduct3__r']['Asset_Model_No__c'];
                            UseProduct3Id = reports[i]['UseProduct3__c'];
                        }
                    }
                    component.set('v.UseProduct3', UseProduct3Text);
                    component.set('v.UseProduct3Id', select_data['UseProduct3__c']);
                }
                //活动日
                var reportDate;
                if (select_data['Report_Date__c'] != '') {
                    for (var i = 0; i < reports.length; i++) {
                        if (reports[i]['Report_Date__c'] == select_data['Report_Date__c']) {
                            reportDate = reports[i]["Report_Date__c"];
                        }
                    }
                    component.set('v.data.Report_Date__c', reportDate);
                }
                // 科室
                // if (select_data['Department_Cateogy__c'] != '') {
                //     component.find('select_department').set('v.value',select_data['Department_Cateogy__c']);
                // }
                //fy Department_Cateogy_text__c
                if (select_data['Department_Cateogy_text__c'] != '') {
                    component.find('select_department').set('v.value', select_data['Department_Cateogy_text__c']);
                }
                //经销商人员
                if (select_data['DealerPersonnel__c'] != '') {
                    this.set_selected(component, 'select_DealerPersonnel', select_data['DealerPersonnel__c']);
                }
                // 活动区分
                if (select_data['WorkRecord__c'] != '') {
                    this.set_selected(component, 'select_purpose_type', select_data['WorkRecord__c']);
                    this.selectPurposeType(component);
                }
                // 拜访人
                if (select_data['WorkRecord__c'] == '科室会') {
                    component.set('v.default_select_doctor_id2', select_data['doctor3__c']);
                    var a = component.get('v.default_select_doctor_id2');
                    this.set_doctor_list_edit(component);
                } else {
                    component.set('v.default_select_doctor_id', select_data['doctor2__c']);
                    this.set_doctor_list_edit(component);
                }
                //产品分类(第三分类)
                if (select_data['ProductClassification__c'] != null) {
                    this.set_selected(component, 'select_ProductClassification', select_data['ProductClassification__c']);
                    this.selectProductClassification(component);
                }
                // 产品1同类耗材科室月使用量
                if (select_data['ConsumptionOfConsumables__c'] != '') {
                    component.find('select_ConsumptionOfConsumables').set('v.value', select_data['ConsumptionOfConsumables__c']);
                }
                // 产品用量
                if (select_data['warlocksNumber__c'] != '') {
                    component.find('select_warlocksNumber').set('v.value', select_data['warlocksNumber__c']);
                }
                // 支援需求
                if (select_data['WorkMark__c'] != false) {
                    component.find('select_WorkMark').set('v.checked', select_data['WorkMark__c']);
                }
                ;
                var report_id = component.get('v.edit_copy_select_report_id');
                if (report_id != "") {
                    var select_EffectProgress1 = '';
                    var WarlockClassification = '';
                    var ProductCcategory = '';
                    var productCategories = '';
                    var i = 0;
                    for (i = 0; i < reports.length; i++) {
                        if (report_id == reports[i]["Id"]) {
                            select_EffectProgress1 = reports[i]["EffectProgress__c"];
                            WarlockClassification = reports[i]["WarlockClassification__c"];
                            ProductCcategory = reports[i]["ProductCcategory__c"];
                            productCategories = reports[i]["productCategories__c"];
                            break;
                        }
                    }
                    //效果/进度
                    if (select_EffectProgress1 != null && select_EffectProgress1 != '') {
                        component.find('select_EffectProgress').set('v.value', select_EffectProgress1);
                    }
                    //术士分类
                    if (WarlockClassification != null && WarlockClassification != '') {
                        component.find('select_OtherBrandConsumables').set('v.value', WarlockClassification);
                    }
                    //已采用其他品牌
                    if (ProductCcategory != null && ProductCcategory != '') {
                        component.find('select_ProductCcategory').set('v.value', ProductCcategory);
                        this.selectpurposetype(component);
                    }
                    //其他品牌产品类别
                    if (productCategories != null && productCategories != '') {
                        component.find('select_productCategories').set('v.value', productCategories);
                    }
                    component.set('v.edit_copy_select_report_id', "");
                }
            }
        } else {
            var select_report_data = component.get('v.select_report_data');
            var Report_Date__c = component.get('v.data.Report_Date__c');
            var Agency_Hospital__c = component.get('v.hospitalLinkId');
            var UseProduct1__c = component.get('v.UseProduct1Id');
            var UseProduct2__c = component.get('v.UseProduct2Id');
            var UseProduct3__c = component.get('v.UseProduct3Id');
            var Department_Cateogy__c = component.find('select_department').get('v.value');
            var ConsumptionOfConsumables__c = component.find('select_ConsumptionOfConsumables').get('v.value');
            var DealerPersonnel__c = component.find('select_DealerPersonnel').get('v.value');
            var doctor2__c = component.find('select_doctor').get('v.value');
            var WorkRecord__c = component.find('select_purpose_type').get('v.value');
            var EffectProgress__c = component.find('select_EffectProgress').get('v.value');
            var WarlockClassification__c = component.find('select_OtherBrandConsumables').get('v.value');
            var ProductCcategory__c = component.find('select_ProductCcategory').get('v.value');
            var productCategories__c = component.find('select_productCategories').get('v.value');
            var warlocksNumber__c = component.find('select_warlocksNumber').get('v.value');
            var WorkMark__c = component.find('select_WorkMark').get('v.checked');
            if (component.get('v.mode') == 'new') {
                var confirm_title = '警告!'
                var confirm_text = '放弃新建日报?';
                if (!Report_Date__c &&
                    !Agency_Hospital__c &&
                    !UseProduct1__c &&
                    !UseProduct2__c &&
                    !UseProduct3__c &&
                    !Department_Cateogy__c &&
                    !ConsumptionOfConsumables__c &&
                    !DealerPersonnel__c &&
                    !doctor2__c &&
                    !EffectProgress__c &&
                    !WarlockClassification__c &&
                    !ProductCcategory__c &&
                    !productCategories__c &&
                    !warlocksNumber__c &&
                    !WorkMark__c &&
                    !WorkRecord__c
                ) {
                    this.allclear(component);
                    $A.util.addClass(modal_window, 'disp_none');
                    $A.util.addClass(modal_bg, 'disp_none');
                    this.close_confirm(component, confirm_title, confirm_text);
                } else {
                    this.close_confirm(component, confirm_title, confirm_text);
                }
            } else if (component.get('v.mode') == 'copy') {
                var confirm_title = '警告!'
                var confirm_text = '放弃新建日报?';
                if (select_report_data['Report_Date__c'] == Report_Date__c &&
                    select_report_data['Agency_Hospital__c'] == Agency_Hospital__c &&
                    select_report_data['UseProduct1__c'] == UseProduct1__c &&
                    select_report_data['UseProduct2__c'] == UseProduct2__c &&
                    select_report_data['UseProduct3__c'] == UseProduct3__c &&
                    select_report_data['Department_Cateogy__c'] == Department_Cateogy__c &&
                    select_report_data['ConsumptionOfConsumables__c'] == ConsumptionOfConsumables__c &&
                    select_report_data['DealerPersonnel__c'] == DealerPersonnel__c &&
                    select_report_data['doctor2__c'] == doctor2__c &&
                    select_report_data['EffectProgress__c'] == EffectProgress__c &&
                    select_report_data['WarlockClassification__c'] == WarlockClassification__c &&
                    select_report_data['ProductCcategory__c'] == ProductCcategory__c &&
                    select_report_data['productCategories__c'] == productCategories__c &&
                    select_report_data['warlocksNumber__c'] == warlocksNumber__c &&
                    select_report_data['WorkMark__c'] == WorkMark__c &&
                    select_report_data['WorkRecord__c'] == WorkRecord__c) {
                    this.allclear(component);
                    $A.util.addClass(modal_window, 'disp_none');
                    $A.util.addClass(modal_bg, 'disp_none');
                } else {
                    this.close_confirm(component, confirm_title, confirm_text);
                }
            } else if (component.get('v.mode') == 'edit') {
                var confirm_title = '警告!'
                var confirm_text = '放弃编辑日报?';
                if (select_report_data['Report_Date__c'] == Report_Date__c &&
                    select_report_data['Agency_Hospital__c'] == Agency_Hospital__c &&
                    select_report_data['UseProduct1__c'] == UseProduct1__c &&
                    select_report_data['UseProduct2__c'] == UseProduct2__c &&
                    select_report_data['UseProduct3__c'] == UseProduct3__c &&
                    select_report_data['Department_Cateogy__c'] == Department_Cateogy__c &&
                    select_report_data['ConsumptionOfConsumables__c'] == ConsumptionOfConsumables__c &&
                    select_report_data['DealerPersonnel__c'] == DealerPersonnel__c &&
                    select_report_data['doctor2__c'] == doctor2__c &&
                    select_report_data['EffectProgress__c'] == EffectProgress__c &&
                    select_report_data['WarlockClassification__c'] == WarlockClassification__c &&
                    select_report_data['ProductCcategory__c'] == ProductCcategory__c &&
                    select_report_data['productCategories__c'] == productCategories__c &&
                    select_report_data['warlocksNumber__c'] == warlocksNumber__c &&
                    select_report_data['WorkMark__c'] == WorkMark__c &&
                    select_report_data['WorkRecord__c'] == WorkRecord__c) {
                    this.allclear(component);
                    $A.util.addClass(modal_window, 'disp_none');
                    $A.util.addClass(modal_bg, 'disp_none');
                } else {
                    this.close_confirm(component, confirm_title, confirm_text);
                }
            }
        }
        //component.set('v.loginEdit',false);
    },
    //关闭页面是   小的提示框是否放弃新建日报
    close_confirm: function (component, title, text) {
        var confirm_status = component.get('v.confirm_status');
@@ -463,7 +728,7 @@
        var modal_bg = component.find('modal_bg');
        var modal_confirm = component.find('modal_confirm');
        var modal_confirm_bg = component.find('modal_confirm_bg');
        debugger
        if (confirm_status == 0) {
            $A.util.addClass(modal_window, 'disp_none');
            $A.util.addClass(modal_bg, 'disp_none');
@@ -512,7 +777,7 @@
    },
    // 复制按钮
    copy_button: function (component, event, helper) {
        debugger
        this.allclear(component);
        component.set('v.mode', 'copy');
        component.set('v.dialog_type', '新建');
@@ -541,10 +806,10 @@
    },
    //删除按钮
    delete_button: function (component, event, helper) {
        debugger
        var select_report_data = component.get('v.select_report_data_radio');
        if (confirm('是否删除该数据?')) {
            debugger
            component.set('v.login', true);
            var action = component.get('c.deleteAgencyReport');
            action.setParams({
@@ -567,7 +832,7 @@
    },
    //复制按钮可用
    change_report_radio: function (component, event, helper) {
        debugger
        var reports = component.get('v.reports');
        for (var i = 0; i < reports.length; i++) {
            if (reports[i].Name == event.getSource().get('v.label')) {
@@ -580,9 +845,10 @@
    },
    //编辑按钮
    edit_button: function (component, event, helper) {
        this.allclear(component);
        //component.set('v.loginEdit', true);
        debugger
        component.set('v.loadOpp', true);
        this.allclear(component);
        //component.set('v.loadOpp', true);
        var index = event.getSource().get('v.value');
        component.set('v.select_report_data', component.get('v.reports')[index]);
        component.set('v.mode', 'edit');
@@ -597,7 +863,7 @@
        var new_label = this.get_agency_person_name(component, select_agency);
        component.set('v.selected_agency_person', new_label);
        component.set('v.edit_copy_select_report_id', component.get('v.reports')[index].Id);
        var ret = this.create_report_header(component, event, helper, name, select_agency, select_date);
        var ret = this.create_report_header_edit(component, event, helper, name, select_agency, select_date);
        // SWAG-CF58C3 fy start
        this.set_aws_url(component, 'Agency_Contact__c')
        // SWAG-CF58C3 fy end
@@ -621,7 +887,7 @@
            // 担当 Person_In_Charge2__c
            Person_In_Charge2__c = component.find('select_agency_person').get('v.value');
        }
        debugger
        // Agency_Report_Header__c
        var Agency_Report_Header__c = component.get('v.agency_report_header_id');
        // 医院 
@@ -800,7 +1066,8 @@
                    component.set('v.login', false);
                }
                else {
                    component.set('v.errorMessage', 'save_report failed.');
                    //component.set('v.errorMessage', 'save_report failed.');
                    this.error('save_report failed.');
                    this.showErrorToast(component);
                    component.find('save_button').set('v.disabled', false);
                    component.set('v.login', false);
@@ -872,7 +1139,8 @@
                            }
                        }
                        else {
                            component.set('v.errorMessage', 'get_reports_now failed.');
                            // component.set('v.errorMessage', 'get_reports_now failed.');
                            this.error('get_reports_now failed.');
                            this.showErrorToast(component);
                            component.find('save_button').set('v.disabled', false);
                            component.set('v.login', false);
@@ -887,7 +1155,8 @@
                }
                else {
                    var error = response.getError();
                    component.set('v.errorMessage', '保存日报失败');
                    //component.set('v.errorMessage', '保存日报失败');
                    this.error('保存日报失败');
                    this.showErrorToast(component);
                    component.find('save_button').set('v.disabled', false);
                    component.set('v.login', false);
@@ -970,14 +1239,16 @@
    create_report_header: function (component, event, helper, name, s_agency, s_date) {
        s_date = this.get_date_string(s_date);
        if (s_date == false) {
            component.set('v.errorMessage', 'get_date_string failed.');
            //component.set('v.errorMessage', 'get_date_string failed.');
            this.error('get_date_string failed.');
            this.showErrorToast(component);
            return false;
        }
        var head_key = this.create_header_input_key(s_agency, s_date);
        component.set('v.agency_report_header', head_key);
        if (head_key == false) {
            component.set('v.errorMessage', 'create_header_input_key failed.');
            //component.set('v.errorMessage', 'create_header_input_key failed.');
            this.error('create_header_input_key failed.');
            this.showErrorToast(component);
            return false;
        }
@@ -999,9 +1270,53 @@
                this.toggle_report(component, event, helper);
            }
            else {
                component.set('v.errorMessage', 'createReportHeader callback failed.');
                //component.set('v.errorMessage', 'createReportHeader callback failed.');
                this.error('createReportHeader callback failed.');
                this.showErrorToast(component);
                component.set('v.login', false);
            }
        });
        $A.enqueueAction(action);
    },
    create_report_header_edit: function (component, event, helper, name, s_agency, s_date) {
        component.set('v.login',true);
        s_date = this.get_date_string(s_date);
        if (s_date == false) {
            //component.set('v.errorMessage', 'get_date_string failed.');
            this.error('get_date_string failed.');
            this.showErrorToast(component);
            return false;
        }
        var head_key = this.create_header_input_key(s_agency, s_date);
        component.set('v.agency_report_header', head_key);
        if (head_key == false) {
            //component.set('v.errorMessage', 'create_header_input_key failed.');
            this.error('create_header_input_key failed.');
            this.showErrorToast(component);
            return false;
        }
        var key2 = s_date.replace(/-/g, '');
        var action = component.get('c.createReportHeader');
        action.setParams({
            "name": name,
            "s_date": s_date,
            "s_agency": s_agency,
            "head_key": head_key,
        });
        component.set('v.loginEdit', true);
        action.setCallback(this, function (response) {
            var state = response.getState();
            if (state == 'SUCCESS') {
                var res = response.getReturnValue();
                component.set('v.agency_report_header_id', res);
                component.set('v.loginEdit', false);
                this.toggle_report_edit(component, event, helper);
            }
            else {
                //component.set('v.errorMessage', 'createReportHeader callback failed.');
                this.error('createReportHeader callback failed.');
                this.showErrorToast(component);
                component.set('v.loginEdit', false);
            }
        });
        $A.enqueueAction(action);
@@ -1010,7 +1325,8 @@
        if (typeof (s_date) != 'string') {
            s_date = this.get_date_string(s_date);
            if (s_date == false) {
                component.set('v.errorMessage', 'get_date_string in create_header_input_key.');
                //component.set('v.errorMessage', 'get_date_string in create_header_input_key.');
                this.error('get_date_string in create_header_input_key.');
                this.showErrorToast(component);
                return false;
            }
@@ -1103,7 +1419,7 @@
        component.set("v.hospitalId", '');
    },
    selectHos: function (component, event, helper) {
        debugger
        var hospital_list = component.find('hospital_list');
        $A.util.removeClass(hospital_list, 'slds-is-open');
        var accname = event.currentTarget.dataset.accname;
@@ -1124,7 +1440,7 @@
        component.set("v.hospitals", accname);
        component.set("v.hospital", accname);
        component.set("v.hospitalId", accid);
        debugger
        component.set('v.setdoctorlisthos', true);
        this.set_doctor_list(component, event, helper);
    },
@@ -1169,7 +1485,7 @@
        component.set('v.data.UseProduct1__c', '');
    },
    seletUseProduct1Change: function (component, event, helper) {
        debugger
        var UseProduct1_List = component.find('UseProduct1_List');
        $A.util.removeClass(UseProduct1_List, 'slds-is-open');
        var accname = event.currentTarget.dataset.accname;
@@ -1187,7 +1503,8 @@
            component.set("v.UseProduct1s", accname);
            component.set("v.UseProduct1", accname);
        } else {
            component.set('v.errorMessage', '不能选择同样的产品');
            //component.set('v.errorMessage', '不能选择同样的产品');
            this.error('不能选择同样的产品');
            this.showErrorToast(component);
        }
    },
@@ -1247,7 +1564,8 @@
            component.set("v.UseProduct2s", accname);
            component.set("v.UseProduct2", accname);
        } else {
            component.set('v.errorMessage', '不能选择同样的产品');
            //component.set('v.errorMessage', '不能选择同样的产品');
            this.error('不能选择同样的产品');
            this.showErrorToast(component);
        }
@@ -1308,14 +1626,15 @@
            component.set("v.UseProduct3s", accname);
            component.set("v.UseProduct3", accname);
        } else {
            component.set('v.errorMessage', '不能选择同样的产品');
            //component.set('v.errorMessage', '不能选择同样的产品');
            this.error('不能选择同样的产品');
            this.showErrorToast(component);
        }
    },
    //hospitalLinkId 经销商医院的ID   拜访人复制的地方
    doctor_change: function (component, event, helper) {
        debugger
        var doctorurpose = component.find('select_purpose_type').get('v.value');
        var doctor_value = component.find('select_doctor').get('v.value');
        var doctor_list = component.get('v.doctor_list');
@@ -1353,16 +1672,18 @@
                component.set('v.AWStransactionURL', awsmap.transactionURL);
            }
            else {
                component.set('v.errorMessage', 'AWS url/token error.');
                // component.set('v.errorMessage', 'AWS url/token error.');
                this.error('AWS url/token error.');
                this.showErrorToast(component);
                component.set('v.login', false);
                component.set('v.loginEdit', false);
            }
        });
        $A.enqueueAction(action);
    },
    insert_agencycontact: function (component, token, newUrl, payload, agencyHospitalid, helper, hospitalName) {
        debugger
        console.log('newUrl = ' + newUrl);
        console.log('payload = ' + payload);
        console.log('token = ' + token);
@@ -1427,17 +1748,20 @@
                    this.to_confirm(component, token, confirmUrl, JSON.stringify(data));
                } else if (acMap.errormsg != '') {
                    component.set('v.errorMessage', acMap.errormsg);
                    // component.set('v.errorMessage', acMap.errormsg);
                    this.error(acMap.errormsg);
                    this.showErrorToast(component);
                    component.set('v.login', false);
                } else {
                    component.set('v.errorMessage', 'agency contact insert id error.');
                    //component.set('v.errorMessage', 'agency contact insert id error.');
                    this.error('agency contact insert id error.');
                    this.showErrorToast(component);
                    component.set('v.login', false);
                }
            }
            else {
                component.set('v.errorMessage', 'agency contact insert error.');
                //component.set('v.errorMessage', 'agency contact insert error.');
                this.error('agency contact insert error.');
                this.showErrorToast(component);
                component.set('v.login', false);
            }
@@ -1470,12 +1794,14 @@
                this.showSuccessToast(component);
                this.set_doctor_list(component);
            } else {
                component.set('v.errorMessage', 'AWS confirm error.');
                //component.set('v.errorMessage', 'AWS confirm error.');
                this.error('AWS confirm error.');
                this.showErrorToast(component);
                component.set('v.login', false);
            }
        }).catch(error => {
            component.set('v.errorMessage', 'AWS confirm error.');
            // component.set('v.errorMessage', 'AWS confirm error.');
            this.error('AWS confirm error.');
            this.showErrorToast(component);
            component.set('v.login', false);
        });
@@ -1500,7 +1826,7 @@
                action.setCallback(this, function (response) {
                    var state = response.getState();
                    if (state == 'SUCCESS') {
                        debugger;
                        ;
                        var res = this.conv_selected(response.getReturnValue());
                        //fy
                        var setdoctorlisthos = component.get('v.setdoctorlisthos');
@@ -1592,12 +1918,13 @@
                            }
                        }
                        // component.set('v.default_select_doctor_id', '');
                        debugger
                        component.set('v.doctor_list', res);
                        component.set('v.login', false);
                    }
                    else {
                        component.set('v.errorMessage', 'set_doctor_list failed.');
                        // component.set('v.errorMessage', 'set_doctor_list failed.');
                        this.error('set_doctor_list failed.');
                        this.showErrorToast(component);
                        component.set('v.login', false);
                    }
@@ -1613,13 +1940,145 @@
            }
        }
    },//fy 20220414
    set_doctor_list_edit: function (component) {
        console.log('set_doctor_list')
        var doctor_value = component.find('select_purpose_type').get('v.value');
        var hospital_id = component.get('v.hospitalLinkId');
        console.log('hospital_id = ' + hospital_id);
        if (hospital_id) {
            if (doctor_value == '科室会') {
                component.set('v.loginEdit', true);
                this.set_doctor_list2(component);
            } else {
                component.set('v.loginEdit', true);
                var action = component.get('c.getDoctorList');
                action.setParams({
                    "hospital_id": hospital_id,
                });
                action.setCallback(this, function (response) {
                    var state = response.getState();
                    if (state == 'SUCCESS') {
                        ;
                        var res = this.conv_selected(response.getReturnValue());
                        //fy
                        var setdoctorlisthos = component.get('v.setdoctorlisthos');
                        if (setdoctorlisthos) {
                            component.set('v.default_select_doctor_id', '');
                            component.set('v.setdoctorlisthos', false);
                        }
                        //fy
                        var default_doctor = component.get('v.default_select_doctor_id');
                        if (default_doctor != '' && res.length > 0) {
                            var doctor_title = '';
                            let awsids = [];
                            for (var i = 0; i < res.length; i++) {
                                if (res[i].value == default_doctor) {
                                    res[i].selected = true;
                                    doctor_title = res[i].Doctor_Division1__c;
                                } else {
                                    res[i].selected = false;
                                }
                                if (res[i].AWS_Data_Id__c) {
                                    awsids.push(res[i].AWS_Data_Id__c);
                                }
                            }
                            component.find('select_doctor').set('v.options', res);
                            component.set('v.doctor_title', doctor_title);
                            console.log('awsids = ' + JSON.stringify(awsids))
                            if (awsids.length > 0) {
                                let PIConfig = component.get('v.PIConfig');
                                let staticResourceAgencyContact = JSON.parse(PIConfig.staticResourceAgencyContact);
                                AWSService.search(staticResourceAgencyContact.searchUrl, {
                                    dataIds: awsids
                                }, function (data) {
                                    console.log('data = ' + JSON.stringify(data))
                                    if (data && data.object && data.object.length) {
                                        let m = {};
                                        for (let di in data.object) {
                                            if (data.object[di] && data.object[di].dataId) {
                                                m[data.object[di].dataId] = data.object[di];
                                            }
                                        }
                                        for (let ri in res) {
                                            if (res[ri] && res[ri].AWS_Data_Id__c && m.hasOwnProperty(res[ri].AWS_Data_Id__c)) {
                                                res[ri].label = m[res[ri].AWS_Data_Id__c].name;
                                            }
                                        }
                                        component.find('select_doctor').set('v.options', res);
                                    }
                                    component.set('v.loginEdit', false);
                                }, staticResourceAgencyContact.token);
                            }
                        } else {
                            let awsids = [];
                            for (var i = 0; i < res.length; i++) {
                                if (res[i].AWS_Data_Id__c) {
                                    awsids.push(res[i].AWS_Data_Id__c);
                                }
                            }
                            component.find('select_doctor').set('v.options', res);
                            if (awsids.length > 0) {
                                let PIConfig = component.get('v.PIConfig');
                                let staticResourceAgencyContact = JSON.parse(PIConfig.staticResourceAgencyContact);
                                AWSService.search(staticResourceAgencyContact.searchUrl, {
                                    dataIds: awsids
                                }, function (data) {
                                    if (data && data.object && data.object.length) {
                                        let m = {};
                                        for (let di in data.object) {
                                            if (data.object[di] && data.object[di].dataId) {
                                                m[data.object[di].dataId] = data.object[di];
                                            }
                                        }
                                        for (let ri in res) {
                                            if (res[ri] && res[ri].AWS_Data_Id__c && m.hasOwnProperty(res[ri].AWS_Data_Id__c)) {
                                                res[ri].label = m[res[ri].AWS_Data_Id__c].name;
                                            }
                                        }
                                        component.find('select_doctor').set('v.options', res);
                                    }
                                    component.set('v.loginEdit', false);
                                }, staticResourceAgencyContact.token);
                            }
                            // component.find('select_doctor').set('v.options', res);
                            if (res.length > 0) {
                                component.set('v.doctor_title', res[0].Doctor_Division1__c);
                            }
                        }
                        // component.set('v.default_select_doctor_id', '');
                        component.set('v.doctor_list', res);
                        component.set('v.loginEdit', false);
                    }
                    else {
                        // component.set('v.errorMessage', 'set_doctor_list failed.');
                        this.error('set_doctor_list failed.');
                        this.showErrorToast(component);
                        component.set('v.loginEdit', false);
                    }
                });
                $A.enqueueAction(action);
            }
        } else {
            if (doctor_value == '科室会') {
                this.set_doctor_list2(component);
            } else {
                component.find('select_doctor').set('v.options', '');
            }
        }
    },
    set_doctor_list2: function (component) {
        var action1 = component.get('c.selectdoctor3c');
        action1.setCallback(this, function (response) {
            var state = response.getState();
            if (state == 'SUCCESS') {
                var res = response.getReturnValue();
                debugger
                for (var i = 0; i < res.length; i++) {
                    if (res[i].selected == 'true') {
                        res[i].selected = true;
@@ -1627,11 +2086,12 @@
                        res[i].selected = false;
                    }
                }
                debugger
                component.find('select_doctor').set('v.options', res);
                var doctor3value = component.get('v.default_select_doctor_id2');
                this.set_selected(component, 'select_doctor', doctor3value);
                component.set('v.login', false);
                component.set('v.loginEdit', false);
            }
        });
        $A.enqueueAction(action1);
@@ -1644,7 +2104,8 @@
        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)) {
            component.set('v.errorMessage', '不能选择同样的产品区分');
            //component.set('v.errorMessage', '不能选择同样的产品区分');
            this.error('不能选择同样的产品区分');
            this.showErrorToast(component);
            component.find('select_Product1').set('v.value', '');
        }
@@ -1657,7 +2118,8 @@
        var p2bool = pcId2 != '' && pcId2 != null;
        var p0bool = product_category_id != '' && product_category_id != null;
        if ((p1bool && p0bool && product_category_id == pcId1) || (p2bool && p0bool && product_category_id == pcId2)) {
            component.set('v.errorMessage', '不能选择同样的产品区分');
            //component.set('v.errorMessage', '不能选择同样的产品区分');
            this.error('不能选择同样的产品区分');
            this.showErrorToast(component);
            component.set('v.UseProduct2_TEXT', '');
        }
@@ -1670,7 +2132,8 @@
        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)) {
            component.set('v.errorMessage', '不能选择同样的产品区分');
            //component.set('v.errorMessage', '不能选择同样的产品区分');
            this.error('不能选择同样的产品区分');
            this.showErrorToast(component);
            component.find('select_Product3').set('v.value', '');
        }
@@ -1688,7 +2151,7 @@
        return obj;
    },
    set_selected: function (component, aura_id_name, value) {
        debugger;
        ;
        var select_tmp = component.find(aura_id_name).get('v.options');
        if (select_tmp) {
            for (var i = 0; i < select_tmp.length; i++) {
@@ -1706,7 +2169,7 @@
    },
    //弹出 成功提示
    showSuccessToast: function (component) {
        debugger
        $A.util.removeClass(component.find('successDiv'), 'slds-hide');
        window.setTimeout($A.getCallback(function () {
            $A.util.addClass(component.find('successDiv'), 'slds-hide');
@@ -1716,7 +2179,7 @@
    },
    //弹出 成功提示
    showSuccessToast01: function (component) {
        debugger
        $A.util.removeClass(component.find('successDiv01'), 'slds-hide');
        window.setTimeout($A.getCallback(function () {
            $A.util.addClass(component.find('successDiv01'), 'slds-hide');
@@ -1726,7 +2189,7 @@
    },
    //弹出 错误提示
    showErrorToast: function (component) {
        debugger
        $A.util.removeClass(component.find('errorDiv'), 'slds-hide');
        window.setTimeout($A.getCallback(function () {
            $A.util.addClass(component.find('errorDiv'), 'slds-hide');
@@ -1736,7 +2199,7 @@
    },
    //弹出 错误提示
    showErrorToast01: function (component) {
        debugger
        $A.util.removeClass(component.find('errorDiv01'), 'slds-hide');
        window.setTimeout($A.getCallback(function () {
            $A.util.addClass(component.find('errorDiv01'), 'slds-hide');
@@ -1829,7 +2292,7 @@
                component.set("v.TargetFileName", output);
            };
            reader.onload = function (e) {
                debugger;
                ;
                var data = e.target.result;
                component.set("v.fileContentData", data);
@@ -1848,9 +2311,13 @@
                    var filecontentdata;
                    var content = "<table class=\"table slds-table slds-table--bordered slds-table--cell-buffer\">";
                    content += "<thead><tr class=\"slds-text-title--caps\">";
                    content += '<th scope=\"col"\>' + '行号' + '</th>';
                    content += '<th scope=\"col"\ style=\"width:100px">' + '行号' + '</th>';
                    for (i = 0; i < headers.length; i++) {
                        content += '<th scope=\"col"\>' + headers[i] + '</th>';
                        if (headers[i] == '产品1同类耗材科室月使用量') {
                            content += '<th scope=\"col"\ style=\"width:250px"\>' + headers[i] + '</th>';
                        } else {
                            content += '<th scope=\"col"\ style=\"width:200px"\>' + headers[i] + '</th>';
                        }
                    }
                    content += "</tr></thead>";
                    for (var i = 1; i < allTextLines.length; i++) {
@@ -1891,7 +2358,8 @@
                if (callback) callback(result);
            }
            else {
                component.set('v.errorMessage', 'AWS url/token error.');
                //component.set('v.errorMessage', 'AWS url/token error.');
                this.error('AWS url/token error.');
                this.showErrorToast01(component);
                component.set('v.login', false);
            }
@@ -1915,13 +2383,15 @@
            if (callback) callback(result);
        }).catch(error => {
            console.log('AWS search error = ' + JSON.stringify(error));
            component.set('v.errorMessage', 'AWS search error.');
            // component.set('v.errorMessage', 'AWS search error.');
            this.error('AWS search error.');
            this.showErrorToast01(component);
            component.set('v.login', false);
        });
    },
    saveRecords: function (component, event, helper) {
        component.set('v.login', true);
        //component.set('v.login', true);
        component.set('v.modal_import_spinner', true);
        //fy 导入 202200506 start
        var action1 = component.get("c.processDataAWSId");
        action1.setParams({
@@ -1930,13 +2400,13 @@
        action1.setCallback(this, function (response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                debugger
                var ress = response.getReturnValue();
                if (ress) {
                    var valur = ress.split('error1');
                    if (valur.length <= 1) {
                        var res = JSON.parse(response.getReturnValue());
                        debugger
                        var dataArr = new Array();
                        var dataMap = new Map();
                        res.forEach(item => {
@@ -1946,7 +2416,7 @@
                                dataMap.set(item.AWS_Data_Id__c, item.AWS_Data_Id__c);
                            }
                        });
                        debugger
                        let obj = Object.create(null);
                        obj['dataIds'] = dataArr;
                        var payload = JSON.stringify(obj);
@@ -1960,24 +2430,31 @@
                                console.log('result = ' + JSON.stringify(result));
                                if (result.status == '0') {
                                    if (result.object != null && result.object.length != 0) {
                                        component.set('v.login', true);
                                        //component.set('v.login', true);
                                        component.set('v.modal_import_spinner', true);
                                        this.saveRecordsEditFile(component, dataMap, result.object, helper);
                                    } else {
                                        component.set('v.errorMessage', 'AWS search status ');
                                        //component.set('v.errorMessage', 'AWS 查询数据为空 ');
                                        this.error('AWS 查询数据为空 ');
                                        this.showErrorToast01(component);
                                        component.set('v.login', false);
                                        //component.set('v.login', false);
                                        component.set('v.modal_import_spinner', false);
                                    }
                                } else {
                                    component.set('v.errorMessage', 'AWS search status : ' + result.status);
                                    //component.set('v.errorMessage', 'AWS search status : ' + result.status);
                                    this.error('AWS search status : ' + result.status);
                                    this.showErrorToast01(component);
                                    component.set('v.login', false);
                                    //component.set('v.login', false);
                                    component.set('v.modal_import_spinner', false);
                                }
                            }, component);
                        });
                    } else {
                        component.set('v.errorMessage', valur[1] + '\n' + "请修改后重新上传");
                        //component.set('v.errorMessage', valur[1] + '\n' + "请修改后重新上传");
                        this.error(valur[1] + '\n' + "请修改后重新上传");
                        this.showErrorToast01(component);
                        component.set('v.login', false);
                        //component.set('v.login', false);
                        component.set('v.modal_import_spinner', false);
                    }
                }
            }
@@ -2037,8 +2514,10 @@
    saveRecordsEditFile: function (component, dataMap, searchData, helper) {
        var searchDataMap = new Map();
        for (var i = 0; i < searchData.length; i++) {
            var sd = searchData[i];
            searchDataMap.set(sd.name.replace(' ', ''), sd.dataId);
            if (searchData[i].name != null) {
                var sd = searchData[i];
                searchDataMap.set(sd.name.replace(' ', ''), sd.dataId);
            }
        }
        console.log('searchDataMap=' + searchDataMap);
        var error = '';
@@ -2104,30 +2583,88 @@
            console.log('zhj error = ' + error);
            let errorArray = error.split('error1');
            let errorDatas = [];
            let errorDataRow = [];
            var fileContentData = component.get("v.fileContentData").split('\n');
            console.log('fileContentData = ' + JSON.stringify(fileContentData))
            console.log('errorArray = ' + JSON.stringify(errorArray))
            for (var i in errorArray) {
                // if (errorArray[i] != '') {
                //     let errorData = {}
                //     errorData.errorRow = errorArray[i].trim().substring(1, 2);
                //     errorData.errorInfo = errorArray[i].trim().substring(5);
                //     errorDatas.push(errorData);
                // }
                if (errorArray[i] != '') {
                    let errorData = {}
                    errorData.errorRow = errorArray[i].trim().substring(1, 2);
                    errorData.errorInfo = errorArray[i].trim().substring(5);
                    errorDatas.push(errorData);
                    let index = errorDataRow.indexOf(errorArray[i].trim().substring(1, 2));
                    if (index == -1) {
                        errorData.errorRow = errorArray[i].trim().substring(1, 2);
                        errorDataRow.push(errorData.errorRow);
                        errorData.errorInfo = errorArray[i].trim().substring(5);
                        if(errorData.errorInfo == '拜访人AWS不存在'){
                            errorData.errorInfo ='拜访人 ' + fileContentData[errorData.errorRow].split(',')[5] + '不存在';
                        }
                        errorDatas.push(errorData);
                    } else {
                        if(errorArray[i].trim().substring(5) == '拜访人AWS不存在'){
                            errorData[index].errorInfo = '; ' + '拜访人 ' + fileContentData[errorDatas[index].errorRow].split(',')[5] + '不存在';
                        }else{
                            errorDatas[index].errorInfo += '; ' + errorArray[i].trim().substring(5);
                        }
                    }
                }
            }
            var fileContentData = component.get("v.fileContentData").split('\n');
            console.log('fileContentData = ' + JSON.stringify(fileContentData))
            let errorColumns = [
                { 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++) {
                let initialWidth = 180;
                if (fileContentData[0].split(',')[i] == '产品1同类耗材科室月使用量' || fileContentData[0].split(',')[i] == '使用产品1(产品型号)') {
                    initialWidth = 250;
                }
                errorColumns.push({
                    label: fileContentData[0].split(',')[i],
                    fieldName: 'field' + i,
                    type: 'text',
                    hideDefaultActions: true,
                    wrapText: true,
                    initialWidth: initialWidth
                });
            }
            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))
            component.set('v.errorColumns', errorColumns);
            component.set('v.errorData', errorDatas);
            component.set("v.showErrorInfo", true);
            console.log('error = ' + error);
            component.set('v.errorMessage', error);
            //component.set('v.errorMessage', error);
            this.error(error);
            this.showErrorToast01(component);
            console.log('error=' + error);
            component.set('v.login', false);
            //component.set('v.login', false);
            component.set('v.modal_import_spinner', false);
            return;
        }
        console.log('fileStr=' + fileStr);
        $A.getCallback(function () {
            debugger
            helper.ImportMethod(component, fileStr, helper);
        })();
@@ -2148,34 +2685,85 @@
                if (res != 'success') {
                    var ress = res.split('=');
                    console.log(ress);
                    let errorDatas = [];
                    let errorDataRow = [];
                    var fileContentData = component.get("v.fileContentData").split('\n');
                    console.log('fileContentData[1].split(,)[5] = ' + fileContentData[1].split(',')[5])
                    for (var i = 0; i < ress.length; i++) {
                        res1 += ress[i].substr(7) + '\n';
                        if (ress[i] != '') {
                            let errorData = {}
                            errorData.errorRow = ress[i].substr(7).substring(1, 2);
                            errorData.errorInfo = ress[i].substr(7).substring(5);
                            errorDatas.push(errorData);
                            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(5);
                                if(errorData.errorInfo == '拜访人不存在'){
                                    console.log('errorData.errorRow = ' + errorData.errorRow)
                                    errorData.errorInfo ='拜访人 ' + fileContentData[errorData.errorRow].split(',')[5] + '不存在';
                                }
                                errorDatas.push(errorData);
                            } else {
                                if(ress[i].substr(7).substring(5) == '拜访人不存在'){
                                    errorDatas[index].errorInfo += '; ' + '拜访人 ' + fileContentData[errorDatas[index].errorRow].split(',')[5] + '不存在';
                                }else{
                                    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: 100 },
                        { label: '错误信息', fieldName: 'errorInfo', type: 'text', hideDefaultActions: true, initialWidth: 300, wrapText: true }
                    ];
                    for (var i = 0; i < fileContentData[0].split(',').length - 1; i++) {
                        let initialWidth = 180;
                        if (fileContentData[0].split(',')[i] == '产品1同类耗材科室月使用量' || fileContentData[0].split(',')[i] == '使用产品1(产品型号)') {
                            initialWidth = 250;
                        }
                        errorColumns.push({
                            label: fileContentData[0].split(',')[i],
                            fieldName: 'field' + i,
                            type: 'text',
                            hideDefaultActions: true,
                            wrapText: true,
                            initialWidth: initialWidth
                        });
                    }
                    for (var i = 0; i < errorDatas.length; i++) {
                        let data = fileContentData[errorDatas[i].errorRow];
                        console.log('data = ' + JSON.stringify(data));
                        for (var j = 0; j < data.split(',').length; j++) {
                            let label = 'field' + j;
                            errorDatas[i][label] = data.split(',')[j];
                        }
                    }
                    component.set('v.errorColumns', errorColumns);
                    component.set('v.errorData', errorDatas);
                    component.set("v.showErrorInfo", true);
                    console.log("==" + res1);
                    component.set('v.errorMessage', res1 + "请修改后重新上传");
                    //component.set('v.errorMessage', res1 + "请修改后重新上传");
                    this.error(res1 + "请修改后重新上传");
                    this.showErrorToast01(component);
                    component.set('v.login', false);
                    //component.set('v.login', false);
                    component.set('v.modal_import_spinner', false);
                } else {
                    component.set('v.successMessage', '导入成功');
                    this.showSuccessToast01(component);
                    component.set("v.showMain", true);
                    component.set('v.login', false);
                    //component.set('v.login', false);
                    component.set('v.modal_import_spinner', false);
                    this.doinit(component, event, helper);
                }
            }
            else if (state === "INCOMPLETE") {
                component.set('v.login', false);
                //component.set('v.login', false);
                component.set('v.modal_import_spinner', false);
            }
            else if (state === "ERROR") {
                var errors = response.getError();
@@ -2183,11 +2771,13 @@
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " +
                            errors[0].message);
                        component.set('v.login', false);
                        //component.set('v.login', false);
                        component.set('v.modal_import_spinner', false);
                    }
                } else {
                    console.log("Unknown error");
                    component.set('v.login', false);
                    //component.set('v.login', false);
                    component.set('v.modal_import_spinner', false);
                }
            }
        });
@@ -2452,7 +3042,8 @@
                    component.set('v.login', false);
                }
                else {
                    component.set('v.errorMessage', 'newlyBuild failed.');
                    //component.set('v.errorMessage', 'newlyBuild failed.');
                    this.error('newlyBuild failed.');
                    this.showErrorToast(component);
                    component.set('v.login', false);
                }
@@ -2468,11 +3059,13 @@
                if (sc.replace(/\D/gi, "")) {
                    component.set("v.select_ConsumptionOfConsumables", sc);
                } else {
                    component.set('v.errorMessage', '产品1同类耗材科室月使用量必须输入数字!');
                    //component.set('v.errorMessage', '产品1同类耗材科室月使用量必须输入数字!');
                    this.error('产品1同类耗材科室月使用量必须输入数字!');
                    this.showErrorToast(component);
                }
            } else {
                component.set('v.errorMessage', '产品1同类耗材科室月使用量最多输入14位数字!');
                //component.set('v.errorMessage', '产品1同类耗材科室月使用量最多输入14位数字!');
                this.error('产品1同类耗材科室月使用量最多输入14位数字!');
                this.showErrorToast(component);
            }
        }
@@ -2485,18 +3078,20 @@
                if (sc.replace(/\D/gi, "")) {
                    component.set("v.select_warlocksNumber", sc);
                } else {
                    component.set('v.errorMessage', '产品用量必须输入数字!');
                    //component.set('v.errorMessage', '产品用量必须输入数字!');
                    this.error('产品用量必须输入数字!');
                    this.showErrorToast(component);
                }
            } else {
                component.set('v.errorMessage', '产品用量最多输入14位数字!');
                //component.set('v.errorMessage', '产品用量最多输入14位数字!');
                this.error('产品用量最多输入14位数字!');
                this.showErrorToast(component);
            }
        }
    },
    //工作会记录
    selectPurposeType: function (component, event, helper) {
        debugger
        var doctor_value = component.find('select_purpose_type').get('v.value');
        // alert(doctor_value);
        if (doctor_value != '科室会') {
@@ -2524,7 +3119,7 @@
    },
    selectProductClassification: function (component, event, helper) {
        debugger
        var select_ProductClassification = component.find('select_ProductClassification').get('v.value');
        if (select_ProductClassification != '') {
            var action = component.get('c.selectProductClassificationc');
@@ -2546,7 +3141,7 @@
    },
    select_ProductCcategory: function (component, event, helper) {
        var select_ProductCcategory = component.find('select_ProductCcategory').get('v.value');
        debugger
        if (select_ProductCcategory != '') {
            var result = component.find('result');
            var UserProType = component.get('v.UserProType');
@@ -2586,7 +3181,7 @@
                $A.util.addClass(result, 'disp_none');
            }
        } else {
            debugger
            component.find('select_productCategories').set('v.value', '');
            var result = component.find('result');
            $A.util.addClass(result, 'disp_none');
@@ -2612,14 +3207,23 @@
    //zhj 导出错误信息 2023-05-16 start
    exportErrorInfoHelper: function (component) {
        var errorData = component.get('v.errorData');
        var errorColumns = component.get('v.errorColumns');
        var datas = [
            ['错误行', '错误信息']
        ];
        var datas = [];
        let errorColumnsArray = [];
        for (var i in errorColumns) {
            errorColumnsArray.push(errorColumns[i].label);
        }
        datas.push(errorColumnsArray);
        //datas.push(errorColumns);
        for (var i in errorData) {
            let data = [];
            data.push(errorData[i].errorRow)
            data.push(errorData[i].errorInfo)
            for (var j = 0; j < Object.keys(errorData[i]).length - 2; j++) {
                data.push(errorData[i]['field' + j])
            }
            datas.push(data);
        }
@@ -2655,11 +3259,24 @@
    downloadCSV: function (component, csv) {
        var link = document.createElement('a');
        link.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(csv);
        var bom = "\uFEFF";
        link.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(bom + csv);
        link.download = 'data.csv';
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
    },
    error: function (message) {
        // $('toastMessage.forceToastManager').css('white-space', 'pre-wrap');
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "错误!",
            "message": message,
            "type": "error",
            //"duration" : "sticky"
        });
        toastEvent.fire();
    },
    //zhj 导出错误信息 2023-05-16 end
})
force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp
@@ -81,22 +81,33 @@
    <aura:attribute name="contactawsurl" type="Map"/>
    <aura:attribute name="allselectlistAgencyPerson" type="Map"/>
    <!-- PIPL update Yin Mingjie 21/02/2022 end -->
    <!-- start DTT-zhj 增加错误信息table 2023-05-16-->
    <aura:attribute name="errorData" type="Object" />
    <aura:attribute name="errorColumns" type="List" />
    <!-- show Error information -->
    <aura:attribute name="showErrorInfo" type="Boolean" default="false" />
    <!-- end DTT-zhj 增加错误信息table 2023-05-16-->
    <!-- 批量添加周报 end-->
    <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" />
    <ltng:require scripts="{! $Resource.jquery183minjs }" />
    
    <!--ロード中...-->
    <aura:renderIf isTrue="{!v.login}">
        <div class="slds-spinner_container height100vh">
            <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>
            </div>
        </div>
        <!-- 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 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>
    
    <div aura:id="report" id="report" class="contents_wrapper">
    <div aura:id="report" id="report">
        <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">
                周
@@ -112,10 +123,10 @@
            <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--2-of-12 slds-large-size--2-of-12">
            <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--2-of-12 slds-large-size--2-of-12">
            <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}" />
@@ -133,26 +144,26 @@
            <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">
                        <th class="table_header slds-text-title--caps" style="width: 250px;">
                            <span class="slds-truncate" title="Name">周报编号</span>
                        </th>
                        <th class="table_header slds-text-title--caps">
                        <th class="table_header slds-text-title--caps" style="width: 100px;">
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.Person_In_Charge2__c}</span>
                        </th>
                        <th class="table_header slds-text-title--caps">
                        <th class="table_header slds-text-title--caps" style="width: 250px;">
                            <span class="slds-truncate" title="Name">医院</span>
                        </th>
                        <th class="table_header slds-text-title--caps">
                        <th class="table_header slds-text-title--caps" style="width: 100px;">
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.Department_Cateogy__c}</span>
                        </th>
                        <th class="table_header slds-text-title--caps">
                        <th class="table_header slds-text-title--caps" style="width: 100px;">
                            <!-- 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">{!v.fieldsmap.Agency_Contact__c}</span>
                            <span class="slds-truncate" title="Name" style="width: 100px;">{!v.fieldsmap.Agency_Contact__c}</span>
                            
                        </th>
                        <th class="table_header slds-text-title--caps">
                        <th class="table_header slds-text-title--caps" style="width: 100px;">
                            <span class="slds-truncate" title="Name">{!v.fieldsmap.visitor_title__c}</span>
                        </th>
                        <th class="table_header slds-text-title--caps">
@@ -245,7 +256,19 @@
                            <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}" />
                            </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" />
                                </div>
                            </div>
                        </aura:if>
                        <!-- start DTT-zhj 增加错误信息table 2023-05-16-->
                    </aura:set>
                </aura:if>
            </div>
@@ -315,21 +338,25 @@
    <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">
                <h4 id="headerTarget" class="slds-float--left">{!v.dialog_type}</h4>
                <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}"/>
            </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">
                        <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"/>
                            <!-- <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" />
                        </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" data-select="single">
                            <ui:inputText aura:id="hospital_input_text" label="医院" class="field" value="{!v.hospital}" updateOn="keyup"/>
                        <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"/>
                            <div class="slds-lookup__menu" id="lookup-66">
                                <ul class="slds-lookup__list" role="listbox">
                                    <aura:iteration var="hospital" items="{!v.hospitalList}">
@@ -346,34 +373,34 @@
                        </div>
                        
                        <!-- 科室分类 -->
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8">
                        <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}"/>
                        </div>
                        
                        <!-- 先生 -->
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8">
                        <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}"/>
                        </div>
                        
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-12">
                        <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"/>
                        </div>
                        
                        <!-- 职位 -->
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-8">
                        <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">
                        <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}"/>
                        </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">
                        <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"/> -->
@@ -394,53 +421,53 @@
                                    filter="{!v.opportunity_cfilter}"
                                    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">
                        <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">
                        <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">
                        <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">
                        <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=""/>
                        </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 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=""/>
                        </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">
                        <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}"/>
                        </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">
                        <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}"/>
                        </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">
                        <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}"/>
                        </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">
                        <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">
                        <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}"/> -->
@@ -569,6 +596,8 @@
                        <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>
force-app/main/default/aura/WeeklyReport/WeeklyReport.css
@@ -138,4 +138,21 @@
.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;
}
.THIS .marginTop{
    margin-top: 10px;
}
.THIS .custom-input .uiInput {
    height: 2rem; /* 调整高度为你需要的值,如 2rem */
}
/* add by Deloitte-Link 2023-6-19 end*/
force-app/main/default/aura/WeeklyReport/WeeklyReportController.js
@@ -1,11 +1,12 @@
({
    doInit : function(component, event, helper) {
        console.log('zhj 新方案');
        console.log('zhj 新方案weeklyReport');
        if (window.location.href.endsWith("weekly-report")) {
            helper.doinit(component, event, helper);
        } else {
            helper.hideCmp(component, event, helper);
        }
        component.set("v.showErrorInfo", false);
    },
    createAopp : function(component, event, helper) {
@@ -15,10 +16,12 @@
            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', '');
        helper.new_report(component, event, helper);
    },
    
@@ -256,10 +259,12 @@
        // var fileInput = component.find("file").getElement();
        // var file = fileInput.files[0];
        helper.readFile(component,helper,files[0]);
        component.set("v.showErrorInfo", false);
    },
    processFileContent : function(component,event,helper){
        helper.saveRecords(component,event,helper);
        component.set("v.showErrorInfo", false);
    },
    
    cancel : function(component,event,helper){
@@ -314,5 +319,8 @@
    close_export : function(component,event,helper){
        component.set("v.showMain",true);
        helper.close_export(component);
    }
    },
    exportErrorInfo: function(component,event,helper){
        helper.exportErrorInfoHelper(component);
    },
})
force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js
@@ -221,7 +221,8 @@
                            b = true;
                            Foo();
                        }else{
                            this.error('AWS search status2 : ' + result.status);
                            //this.error('AWS search status2 : ' + result.status);
                            this.success('请重新刷新页面进行解密');
                        }
                    },component);
                }else{
@@ -438,6 +439,7 @@
                    }
                    if (reportDate != null) {
                        console.log('reportDate = ' + reportDate);
                        component.set('v.data.Report_Date__c', reportDate);
                    }
                    
@@ -962,6 +964,7 @@
        component.find('select_Product1').set('v.value','');
        component.find('select_Product2').set('v.value','');
        component.find('select_Product3').set('v.value','');
        console.log('reportDate = 空');
        component.set('v.data.Report_Date__c', '');
        component.set('v.oppdata.Close_Forecasted_Date__c', '');
        component.set('v.oppdata.Amount__c', '');
@@ -1446,6 +1449,9 @@
        // });
    },
    search_core : function(token,searchUrl,payload,callback,component) {
        console.log('token = ' + token);
        console.log('searchUrl = ' + searchUrl);
        console.log('payload = ' + payload);
        fetch(searchUrl, {
            method: 'POST',
            body: payload,
@@ -1459,6 +1465,7 @@
            component.set('v.login',false);
            if(callback)callback(result);
        }).catch(error => {
            console.log('error = ' + JSON.stringify(error));
            this.error('AWS search error.');
            component.set('v.login',false);
        });
@@ -1898,20 +1905,25 @@
    },
    
    saveRecords : function(component,event,helper){
        debugger
        component.set('v.login',true);
        //fy 导入 20220424 start
        var action1 = component.get("c.processDataAWSId");
        action1.setParams({ 
            fileData : component.get("v.fileContentData"),
        }); 
        debugger
        action1.setCallback(this, function(response) {
            console.log('response = '  + JSON.stringify(response));
            var state = response.getState();
            if (state === "SUCCESS") {
                var ress = response.getReturnValue();
                console.log('ress = '  + JSON.stringify(ress));
                if(ress){
                    var valur =ress.split('error1');
                    if(valur.length<=1){
                        var res = JSON.parse(response.getReturnValue());
                        console.log('res = '  + JSON.stringify(res));
                        var dataArr = new Array();
                        var dataMap = new Map();
                        res.forEach(item => {
@@ -1921,10 +1933,11 @@
                                dataMap.set(item.AWS_Data_Id__c,item.AWS_Data_Id__c);       //zhj 新方案改造 2022-12-21
                            }
                        });
                        debugger
                        let obj= Object.create(null);
                        obj['dataIds'] = dataArr;
                        var payload = JSON.stringify(obj);
                        console.log('payload zhj = ' + JSON.stringify(payload));
                        this.search_contact_url(component, 'Agency_Contact__c', (result)=>{
                            var token = result.token;
                            var searchUrl = result.searchUrl;
@@ -1941,7 +1954,7 @@
                                        component.set('v.login',true);
                                        this.saveRecordsEditFile(component,dataMap,result.object,helper);
                                    }else{
                                        this.error('AWS search status5 ' );
                                        this.error('AWS 查询数据为空 ' );
                                        component.set('v.login',false);
                                    }
                                }else{
@@ -2019,7 +2032,10 @@
        // });
        // $A.enqueueAction(action);
    },isNumber: function(str) {
        return /^\d+$/.test(str);
    },ImportMethod : function(component,fileStr){
        debugger
        var actionss = component.get("c.processData");
         var selectDate = component.find('select_date').get('v.value');
        var fieldsList=['Name','Phone','AccountNumber']; //Please write your code dynamic 
@@ -2042,10 +2058,64 @@
                    if(res != 'success'){
                        var ress = res.split('=');
                        console.log(ress);
                        let errorDatas = [];
                        let errorDataRow = [];
                        debugger
                        var fileContentData = component.get("v.fileContentData").split('\n');
                        for (var i=0; i<ress.length; i++) {
                            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(5).replace('=','');
                                    if(errorData.errorInfo == '拜访人不存在'){
                                        console.log('errorData.errorRow = ' + errorData.errorRow)
                                        errorData.errorInfo ='拜访人 ' + fileContentData[errorData.errorRow].split(',')[4] + '不存在';
                                    }
                                    errorDatas.push(errorData);
                                } else {
                                    if(ress[i].substr(7).substring(5) == '拜访人不存在'){
                                        errorDatas[index].errorInfo += '; ' + '拜访人 ' + fileContentData[errorDatas[index].errorRow].split(',')[4] + '不存在';
                                    }else{
                                        errorDatas[index].errorInfo += '; ' + ress[i].substr(7).substring(5);
                                    }
                                }
                            }
                        }
                        // $('.forceToastManager').css('white-space', 'pre-wrap');
                        let errorColumns = [
                            { 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; i++) {
                            errorColumns.push({
                                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];
                                }
                            }
                        }
                        component.set('v.errorColumns', errorColumns);
                        component.set('v.errorData', errorDatas);
                        component.set("v.showErrorInfo", true);
                        console.log("=="+res1);
                        this.error(res1+"请修改后重新上传");
                        component.set('v.login',false);
@@ -2080,6 +2150,7 @@
        var searchDataMap = new Map();
         for (var i = 0; i < searchData.length; i++) {
         var sd = searchData[i];
         if(sd.name)
         searchDataMap.set(sd.name.replace(' ',''),sd.dataId);
         }
         console.log('searchDataMap='+searchDataMap);
@@ -2111,6 +2182,71 @@
        }
        if (error != '') {
            console.log('zhj error = ' + error);
            let errorArray = error.split('error1');
            let errorDatas = [];
            let errorDataRow = [];
            debugger
            var fileContentData = component.get("v.fileContentData").split('\n');
            console.log('errorArray = ' + JSON.stringify(errorArray))
            for (var i in errorArray) {
                if (errorArray[i] != '') {
                    let errorData = {}
                    if(!this.isNumber(errorArray[i].trim().substring(1, 2))){
                        continue
                    }
                    let index = errorDataRow.indexOf(errorArray[i].trim().substring(1, 2));
                    if (index == -1) {
                        errorData.errorRow = errorArray[i].trim().substring(1, 2);
                        errorDataRow.push(errorData.errorRow);
                        errorData.errorInfo = errorArray[i].trim().substring(5,errorArray[i].trim().length).replace('=','');
                        if(errorData.errorInfo == '拜访人AWS不存在'){
                            errorData.errorInfo ='拜访人 ' + fileContentData[errorData.errorRow].split(',')[4] + '不存在';
                        }
                        errorDatas.push(errorData);
                    } else {
                        if(errorArray[i].trim().substring(5) == '拜访人AWS不存在'){
                            errorData[index].errorInfo = '; ' + '拜访人 ' + fileContentData[errorDatas[index].errorRow].split(',')[4] + '不存在';
                        }else{
                            errorDatas[index].errorInfo += '; ' + errorArray[i].trim().substring(5,errorArray[i].trim().length);
                        }
                    }
                }
            }
            var fileContentData = component.get("v.fileContentData").split('\n');
            let errorColumns = [
                { 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; i++) {
                errorColumns.push({
                    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));
                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))
            component.set('v.errorColumns', errorColumns);
            component.set('v.errorData', errorDatas);
            component.set("v.showErrorInfo", true);
            console.log('error = ' + error);
            component.set('v.errorMessage', error);
            this.error(error);
            console.log('error='+error);
            component.set('v.login',false);
@@ -2345,6 +2481,71 @@
    },
    //zhj MEBG新方案改造 2022-11-29 end
    //zhj 导出错误信息 2023-05-16 start
    exportErrorInfoHelper: function (component) {
        var errorData = component.get('v.errorData');
        var errorColumns = component.get('v.errorColumns');
        var datas = [];
        let errorColumnsArray = [];
        for(var i in errorColumns){
            errorColumnsArray.push(errorColumns[i].label);
        }
        datas.push(errorColumnsArray);
        //datas.push(errorColumns);
        for (var i in errorData) {
            let data = [];
            data.push(errorData[i].errorRow)
            data.push(errorData[i].errorInfo)
            for(var j = 0 ; j < Object.keys(errorData[i]).length - 2 ; j++){
                data.push(errorData[i]['field' + j])
            }
            datas.push(data);
        }
        console.log('datas = ' + JSON.stringify(datas));
        var csv = this.convertToCSV(component, datas);
        console.log('csv = ' + JSON.stringify(csv))
        this.downloadCSV(component, csv);
    },
    convertToCSV: function (component, data) {
        console.log('enter convertToCSV')
        console.log('data = ' + data);
        var csv = '';
        for (var i = 0; i < data.length; i++) {
            var row = data[i];
            console.log('row = ' + JSON.stringify(row));
            for (var j = 0; j < row.length; j++) {
                var val = '';
                val = row[j] === null ? '' : row[j].toString();
                console.log('val = ' + val);
                if (val.indexOf(',') !== -1 || val.indexOf('"') !== -1 || val.indexOf('\n') !== -1) {
                    //val = '"' + val.replace(/"/g,'""') + '"';
                }
                if (j > 0) {
                    csv += ',';
                }
                csv += val;
            }
            csv += '\n';
        }
        return csv;
    },
    downloadCSV: function (component, csv) {
        var link = document.createElement('a');
        // 设置字符集和文件头
        var bom = "\uFEFF";
        link.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(bom + csv);
        link.download = 'data.csv';
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
    },
    //zhj 导出错误信息 2023-05-16 end
    // searchAgencyContact : function(res) {
    //     var agencyContacts = [];
    //     for (let idx = 0; idx < res.length; idx++) {
force-app/main/default/classes/ArriveGoodsController.cls
@@ -1217,7 +1217,8 @@
                        AND TracingCode__c in :barMcodeMap.values()
                        AND Bar_Code__c not in :barMcodeMap.keySet()
                        ORDER BY Name ];
            System.debug('barMcodeMap1:'+barMcodeMap.values());
            System.debug('barMcodeMap2s:'+barMcodeMap.keySet());
            if(reSet.size()>0){
                for (Integer i = 0; i < reSet.size(); i++) {
                    if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)){
force-app/main/default/classes/ArriveGoodsControllerTest.cls
@@ -2908,4 +2908,99 @@
        }
    }
    @isTest
    static  void makeRecordsVieweTest() {
        Integer count  = 1001;
        List<ArriveGoodsController.ConsumableorderdetailsInfo> conList = new List<ArriveGoodsController.ConsumableorderdetailsInfo>();
        for(Integer i = 0; i < 1001; i++){
            conList.add(new ArriveGoodsController.ConsumableorderdetailsInfo());
        }
        ArriveGoodsController arr = new ArriveGoodsController();
        arr.makeRecordsView(conList);
        ArriveGoodsController arr1 = new ArriveGoodsController('','');
    }
    @isTest
    static  void compareToTest() {
        ArriveGoodsController.ConsumableorderdetailsInfo c1 = new ArriveGoodsController.ConsumableorderdetailsInfo();
        ArriveGoodsController.ConsumableorderdetailsInfo c2 = new ArriveGoodsController.ConsumableorderdetailsInfo();
        c1.compareTo(c2);
    }
    @isTest
    static  void searchProTest1() {
        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 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');
        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 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';
            Order1.Order_status__c = '批准';
            Order1.Order_type__c = '订单';
            Order1.Dealer_Info__c = myAccount1.id;
            Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
            Order1.Order_ProType__c = 'ET';
            insert Order1;
            Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
            Orderdet.Name = 'OCM_01_00101';
            Orderdet.Consumable_order__c = Order1.Id;
            Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
            Orderdet.Consumable_Product__c = pro1.Id;
            Orderdet.Consumable_count__c = 4;
            insert Orderdet;
            Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
            Orderdet1.Name = 'OCM_01_001001';
            Orderdet1.Consumable_order_minor__c = Order1.Id;
            Orderdet1.Consumable_Product__c = pro1.Id;
            Orderdet1.Asset_Model_No__c = 'Test01';
            Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
            Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
            Orderdet1.Cancellation_Date__c = null;
            Orderdet1.TracingCode__c = 'BXJRF';
            Orderdet1.SerialLotNo__c = '5ZK';
            insert Orderdet1;
            System.debug('Orderdet1:'+Orderdet1);
            Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
            Orderdet2.Name = 'OCM_01_001001';
            Orderdet2.Consumable_order_minor__c = Order1.Id;
            Orderdet2.Consumable_Product__c = pro1.Id;
            Orderdet2.Asset_Model_No__c = 'Test01';
            Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
            Orderdet2.Bar_Code__c = '01049531702003111115120017181234105ZK250BXJRF';
            Orderdet1.Cancellation_Date__c = null;
            Orderdet2.TracingCode__c = 'BXJRF';
            Orderdet2.SerialLotNo__c = '5ZK';
            insert Orderdet2;
            PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr');
            System.Test.setCurrentPage(page);
            ArriveGoodsController Controller = new ArriveGoodsController();
            System.Test.startTest();
            Controller.init();
            Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF';
            Controller.SearchPro();
            Controller.ArriveGoodsConfim();
            List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c];
            System.Test.stopTest();
        }
    }
}
force-app/main/default/classes/DealerInquiryModifyStateController.cls
@@ -51,6 +51,9 @@
    private String strColumus;
    private String strRtColumus;
    //add by Link 2023-6-2
    public String remindMsg{get;set;}
    @TestVisible private String accTypeForSort = null;
    private static Integer oppLimit = 500;
@@ -124,6 +127,7 @@
    }
    public PageReference init() {
        remindMsg = '';
        PartnerSoapSforceCom.Soap soap = new PartnerSoapSforceCom.Soap();
        soap.SessionHeader = new PartnerSoapSforceCom.SessionHeader_element();
        soap.SessionHeader.sessionId = UserInfo.getSessionId();
@@ -372,14 +376,22 @@
        //显示提示操作信息
        if (String.isBlank(this.saveType) && String.isBlank(this.sortKey)) {
            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 + '件'));
                //add by Link 2023-6-2
                remindMsg = '数据超过' + oppLimit + '件,只显示前' + oppLimit + '件';
            } else {
                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 + ' 条数据'));
            //add by Link 2023-6-2
            remindMsg = '共有 ' + oppCount + ' 条数据';
        }
    }
    //检索条件:数据字段1,数据字段2,数据字段3均满足进入此方法 判断多种情况
@@ -566,6 +578,8 @@
            //     update updOpps;
            // }
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '保存完了'));
            //add by Link 2023-6-2
            remindMsg = '保存完了';
        } catch (Exception e) {
            //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请确定科室分类和产品区分的关系'));
        }
force-app/main/default/classes/LexArriveGoodsController.cls
@@ -1,5 +1,4 @@
public without sharing class LexArriveGoodsController {
    //初始化
    @AuraEnabled
    public static Results init(String arrType, String eSetId) {
@@ -26,20 +25,20 @@
    public static Results searchProduct(String barcode, String arrControllerStr) {
        Results results = new Results();
        try {
            System.debug('arrControllerStr:'+arrControllerStr);
            ArriveGoodsController arrController = (ArriveGoodsController)JSON.deserialize(arrControllerStr, ArriveGoodsController.class);
            System.debug('arrControllerStr:' + arrControllerStr);
            ArriveGoodsController arrController = (ArriveGoodsController) JSON.deserialize(arrControllerStr, ArriveGoodsController.class);
            arrController.barcode = barcode;
            arrController.returnError = null;
            arrController.warningList = new List<String>();
            arrController.errorList = new List<String>();
            arrController.SearchPro();
            results.arrGoodCon = JSON.serialize(arrController);
            if(arrController.returnError != null && arrController.returnError != ''){
            if (arrController.returnError != null && arrController.returnError != '') {
                results.result = 'Fail';
                results.errorMsgList = arrController.errorList;
                results.warningMsgList = arrController.warningList;
                results.errorMsg = arrController.returnError;
            }else {
            } else {
                results.coc = arrController.coc;
                results.saveFLGbln = arrController.saveFLGbln;
                results.returnFLGbln = arrController.ReturnFLGbln;
@@ -64,56 +63,20 @@
    public static Results arriveGoodsConfim(String arrControllerStr) {
        Results results = new Results();
        try {
            ArriveGoodsController arrController = (ArriveGoodsController)JSON.deserialize(arrControllerStr, ArriveGoodsController.class);
            ArriveGoodsController arrController = (ArriveGoodsController) JSON.deserialize(arrControllerStr, ArriveGoodsController.class);
            arrController.returnError = null;
            arrController.warningList = new List<String>();
            arrController.errorList = new List<String>();
            Pagereference page = arrController.ArriveGoodsConfim();
            results.arrGoodCon = JSON.serialize(arrController);
            if(arrController.returnError != null && arrController.returnError != ''){
            if (arrController.returnError != null && arrController.returnError != '') {
                results.result = 'Fail';
                results.errorMsgList = arrController.errorList;
                results.warningMsgList = arrController.warningList;
                results.errorMsg = arrController.returnError;
            }else {
                if(arrController.urlType == 'UnabletoEdit'){
                    results.url = '/lexarrivegsdetails?EsetId='+arrController.arriveId;
                }
                results.errorMsgList = arrController.errorList;
                results.warningMsgList = arrController.warningList;
                results.result = 'Success';
            }
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
        return results;
    }
    //登录返品
    @AuraEnabled
    public static Results updateGoodsOfReturn(String arrControllerStr, String showGoodsofReturnListStr) {
        Results results = new Results();
        try {
            List<ConsumableorderdetailsInfo> showGoodsofReturnList = (List<ConsumableorderdetailsInfo>)JSON.deserialize(showGoodsofReturnListStr, List<ConsumableorderdetailsInfo>.class);
            ArriveGoodsController arrController = (ArriveGoodsController)JSON.deserialize(arrControllerStr, ArriveGoodsController.class);
            arrController.ShowGoodsofReturnList = changeType2(showGoodsofReturnList);
            arrController.returnError = null;
            arrController.warningList = new List<String>();
            arrController.errorList = new List<String>();
            Pagereference page = arrController.UpdateGoodsOfReturn();
            results.arrGoodCon = JSON.serialize(arrController);
            if(arrController.returnError != null && arrController.returnError != ''){
                results.result = 'Fail';
                results.errorMsgList = arrController.errorList;
                results.warningMsgList = arrController.warningList;
                results.errorMsg = arrController.returnError;
            }else {
                if(arrController.urlType == 'ToReturnGoodsPage'){
                    results.url = '/detail/'+arrController.return_Order_id;
                }
                if(arrController.urlType == 'ToInventoryGoodsPage'){
                    results.url = '/detail/'+arrController.inventory_Order_id;
            } else {
                if (arrController.urlType == 'UnabletoEdit') {
                    results.url = '/lexarrivegsdetails?EsetId=' + arrController.arriveId;
                }
                results.errorMsgList = arrController.errorList;
                results.warningMsgList = arrController.warningList;
@@ -126,10 +89,50 @@
        return results;
    }
    public static List<ConsumableorderdetailsInfo> changeType1(List<ArriveGoodsController.ConsumableorderdetailsInfo> conList){
    //登录返品
    @AuraEnabled
    public static Results updateGoodsOfReturn(String arrControllerStr, String showGoodsofReturnListStr) {
        Results results = new Results();
        try {
            List<ConsumableorderdetailsInfo> showGoodsofReturnList = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
                showGoodsofReturnListStr,
                List<ConsumableorderdetailsInfo>.class
            );
            ArriveGoodsController arrController = (ArriveGoodsController) JSON.deserialize(arrControllerStr, ArriveGoodsController.class);
            arrController.ShowGoodsofReturnList = changeType2(showGoodsofReturnList);
            arrController.returnError = null;
            arrController.warningList = new List<String>();
            arrController.errorList = new List<String>();
            StaticParameter.ConsumableOrderTrigger = true; //Add by Li Jun for bypass ConsumableOrderTrigger 20230616
            Pagereference page = arrController.UpdateGoodsOfReturn();
            results.arrGoodCon = JSON.serialize(arrController);
            if (arrController.returnError != null && arrController.returnError != '') {
                results.result = 'Fail';
                results.errorMsgList = arrController.errorList;
                results.warningMsgList = arrController.warningList;
                results.errorMsg = arrController.returnError;
            } else {
                if (arrController.urlType == 'ToReturnGoodsPage') {
                    results.url = '/detail/' + arrController.return_Order_id;
                }
                if (arrController.urlType == 'ToInventoryGoodsPage') {
                    results.url = '/detail/' + arrController.inventory_Order_id;
                }
                results.errorMsgList = arrController.errorList;
                results.warningMsgList = arrController.warningList;
                results.result = 'Success';
            }
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
        return results;
    }
    public static List<ConsumableorderdetailsInfo> changeType1(List<ArriveGoodsController.ConsumableorderdetailsInfo> conList) {
        List<ConsumableorderdetailsInfo> conList1 = new List<ConsumableorderdetailsInfo>();
        if(conList != null){
            for(ArriveGoodsController.ConsumableorderdetailsInfo con : conList){
        if (conList != null) {
            for (ArriveGoodsController.ConsumableorderdetailsInfo con : conList) {
                ConsumableorderdetailsInfo con1 = new ConsumableorderdetailsInfo();
                con1.esd = con.esd;
                con1.Prod = con.Prod;
@@ -152,10 +155,10 @@
        return conList1;
    }
    public static List<ArriveGoodsController.ConsumableorderdetailsInfo> changeType2(List<ConsumableorderdetailsInfo> conList){
    public static List<ArriveGoodsController.ConsumableorderdetailsInfo> changeType2(List<ConsumableorderdetailsInfo> conList) {
        List<ArriveGoodsController.ConsumableorderdetailsInfo> conList1 = new List<ArriveGoodsController.ConsumableorderdetailsInfo>();
        if(conList != null){
            for(ConsumableorderdetailsInfo con : conList){
        if (conList != null) {
            for (ConsumableorderdetailsInfo con : conList) {
                ArriveGoodsController.ConsumableorderdetailsInfo con1 = new ArriveGoodsController.ConsumableorderdetailsInfo();
                con1.esd = con.esd;
                con1.Prod = con.Prod;
@@ -243,63 +246,9 @@
        @AuraEnabled
        public String ReportProductExpirationDate { get; set; }
        public ConsumableorderdetailsInfo(){
        public ConsumableorderdetailsInfo() {
        }
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) {
            esd = e;
            Prod = e.Consumable_Product__r;
            oldConsumableCount = e.name;
            ErrorReason = str;
            intMark = 1;
            if (e.Report_Product_Expiration__c != null) {
                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
            }
        }
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
            canEdit = false;
            if (e.Box_Piece__c == '盒') {
                e.Rrturn_count__c = 1;
                canEdit = true;
            }
            esd = e;
            Prod = e.Consumable_Product__r;
            oldConsumableCount = e.name;
            if (e.Report_Product_Expiration__c != null) {
                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
            }
        }
        public ConsumableorderdetailsInfo(Product2__c e, List<String> barinfoL) {
            esd = new Consumable_order_details2__c();
            ProductName = e.Name__c;
            Prod = e;
            barCodeNo = barinfoL[0];
            if (String.isNotBlank(barinfoL[1])) {
                sterilizationlimitDate = Date.valueOf(barinfoL[1]);
            }
            serialNoorLotNo = barinfoL[2];
            tracingCodeNo = barinfoL[3];
            ReturnReason = '';
        }
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e, List<String> barinfoL) {
            esd = e;
            Prod = e.Consumable_Product__r;
            barCodeNo = barinfoL[0];
            if (String.isNotBlank(barinfoL[1])) {
                sterilizationlimitDate = Date.valueOf(barinfoL[1]);
            }
            serialNoorLotNo = barinfoL[2];
            tracingCodeNo = barinfoL[3];
            if (e.Report_Product_Expiration__c != null) {
                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
            }
        }
        public ConsumableorderdetailsInfo(Product2__c e) {
            Prod = e;
        }
        // 排序
        public Integer compareTo(Object compareTo) {
            return null;
force-app/main/default/classes/LexArriveGoodsMainController.cls
@@ -1,13 +1,13 @@
public without sharing class LexArriveGoodsMainController {
    /*****************検索用******************/
    //经销商产品分类
    public static String agencyProType {get;set;}
    public static String agencyProType { get; set; }
    // public static Consumable_order__c coc { get; set; }
    public static String category1 { get; set; }
    private static String cate1ForSort = null;
    private static Date cate2ForSort = Date.today();
    private static Date cate2 = Date.today();
    private static String[] columus = new String[]{ 'Product2__c.Name'};
    private static String[] columus = new List<String>{ 'Product2__c.Name' };
    // 产品 ID
    private static String ESetId = '';
    private static String accountid = null;
@@ -21,37 +21,25 @@
    // 登录者工作地
    private static String userWorkLocation;
    // 20200904 ljh  汇总使用 start
    public static Integer Total_num {get; set;}
    public static Integer OrderNumber_arrived {get; set;}
    public static Integer Delivery_detail_count {get; set;}
    public static Integer OrderNumber_notarrive {get; set;}
    public static Integer More_than_seven_days {get; set;}
    public static Integer Total_num { get; set; }
    public static Integer OrderNumber_arrived { get; set; }
    public static Integer Delivery_detail_count { get; set; }
    public static Integer OrderNumber_notarrive { get; set; }
    public static Integer More_than_seven_days { get; set; }
    @AuraEnabled
    public static Results init(){
    public static Results init() {
        Results results = new Results();
        results.isNoteStay = LexUtility.getIsNoteStay();
        try {
            List<String> idList  = new List<String>();
            idList.add('a2K10000002zHyDEAU');
            idList.add('a2K10000002zIJEEA2');
            idList.add('a2K10000002zK9rEAE');
            idList.add('a2K10000004AKGBEA4');
            idList.add('a2K10000004ALqeEAG');
            idList.add('a2K10000004AMmrEAG');
            idList.add('a2K10000004ANvDEAW');
            idList.add('a2K10000004AOVxEAO');
            idList.add('a2K10000004AOJZEA4');
            idList.add('a2K10000004AOLuEAO');
            idList.add('a2K10000004AOLfEAO');
            // coc = new Consumable_order__c();
            String userId = UserInfo.getUserId();
            List<user> Useracc = New List<user>();
            Useracc = [select accountid, Work_Location__c,UserPro_Type__c from user where id =:userId];
            List<user> Useracc = new List<user>();
            Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
            accountid = Useracc[0].accountid;
            userWorkLocation = Useracc[0].Work_Location__c;
            agencyProType = Useracc[0].UserPro_Type__c;
            if(String.isBlank(Useracc[0].UserPro_Type__c)){
            if (String.isBlank(Useracc[0].UserPro_Type__c)) {
                agencyProType = 'ET';
            }
            // 获得订单一览
@@ -74,7 +62,18 @@
            for (String s : column) {
                soql += ',' + s;
            }
            soql += ' from Consumable_order__c where Order_type__c = \''+'订单'+'\' and  recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\' and Order_ProType__c =\'' + agencyProType +'\' and   (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' and showFalseNotshowTrue__c = false order by Deliver_date__c'; //
            soql +=
                ' from Consumable_order__c where Order_type__c = \'' +
                '订单' +
                '\' and  recordtypeid =\'' +
                System.Label.RT_ConOrder_Delivery +
                '\' and Dealer_Info__c =\'' +
                accountid +
                '\' and Order_ProType__c =\'' +
                agencyProType +
                '\' and   (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_Owner_WorkLocal__c = \'' +
                userWorkLocation +
                '\' and showFalseNotshowTrue__c = false order by Deliver_date__c'; //
            // soql = 'select id,name,ContractNo__c,Total_num__c,OrderNumber_arrived__c,Delivery_detail_count__c,OrderNumber_notarrive__c,More_than_seven_days__c,Shipment_date__c,First_Delivery__c from Consumable_order__c where id in :idList';
            raesList = Database.query(soql);
            //20200904 ljh add start
@@ -83,22 +82,22 @@
            Delivery_detail_count = 0;
            OrderNumber_notarrive = 0;
            More_than_seven_days = 0;
            System.debug('-----1------'+raesList);
            for(Consumable_order__c conorder :raesList){
                if(conorder.Total_num__c != null){
                    Total_num += (Integer)conorder.Total_num__c;
            System.debug('-----1------' + raesList);
            for (Consumable_order__c conorder : raesList) {
                if (conorder.Total_num__c != null) {
                    Total_num += (Integer) conorder.Total_num__c;
                }
                if(conorder.OrderNumber_arrived__c != null){
                    OrderNumber_arrived += (Integer)conorder.OrderNumber_arrived__c;
                if (conorder.OrderNumber_arrived__c != null) {
                    OrderNumber_arrived += (Integer) conorder.OrderNumber_arrived__c;
                }
                if(conorder.Delivery_detail_count__c != null){
                    Delivery_detail_count += (Integer)conorder.Delivery_detail_count__c;
                if (conorder.Delivery_detail_count__c != null) {
                    Delivery_detail_count += (Integer) conorder.Delivery_detail_count__c;
                }
                if(conorder.OrderNumber_notarrive__c != null){
                    OrderNumber_notarrive += (Integer)conorder.OrderNumber_notarrive__c;
                if (conorder.OrderNumber_notarrive__c != null) {
                    OrderNumber_notarrive += (Integer) conorder.OrderNumber_notarrive__c;
                }
                if(conorder.More_than_seven_days__c != null){
                    More_than_seven_days += (Integer)conorder.More_than_seven_days__c;
                if (conorder.More_than_seven_days__c != null) {
                    More_than_seven_days += (Integer) conorder.More_than_seven_days__c;
                }
            }
            results.agencyProType = agencyProType;
@@ -120,7 +119,13 @@
    }
    @AuraEnabled
    public static Results searchConsumableorderdetails(String category1Str, Date cate2Str, String accountidStr, String userWorkLocationStr, String agencyProTypeStr){
    public static Results searchConsumableorderdetails(
        String category1Str,
        Date cate2Str,
        String accountidStr,
        String userWorkLocationStr,
        String agencyProTypeStr
    ) {
        Results results = new Results();
        category1 = category1Str;
        cate2 = cate2Str;
@@ -149,16 +154,23 @@
            for (String s : column) {
                soql += ',' + s;
            }
            soql += ' from Consumable_order__c where Order_type__c = \''+'订单'+'\' and  recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\' and  (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) ';
            soql +=
                ' from Consumable_order__c where Order_type__c = \'' +
                '订单' +
                '\' and  recordtypeid =\'' +
                System.Label.RT_ConOrder_Delivery +
                '\' and Dealer_Info__c =\'' +
                accountid +
                '\' and  (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) ';
            soql += 'and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
            soql += 'and showFalseNotshowTrue__c = false';
            if (!String.isBlank(category1)) {
                soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' ';
            }
            if(cate2 != null){
            if (cate2 != null) {
                soql += ' and Shipment_date__c = :cate2 ';
            }
            soql += '  and Order_ProType__c =\'' + agencyProType +'\'';
            soql += '  and Order_ProType__c =\'' + agencyProType + '\'';
            soql += ' order by Deliver_date__c';
            system.debug('====soql:' + soql);
            raesList = Database.query(soql);
force-app/main/default/classes/LexArriveGsDetailsController.cls
@@ -19,45 +19,72 @@
        try {
            //取经销商信息
            String userId = UserInfo.getUserId();
            List<user> useracc = New List<user>();
            useracc = [select accountid from user where id =:userId];
            List<user> useracc = new List<user>();
            useracc = [SELECT accountid FROM user WHERE id = :userId];
            accountid = useracc[0].accountid;
            List<Consumable_order__c> rs = New List<Consumable_order__c>();
            if(eSetId == NULL || eSetId == '') {
            }else {
                rs = [SELECT id,name,Order_reason__c,Arrive_Order__c,Arrive_Order__r.Total_num__c,Arrive_Order__r.IsShipment__c,Arrive_Order__r.Name,
                            recordtypeid,Order_status__c,Deliver_date__c,Arrive_total_amount__c
                        FROM Consumable_order__c
                        WHERE id =:eSetId];
                coc =  new Consumable_order__c();
                if(rs.size()>0){
            List<Consumable_order__c> rs = new List<Consumable_order__c>();
            if (eSetId == null || eSetId == '') {
            } else {
                rs = [
                    SELECT
                        id,
                        name,
                        Order_reason__c,
                        Arrive_Order__c,
                        Arrive_Order__r.Total_num__c,
                        Arrive_Order__r.IsShipment__c,
                        Arrive_Order__r.Name,
                        recordtypeid,
                        Order_status__c,
                        Deliver_date__c,
                        Arrive_total_amount__c
                    FROM Consumable_order__c
                    WHERE id = :eSetId
                ];
                coc = new Consumable_order__c();
                if (rs.size() > 0) {
                    coc = rs[0];
                    orderallcount = coc.Arrive_Order__r.Total_num__c;
                }
                if(coc.Arrive_Order__c == null){
                if (coc.Arrive_Order__c == null) {
                    arrivetoorder = true;
                }
                List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = [SELECT Id,Dealer_Arrive__c,Bar_Code__c, RecordTypeid, Name,Consumable_Product__r.Name__c,
                                                            Consumable_Product__c,Consumable_Product__r.Name,Dealer_Saled__c,
                                                            Sterilization_limit__c,Deliver_date__c,
                                                            Intra_Trade_List_RMB__c,Asset_Model_No__c,Arrive_Date__c,Send_Date__c,
                                                            Consumable_Product__r.SFDA_Status__c,
                                                            Consumable_Product__r.Product2__r.Packing_list_manual__c,
                                                            Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                                                            Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
                                                        FROM Consumable_order_details2__c
                                                        WHERE Consumable_Arrived_order__c = :eSetId
                                                        ORDER BY Name ];
                List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = [
                    SELECT
                        Id,
                        Dealer_Arrive__c,
                        Bar_Code__c,
                        RecordTypeid,
                        Name,
                        Consumable_Product__r.Name__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Dealer_Saled__c,
                        Sterilization_limit__c,
                        Deliver_date__c,
                        Intra_Trade_List_RMB__c,
                        Asset_Model_No__c,
                        Arrive_Date__c,
                        Send_Date__c,
                        Consumable_Product__r.SFDA_Status__c,
                        Consumable_Product__r.Product2__r.Packing_list_manual__c,
                        Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                        Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
                    FROM Consumable_order_details2__c
                    WHERE Consumable_Arrived_order__c = :eSetId
                    ORDER BY Name
                ];
                for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
                        consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
                    }
                    consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
                }
            }
            for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){
            for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) {
                bss.packing_list = bss.Prod.Product2__r.Packing_list_manual__c;
                bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                //update by rentx 20210622 start CHAN-C3K4ZQ
                bss.expiration_DateStr = bss.Prod.Product2__r.SFDA_Expiration_Date__c == null ? '' : bss.Prod.Product2__r.SFDA_Expiration_Date__c.format();
                bss.expiration_DateStr = bss.Prod.Product2__r.SFDA_Expiration_Date__c == null
                    ? ''
                    : bss.Prod.Product2__r.SFDA_Expiration_Date__c.format();
                bss.Sterilization_limitStr = bss.esd.Sterilization_limit__c == null ? '' : bss.esd.Sterilization_limit__c.format();
                //update by rentx 20210622 end CHAN-C3K4ZQ
            }
@@ -65,7 +92,7 @@
            //add by rentx 20210622 CHAN-C3K4ZQ
            // makeRecordsView(consumableorderdetailsRecords);
            //add by rentx 20210622 CHAN-
            for(ConsumableorderdetailsInfo con : consumableorderdetailsRecords){
            for (ConsumableorderdetailsInfo con : consumableorderdetailsRecords) {
                con.prodName = con.esd.Consumable_Product__r.Name__c;
            }
            results.coc = coc;
@@ -84,30 +111,34 @@
    //出库
    @AuraEnabled
    public static Results proSale(String cocStr, Decimal orderallcountParm, Integer consumableorderdetailsCountParm) {
    public static Results proSale(String cocStr, Decimal orderallcountParm, Integer consumableorderdetailsCountParm, String eSetIdStr) {
        Results results = new Results();
        eSetId = eSetIdStr;
        try {
            orderallcount = orderallcountParm;
            consumableorderdetailsCount = consumableorderdetailsCountParm;
            coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class);
            coc = (Consumable_order__c) JSON.deserialize(cocStr, Consumable_order__c.class);
            List<Consumable_order_details2__c> orderdetails = new List<Consumable_order_details2__c>();
            //发货明细2
            orderdetails = [SELECT Id
                            FROM Consumable_order_details2__c
                            WHERE Consumable_order_minor__c =:coc.Arrive_Order__c
                            AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                            AND Dealer_Arrive__c = true ];
            if(orderallcount!= consumableorderdetailsCount){
            orderdetails = [
                SELECT Id
                FROM Consumable_order_details2__c
                WHERE
                    Consumable_order_minor__c = :coc.Arrive_Order__c
                    AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                    AND Dealer_Arrive__c = TRUE
            ];
            if (orderallcount != consumableorderdetailsCount) {
                results.result = 'Fail';
                results.errorMsg = '订单不完全到货,无法出库';
                return results;
            }
            if(coc.Arrive_Order__r.IsShipment__c == true){
            if (coc.Arrive_Order__r.IsShipment__c == true) {
                results.result = 'Fail';
                results.errorMsg = '订单已经出库';
                return results;
            }
            results.url = '/lexsummonscreat?arriveorder=' + eSetId +'&KeyWords=Redirect';
            results.url = '/lexsummonscreat?arriveorder=' + eSetId + '&KeyWords=Redirect';
            results.result = 'Success';
        } catch (Exception e) {
            results.result = 'Fail';
@@ -143,7 +174,7 @@
        @AuraEnabled
        public Consumable_order_details2__c esd;
        @AuraEnabled
        public Product2__c Prod;
        public Product2__c Prod;
        @AuraEnabled
        public Decimal packing_list;
        @AuraEnabled
@@ -156,7 +187,6 @@
        public String Sterilization_limitStr;
        @AuraEnabled
        public String prodName;
        // 已存在消耗品明细用
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
force-app/main/default/classes/LexCancelRemoveBoxController.cls
@@ -1,6 +1,6 @@
public with sharing class LexCancelRemoveBoxController {
    //经销商产品分类
    public static String agencyProType {get;set;}
    public static String agencyProType { get; set; }
    public static String userPro_Typestr = null;
    public static String barcode { get; set; }
    /*****************画面表示Bean******************/
@@ -9,32 +9,32 @@
    public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; }
    //拆盒明细
    public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
    public static boolean saveFLGbln {get;set;}
    public static boolean saveFLGbln { get; set; }
    //错误信息
    public static String alertMessage {set;get;}
    public static String alertMessage { get; set; }
    //拆盒明细件数
    public static Integer getinventorysize(){
    public static Integer getinventorysize() {
        return ConsumableorderdetailsRecordsdummy.size();
    }
    public static Map<String, String> ExistIdMap = new Map<String, String>();
    public static Map<String, String> ErrorIdMap = new Map<String, String>();
    public static Map<String, String> AllMap = new Map<String, String>();
    public static  List<String> BarCodeListP = new List<String>();
    public static List<String> BarCodeListP = new List<String>();
    //不符合的barcode和型号
    public static list<String> notInlist = new list<String>();
    public static  String baseUrl {get;private set;}
    public static list<String> notInlist = new List<String>();
    public static String baseUrl { get; private set; }
    private static String accountid = null;
    private static String accountName = null;
    //public String[] proidList =new String[]{};
    // 登录者工作地
    private static String userWorkLocation;
    public LexCancelRemoveBoxController(){
    public LexCancelRemoveBoxController() {
        baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
        ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
        ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
        consumableInventory = new List<ConsumableorderdetailsInfo>();
        saveFLGbln = FALSE;
        saveFLGbln = false;
    }
    @AuraEnabled
@@ -44,39 +44,38 @@
        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;
        if(String.isBlank(Useracc[0].UserPro_Type__c)){
        if (String.isBlank(Useracc[0].UserPro_Type__c)) {
            agencyProType = 'ET';
        }
        userPro_Typestr = '%' + agencyProType + '%';
        List<account> accountInfo = [SELECT Name FROM account WHERE id =:accountid];
        List<account> accountInfo = [SELECT Name FROM account WHERE id = :accountid];
        //String view_product = accountInfo[0].view_product__c;
        accountName = accountInfo[0].Name;
        //proidList = view_product.split(',');
        data.put('accountName',accountName);
        data.put('userWorkLocation',userWorkLocation);
        data.put('agencyProType',agencyProType);
        data.put('accountName', accountName);
        data.put('userWorkLocation', userWorkLocation);
        data.put('agencyProType', agencyProType);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        return res;
    }
    // 将页面或取得BarCode去掉重复的,转换成List
    public static List<String> ParseBarCode(String Code){
        String[] Cache = new String[]{};
    public static List<String> ParseBarCode(String Code) {
        String[] Cache = new List<String>{};
        Cache = Code.split('\n');
        Set <String> Buff = new Set<String>();
        for(String A : Cache){
        Set<String> Buff = new Set<String>();
        for (String A : Cache) {
            Buff.add(A);
        }
        List<String> outPut = new List<String>();
        for(String B :Buff){
        for (String B : Buff) {
            B = B.trim();
            outPut.add(B);
        }
@@ -85,9 +84,14 @@
    //获取明细
    @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>();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        userPro_Typestr = '%' + agencyProType + '%';
        barcode = barcode;
@@ -97,20 +101,18 @@
        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;
        alertMessage='';
        saveFLGbln = false;
        alertMessage = '';
        //判断barcode是否为空
        if(barcode == null || barcode ==''){
            return new ResponseBodyLWC('Error',500, '请输入BarCode号', '');
        if (barcode == null || barcode == '') {
            return new ResponseBodyLWC('Error', 500, '请输入BarCode号', '');
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'请输入BarCode号。'));
            // return;
        }
@@ -122,309 +124,416 @@
        // ConsumableorderdetailsRecordsdummy.clear();
        // 产品类型不同
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,Product_Type__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                        /*,ContractNo__c*/
                        //add by rentx 2020-10-13 end
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    AND   Arrive_Owner_Work_Location__c = : userWorkLocation
                    AND (not Product_Type__c like : userPro_Typestr)
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Product_Type__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c,
                Arrive_Owner_Work_Location__c,
                //add by rentx 2020-10-13 start
                ContractNo_text__c
            /*,ContractNo__c*/
            //add by rentx 2020-10-13 end
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
                AND (NOT Product_Type__c LIKE :userPro_Typestr)
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                    String str = '该商品类型'+ reSet1[i].Product_Type__c +'与产品类型'+ agencyProType +'不符,不能拆盒';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                } else {
                    String str = '该商品类型' + reSet1[i].Product_Type__c + '与产品类型' + agencyProType + '不符,不能拆盒';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //没有拆盒
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                         /*,ContractNo__c*/
                        //add by rentx 2020-10-13 end
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND  Dealer_Shipment__c= false
                    AND  Dealer_Saled__c = false
                    AND  Dealer_Returned__c = false
                    AND  Lose_Flag__c = false
                    AND  Box_Piece__c = '盒'
                    //AND  ProductPacking_list_manual__c > 1
                    AND  Bar_Code__c in :BarCodeListP
                    AND  Dealer_Info_text__c = :accountName
                    ORDER BY Name ];  //没出库,没销售,在库,没有拆盒
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c,
                //add by rentx 2020-10-13 start
                ContractNo_text__c
            /*,ContractNo__c*/
            //add by rentx 2020-10-13 end
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Box_Piece__c = '盒'
                //AND  ProductPacking_list_manual__c > 1
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ]; //没出库,没销售,在库,没有拆盒
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品没有拆盒';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //已出货,未到货
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                        /*,ContractNo__c*/
                        //add by rentx 2020-10-13 end
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = FALSE
                    AND  Dealer_Shipment__c= FALSE
                    AND  Dealer_Saled__c = FALSE
                    AND  Dealer_Returned__c = false
                    AND  Lose_Flag__c = false
                    AND  Box_Piece__c = '盒'
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c,
                //add by rentx 2020-10-13 start
                ContractNo_text__c
            /*,ContractNo__c*/
            //add by rentx 2020-10-13 end
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = FALSE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Box_Piece__c = '盒'
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品还未到货';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //拆盒已出货
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                        /*,ContractNo__c*/
                        //add by rentx 2020-10-13 end
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Shipment__c = true
                    AND   Dealer_Arrive__c = true
                    AND   Dealer_Returned__c = false
                    AND   Lose_Flag__c = false
                    AND   Box_Piece__c = '个'
                    AND   RemoveBox_date__c != null
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c,
                //add by rentx 2020-10-13 start
                ContractNo_text__c
            /*,ContractNo__c*/
            //add by rentx 2020-10-13 end
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Shipment__c = TRUE
                AND Dealer_Arrive__c = TRUE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Box_Piece__c = '个'
                AND RemoveBox_date__c != NULL
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品存在出货履历';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //拆盒已销售
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                        /*,ContractNo__c*/
                        //add by rentx 2020-10-13 end
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Saled__c = true
                    AND   Dealer_Arrive__c = true
                    AND   Dealer_Returned__c = false
                    AND   Lose_Flag__c = false
                    AND   Box_Piece__c = '个'
                    AND   RemoveBox_date__c != null
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c,
                //add by rentx 2020-10-13 start
                ContractNo_text__c
            /*,ContractNo__c*/
            //add by rentx 2020-10-13 end
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Saled__c = TRUE
                AND Dealer_Arrive__c = TRUE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Box_Piece__c = '个'
                AND RemoveBox_date__c != NULL
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品存在销售履历';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //拆盒返品
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                        /*,ContractNo__c*/
                        //add by rentx 2020-10-13 end
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Returned__c = true
                    AND   Return_date__c != null
                    AND   Box_Piece__c = '个'
                    AND   RemoveBox_date__c != null
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c,
                //add by rentx 2020-10-13 start
                ContractNo_text__c
            /*,ContractNo__c*/
            //add by rentx 2020-10-13 end
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Returned__c = TRUE
                AND Return_date__c != NULL
                AND Box_Piece__c = '个'
                AND RemoveBox_date__c != NULL
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品存在返品履历';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //拆盒后盘点过(盘点日期不为空)
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                        /*,ContractNo__c*/
                        //add by rentx 2020-10-13 end
                    FROM Consumable_order_details2__c
                    WHERE Inventory_date__c != null
                    AND   Box_Piece__c = '个'
                    AND   RemoveBox_date__c != null
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c,
                //add by rentx 2020-10-13 start
                ContractNo_text__c
            /*,ContractNo__c*/
            //add by rentx 2020-10-13 end
            FROM Consumable_order_details2__c
            WHERE
                Inventory_date__c != NULL
                AND Box_Piece__c = '个'
                AND RemoveBox_date__c != NULL
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品存在盘点履历';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //不同工作地
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                        /*,ContractNo__c*/
                        //add by rentx 2020-10-13 end
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    AND   Arrive_Owner_Work_Location__c !=: userWorkLocation
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c,
                Arrive_Owner_Work_Location__c,
                //add by rentx 2020-10-13 start
                ContractNo_text__c
            /*,ContractNo__c*/
            //add by rentx 2020-10-13 end
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c != :userWorkLocation
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品属于' + reSet1[i].Arrive_Owner_Work_Location__c + ',不能取消拆盒';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        reSet = [SELECT Id,
                        Name,
                        Intra_Trade_List_RMB__c,
                        Asset_Model_No__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Consumable_Product__r.Name__c,
                        Sterilization_limit__c,
                        Deliver_date__c,
                        Bar_Code__c,
                        Arrive_date__c,
                        Send_Date__c,
                        Consumable_order_minor__r.Name,
                        Consumable_order_minor__c,
                        Dealer_Arrive__c,
                        Guarantee_period_for_products__c,
                        CFDA_Status__c,
                        ProductPacking_list_manual__c,
                        Report_Product_Approbation__c,
                        Report_Product_Expiration__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                        /*,ContractNo__c*/
                        //add by rentx 2020-10-13 end
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND Dealer_Shipment__c = false
                    AND Dealer_Saled__c = false
                    AND Dealer_Returned__c = false
                    AND Lose_Flag__c = false
                    AND Box_Piece__c = '个'
                    AND RemoveBox_date__c != null
                    AND Bar_Code__c in :BarCodeListP
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c =: userWorkLocation
                    AND  Product_Type__c like : userPro_Typestr
                ];
        if(reSet.size()>0){
        reSet = [
            SELECT
                Id,
                Name,
                Intra_Trade_List_RMB__c,
                Asset_Model_No__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Consumable_Product__r.Name__c,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                Dealer_Arrive__c,
                Guarantee_period_for_products__c,
                CFDA_Status__c,
                ProductPacking_list_manual__c,
                Report_Product_Approbation__c,
                Report_Product_Expiration__c,
                //add by rentx 2020-10-13 start
                ContractNo_text__c
            /*,ContractNo__c*/
            //add by rentx 2020-10-13 end
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Box_Piece__c = '个'
                AND RemoveBox_date__c != NULL
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
                AND Product_Type__c LIKE :userPro_Typestr
        ];
        if (reSet.size() > 0) {
            for (Integer i = 0; i < reSet.size(); i++) {
                if(ErrorIdMap.containsKey(reSet[i].Bar_Code__c) ){
                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{
                } else {
                    ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
                    ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
                    ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
                }
            }
        }
@@ -432,89 +541,97 @@
        AllMap.putAll(ExistIdMap);
        //得到不存在的BarCode
        for(Integer i = 0; i < BarCodeListP.size(); i++){
            if(ExistIdMap.containsKey(BarCodeListP[i])){
        for (Integer i = 0; i < BarCodeListP.size(); i++) {
            if (ExistIdMap.containsKey(BarCodeListP[i])) {
                continue;
            }else if(ErrorIdMap.containsKey(BarCodeListP[i])){
            } else if (ErrorIdMap.containsKey(BarCodeListP[i])) {
                continue;
            }else{
            } else {
                notInlist.add(BarCodeListP[i]);
            }
        }
        if(notInlist.size()>0){
                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '不存在。'));
                return new ResponseBodyLWC('Error',500, 'BarCode'+ notInlist + '不存在。', '');
        if (notInlist.size() > 0) {
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '不存在。'));
            return new ResponseBodyLWC('Error', 500, 'BarCode' + notInlist + '不存在。', '');
        }
        data.put('ConsumableorderdetailsRecordsdummy',JSON.serialize(ConsumableorderdetailsRecordsdummy));
        data.put('ConsumableorderdetailsRecordserror',JSON.serialize(ConsumableorderdetailsRecordserror));
        data.put('dataSize',ConsumableorderdetailsRecordsdummy.size());
        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>();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        userPro_Typestr = '%' + agencyProType + '%';
        accountName = accountName;
        userWorkLocation =userWorkLocation;
        List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>)JSON.deserialize(saveConsumableorderdetailsRecordsdummy,List<ConsumableorderdetailsInfo>.class);
        userWorkLocation = userWorkLocation;
        List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
            saveConsumableorderdetailsRecordsdummy,
            List<ConsumableorderdetailsInfo>.class
        );
        List<Consumable_order_details2__c> ins = new List<Consumable_order_details2__c>();
        List<Consumable_order_details2__c> ins = New List<Consumable_order_details2__c>();
        Savepoint sp = Database.setSavepoint();
        if(ConsumableorderdetailsRecordsdummy.size()<1){
        if (ConsumableorderdetailsRecordsdummy.size() < 1) {
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'不存在取消拆盒明细'));
            return new ResponseBodyLWC('Error',500, '不存在取消拆盒明细', '');
            return new ResponseBodyLWC('Error', 500, '不存在取消拆盒明细', '');
            // return null;
        }
        List<String> BarCodeList = new List<String>();
        for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy)  {
        for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) {
            BarCodeList.add(tmp.esd.Bar_Code__c);
        }
        try{
        try {
            //取得通番大于001的在库明细
            List<Consumable_order_details2__c> orderDetails2del =  [SELECT
                        Id,
                        Box_Piece__c,
                        RemoveBox_date__c,
                        RemoveBox_No__c,
                        Bar_Code__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                        /*,ContractNo__c*/
                        //add by rentx 2020-10-13 end
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND Dealer_Shipment__c = false
                    AND Dealer_Saled__c = false
                    AND Dealer_Returned__c = false
                    AND Lose_Flag__c = false
            List<Consumable_order_details2__c> orderDetails2del = [
                SELECT
                    Id,
                    Box_Piece__c,
                    RemoveBox_date__c,
                    RemoveBox_No__c,
                    Bar_Code__c,
                    //add by rentx 2020-10-13 start
                    ContractNo_text__c
                /*,ContractNo__c*/
                //add by rentx 2020-10-13 end
                FROM Consumable_order_details2__c
                WHERE
                    Dealer_Arrive__c = TRUE
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Dealer_Returned__c = FALSE
                    AND Lose_Flag__c = FALSE
                    AND Box_Piece__c = '个'
                    AND RemoveBox_date__c != null
                    AND RemoveBox_date__c != NULL
                    AND RemoveBox_No__c > 1
                    AND Bar_Code__c in :BarCodeList
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c =: userWorkLocation
                    AND  Product_Type__c like : userPro_Typestr
                ];
                    AND Bar_Code__c IN :BarCodeList
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
                    AND Product_Type__c LIKE :userPro_Typestr
            ];
            List<Consumable_order_details2__c> orderlistdel = new List<Consumable_order_details2__c>();
            List<Consumable_order_details2__c> orderlistupd= new List<Consumable_order_details2__c>();
            List<Consumable_order_details2__c> orderlistupd = new List<Consumable_order_details2__c>();
            for (Consumable_order_details2__c detail2tmp : orderDetails2del) {
                Consumable_order_details2__c delDetails2 = new Consumable_order_details2__c();
                delDetails2.Id                           = detail2tmp.Id;
                delDetails2.Id = detail2tmp.Id;
                //删除通番大于001的明细2
                //delete delDetails2;
@@ -522,46 +639,48 @@
            }
            //取得通番001的在库明细
            List<Consumable_order_details2__c> orderDetails2 =  [SELECT
                        Id,
                        Box_Piece__c,
                        RemoveBox_date__c,
                        RemoveBox_No__c,
                        Bar_Code__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                        /*,ContractNo__c*/
                        //add by rebtx 2020-10-13 end
            List<Consumable_order_details2__c> orderDetails2 = [
                SELECT
                    Id,
                    Box_Piece__c,
                    RemoveBox_date__c,
                    RemoveBox_No__c,
                    Bar_Code__c,
                    //add by rentx 2020-10-13 start
                    ContractNo_text__c,
                    /*,ContractNo__c*/
                    //add by rebtx 2020-10-13 end
                    // tcm start
                    ,Consumable_order_minor__r.ContractNo__c
                    // tcm end
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND Dealer_Shipment__c = false
                    AND Dealer_Saled__c = false
                    AND Dealer_Returned__c = false
                    AND Lose_Flag__c = false
                    Consumable_order_minor__r.ContractNo__c
                // tcm end
                FROM Consumable_order_details2__c
                WHERE
                    Dealer_Arrive__c = TRUE
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Dealer_Returned__c = FALSE
                    AND Lose_Flag__c = FALSE
                    AND Box_Piece__c = '个'
                    AND RemoveBox_date__c !=null
                    AND RemoveBox_date__c != NULL
                    AND RemoveBox_No__c = 1
                    AND Bar_Code__c in :BarCodeList
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c =: userWorkLocation
                    AND  Product_Type__c like : userPro_Typestr
                ];
                    AND Bar_Code__c IN :BarCodeList
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
                    AND Product_Type__c LIKE :userPro_Typestr
            ];
            for (Consumable_order_details2__c detail2tmp : orderDetails2) {
                Consumable_order_details2__c updDetails2 = new Consumable_order_details2__c();
                updDetails2.Id                           = detail2tmp.Id;
                updDetails2.Box_Piece__c                 = '盒';
                updDetails2.RemoveBox_date__c            = null;
                updDetails2.RemoveBox_No__c              = null;
                updDetails2.Id = detail2tmp.Id;
                updDetails2.Box_Piece__c = '盒';
                updDetails2.RemoveBox_date__c = null;
                updDetails2.RemoveBox_No__c = null;
                // tcm start
                if (String.isBlank(detail2tmp.Consumable_order_minor__r.ContractNo__c)) {
                    updDetails2.ContractNo_text__c= detail2tmp.ContractNo_text__c;
                }else {
                    updDetails2.ContractNo_text__c= detail2tmp.Consumable_order_minor__r.ContractNo__c;
                    updDetails2.ContractNo_text__c = detail2tmp.ContractNo_text__c;
                } else {
                    updDetails2.ContractNo_text__c = detail2tmp.Consumable_order_minor__r.ContractNo__c;
                }
                // updDetails2.ContractNo_text__c       = detail2tmp.ContractNo__c;
                // tcm end
@@ -571,29 +690,28 @@
                orderlistupd.add(updDetails2);
            }
            if(orderlistdel.size()>0){
            if (orderlistdel.size() > 0) {
                delete orderlistdel;
            }
            if(orderlistupd.size()>0){
            if (orderlistupd.size() > 0) {
                update orderlistupd;
            }
            saveFLGbln = true;
            alertMessage = '取消拆盒完成';
            data.put('saveFLGbln',saveFLGbln);
            data.put('saveFLGbln', saveFLGbln);
            res.status = 'Success';
            res.code = 200;
            res.msg = alertMessage;
            System.debug('res = ' + res);
            return res;
            // return null;
        }catch(Exception e){
        } catch (Exception e) {
            Database.rollback(sp);
            ApexPages.addMessages(e);
            return null;
        }
    }
    class ConsumableorderdetailsInfo implements Comparable {
        public Consumable_order_details2__c esd { get; set; }
@@ -606,18 +724,18 @@
        //public String tracingCodeNo { get; set; }
        public String oldConsumableCount { get; set; }
        public String ErrorReason { get; set; }
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) {
            esd                = e;
            Prod               = e.Consumable_Product__r;
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) {
            esd = e;
            Prod = e.Consumable_Product__r;
            oldConsumableCount = e.name;
            ErrorReason        = str;
            ErrorReason = str;
        }
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
            esd                = e;
            Prod               = e.Consumable_Product__r;
            esd = e;
            Prod = e.Consumable_Product__r;
            oldConsumableCount = e.name;
        }
/*
        /*
        public ConsumableorderdetailsInfo(Product2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) {
            esd = new Consumable_order_details2__c();
            ProductName = e.Name__c;
force-app/main/default/classes/LexConInvoiceViewController.cls
@@ -388,7 +388,11 @@
        //         attachmentRecoeds.add(new InvoiceOrderInfo(attachmentinfo[i]));
        //     }
        // }
        List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :invoiceId];
        List<ContentVersion> cvInfo = [
            SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId
            FROM ContentVersion
            WHERE FirstPublishLocationId = :invoiceId
        ];
        if (cvInfo.size() > 0) {
            for (Integer i = 0; i < cvInfo.size(); i++) {
                attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i]));
@@ -415,17 +419,16 @@
        data.put('done', getdone());
        data.put('invoiceOrderdetail1Recoeds', invoiceOrderdetail1Recoeds);
        data.put('accountid', accountid);
        data.put('invoiceOrderRecoedschange',invoiceOrderRecoedschange);
        data.put('attachmentRecoeds',attachmentRecoeds);
        data.put('outOrderStringList',outOrderStringList);
        data.put('outordercountMap',outordercountMap);
        data.put('invoiceOrderRecoedschange', invoiceOrderRecoedschange);
        data.put('attachmentRecoeds', attachmentRecoeds);
        data.put('outOrderStringList', outOrderStringList);
        data.put('outordercountMap', outordercountMap);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        return res;
    }
    //保存
    @AuraEnabled
    public static ResponseBodyLWC save(
@@ -453,12 +456,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) {
@@ -533,7 +536,6 @@
                }
            } else {
                if (HospitalInfo != null && HospitalInfo != '') {
                    System.debug('++++++++++++' + ass.esd.Order_ForHospital__c + '   ' + shipmentAccountString);
                    if (ass.esd.Order_ForHospital__c != shipmentAccountString) {
                        System.debug('HospitalInfo != null ass.esd.Order_ForHospital__c != shipmentAccountString');
@@ -552,7 +554,9 @@
                        (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') &&
                        ass.esd.ShipmentAccount__c != shipmentAccountString
                    ) {
                        System.debug('HospitalInfo == null && ass.esd.Order_ForDealerText__c != null ass.esd.ShipmentAccount__c != shipmentAccountString');
                        System.debug(
                            'HospitalInfo == null && ass.esd.Order_ForDealerText__c != null ass.esd.ShipmentAccount__c != shipmentAccountString'
                        );
                        invoiceOrderAccountList.add(ass.esd.Name);
                    }
                }
@@ -693,12 +697,12 @@
                invoiceHead.Order_ProType__c = agencyProType;
                invoiceHead.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
                //if (deliveryId != null) {
                    if (String.isNotBlank(deliveryId)) {
                if (String.isNotBlank(deliveryId)) {
                    invoiceHead.Outbound_order__c = deliveryId;
                }
                invoiceHead.RecordTypeid = System.Label.RT_ConOrder_Invoice;
                //if (SecondDealer == null) {
                    if (String.isBlank(SecondDealer)) {
                if (String.isBlank(SecondDealer)) {
                    if (HospitalInfo != null && HospitalInfo != '') {
                        invoiceHead.Order_ForHospital__c = HospitalInfo;
                    }
@@ -849,6 +853,8 @@
                    delete invoiceLinkdetList;
                }
                //新建发票明细1
                System.debug('===>' + chukudanID);
                System.debug('===>' + chukudanID.size());
                if (chukudanID.size() > 0) {
                    newinvoicedetails1(chukudanID);
                }
@@ -883,7 +889,7 @@
                if (cocinfo.size() > 0) {
                    invoiceHead = cocinfo[0];
                }
                if (String.isNotBlank(deliveryId)) {
                if (String.isNotBlank(deliveryId)) {
                    for (InvoiceOrderInfo ass : invoiceOrderRecoedschange) {
                        insertDetMap.put(ass.esd.Id, invoiceHead.Id);
                    }
@@ -1267,13 +1273,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();
@@ -1299,7 +1305,16 @@
    // 检索(未开发票出库单)
    @AuraEnabled
    public static ResponseBodyLWC InvoiceorderSearch(Consumable_order__c cocLwc,String invoiceIdLwc,String accountidLwc,String userWorkLocationLwc,String agencyProTypeLwc,String HospitalInfoLwc,String SecondDealerLwc,String invoiceOrderRecoedsLwc) {
    public static ResponseBodyLWC InvoiceorderSearch(
        Consumable_order__c cocLwc,
        String invoiceIdLwc,
        String accountidLwc,
        String userWorkLocationLwc,
        String agencyProTypeLwc,
        String HospitalInfoLwc,
        String SecondDealerLwc,
        String invoiceOrderRecoedsLwc
    ) {
        System.debug('进入 InvoiceorderSearch');
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
@@ -1309,12 +1324,12 @@
        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;
        userWorkLocation = userWorkLocationLwc;
        Map<String, String> invoiceOrderMap = new Map<String, String>();
        String msoql = '';
        List<InvoiceOrderInfo> invoiceOrderdetailMid = new List<InvoiceOrderInfo>();
@@ -1340,7 +1355,7 @@
                invoiceOrderMap.put(invoiceOrderList[i].Name, invoiceOrderList[i].Name);
            }
        }
        data.put('invoiceOrderRecoeds',invoiceOrderRecoeds);
        data.put('invoiceOrderRecoeds', invoiceOrderRecoeds);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
@@ -1396,7 +1411,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>();
@@ -1429,7 +1444,11 @@
    // 提交按钮
    @AuraEnabled
    public static ResponseBodyLWC approval(List<String> outOrderStringListLwc,Map<String, Consumable_Orderdetails__c> outordercountMapLwc,String invoiceIdLwc) {
    public static ResponseBodyLWC approval(
        List<String> outOrderStringListLwc,
        Map<String, Consumable_Orderdetails__c> outordercountMapLwc,
        String invoiceIdLwc
    ) {
        System.debug('进入 approval');
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
@@ -1437,7 +1456,7 @@
        outOrderStringList = outOrderStringListLwc;
        outordercountMap = outordercountMapLwc;
        invoiceId= invoiceIdLwc;
        invoiceId = invoiceIdLwc;
        //更新发票明细2链接
        Consumable_order__c P = new Consumable_order__c();
        List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
@@ -1501,6 +1520,8 @@
                        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;
                Decimal invoicedProcount = 0;
@@ -1521,6 +1542,8 @@
                    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('还没发票数量===>' + invoicedProcount);
                if (outOrderdet1List[i].InvoiceProNot_count__c < invoicedProcount) {
                    // ApexPages.addmessage(
@@ -1534,7 +1557,16 @@
                    //     )
                    // );
                    // return null;
                    return new ResponseBodyLWC('Error', 500, '出库单' + outOrderdet1List[i].Consumable_order__r.Name + '中,' + outOrderdet1List[i].Asset_Model_No__c + '还没开票数量小于发票数量,请确认是否有返品', '');
                    return new ResponseBodyLWC(
                        'Error',
                        500,
                        '出库单' +
                            outOrderdet1List[i].Consumable_order__r.Name +
                            '中,' +
                            outOrderdet1List[i].Asset_Model_No__c +
                            '还没开票数量小于发票数量,请确认是否有返品',
                        ''
                    );
                }
                outOrderdetUp1List.add(invoiceUpdte1);
@@ -1570,7 +1602,7 @@
        System.debug('res = ' + res);
        return res;
    }
    @TestVisible
    class InvoiceOrderInfo implements Comparable {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -1583,12 +1615,12 @@
        @AuraEnabled
        public Attachment attach { get; set; }
        @AuraEnabled
        public ContentVersion cvInfo{ get; set; }
        public ContentVersion cvInfo { get; set; }
        @AuraEnabled
        public String mailSelectOptsin { get; set; }
        public List<SelectOption> mailSelectOpts { get; set; }
        @AuraEnabled
        public Map<String,String> mailSelectOptsMap { get; set; }
        public Map<String, String> mailSelectOptsMap { get; set; }
        @AuraEnabled
        public String invoiceOrderId { get; set; }
        @AuraEnabled
@@ -1616,7 +1648,7 @@
        //ContentVersion
        public InvoiceOrderInfo(ContentVersion cv) {
            cvInfo = cv;
            mailSelectOptsMap = new Map<String,String>();
            mailSelectOptsMap = new Map<String, String>();
            mailSelectOptsMap.put('发票和明细', '发票和明细');
            mailSelectOptsMap.put('发票', '发票');
            mailSelectOptsMap.put('明细', '明细');
force-app/main/default/classes/LexConInvoicedetailsController.cls
@@ -1,20 +1,20 @@
public with sharing class LexConInvoicedetailsController {
    //出库单使用
    public static Consumable_order__c coc { get; set; }
    public static Consumable_order__c coc { get; set; }
    //发票使用
    public static Consumable_order__c invoicecode { get; set; }
    //发票使用
    public static Consumable_order__c invoicecode { get; set; }
    //价格计算结果
    public static Decimal sumPrice {get;set;}
    //价格计算结果
    public static Decimal sumPrice { get; set; }
    //出库单ID
    private static String orderId {get;set;}
    //发票单ID
    private static String invoiceId {get;set;}
    //出库单ID
    private static String orderId { get; set; }
    //发票单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();
@@ -23,7 +23,7 @@
    //页面初始化
    @AuraEnabled
    public static ResponseBodyLWC init(String orderIdLwc,String invoiceIdLwc) {
    public static ResponseBodyLWC init(String orderIdLwc, String invoiceIdLwc) {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
@@ -101,6 +101,7 @@
            FROM Consumable_Orderdetails__c
            WHERE Consumable_order__c = :orderId
        ];
        System.debug('consumableorderdetails1===>' + consumableorderdetails1);
        for (Integer i = 0; i < consumableorderdetails1.size(); i++) {
            consumableorderdetails1Records.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i]));
        }
@@ -138,9 +139,9 @@
                ass.esd.Invoice_Unitprice__c = ass.esd.Delivery_List_RMB__c;
            }
        }
        data.put('invoicecode',invoicecode);
        data.put('coc',coc);
        data.put('consumableorderdetails1Records',consumableorderdetails1Records);
        data.put('invoicecode', invoicecode);
        data.put('coc', coc);
        data.put('consumableorderdetails1Records', consumableorderdetails1Records);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
@@ -148,12 +149,15 @@
    }
    @AuraEnabled
    public static ResponseBodyLWC save(String consumableorderdetails1RecordsLwc,String invoiceIdLwc,String orderIdLwc) {
    public static ResponseBodyLWC save(String consumableorderdetails1RecordsLwc, String invoiceIdLwc, String orderIdLwc) {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        consumableorderdetails1Records= (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetails1RecordsLwc, List<ConsumableorderdetailsInfo>.class);
        consumableorderdetails1Records = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
            consumableorderdetails1RecordsLwc,
            List<ConsumableorderdetailsInfo>.class
        );
        invoiceId = invoiceIdLwc;
        orderId = orderIdLwc;
        System.debug('consumableorderdetails1Records = ' + consumableorderdetails1Records);
@@ -352,6 +356,7 @@
    }
    // Data Bean
    @TestVisible
    class ConsumableorderdetailsInfo {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -369,7 +374,7 @@
        public Decimal Packing_list_manual { get; set; }
        public List<SelectOption> Invoice_UnitOpts { get; set; }
        @AuraEnabled
        public Map<String,String> Invoice_UnitOptsMap { get; set; }
        public Map<String, String> Invoice_UnitOptsMap { get; set; }
        // 消耗品产品明细
        public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
            check = false;
@@ -379,12 +384,13 @@
            invoiceAllprice = 0;
            Packing_list_manual = e.Consumable_Product__r.Packing_list_manual__c;
            if (!Test.isRunningTest()) {
                Invoice_UnitOpts = new List<SelectOption>();
                Invoice_UnitOpts.add(new SelectOption('盒', '盒'));
                Invoice_UnitOpts.add(new SelectOption('个', '个'));
            }
            Invoice_UnitOpts = new List<SelectOption>();
            Invoice_UnitOpts.add(new SelectOption('盒', '盒'));
            Invoice_UnitOpts.add(new SelectOption('个', '个'));
            Invoice_UnitOptsMap = new Map<String,String>();
            Invoice_UnitOptsMap = new Map<String, String>();
            Invoice_UnitOptsMap.put('盒', '盒');
            Invoice_UnitOptsMap.put('个', '个');
        }
force-app/main/default/classes/LexConsumableAccountController.cls
@@ -164,12 +164,34 @@
                arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime);
            }
            // Map<String,Decimal> mapTemp = new Map<String,Decimal>();
            // for (AggregateResult ar : arList) {
            //     if(!mapTemp.get(String.valueOf(ar.get('hospitalName')))){
            //         mapTemp.put(String.valueOf(ar.get('hospitalName'),Decimal.valueOf(String.valueOf(ar.get('thisAmount')))));
            //     }else {
            //         Decimal decimal = mapTemp.get(String.valueOf(ar.get('hospitalName')));
            //         decimal += Decimal.valueOf(String.valueOf(ar.get('thisAmount')));
            //         mapTemp.put(String.valueOf(ar.get('hospitalName'),decimal));
            //     }
            // }
            // System.debug('mapTemp = ' + mapTemp);
            // //排序Decimal从大到小
            // List<Decimal> decimalList = new List<Decimal>(mapTemp.values());
            // decimalList.sort((a, b) => b.compareTo(a));
            // Map<String, Decimal> sortedMap = new Map<String, Decimal>();
            // for (String key : mapTemp.keySet()) {
            //     sortedMap.put(key, mapTemp.get(key));
            // }
            // System.debug('Sorted Map: ' + sortedMap);
            //查询客户信息(名称,省,县)
            System.debug('arList = ' + arList);
            List<String> accountList = new List<String>();
            for (AggregateResult ar : arList) {
                System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount')));
                if(String.valueOf(ar.get('thisAmount')) != '0.0'){
                    accountList.add(String.valueOf(ar.get('hospitalName')));
                    accountList.add(String.valueOf(ar.get('Order_ForHospital__c')));
                    topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount'))));  
                }
            }
@@ -194,14 +216,14 @@
                    Town__c,
                    Phone
                FROM Account
                WHERE Name = :accountList
                WHERE Id = :accountList
            ];
            List<Account> acListTemp = new List<Account>();
            for (String s : accountList) {
                for (Account a : acList) {
                    if (s == a.Name) {
                    if (s == a.id) {
                        acListTemp.add(a);
                    }
                }
@@ -244,31 +266,39 @@
            AggregateResult[] arList = null;
            System.debug('fiscalYear = ' + fiscalYear);
            System.debug('thisYear = ' + thisYear);
            System.debug('lastYear = ' + lastYear);
            if (fiscalYear == 'thisYear') {
                AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime, nextDatetime);
                topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
                if (saleAmountList[0].get('saleAmount') != null) {
                    topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                    System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
                }
                arList = LexConsumableAccountSOQL.getAccountBySales(thisDatetime, nextDatetime);
            } else if (fiscalYear == 'lastYear') {
                AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, thisDatetime2);
                topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
                if (saleAmountList[0].get('saleAmount') != null) {
                    topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                    System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
                }
                arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, thisDatetime2);
            } else {
                AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(lastDatetime, nextDatetime);
                topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
                if (saleAmountList[0].get('saleAmount') != null) {
                    topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                    System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
                }
                arList = LexConsumableAccountSOQL.getAccountBySales(lastDatetime, nextDatetime);
            }
            //查询客户信息(名称,省,县)
            List<String> accountList = new List<String>();
            for (AggregateResult ar : arList) {
                System.debug('thisAmount = ' + String.valueOf(ar.get('thisAmount')));
                if(String.valueOf(ar.get('thisAmount')) != '0.0'){
                    accountList.add(String.valueOf(ar.get('hospitalName')));
                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'))));
                }
            }
            System.debug('accountList = ' + accountList);
            System.debug('topInfo = ' + topInfo);
@@ -289,12 +319,12 @@
                    Town__c,
                    Phone
                FROM Account
                WHERE Name = :accountList
                WHERE Id = :accountList
            ];
            List<Account> acListTemp = new List<Account>();
            for (String s : accountList) {
                for (Account a : acList) {
                    if (s == a.Name) {
                    if (s == a.id) {
                        acListTemp.add(a);
                    }
                }
force-app/main/default/classes/LexConsumableAccountInfoController.cls
@@ -37,7 +37,7 @@
            if (accList != null && accList.size() > 0) {
                obj = accList.get(0);
            }
        }else {
        } else {
            return new ResponseBodyLWC('Error', 500, 'accId为空', '');
        }
        data.put('obj', obj);
force-app/main/default/classes/LexConsumableAccountSOQL.cls
@@ -1,13 +1,14 @@
public with sharing class LexConsumableAccountSOQL {
    public static AggregateResult[] getAccountBySales(Datetime thisDatetime ,Datetime nextDatetime){
        AggregateResult[] arList = new List<AggregateResult>([
            SELECT count(id), Consumable_order__r.Order_ForHospital__r.name hospitalName, sum(Sale_amount__c) thisAmount
            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__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
        ]);
force-app/main/default/classes/LexConsumableController.cls
@@ -105,8 +105,8 @@
    // 登录者工作地
    private static String userWorkLocation;
    public static String agencyProType { get; set; }
    public static String agencyProType1 {get;set;}  //lt 20230526 安徽两票制 add
    private static Boolean OSHFLG;//lt 20230517 安徽两票制 add
    public static String agencyProType1 { get; set; } //lt 20230526 安徽两票制 add
    private static Boolean OSHFLG; //lt 20230517 安徽两票制 add
    public static String methodType { get; set; }
    public static String hospitalName { get; set; }
    public static String hospitalId { get; set; }
@@ -167,10 +167,10 @@
            if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) {
                addNo++;
                //continue;
            }
            }
            // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) {
            //     break;
            // }
            // }
            else {
                if (consumableorderdetailsRecords[i].check == false) {
                    consumableorderdetailsRecords[i].esd = orderdetails1;
@@ -206,12 +206,12 @@
        pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
        ESetId = esetId;
        methodType = type;
        if(String.isBlank(methodType) && String.isNotBlank(ESetId)){
        if (String.isBlank(methodType) && String.isNotBlank(ESetId)) {
            List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid];
            methodType = oclist.get(0).orderPattern__c;
        }
        statusEdit = keywordStr;
        System.debug('Param:'+ESetId+'---'+methodType+'---'+statusEdit);
        System.debug('Param:' + ESetId + '---' + methodType + '---' + statusEdit);
        try {
            sortKey = '1';
            preSortKey = '1';
@@ -232,17 +232,16 @@
            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;
            agencyProType1 = Useracc[0].UserPro_Type__c; //lt 20230526 安徽两票制 add
            //lt 20230526 安徽两票制 start
            OSHFLG = Useracc[0].OSHFLG__c; //lt 20230517 安徽两票制 add
            if(OSHFLG){
            if (OSHFLG) {
                agencyProType1 = 'OSH';
            }
            else if(String.isBlank(Useracc[0].UserPro_Type__c)){
            } else if (String.isBlank(Useracc[0].UserPro_Type__c)) {
                agencyProType1 = 'ET';
            }
            //lt 20230526 安徽两票制 end
@@ -264,9 +263,9 @@
                    RecordType.DeveloperName = 'AgencyContract'
                    AND Contract_Decide_Start_Date__c <= :dateToday
                    AND Contract_Decide_End_Date__c >= :dateToday
                    and Contact_Type__c like :agencyProType1//lt 20230517 安徽两票制 add 1
                    and Agent_Ref__c =:accountid
                    and OSH_Dealer__c =: OSHFLG  //lt 20230517 安徽两票制 add
                    AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 安徽两票制 add 1
                    AND Agent_Ref__c = :accountid
                    AND OSH_Dealer__c = :OSHFLG //lt 20230517 安徽两票制 add
            ];
            for (Account contract : contractList) {
                contactDealer.add(contract.Id);
@@ -330,10 +329,10 @@
                    FROM Account
                    WHERE
                        ParentId = :accountid
                        AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1
                        AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 安徽两票制 add 1
                        AND Contract_Decide_Start_Date__c <= :Date.Today()
                        AND Contract_Decide_End_Date__c >= :Date.Today()
                        AND OSH_Dealer__c =: OSHFLG  //lt 20230517 安徽两票制 add
                        AND OSH_Dealer__c = :OSHFLG //lt 20230517 安徽两票制 add
                ];
                if (contract.size() == 1) {
                    contractName = contract[0].Name;
@@ -382,7 +381,16 @@
                }
                consumableorderdetailsRecords.sort();
                if (methodType != null && methodType != '' && (methodType.equals('hospitalorder') || methodType.equals('promotionorder'))) {
                    searchorderdetails(methodType,accountid,hospitalId,contractId,userWorkLocation,accountName,proLimitAndDate,editAble);
                    searchorderdetails(
                        methodType,
                        accountid,
                        hospitalId,
                        contractId,
                        userWorkLocation,
                        accountName,
                        proLimitAndDate,
                        editAble
                    );
                    isfirst = true;
                }
                getPageInfo();
@@ -458,12 +466,12 @@
                        AND Consumable_order__r.Dealer_Info__c = :accountid
                ];
                for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) {
                    if(cdc1.Consumable_Product__c != null){
                    if (cdc1.Consumable_Product__c != null) {
                        orderzaikuId.add(cdc1.Consumable_Product__c);
                    }
                }
                soql = makeSoqlorderdet();
                System.debug('soql:'+soql);
                System.debug('soql:' + soql);
                size = orderzaikuId.size();
                initStandardController();
                product2Selected = Database.query(soql);
@@ -543,10 +551,21 @@
                //         attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
                //     }
                // }
                List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :ESetId];
                if (cvInfo.size() > 0) {
                    for (Integer i = 0; i < cvInfo.size(); i++) {
                        attachmentRecoeds.add(new ConsumableorderdetailsInfo(cvInfo[i]));
                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
                        FROM ContentVersion
                        WHERE ContentDocumentId IN :documentIds
                    ];
                    if (cvInfo.size() > 0) {
                        for (Integer i = 0; i < cvInfo.size(); i++) {
                            attachmentRecoeds.add(new ConsumableorderdetailsInfo(cvInfo[i]));
                        }
                    }
                }
                //
@@ -560,7 +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);
                        }
@@ -596,22 +615,22 @@
            // categoryOptionList = new List<SelectOption>();
            category3Option = new List<CusOption>();
            // categoryOptionList.add(new SelectOption('', '-无-'));
            category3Option.add(new CusOption('-无-',''));
            category3Option.add(new CusOption('-无-', ''));
            for (AggregateResult category3Search : categoryList) {
                String deliverycnt = String.valueOf(category3Search.get('c3c'));
                // categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
                category3Option.add(new CusOption(deliverycnt,deliverycnt));
                category3Option.add(new CusOption(deliverycnt, deliverycnt));
            }
            //categoty4
            // category4OptionList = new List<SelectOption>();
            category4Option = new List<CusOption>();
            // category4OptionList.add(new SelectOption('', '-无-'));
            category4Option.add(new CusOption('-无-',''));
            category4Option.add(new CusOption('-无-', ''));
            //categoty5
            // category5OptionList = new List<SelectOption>();
            category5Option = new List<CusOption>();
            // category5OptionList.add(new SelectOption('', '-无-'));
            category5Option.add(new CusOption('-无-',''));
            category5Option.add(new CusOption('-无-', ''));
            //return msg
            consumableorderdetailsRecordsview = consumableorderdetailsRecords;
            getConsumableShowTableFieldValue();
@@ -652,7 +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;
@@ -708,7 +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;
@@ -734,7 +753,7 @@
                // category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
                category4Option.add(new CusOption(deliverycnt4, deliverycnt4));
            }
            AggregateResult[] category5List = [
                SELECT Count(id), Category5_text__c c5c
                FROM Product2__c
@@ -929,7 +948,7 @@
        String consumableorderdetailsRecordsviewStr,
        Boolean editAbleStr,
        List<String> proLimitAndDateList
    ){
    ) {
        Results results = new Results();
        errorMsgList = new List<String>();
        warningMsgList = new List<String>();
@@ -948,8 +967,11 @@
        methodType = methodTypeStr;
        editAble = editAbleStr;
        proLimitAndDate = proLimitAndDateList;
        dealerProductId = (List<String>)JSON.deserialize(dealerProductIdStr, List<String>.class);
        consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class);
        dealerProductId = (List<String>) JSON.deserialize(dealerProductIdStr, List<String>.class);
        consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
            consumableorderdetailsRecordsviewStr,
            List<ConsumableorderdetailsInfo>.class
        );
        size = Integer.valueOf(System.Label.orderdetLimitsize);
        pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
        try {
@@ -993,7 +1015,7 @@
            soql = makeSoql(category1, category_Goods, category3, category4, category5, specialCampaign, DealerProductId);
            size = Integer.valueOf(System.Label.orderdetLimitsize);
            initStandardController();
            System.debug('soql:'+soql);
            System.debug('soql:' + soql);
            product2Selected = Database.query(soql);
            for (Integer i = 0; i < product2Selected.size(); i++) {
                MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
@@ -1068,12 +1090,12 @@
            // makeMessage();
            results.errorMsgList = errorMsgList;
            results.warningMsgList = warningMsgList;
            if(consumableorderdetailsRecords.size() > 0){
            if (consumableorderdetailsRecords.size() > 0) {
                getConsumableShowTableFieldValue();
                results.result = 'Success';
                results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
                results.errorMsg = '搜索到' + consumableorderdetailsRecords.size() + '件产品';
            }else {
            } else {
                getConsumableShowTableFieldValue();
                results.result = 'Fail';
                results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
@@ -1097,7 +1119,7 @@
        String accountNameStr,
        List<String> proLimitAndDateList,
        Boolean editAbleStr
    ){
    ) {
        Results results = new Results();
        methodType = methodTypeStr;
        accountId = accountIdStr;
@@ -1123,7 +1145,7 @@
                    for (hospitalprice__c hc : hplist) {
                        hpids.add(hc.product__c);
                    }
                    if (hpids != null && hpids.size() > 0) {
                        soql += ' AND Id in : hpids ';
                    }
@@ -1248,10 +1270,10 @@
            noOfRecords = consumableorderdetailsRecords.size();
            getConsumableShowTableFieldValue();
            results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
            if(consumableorderdetailsRecordsview.size() > 0){
            if (consumableorderdetailsRecordsview.size() > 0) {
                results.result = 'Success';
                results.errorMsg = '共搜索到'+consumableorderdetailsRecordsview.size()+'条数据';
            }else {
                results.errorMsg = '共搜索到' + consumableorderdetailsRecordsview.size() + '条数据';
            } else {
                results.result = 'Fail';
                results.errorMsg = '没有搜索到相关数据';
            }
@@ -1278,10 +1300,10 @@
            if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) {
                addNo++;
                //continue;
            }
            }
            // else if (consumableorderdetailsRecordsview.size() >= pageLimit + size) {
            //     break;
            // }
            // }
            else {
                if (consumableorderdetailsRecords[i].check == false) {
                    consumableorderdetailsRecords[i].esd = orderdetails1;
@@ -1442,8 +1464,8 @@
            }
        }
        String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c,Category3__c,Category4__c,Category5__c FROM Product2__c WHERE Estimation_Entry_Possibility__c = \'○\' ';
        System.debug('sqlTail:'+sqlTail);
        System.debug('orderzaikuId:'+orderzaikuId);
        System.debug('sqlTail:' + sqlTail);
        System.debug('orderzaikuId:' + orderzaikuId);
        if (orderzaikuId.size() > 0) {
            soql += ' AND Id in' + sqlTail;
        }
@@ -1452,7 +1474,7 @@
    // 编辑按钮
    @AuraEnabled
    public static Results setEditAble(String eSetidStr){
    public static Results setEditAble(String eSetidStr) {
        Results results = new Results();
        ESetId = eSetidStr;
        try {
@@ -1501,7 +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';
@@ -1514,7 +1536,7 @@
    //删除按钮
    @AuraEnabled
    public static Results delConsumable(String eSetidStr){
    public static Results delConsumable(String eSetidStr) {
        Results results = new Results();
        ESetId = eSetidStr;
        try {
@@ -1537,7 +1559,7 @@
    // 提交按钮
    @AuraEnabled
    public static Results sorder(String eSetidStr,String accountidStr){
    public static Results sorder(String eSetidStr, String accountidStr) {
        Results results = new Results();
        errorMsgList = new List<String>();
        warningMsgList = new List<String>();
@@ -1618,10 +1640,23 @@
        Boolean OSHFLGStr
    ) {
        ESetId = '';
        return save(contractNameStr,cocStr,agencyProTypeStr,accountidStr,consumableorderdetailsRecordsviewStr,contactDealerStr,methodTypeStr,ESetId,hospitalIdStr,contractIdStr,agencyProType1Str,OSHFLGStr);
        return save(
            contractNameStr,
            cocStr,
            agencyProTypeStr,
            accountidStr,
            consumableorderdetailsRecordsviewStr,
            contactDealerStr,
            methodTypeStr,
            ESetId,
            hospitalIdStr,
            contractIdStr,
            agencyProType1Str,
            OSHFLGStr
        );
    }
    //保存按钮
    //保存按钮
    @AuraEnabled
    public static Results save(
        String contractNameStr,
@@ -1636,7 +1671,7 @@
        String contractIdStr,
        String agencyProType1Str,
        Boolean OSHFLGStr
    ){
    ) {
        Results results = new Results();
        errorMsgList = new List<String>();
        warningMsgList = new List<String>();
@@ -1649,12 +1684,16 @@
        contractId = contractIdStr;
        agencyProType1 = agencyProType1Str;
        OSHFLG = OSHFLGStr;
        coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class);
        contactDealer = (List<String>)JSON.deserialize(contactDealerStr, List<String>.class);
        consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class);
        if(coc.Offers_Price__c != null){
        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
        );
        if (coc.Offers_Price__c != null) {
            String offerStr = String.valueOf(coc.Offers_Price__c);
            bargainPrice = Decimal.valueOf(offerStr.replace(',',''));
            bargainPrice = Decimal.valueOf(offerStr.replace(',', ''));
        }
        Savepoint sp = Database.setSavepoint();
        try {
@@ -1669,12 +1708,12 @@
                FROM account
                WHERE
                    Name = :contractName
                    AND Id =: contractId   //lt 20230517 安徽两票制 add
                    AND Id = :contractId //lt 20230517 安徽两票制 add
                    AND Contract_Decide_Start_Date__c <= :Date.Today()
                    AND Contract_Decide_End_Date__c >= :Date.Today()
                    AND Contact_Type__c like :agencyProType1  //lt 20230517 安徽两票制 add 1
                    AND Agent_Ref__c =:accountid
                    AND OSH_Dealer__c =: OSHFLG  //lt 20230517 安徽两票制 add
                    AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 安徽两票制 add 1
                    AND Agent_Ref__c = :accountid
                    AND OSH_Dealer__c = :OSHFLG //lt 20230517 安徽两票制 add
            ];
            if (contract.size() <= 0) {
                // coc.Order_effective_contact__c.addError('不存在的合同,请重新确认。');
@@ -1727,13 +1766,14 @@
            }
            //=======================================医院特价,有金额的话取金额
            Map<String, Decimal> dealerHospitalmMap = new Map<String, Decimal>();
            List<hospitalprice__c> hplist = [select Id,hospital__c,mPrice__c,pPrice__c,product__c,account__c
                                                from hospitalprice__c
                                                where product__c in :tpids and mPrice__c <> null and account__c=:accountid
                                                ];
            List<hospitalprice__c> hplist = [
                SELECT Id, hospital__c, mPrice__c, pPrice__c, product__c, account__c
                FROM hospitalprice__c
                WHERE product__c IN :tpids AND mPrice__c != NULL AND account__c = :accountid
            ];
            for (hospitalprice__c dealerProduct : hplist) {
                if (dealerProduct.mPrice__c != null) {
                    dealerHospitalmMap.put('' + dealerProduct.hospital__c + dealerProduct.product__c,dealerProduct.mPrice__c);
                if (dealerProduct.mPrice__c != null) {
                    dealerHospitalmMap.put('' + dealerProduct.hospital__c + dealerProduct.product__c, dealerProduct.mPrice__c);
                }
            }
            //促销订货 根据经销商产品中的数据计算金额
@@ -1815,13 +1855,13 @@
                FROM Account
                WHERE
                    Name = :contractName
                    AND Id =: contractId   //lt 20230517 安徽两票制 add
                    AND Contact_Type__c like :agencyProType1  //lt 20230517 安徽两票制 add  1
                    AND Id = :contractId //lt 20230517 安徽两票制 add
                    AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 安徽两票制 add  1
                    AND Contact_Type__c LIKE :agencyProType
                    AND Contract_Decide_Start_Date__c <= :Date.Today()
                    AND Contract_Decide_End_Date__c >= :Date.Today()
                    AND Contract_Decide_End_Date__c >= :Date.Today()
                    AND OSH_Dealer__c =: OSHFLG  //lt 20230517 安徽两票制 add
                    AND OSH_Dealer__c = :OSHFLG //lt 20230517 安徽两票制 add
            ];
            if (at.size() > 0 && at[0].Dealer_discount__c != null) {
                disCount = at[0].Dealer_discount__c;
@@ -1886,16 +1926,19 @@
                                        ass.Prod.Intra_Trade_List_RMB__c *
                                        dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) /
                                        100;
                                        system.debug('cai 00' + InsAfterDel.Intra_Trade_List_RMB__c);
                                    system.debug('cai 00' + InsAfterDel.Intra_Trade_List_RMB__c);
                                }
                                //=====================================================================================update by rentx 2020-11-25
                            } else if (methodType.equals('hospitalorder')) {
                                //医院特价
                                Consumable_order[0].Order_ForHospital__c = hospitalId;
                                Consumable_order[0].orderPattern__c = 'hospitalorder';
                                if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) {
                                if (
                                    dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) &&
                                    dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null
                                ) {
                                    //直接根据促销金额计算
                                    InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id);
                                    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;
@@ -1986,9 +2029,12 @@
                                Consumable_order[0].orderPattern__c = 'hospitalorder';
                                //医院特价
                                Consumable_order[0].Order_ForHospital__c = hospitalId;
                                if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) {
                                if (
                                    dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) &&
                                    dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null
                                ) {
                                    //直接根据促销金额计算
                                    InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id);
                                    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;
@@ -2018,13 +2064,19 @@
    //删除附件
    @AuraEnabled
    public static Results deleteAtt(String contentVersionId){
    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];
            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];
                c.Consumable_pdf_insert_day__c = null;
                update c;
            }
            results.result = 'Success';
        } catch (Exception e) {
            results.result = 'Fail';
@@ -2033,11 +2085,11 @@
        return results;
    }
    public static void getConsumableShowTableFieldValue(){
        for(ConsumableorderdetailsInfo con :consumableorderdetailsRecordsview){
            if(con.Prod != null){
    public static void getConsumableShowTableFieldValue() {
        for (ConsumableorderdetailsInfo con : consumableorderdetailsRecordsview) {
            if (con.Prod != null) {
                con.recordId = con.Prod.Id;
                if(!con.oldCheck){
                if (!con.oldCheck) {
                    con.prodName = con.Prod.Name__c;
                    // System.debug('ProdName:'+con.Prod.Id+'---'+con.Prod.Name__c);
                }
@@ -2047,16 +2099,16 @@
                con.prodCategory5 = con.Prod.Category5__c;
                con.prodIntraTradeList = con.Prod.Intra_Trade_List_RMB__c;
            }
            if(con.esd != null){
            if (con.esd != null) {
                // if(con.oldCheck){
                    // con.prodName = con.esd.Consumable_Product__r.Name__c;
                // con.prodName = con.esd.Consumable_Product__r.Name__c;
                // }
                con.consumableCount = con.esd.Consumable_count__c;
            }
        }
    }
    class ConsumableorderdetailsInfo implements Comparable {
    public class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Boolean check { get; set; }
        @AuraEnabled
@@ -2109,7 +2161,6 @@
        public Decimal prodIntraTradeList { get; set; }
        @AuraEnabled
        public Decimal consumableCount { get; set; }
        // 已存产品明细
        public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
force-app/main/default/classes/LexConsumableGoodsInfo.cls
@@ -1,71 +1,87 @@
public without sharing class LexConsumableGoodsInfo {
    //所有产品一览
    @AuraEnabled
    public static Results initTotalNum(String ordId, String type){
    public static Results initTotalNum(String ordId, String type) {
        Results results = new Results();
        List<ShowRecords> allOtherDetIifo = new List<ShowRecords>();
        Set<String> orderId = new Set<String>();
        if(ordId != '1'){
            orderId.add(ordId);
        if (ordId != '1') {
            orderId.add(ordId);
        }
        try {
            if(!(orderId.size() > 0)){
            if (!(orderId.size() > 0)) {
                String userId = UserInfo.getUserId();
                List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
                                FROM user
                                WHERE id = :userId ];
                List<User> userList = [
                    SELECT accountid, Work_Location__c, UserPro_Type__c
                    FROM user
                    WHERE id = :userId
                ];
                String accountid = userList[0].accountid;
                String userPro_Type = userList[0].UserPro_Type__c;
                String userWorklocation = userList[0].Work_Location__c;
                String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
                List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
                //20200916 ljh update start
                if(Test.isRunningTest()){
                    if(type !=null && type.equals('all')){
                        conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                    }else{
                        conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                    }
                }else{
                    if(type !=null && type.equals('all')){
                        conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                    }else{
                        conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                    }
                if (type != null && type.equals('all')) {
                    conorderlist = [
                        SELECT id, Owner.Name
                        FROM Consumable_order__c
                        WHERE
                            Order_type__c = '订单'
                            AND recordtypeid = :rtTypeDelivery
                            AND Dealer_Info__c = :accountid
                            AND (OrderNumber_notarrive__c > 0
                            OR Delivery_detail_count__c > 0)
                            AND Order_ProType__c = :userPro_Type
                            AND Order_Owner_WorkLocal__c = :userWorklocation
                            AND showFalseNotshowTrue__c = FALSE
                    ];
                } else {
                    conorderlist = [
                        SELECT id, Owner.Name
                        FROM Consumable_order__c
                        WHERE
                            Order_type__c = '订单'
                            AND recordtypeid = :rtTypeDelivery
                            AND Dealer_Info__c = :accountid
                            AND Delivery_detail_count__c > 0
                            AND Order_ProType__c = :userPro_Type
                            AND Order_Owner_WorkLocal__c = :userWorklocation
                            AND showFalseNotshowTrue__c = FALSE
                    ];
                }
                for(Consumable_order__c conorder : conorderlist){
                    String temp = (String)conorder.Id;
                for (Consumable_order__c conorder : conorderlist) {
                    String temp = (String) conorder.Id;
                    orderId.add(temp);
                }
                System.debug('ANY o'+orderId);
                System.debug('ANY o' + orderId);
            }
            List<Consumable_Orderdetails__c> conOrderList1 = new List<Consumable_Orderdetails__c>();
            if(Test.isRunningTest()){
                conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c];
            }else{
                conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c WHERE Consumable_order__c =:orderId];
            }
            Map<String,Decimal> allConOrderMap = new Map<String,Decimal>();
            for(Consumable_Orderdetails__c con : conOrderList1){
                if(con.Consumable_count__c == null){
            conOrderList1 = [
                SELECT Asset_Model_No__c, Consumable_count__c
                FROM Consumable_Orderdetails__c
                WHERE Consumable_order__c = :orderId
            ];
            Map<String, Decimal> allConOrderMap = new Map<String, Decimal>();
            for (Consumable_Orderdetails__c con : conOrderList1) {
                if (con.Consumable_count__c == null) {
                    con.Consumable_count__c = 0;
                }
                if(allConOrderMap.containsKey(con.Asset_Model_No__c)){
                    allConOrderMap.put(con.Asset_Model_No__c,allConOrderMap.get(con.Asset_Model_No__c)+con.Consumable_count__c);
                }else{
                if (allConOrderMap.containsKey(con.Asset_Model_No__c)) {
                    allConOrderMap.put(con.Asset_Model_No__c, allConOrderMap.get(con.Asset_Model_No__c) + con.Consumable_count__c);
                } else {
                    allConOrderMap.put(con.Asset_Model_No__c, con.Consumable_count__c);
                }
            }
            for(String pmodel : allConOrderMap.keySet()){
                if(allConOrderMap.get(pmodel) > 0){
            for (String pmodel : allConOrderMap.keySet()) {
                if (allConOrderMap.get(pmodel) > 0) {
                    ShowRecords showrecord2 = new ShowRecords();
                    showrecord2.recordCount = allConOrderMap.get(pmodel);
                    showrecord2.prodModel = pmodel;
                    allOtherDetIifo.add(showrecord2);
                }
                }
            }
            results.result = 'Success';
            results.recordList = allOtherDetIifo;
@@ -78,28 +94,35 @@
    //已到货产品一览
    @AuraEnabled
    public static Results initArrDet(String orderId){
    public static Results initArrDet(String orderId) {
        Results results = new Results();
        List<ShowRecords> arrDetIifo = new List<ShowRecords>();
        try{
            List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
        try {
            List<Consumable_order_details2__c> conList = [
                SELECT id, Bar_Code__c
                FROM Consumable_order_details2__c
                WHERE Dealer_Arrive__c = TRUE AND Consumable_order_minor__c = :orderId
            ];
            Map<String, String> srtMap = new Map<String, String>();
            for (Consumable_order_details2__c con : conList) {
                srtMap.put(con.Bar_Code__c, con.Id);
            }
            List<String> str = new List<String>();
            for(String s : srtMap.keySet()){
            for (String s : srtMap.keySet()) {
                str.add(srtMap.get(s));
            }
            List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Id =: str
                            GROUP BY Asset_Model_No__c];
            for(Integer i = 0 ; i< arrDetList.size();i++){
            List<AggregateResult> arrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Id = :str
                GROUP BY Asset_Model_No__c
            ];
            for (Integer i = 0; i < arrDetList.size(); i++) {
                arrDetIifo.add(new showRecords(arrDetList[i]));
            }
            results.recordList = arrDetIifo;
            results.result = 'Success';
        }catch (Exception e){
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
@@ -108,14 +131,16 @@
    //已到货产品一览All
    @AuraEnabled
    public static Results initArrDetAll(String type){
    public static Results initArrDetAll(String type) {
        Results results = new Results();
        List<ShowRecords> allArrDetIifo = new List<ShowRecords>();
        try{
        try {
            String userId = UserInfo.getUserId();
            List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
                            FROM user
                            WHERE id = :userId ];
            List<User> userList = [
                SELECT accountid, Work_Location__c, UserPro_Type__c
                FROM user
                WHERE id = :userId
            ];
            String accountid = userList[0].accountid;
            String userPro_Type = userList[0].UserPro_Type__c;
            String userWorklocation = userList[0].Work_Location__c;
@@ -123,65 +148,92 @@
            String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            if(Test.isRunningTest()){
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            }else{
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
            if (type != null && type.equals('all')) {
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND (OrderNumber_notarrive__c > 0
                        OR Delivery_detail_count__c > 0)
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            } else {
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND Delivery_detail_count__c > 0
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            }
            //20200916 ljh update end
            // List<Consumable_order__c> conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
            System.debug('======'+conorderlist+'daxiao:'+conorderlist.size());
            for(Consumable_order__c conorder : conorderlist){
                System.debug('======'+conorder.Owner.Name+'======');
            System.debug('======' + conorderlist + 'daxiao:' + conorderlist.size());
            for (Consumable_order__c conorder : conorderlist) {
                System.debug('======' + conorder.Owner.Name + '======');
            }
            Set<String> orderId = new Set<String>();
            for(Consumable_order__c conorder : conorderlist){
            for (Consumable_order__c conorder : conorderlist) {
                orderId.add(conorder.Id);
            }
            System.debug('ANY o'+orderId);
            System.debug('ANY o' + orderId);
            List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
            if(Test.isRunningTest()){
                conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
            }else{
                //20200916 ljh update start
                //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                if(type !=null && type.equals('all')){
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                }else{
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                }
                //20200916 ljh update end
            //20200916 ljh update start
            //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            if (type != null && type.equals('all')) {
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = TRUE
                        AND Consumable_order_minor__c = :orderId
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
            } else {
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = TRUE
                        AND Consumable_order_minor__c = :orderId
                        AND Deliver_date__c < :orderdate
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
            }
            //20200916 ljh update end
            // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
            Map<String, String> srtMap = new Map<String, String>();
            for (Consumable_order_details2__c con : conList) {
                srtMap.put(con.Bar_Code__c, con.Id);
            }
            List<String> str = new List<String>();
            for(String s : srtMap.keySet()){
            for (String s : srtMap.keySet()) {
                str.add(srtMap.get(s));
            }
            List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Id =: str
                            GROUP BY Asset_Model_No__c];
            List<AggregateResult> arrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Id = :str
                GROUP BY Asset_Model_No__c
            ];
            // List<showRecords> allArrDetIifo = new List<showRecords>();
            for(Integer i = 0 ; i< arrDetList.size();i++){
            for (Integer i = 0; i < arrDetList.size(); i++) {
                allArrDetIifo.add(new showRecords(arrDetList[i]));
            }
            results.recordList = allArrDetIifo;
            results.result = 'Success';
        }catch (Exception e){
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
@@ -190,20 +242,22 @@
    //未到货产品一览
    @AuraEnabled
    public static Results initDeliveryDet(String orderId){
    public static Results initDeliveryDet(String orderId) {
        Results results = new Results();
        List<ShowRecords> notArrDetIifo = new List<ShowRecords>();
        try{
            List<AggregateResult> notArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                        WHERE Dealer_Arrive__c = false
                        AND Consumable_order_minor__c = :orderId
                        GROUP BY Asset_Model_No__c];
            for(Integer i = 0 ; i< notArrDetList.size();i++){
        try {
            List<AggregateResult> notArrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Dealer_Arrive__c = FALSE AND Consumable_order_minor__c = :orderId
                GROUP BY Asset_Model_No__c
            ];
            for (Integer i = 0; i < notArrDetList.size(); i++) {
                notArrDetIifo.add(new showRecords(notArrDetList[i]));
            }
            results.recordList = notArrDetIifo;
            results.result = 'Success';
        }catch (Exception e){
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
@@ -212,14 +266,16 @@
    //未到货产品一览All
    @AuraEnabled
    public static Results initDeliveryDetAll(String type){
    public static Results initDeliveryDetAll(String type) {
        Results results = new Results();
        List<ShowRecords> allNotArrDetIifo = new List<ShowRecords>();
        try{
        try {
            String userId = UserInfo.getUserId();
            List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
                            FROM user
                            WHERE id = :userId ];
            List<User> userList = [
                SELECT accountid, Work_Location__c, UserPro_Type__c
                FROM user
                WHERE id = :userId
            ];
            String accountid = userList[0].accountid;
            String userPro_Type = userList[0].UserPro_Type__c;
            String userWorklocation = userList[0].Work_Location__c;
@@ -227,65 +283,92 @@
            String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            if(Test.isRunningTest()){
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation  and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            }else{
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
            if (type != null && type.equals('all')) {
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND (OrderNumber_notarrive__c > 0
                        OR Delivery_detail_count__c > 0)
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            } else {
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND Delivery_detail_count__c > 0
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            }
            //20200916 ljh update end
            // List<Consumable_order__c> conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
            System.debug('======'+conorderlist+'daxiao:'+conorderlist.size());
            for(Consumable_order__c conorder : conorderlist){
                System.debug('======'+conorder.Owner.Name+'======');
            System.debug('======' + conorderlist + 'daxiao:' + conorderlist.size());
            for (Consumable_order__c conorder : conorderlist) {
                System.debug('======' + conorder.Owner.Name + '======');
            }
            Set<String> orderId = new Set<String>();
            for(Consumable_order__c conorder : conorderlist){
            for (Consumable_order__c conorder : conorderlist) {
                orderId.add(conorder.Id);
            }
            System.debug('ANY o'+orderId);
            System.debug('ANY o' + orderId);
            //20200916 ljh update start
            //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
            if(Test.isRunningTest()){
                conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
            }else{
                //20200916 ljh update start
                //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                if(type !=null && type.equals('all')){
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                }else{
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                }
                //20200916 ljh update end
            if (type != null && type.equals('all')) {
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = FALSE
                        AND Consumable_order_minor__c = :orderId
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
            } else {
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = FALSE
                        AND Consumable_order_minor__c = :orderId
                        AND Deliver_date__c < :orderdate
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
            }
            //20200916 ljh update end
            // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
            Map<String, String> srtMap = new Map<String, String>();
            for (Consumable_order_details2__c con : conList) {
                srtMap.put(con.Bar_Code__c, con.Id);
            }
            List<String> str = new List<String>();
            for(String s : srtMap.keySet()){
            for (String s : srtMap.keySet()) {
                str.add(srtMap.get(s));
            }
            List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Id =: str and Cancellation_Flag__c = false
                            GROUP BY Asset_Model_No__c];
            List<AggregateResult> arrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Id = :str AND Cancellation_Flag__c = FALSE
                GROUP BY Asset_Model_No__c
            ];
            // List<showRecords> allArrDetIifo = new List<showRecords>();
            for(Integer i = 0 ; i< arrDetList.size();i++){
            for (Integer i = 0; i < arrDetList.size(); i++) {
                allNotArrDetIifo.add(new showRecords(arrDetList[i]));
            }
            results.recordList = allNotArrDetIifo;
            results.result = 'Success';
        }catch (Exception e){
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
@@ -294,77 +377,89 @@
    //还没发货数量
    @AuraEnabled
    public static Results initNotArrDet(String orderId){
    public static Results initNotArrDet(String orderId) {
        Results results = new Results();
        List<Consumable_Orderdetails__c> otherArrDetIifo = new List<Consumable_Orderdetails__c>();
        List<ShowRecords> otherArrList = new List<ShowRecords>();
        try{
        try {
            List<showRecords> arrDetIifo = new List<showRecords>();
            List<showRecords> notArrDetIifo = new List<showRecords>();
            List<showRecords> allArrDetIifo = new List<showRecords>();
            // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId];
            List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
            List<Consumable_order_details2__c> conList = [
                SELECT id, Bar_Code__c
                FROM Consumable_order_details2__c
                WHERE Consumable_order_minor__c = :orderId
            ];
            Map<String, String> srtMap = new Map<String, String>();
            for (Consumable_order_details2__c con : conList) {
                srtMap.put(con.Bar_Code__c, con.Id);
            }
            List<String> str = new List<String>();
            for(String s : srtMap.keySet()){
            for (String s : srtMap.keySet()) {
                str.add(srtMap.get(s));
            }
            List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Id =: str AND Dealer_Arrive__c = true
                            GROUP BY Asset_Model_No__c];
            for(Integer i = 0 ; i< arrDetList.size();i++){
            List<AggregateResult> arrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Id = :str AND Dealer_Arrive__c = TRUE
                GROUP BY Asset_Model_No__c
            ];
            for (Integer i = 0; i < arrDetList.size(); i++) {
                arrDetIifo.add(new showRecords(arrDetList[i]));
            }
            List<AggregateResult> notArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Dealer_Arrive__c = false
                            AND Consumable_order_minor__c = :orderId
                            GROUP BY Asset_Model_No__c];
            for(Integer i = 0 ; i< notArrDetList.size();i++){
            List<AggregateResult> notArrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Dealer_Arrive__c = FALSE AND Consumable_order_minor__c = :orderId
                GROUP BY Asset_Model_No__c
            ];
            for (Integer i = 0; i < notArrDetList.size(); i++) {
                notArrDetIifo.add(new showRecords(notArrDetList[i]));
            }
            // List<AggregateResult> allArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
            //                 WHERE Id =: str
            //                 GROUP BY Asset_Model_No__c];
            List<Consumable_Orderdetails__c> allArrDetList = [SELECT Asset_Model_No__c,Consumable_count__c FROM Consumable_Orderdetails__c
                            WHERE Consumable_order__c =: orderId];
            List<Consumable_Orderdetails__c> allArrDetList = [
                SELECT Asset_Model_No__c, Consumable_count__c
                FROM Consumable_Orderdetails__c
                WHERE Consumable_order__c = :orderId
            ];
            // for(Integer i = 0 ; i< allArrDetList.size();i++){
            //     allArrDetIifo.add(new showRecords(notArrDetList[i]));
            // }
            Map<String,Decimal> arrDetMap = new Map<String,Decimal>();
            for(showRecords arr : arrDetIifo){
            Map<String, Decimal> arrDetMap = new Map<String, Decimal>();
            for (showRecords arr : arrDetIifo) {
                arrDetMap.put(arr.prodModel, arr.recordCount);
            }
            for(showRecords notarr : notArrDetIifo){
                if(arrDetMap.containsKey(notarr.prodModel)){
                    arrDetMap.put(notarr.prodModel, arrDetMap.get(notarr.prodModel)+notarr.recordCount);
                }else{
            for (showRecords notarr : notArrDetIifo) {
                if (arrDetMap.containsKey(notarr.prodModel)) {
                    arrDetMap.put(notarr.prodModel, arrDetMap.get(notarr.prodModel) + notarr.recordCount);
                } else {
                    arrDetMap.put(notarr.prodModel, notarr.recordCount);
                }
            }
            List<String> AssetModelNoEdList = new List<String>();//20200904 ljh add
            for(Consumable_Orderdetails__c allarr : allArrDetList){
                for(String promodel : arrDetMap.keySet()){
                    if(allarr.Asset_Model_No__c == promodel){
                        if((allarr.Consumable_count__c - arrDetMap.get(promodel)) > 0){
            List<String> AssetModelNoEdList = new List<String>(); //20200904 ljh add
            for (Consumable_Orderdetails__c allarr : allArrDetList) {
                for (String promodel : arrDetMap.keySet()) {
                    if (allarr.Asset_Model_No__c == promodel) {
                        if ((allarr.Consumable_count__c - arrDetMap.get(promodel)) > 0) {
                            allarr.Consumable_count__c = (allarr.Consumable_count__c - arrDetMap.get(promodel));
                            otherArrDetIifo.add(allarr);
                        }
                        AssetModelNoEdList.add(promodel);//20200904 ljh add
                        AssetModelNoEdList.add(promodel); //20200904 ljh add
                    }
                }
            }
            //20200904 ljh add  start
            for(Consumable_Orderdetails__c allarr1 : allArrDetList){
                if(!AssetModelNoEdList.contains(allarr1.Asset_Model_No__c)){
            for (Consumable_Orderdetails__c allarr1 : allArrDetList) {
                if (!AssetModelNoEdList.contains(allarr1.Asset_Model_No__c)) {
                    otherArrDetIifo.add(allarr1);
                }
            }
            for(Consumable_Orderdetails__c conOrderDetail : otherArrDetIifo){
            for (Consumable_Orderdetails__c conOrderDetail : otherArrDetIifo) {
                ShowRecords record = new ShowRecords();
                record.prodModel = conOrderDetail.Asset_Model_No__c;
                record.recordCount = conOrderDetail.Consumable_count__c;
@@ -372,7 +467,7 @@
            }
            results.recordList = otherArrList;
            results.result = 'Success';
        }catch (Exception e){
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
@@ -381,14 +476,16 @@
    //还没发货数量All
    @AuraEnabled
    public static Results initNotArrDetAll(String type){
    public static Results initNotArrDetAll(String type) {
        Results results = new Results();
        List<ShowRecords> allOtherDetIifo = new List<ShowRecords>();
        try{
        try {
            String userId = UserInfo.getUserId();
            List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
                            FROM user
                            WHERE id = :userId ];
            List<User> userList = [
                SELECT accountid, Work_Location__c, UserPro_Type__c
                FROM user
                WHERE id = :userId
            ];
            String accountid = userList[0].accountid;
            String userPro_Type = userList[0].UserPro_Type__c;
            String userWorklocation = userList[0].Work_Location__c;
@@ -396,84 +493,111 @@
            String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            if(Test.isRunningTest()){
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            }else{
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
            if (type != null && type.equals('all')) {
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND (OrderNumber_notarrive__c > 0
                        OR Delivery_detail_count__c > 0)
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            } else {
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND Delivery_detail_count__c > 0
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            }
            //20200916 ljh update end
            // List<Consumable_order__c> conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
            System.debug('======'+conorderlist+'daxiao:'+conorderlist.size());
            for(Consumable_order__c conorder : conorderlist){
                System.debug('======'+conorder.Owner.Name+'======');
            System.debug('======' + conorderlist + 'daxiao:' + conorderlist.size());
            for (Consumable_order__c conorder : conorderlist) {
                System.debug('======' + conorder.Owner.Name + '======');
            }
            Set<String> orderId = new Set<String>();
            for(Consumable_order__c conorder : conorderlist){
            for (Consumable_order__c conorder : conorderlist) {
                orderId.add(conorder.Id);
            }
            System.debug('ANY o'+orderId);
            System.debug('ANY o' + orderId);
            List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
            if(Test.isRunningTest()){
                conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
            }else{
                //20200916 ljh update start
                //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE  Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                if(type !=null && type.equals('all')){
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE  Consumable_order_minor__c = :orderId  AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                }else{
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE  Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                }
                //20200916 ljh update end
            //20200916 ljh update start
            //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE  Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            if (type != null && type.equals('all')) {
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
            } else {
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Consumable_order_minor__c = :orderId
                        AND Deliver_date__c < :orderdate
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
            }
            //20200916 ljh update end
            // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
            Map<String, String> srtMap = new Map<String, String>();
            for (Consumable_order_details2__c con : conList) {
                srtMap.put(con.Bar_Code__c, con.Id);
            }
            List<String> str = new List<String>();
            for(String s : srtMap.keySet()){
            for (String s : srtMap.keySet()) {
                str.add(srtMap.get(s));
            }
            List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Id =: str and Cancellation_Flag__c = false
                            GROUP BY Asset_Model_No__c];
            Map<String,Decimal> conOrderMap = new Map<String,Decimal>();
            for(AggregateResult agg : arrDetList){
            List<AggregateResult> arrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Id = :str AND Cancellation_Flag__c = FALSE
                GROUP BY Asset_Model_No__c
            ];
            Map<String, Decimal> conOrderMap = new Map<String, Decimal>();
            for (AggregateResult agg : arrDetList) {
                conOrderMap.put(String.valueOf(agg.get('prodModel')), Integer.valueOf(agg.get('recordCount')));
            }
            List<Consumable_Orderdetails__c> conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c WHERE Consumable_order__c =: orderId ];
            Map<String,Decimal> allConOrderMap = new Map<String,Decimal>();
            for(Consumable_Orderdetails__c con : conOrderList1){
                if(con.Consumable_count__c == null){
            List<Consumable_Orderdetails__c> conOrderList1 = [
                SELECT Asset_Model_No__c, Consumable_count__c
                FROM Consumable_Orderdetails__c
                WHERE Consumable_order__c = :orderId
            ];
            Map<String, Decimal> allConOrderMap = new Map<String, Decimal>();
            for (Consumable_Orderdetails__c con : conOrderList1) {
                if (con.Consumable_count__c == null) {
                    con.Consumable_count__c = 0;
                }
                if(allConOrderMap.containsKey(con.Asset_Model_No__c)){
                    allConOrderMap.put(con.Asset_Model_No__c,allConOrderMap.get(con.Asset_Model_No__c)+con.Consumable_count__c);
                }else{
                if (allConOrderMap.containsKey(con.Asset_Model_No__c)) {
                    allConOrderMap.put(con.Asset_Model_No__c, allConOrderMap.get(con.Asset_Model_No__c) + con.Consumable_count__c);
                } else {
                    allConOrderMap.put(con.Asset_Model_No__c, con.Consumable_count__c);
                }
            }
            for(String pmodel : allConOrderMap.keySet()){
                if(conOrderMap.containsKey(pmodel)){
                    if(allConOrderMap.get(pmodel) - conOrderMap.get(pmodel) > 0){
            for (String pmodel : allConOrderMap.keySet()) {
                if (conOrderMap.containsKey(pmodel)) {
                    if (allConOrderMap.get(pmodel) - conOrderMap.get(pmodel) > 0) {
                        showRecords showrecord1 = new showRecords();
                        showrecord1.recordCount = allConOrderMap.get(pmodel) - conOrderMap.get(pmodel);
                        showrecord1.prodModel = pmodel;
                        allOtherDetIifo.add(showrecord1);
                    }
                }else{
                } else {
                    showRecords showrecord2 = new showRecords();
                    showrecord2.recordCount = allConOrderMap.get(pmodel);
                    showrecord2.prodModel = pmodel;
@@ -482,7 +606,7 @@
            }
            results.recordList = allOtherDetIifo;
            results.result = 'Success';
        }catch (Exception e){
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
@@ -491,26 +615,30 @@
    //发货七天还未到货数
    @AuraEnabled
    public static Results initMoreThan7(String orderId){
    public static Results initMoreThan7(String orderId) {
        Results results = new Results();
        List<ShowRecords> morethansevendaysIifo = new List<ShowRecords>();
        try{
            List<AggregateResult> morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Consumable_order_minor__c != null
                            AND Dealer_Shipment__c = false
                            AND Dealer_Arrive__c = false
                            AND Dealer_Saled__c = false
                            AND Consumable_order_minor__r.showFalseNotshowTrue__c = false
                            AND Deliver_date__c < LAST_N_DAYS:7
                            AND Consumable_order_minor__c = :orderId
                            GROUP BY Asset_Model_No__c];
            for(Integer i = 0 ; i< morethan7daysList.size() ; i++){
        try {
            List<AggregateResult> morethan7daysList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE
                    Consumable_order_minor__c != NULL
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Arrive__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Consumable_order_minor__r.showFalseNotshowTrue__c = FALSE
                    AND Deliver_date__c < LAST_N_DAYS:7
                    AND Consumable_order_minor__c = :orderId
                GROUP BY Asset_Model_No__c
            ];
            for (Integer i = 0; i < morethan7daysList.size(); i++) {
                morethansevendaysIifo.add(new showRecords(morethan7daysList[i]));
            }
            results.recordList = morethansevendaysIifo;
            results.result = 'Success';
        }catch (Exception e){
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
@@ -519,14 +647,16 @@
    //发货七天还未到货数All
    @AuraEnabled
    public static Results initMoreThan7All(String type){
    public static Results initMoreThan7All(String type) {
        Results results = new Results();
        List<ShowRecords> morethansevendaysIifo = new List<ShowRecords>();
        try{
        try {
            String userId = UserInfo.getUserId();
            List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
                            FROM user
                            WHERE id = :userId ];
            List<User> userList = [
                SELECT accountid, Work_Location__c, UserPro_Type__c
                FROM user
                WHERE id = :userId
            ];
            String accountid = userList[0].accountid;
            String userPro_Type = userList[0].UserPro_Type__c;
            String userWorklocation = userList[0].Work_Location__c;
@@ -534,78 +664,107 @@
            String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            if(Test.isRunningTest()){
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation  and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            }else{
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
            if (type != null && type.equals('all')) {
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND (OrderNumber_notarrive__c > 0
                        OR Delivery_detail_count__c > 0)
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            } else {
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND Delivery_detail_count__c > 0
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            }
            system.debug('==============>conorderlist'+conorderlist);
            system.debug('==============>conorderlist'+conorderlist.size());
            system.debug('==============>conorderlist' + conorderlist);
            system.debug('==============>conorderlist' + conorderlist.size());
            //20200916 ljh update end
            // List<Consumable_order__c> conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
            System.debug('======'+conorderlist+'daxiao:'+conorderlist.size());
            for(Consumable_order__c conorder : conorderlist){
                System.debug('======'+conorder.Owner.Name+'======');
            System.debug('======' + conorderlist + 'daxiao:' + conorderlist.size());
            for (Consumable_order__c conorder : conorderlist) {
                System.debug('======' + conorder.Owner.Name + '======');
            }
            Set<String> orderId = new Set<String>();
            for(Consumable_order__c conorder : conorderlist){
            for (Consumable_order__c conorder : conorderlist) {
                orderId.add(conorder.Id);
            }
            System.debug('ANY o'+orderId);
            System.debug('ANY o' + orderId);
            List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
            if(Test.isRunningTest()){
                conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
            }else{
                //20200916 ljh update start
                //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                if(type !=null && type.equals('all')){
                    system.debug('all============');
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                    system.debug('allconList==========='+conList.size());
                }else{
                    system.debug('notall=============');
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                    system.debug('notallconList==========='+conList.size());
                }
                //20200916 ljh update end
            //20200916 ljh update start
            //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            if (type != null && type.equals('all')) {
                system.debug('all============');
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = FALSE
                        AND Consumable_order_minor__c = :orderId
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
                system.debug('allconList===========' + conList.size());
            } else {
                system.debug('notall=============');
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = FALSE
                        AND Consumable_order_minor__c = :orderId
                        AND Deliver_date__c < :orderdate
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
                system.debug('notallconList===========' + conList.size());
            }
            //20200916 ljh update end
            // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
            Map<String, String> srtMap = new Map<String, String>();
            for (Consumable_order_details2__c con : conList) {
                srtMap.put(con.Bar_Code__c, con.Id);
            }
            List<String> str = new List<String>();
            for(String s : srtMap.keySet()){
            for (String s : srtMap.keySet()) {
                str.add(srtMap.get(s));
            }
            List<AggregateResult> morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Id =: str and Cancellation_Flag__c = false
                            AND Consumable_order_minor__c != null
                            AND Dealer_Shipment__c = false
                            AND Dealer_Arrive__c = false
                            AND Dealer_Saled__c = false
                            AND Consumable_order_minor__r.showFalseNotshowTrue__c = false
                            AND Deliver_date__c < LAST_N_DAYS:7
                            GROUP BY Asset_Model_No__c];
            system.debug('Morethan7daysList================>'+morethan7daysList.size());
            for(Integer i = 0 ; i< morethan7daysList.size() ; i++){
            List<AggregateResult> morethan7daysList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE
                    Id = :str
                    AND Cancellation_Flag__c = FALSE
                    AND Consumable_order_minor__c != NULL
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Arrive__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Consumable_order_minor__r.showFalseNotshowTrue__c = FALSE
                    AND Deliver_date__c < LAST_N_DAYS:7
                GROUP BY Asset_Model_No__c
            ];
            system.debug('Morethan7daysList================>' + morethan7daysList.size());
            for (Integer i = 0; i < morethan7daysList.size(); i++) {
                morethansevendaysIifo.add(new showRecords(morethan7daysList[i]));
                system.debug('MorethansevendaysIifo+++++++'+morethansevendaysIifo);
                system.debug('MorethansevendaysIifo+++++++' + morethansevendaysIifo);
            }
            results.recordList = morethansevendaysIifo;
            results.result = 'Success';
        }catch (Exception e){
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
@@ -621,17 +780,17 @@
        public List<ShowRecords> recordList;
    }
    public class ShowRecords implements Comparable {
        @AuraEnabled
        public Decimal recordCount { get; set; }
        @AuraEnabled
        public String prodModel { get; set; }
        public ShowRecords() {}
        public ShowRecords() {
        }
        public ShowRecords(AggregateResult e) {
            recordCount =Integer.valueOf(e.get('recordCount'));
            recordCount = Integer.valueOf(e.get('recordCount'));
            prodModel = String.valueOf(e.get('prodModel'));
        }
        // 排序
force-app/main/default/classes/LexInventoryController.cls
@@ -4,44 +4,45 @@
    public static Integer pageToken { get; set; }
    public static String sortField { get; set; }
    public static String sortOrder { get; set; }
    public static Integer totalcount { get; set; }
    //分页使用数据
    public static String fileName { get; set; }
    public static  Integer size{get;set;}
    public static  Integer noOfRecords{get; set;}
    public static  List<ConsumableorderdetailsInfo> codPageRecords { get; set; } // 丢失和巡回的,画面显示用
    public static  ApexPages.StandardSetController setCon { get; set; }
    public static Integer size { get; set; }
    public static Integer noOfRecords { get; set; }
    public static List<ConsumableorderdetailsInfo> codPageRecords { get; set; } // 丢失和巡回的,画面显示用
    public static ApexPages.StandardSetController setCon { get; set; }
    @AuraEnabled
    public static  List<Consumable_order_details2__c> setConDetails2 { get; set; }
    public static  Map<Id,String> pandiandetailsMap = new Map<Id,String>();
    public static List<Consumable_order_details2__c> setConDetails2 { get; set; }
    public static Map<Id, String> pandiandetailsMap = new Map<Id, String>();
    /*****************検索用******************/
    public static  String barcode { get; set; }
    public static  Boolean done { get; set; }
    public static String barcode { get; set; }
    public static Boolean done { get; set; }
    /*****************画面表示Bean******************/
    //页面主数据显示用
    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; }
    // private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
    //盘点到的产品
    public static  List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
    public static  List<Consumable_order_details2__c> showcod2nid = new List<Consumable_order_details2__c>();
    public static List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
    public static List<Consumable_order_details2__c> showcod2nid = new List<Consumable_order_details2__c>();
    //public List<Consumable_order_details2__c> pandiandetailsList { get; set; }
    public static  List<List<Consumable_order_details2__c>> pandiandetailsListShow { get; set; }
    public static List<List<Consumable_order_details2__c>> pandiandetailsListShow { get; set; }
    //寻回明细
    public static  List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserrordummy;  // 丢失和巡回的,实际炒作用
    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserrordummy; // 丢失和巡回的,实际炒作用
    @AuraEnabled
    public static  List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; }       // 产品单位的List
    public static  List<Consumable_order_details2__c> InsListUp = New List<Consumable_order_details2__c>();
    public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; } // 产品单位的List
    public static List<Consumable_order_details2__c> InsListUp = new List<Consumable_order_details2__c>();
    public static List<ConsumableorderdetailsInfo> consumableorderdetailsviewRecords;
    public static  Integer consumableorderdetailsCount  {
    public static Integer consumableorderdetailsCount {
        get {
            return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size();
        }
    }
    //list<String> notexitlist = new list<String>();
    public static  Map<String,String> reFindProduct = new Map<String,String>();
    public static Map<String, String> reFindProduct = new Map<String, String>();
    //排序用
    // public static  String sortKey;
    // public static  String preSortKey;
@@ -56,12 +57,12 @@
    // 登录者工作地
    private static String userWorkLocation;
    //经销商用户产品分类(ET、ENG)
    public static String agencyProType {get;set;}
    public static String agencyProType { get; set; }
    public static String sqlagencyProType;
    //判断操作人员是否盘点
    public static Boolean iSinventory = false;
    public LexInventoryController(){
    public LexInventoryController() {
        size = Integer.valueOf(System.Label.orderdetLimitsize);
        consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
        done = false;
@@ -72,65 +73,79 @@
        //codPageRecordsShow = new List<ConsumableorderdetailsInfo>();
    }
    private static void initStandardController(){
    private static void initStandardController() {
        // init standard controller
        List<Consumable_order_details2__c> showcod2 = [select Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,
                            Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                            Bar_Code_search__c
                        FROM Consumable_order_details2__c
                        WHERE Id in :pandiandetailsMap.keySet()
                        order by Name desc];
        List<Consumable_order_details2__c> showcod2 = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                Bar_Code_search__c
            FROM Consumable_order_details2__c
            WHERE Id IN :pandiandetailsMap.keySet()
            ORDER BY Name DESC
        ];
        setConDetails2 = showcod2;
        System.debug('setConDetails2===>'+setConDetails2);
        System.debug('setConDetails2===>' + setConDetails2);
        // setCon = new ApexPages.StandardSetController(showcod2);
        // // sets the number of records in each page set
        // setCon.setPageSize(size);
        // noOfRecords = setCon.getResultSize();
    }
    public static  List<Consumable_order_details2__c> cod2s() {
         return setConDetails2;
    public static List<Consumable_order_details2__c> cod2s() {
        return setConDetails2;
    }
    //Changes the size of pagination
    public static  PageReference refreshPageSize() {
    public static PageReference refreshPageSize() {
        setCon.setPageSize(size);
        //showcod2nid = cod2s();
        makepagerecords();
        return null;
    }
    public static  List<ConsumableorderdetailsInfo> makepagerecords() {
    public static List<ConsumableorderdetailsInfo> makepagerecords() {
        showcod2nid = cod2s();
        codPageRecords = new List<ConsumableorderdetailsInfo>();
        for (Consumable_order_details2__c cod2 : showcod2nid) {
            codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id)));
            codPageRecords.add(new ConsumableorderdetailsInfo(cod2, pandiandetailsMap.get(cod2.Id)));
        }
        System.debug('===>codPageRecords1'+codPageRecords);
         return codPageRecords;
        System.debug('===>codPageRecords1' + codPageRecords);
        return codPageRecords;
    }
    // 画面初始化
    @AuraEnabled
    public static ResponseBodyLWC init() {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String,object> data = new Map<String,object>();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
        setConDetails2 = new List<Consumable_order_details2__c>();
        String url = '在库调整一览';
        fileName = EncodingUtil.urlEncode(url, 'UTF-8');
        List<Consumable_order_details2__c> showcod2 = [select Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,
                            Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                            Bar_Code_search__c
                        FROM Consumable_order_details2__c
                        WHERE Id in :pandiandetailsMap.keySet()
                        order by Name];
                        System.debug('pandiandetailsMap====>'+pandiandetailsMap);
        List<Consumable_order_details2__c> showcod2 = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                Bar_Code_search__c
            FROM Consumable_order_details2__c
            WHERE Id IN :pandiandetailsMap.keySet()
            ORDER BY Name
        ];
        System.debug('pandiandetailsMap====>' + pandiandetailsMap);
        initStandardController();
        makepagerecords();
        // sortKey = '1';
@@ -142,133 +157,163 @@
        String userId = UserInfo.getUserId();
        //String userId = '00510000006k82X';
        //String userId = '00510000005QO75';
        user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =:userId];
        accountid = Useracc.accountid;
        user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
        accountid = Useracc.Accountid;
        userWorkLocation = Useracc.Work_Location__c;
        agencyProType = Useracc.UserPro_Type__c;
        if(String.isBlank(Useracc.UserPro_Type__c)){
        if (String.isBlank(Useracc.UserPro_Type__c)) {
            agencyProType = 'ET';
        }
        sqlagencyProType = '%' + agencyProType + '%';
        Account accountInfo = [SELECT Name,Dealer_discount__c FROM account WHERE id =:accountid];
        Account accountInfo = [SELECT Name, Dealer_discount__c FROM account WHERE id = :accountid];
        accountName = accountInfo.Name;
        consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
        Map<String,Product2__c> midMap = new Map<String,Product2__c>();
        Map<String, Product2__c> midMap = new Map<String, Product2__c>();
        List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
        Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
        Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
        Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
        Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
        //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 fy start
        //开始制作表头数据
        List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c,
                                                            SFDA_Status__c,Packing_list_manual__c,
                                                            Asset_Model_No__c
                                                        from Product2__c
                                                        //where Estimation_Entry_Possibility__c = '○'
                                                         where Product_Type__c like : sqlagencyProType
                                                        ];
        for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){
        // List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c,
        //                                                     SFDA_Status__c,Packing_list_manual__c,
        //                                                     Asset_Model_No__c
        //                                                 from Product2__c
        //                                                 //where Estimation_Entry_Possibility__c = '○'
        //                                                  where Product_Type__c like : sqlagencyProType
        //                                                 ];
        // for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){
        //     midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]);
        // }
        //查询库存 追加返品库存
        List<Consumable_order_details2__c> ProductCount_Res = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
                AND Dealer_Info_text__c = :accountName
        ];
        //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 fy start
        //开始制作表头数据
        Set<Id> Product2cIdSet = new Set<Id>();
        for (Consumable_order_details2__c con_or_d2item : ProductCount_Res) {
            Product2cIdSet.add(con_or_d2item.Consumable_Product__c);
        }
        List<Product2__c> productCount_Unfull_bak = [
            SELECT Id, Name, Name__c, SFDA_Status__c, Packing_list_manual__c, Asset_Model_No__c
            FROM Product2__c
            //where Estimation_Entry_Possibility__c = '○'
            WHERE Id IN :Product2cIdSet AND Product_Type__c LIKE :sqlagencyProType
        ];
        for (integer i = 0; i < productCount_Unfull_bak.size(); i++) {
            midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]);
        }
        //查询库存 追加返品库存
        List<Consumable_order_details2__c> ProductCount_Res = [select Id,  Name,Consumable_Product__c,
                                Bar_Code__c,Consumable_Product__r.Name__c,
                                Asset_Model_No__c,Isoverdue__c,Box_Piece__c
                            FROM Consumable_order_details2__c
                            WHERE Dealer_Arrive__c = true
                            AND Dealer_Shipment__c = false
                            AND Dealer_Saled__c = false
                            AND Dealer_Returned__c = false
                            AND Lose_Flag__c = false
                            AND Cancellation_Flag__c = false
                            AND Bar_Code__c !=null
                            AND Product_Type__c like : sqlagencyProType
                            AND Arrive_Owner_Work_Location__c =: userWorkLocation
                            AND  Dealer_Info_text__c = :accountName];
                            System.debug('ProductCount_Res==>'+ProductCount_Res);
        //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ProductCount_Res  ' + ProductCount_Res.size()));
        for(Integer i = 0 ; i< ProductCount_Res.size();i++){
        system.debug('productCount_Unfull_bak' + productCount_Unfull_bak.size());
        // String erro='productCount_Unfull_bak:'+productCount_Unfull_bak.size();
        // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, erro));
        //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 fy end
        // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ProductCount_Res  ' + ProductCount_Res.size()));
        for (Integer i = 0; i < ProductCount_Res.size(); i++) {
            //然后循环CountDel做Box和piece2个map
            if(MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '盒'){
                if(newMidBoxMap.containsKey(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c)){
                    ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c).clone();
                    Jstage.countid = Jstage.countid+1 ;
                    if(ProductCount_Res[i].Isoverdue__c == 1){
            if (MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '盒') {
                if (newMidBoxMap.containsKey(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c)) {
                    ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
                            ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c
                        )
                        .clone();
                    Jstage.countid = Jstage.countid + 1;
                    if (ProductCount_Res[i].Isoverdue__c == 1) {
                        Jstage.limitCount = Jstage.limitCount + 1;
                    }
                    Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
                    newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage);
                }else{
                    ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(ProductCount_Res[i].Consumable_Product__c));
                    Jstage.countid = Jstage.countid+1 ;
                    if(ProductCount_Res[i].Isoverdue__c == 1){
                    newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, Jstage);
                } else {
                    ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
                        MidMap.get(ProductCount_Res[i].Consumable_Product__c)
                    );
                    Jstage.countid = Jstage.countid + 1;
                    if (ProductCount_Res[i].Isoverdue__c == 1) {
                        Jstage.limitCount = Jstage.limitCount + 1;
                    }
                    Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
                    newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage);
                    newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, Jstage);
                }
            }else if(MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '个'){
                if(newMidPieceMap.containsKey(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c)){
                    ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c).clone();
                    Jstage.countid = Jstage.countid+1 ;
                    if(ProductCount_Res[i].Isoverdue__c == 1){
            } else if (MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '个') {
                if (newMidPieceMap.containsKey(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c)) {
                    ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
                            ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c
                        )
                        .clone();
                    Jstage.countid = Jstage.countid + 1;
                    if (ProductCount_Res[i].Isoverdue__c == 1) {
                        Jstage.limitCount = Jstage.limitCount + 1;
                    }
                    Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
                    newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage);
                }else{
                    ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(ProductCount_Res[i].Consumable_Product__c));
                    Jstage.countid = Jstage.countid+1 ;
                    if(ProductCount_Res[i].Isoverdue__c == 1){
                    newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, Jstage);
                } else {
                    ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
                        MidMap.get(ProductCount_Res[i].Consumable_Product__c)
                    );
                    Jstage.countid = Jstage.countid + 1;
                    if (ProductCount_Res[i].Isoverdue__c == 1) {
                        Jstage.limitCount = Jstage.limitCount + 1;
                    }
                    Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
                    newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage);
                    newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, Jstage);
                }
            }
        }
        for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){
        for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) {
            bss.overlimitCount = bss.countid - bss.limitCount;
            boxRecords.add(bss);
        }
        boxRecords.sort();
        for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
        for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
            bss.overlimitCount = bss.countid - bss.limitCount;
        }
        for(ConsumableorderdetailsInfo bss : boxRecords){
        for (ConsumableorderdetailsInfo bss : boxRecords) {
            consumableorderdetailsRecords.add(bss);
            if(newMidPieceMap.containsKey(bss.Prod.Id + '个')){
            if (newMidPieceMap.containsKey(bss.Prod.Id + '个')) {
                consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个'));
                //newMidPieceMap移除已经添加的Piece
                newMidPieceMap.remove(bss.Prod.Id + '个');
            }
        }
        for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
        for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
            consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个'));
        }
        //consumableorderdetailsCount = consumableorderdetailsRecords.size();
        listCut();
        system.debug('ConsumableorderdetailsRecordsview'+ConsumableorderdetailsRecordsview);
        System.debug('ConsumableorderdetailsRecordsview==>'+ConsumableorderdetailsRecordsview);
        System.debug('consumableorderdetailsviewRecords===>'+consumableorderdetailsviewRecords);
        System.debug('consumableorderdetailsRecords===>'+consumableorderdetailsRecords);
        data.put('ConsumableorderdetailsRecordsview', JSON.serialize(ConsumableorderdetailsRecordsview));
        data.put('userWorkLocation', userWorkLocation);
        data.put('agencyProType', agencyProType);
        data.put('accountName', accountName);
        data.put('accountid', accountid);
        data.put('ConsumableorderdetailsRecordsview',JSON.serialize(ConsumableorderdetailsRecordsview));
        data.put('userWorkLocation',userWorkLocation);
        data.put('agencyProType',agencyProType);
        data.put('accountName',accountName);
        data.put('accountid',accountid);
        data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords));
        data.put('consumableorderdetailsRecords', JSON.serialize(consumableorderdetailsRecords));
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        return res;
    }
    private static void listCut(){
    private static void listCut() {
        //拆分暂用list
        List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
        List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
@@ -279,44 +324,41 @@
        //选择产品view
        ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
        ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
        if(consumableorderdetailsRecords.size() > 1000){
            for(Integer i = 0; i < consumableorderdetailsRecords.size(); i++){
                if(i < 1000){
        if (consumableorderdetailsRecords.size() > 1000) {
            for (Integer i = 0; i < consumableorderdetailsRecords.size(); i++) {
                if (i < 1000) {
                    c = consumableorderdetailsRecords.get(i);
                    ConsumableorderdetailsRecordsbreak.add(c);
                }else{
                } else {
                    c = consumableorderdetailsRecords.get(i);
                    ConsumableorderdetailsRecordsbreakover.add(c);
                }
            }
            consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreak);
            consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreakover);
        }else{
        } else {
            consumableorderdetailsRecordsview.add(consumableorderdetailsRecords);
        }
    }
    //========20160311======ADD_Start================================
    // 将页面或取得BarCode去掉重复的,转换成List
    //========20160311======ADD_Start================================
    public static  List<String> ParseBarCode(String Code){
        Map<String,Integer> barcodeCountMap = new Map<String,Integer>();
        String[] Cache = new String[]{};
    public static List<String> ParseBarCode(String Code) {
        Map<String, Integer> barcodeCountMap = new Map<String, Integer>();
        String[] Cache = new List<String>{};
        Cache = Code.split('\n');
        List <String> Buff = new List<String>();
        for(String A : Cache){
        List<String> Buff = new List<String>();
        for (String A : Cache) {
            A = A.trim().toUpperCase();
            if(barcodeCountMap.containsKey(A)){
                barcodeCountMap.put(A,barcodeCountMap.get(A) + 1);
            }else{
                barcodeCountMap.put(A,1);
            if (barcodeCountMap.containsKey(A)) {
                barcodeCountMap.put(A, barcodeCountMap.get(A) + 1);
            } else {
                barcodeCountMap.put(A, 1);
            }
            Buff.add(A + barcodeCountMap.get(A));
        }
        return Buff;
    }
    //test
@@ -327,57 +369,78 @@
    //========20160311======ADD_End==================================
    // BarCode录入
    @AuraEnabled
    public static ResponseBodyLWC searchConsumableorderdetails(String agencyProType,String userWorkLocation,String accountName,String barcode,String consumableorderdetailsRecordsLWC,Integer pageSizeLWC, Integer pageTokenLWC, String sortFieldLWC, String sortOrderLWC){
    public static ResponseBodyLWC searchConsumableorderdetails(
        String agencyProType,
        String userWorkLocation,
        String accountName,
        String barcode,
        String consumableorderdetailsRecordsLWC,
        Integer pageSizeLWC,
        Integer pageTokenLWC,
        String sortFieldLWC,
        String sortOrderLWC
    ) {
        pageSize = pageSizeLWC;
        pageToken = pageTokenLWC;
        sortField = sortFieldLWC;
        sortOrder = sortOrderLWC;
        System.debug('===>consumableorderdetailsRecordsLWC'+consumableorderdetailsRecordsLWC);
        List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class);
        System.debug('===>consumableorderdetailsRecordsLWC' + consumableorderdetailsRecordsLWC);
        List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
            consumableorderdetailsRecordsLWC,
            List<ConsumableorderdetailsInfo>.class
        );
        // ConsumableorderdetailsInfo[] consumableorderdetailsRecords=(List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class);
       system.debug('=====>consumableorderdetailsRecordsLWC'+consumableorderdetailsRecordsLWC);
        system.debug('=====>consumableorderdetailsRecordsLWC' + consumableorderdetailsRecordsLWC);
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String,object> data = new Map<String,object>();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        sqlagencyProType = '%' + agencyProType + '%';
        // consumableorderdetailsRecords = consumableorderdetailsRecordsLWC;
         System.debug('consumableorderdetailsRecords===>'+consumableorderdetailsRecords);
        System.debug('agencyProType===>'+sqlagencyProType);
        System.debug('accountName===>'+accountName);
        System.debug('sqlagencyProType==>' + sqlagencyProType);
        System.debug('accountName==>' + accountName);
        System.debug('userWorkLocation==>' + userWorkLocation);
        /* BarCodelist做成 */
        //FIXME barcodeSet 做成,ProductCount_ResSet 做成
        List<Consumable_order_details2__c> pandiandetailsList = new List<Consumable_order_details2__c>();
        pandiandetailsListShow = new List<List<Consumable_order_details2__c>>();
        done = false;
        List<String> BarCodeListP = ParseBarCode( barcode );
        List<String> BarCodeListP = ParseBarCode(barcode);
        System.debug('BarCodeListP===>' + BarCodeListP);
        //查询库存 追加返品库存
        List<Consumable_order_details2__c> ProductCount_Res = [select Id,  Name,Consumable_Product__c,
                                Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c,
                                Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                                Bar_Code_search__c
                            FROM Consumable_order_details2__c
                            WHERE Dealer_Arrive__c = true
                            AND Dealer_Shipment__c = false
                            AND Dealer_Saled__c = false
                            AND Dealer_Returned__c = false
                            AND Lose_Flag__c = false
                            AND Cancellation_Flag__c = false
                            AND Bar_Code__c !=null
                            AND Product_Type__c like : sqlagencyProType
                            AND Arrive_Owner_Work_Location__c =: userWorkLocation
                            AND  Dealer_Info_text__c = :accountName ];
        List<Consumable_order_details2__c> ProductCount_Res = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Dealer_Info_text__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                Bar_Code_search__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
                AND Dealer_Info_text__c = :accountName
        ];
        System.debug('ProductCount_Res==>' + ProductCount_Res);
        reFindProduct.clear();
        System.debug('ProductCount_Res==>'+ProductCount_Res);
        Map<String,ConsumableorderdetailsInfo> barCodeListAdjustMap = new  Map<String,ConsumableorderdetailsInfo>();
        Map<String, ConsumableorderdetailsInfo> barCodeListAdjustMap = new Map<String, ConsumableorderdetailsInfo>();
        //barCodeListLoseMap.clear();
        Set<String> carCodeListLose = new Set<String>();
        List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsAdjust = new List<ConsumableorderdetailsInfo>();
        Map<String,String> proIdNotinpage = new Map<String,String>();
        Map<String, String> proIdNotinpage = new Map<String, String>();
        List<Consumable_order_details2__c> reFindProductList = new List<Consumable_order_details2__c>();
        codPageRecords = new List<ConsumableorderdetailsInfo>();
        consumableorderdetailsRecordserrordummy = new List<ConsumableorderdetailsInfo>();
@@ -385,20 +448,23 @@
        pandiandetailsMap.clear();
        reSet = new List<Consumable_order_details2__c>();
        /* 判断BarCode是否为空 */
        if (barcode == null || barcode == ''){
        if (barcode == null || barcode == '') {
            //先取出所有丢失产品
            for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
            for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
                // 20200509 gzw add 盘点数量初始化
                ass.Pandian = 0;
                // 20200509 gzw add 盘点数量初始化
                if(ass.check==true){
                if (ass.check == true) {
                    //ass.Diff = ass.countid - ass.Pandian;
                    for(integer i = 0 ; i < ProductCount_Res.size();i++){
                        if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){
                            if(carCodeListLose.contains(ProductCount_Res[i].Bar_Code__c)){
                    for (integer i = 0; i < ProductCount_Res.size(); i++) {
                        System.debug('Pro==>' + ProductCount_Res[i].Consumable_Product__c);
                        System.debug('ProId==>' + ass.Prod.Id);
                        System.debug('ass.boxPiece ==>' + ass.boxPiece);
                        System.debug('boxPiece ==>' + ProductCount_Res[i].Box_Piece__c);
                        if (ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c) {
                            if (carCodeListLose.contains(ProductCount_Res[i].Bar_Code__c)) {
                                continue;
                            }else{
                            } else {
                                //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失'));
                                //pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失');
                                ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i]));
@@ -410,577 +476,170 @@
            }
            //已经出库的产品
            List<Consumable_order_details2__c>  reSet1 = [SELECT Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,
                            Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                            Bar_Code_search__c,Dealer_Info_text__c
                        FROM Consumable_order_details2__c
                        WHERE Dealer_Arrive__c = TRUE
                        AND  (Dealer_Shipment__c= TRUE
                        or  Dealer_Saled__c = TRUE)
                        AND  Dealer_Returned__c = FALSE
                        AND  Cancellation_Flag__c = FALSE
                        AND  Bar_Code__c in :carCodeListLose
                        AND Dealer_Info_text__c = :accountName
                        ORDER BY Name ];
                        System.debug('reSet1==>'+reSet1);
            Map<String,Consumable_order_details2__c> needreturnMap = new Map<String,Consumable_order_details2__c>();
            for(Consumable_order_details2__c cod2 :reSet1){
                needreturnMap.put(cod2.Bar_Code__c,cod2);
            List<Consumable_order_details2__c> reSet1 = [
                SELECT
                    Id,
                    Name,
                    Consumable_Product__c,
                    Bar_Code__c,
                    Consumable_Product__r.Name__c,
                    Asset_Model_No__c,
                    Isoverdue__c,
                    Box_Piece__c,
                    Bar_Code_search__c,
                    Dealer_Info_text__c
                FROM Consumable_order_details2__c
                WHERE
                    Dealer_Arrive__c = TRUE
                    AND (Dealer_Shipment__c = TRUE
                    OR Dealer_Saled__c = TRUE)
                    AND Dealer_Returned__c = FALSE
                    AND Cancellation_Flag__c = FALSE
                    AND Bar_Code__c IN :carCodeListLose
                    AND Dealer_Info_text__c = :accountName
                ORDER BY Name
            ];
            Map<String, Consumable_order_details2__c> needreturnMap = new Map<String, Consumable_order_details2__c>();
            for (Consumable_order_details2__c cod2 : reSet1) {
                needreturnMap.put(cod2.Bar_Code__c, cod2);
            }
            // 经销商之间或者同一经销商不同工作地调货
            reSet1 = [SELECT Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,
                            Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                            Bar_Code_search__c,Dealer_Info_text__c
                        FROM Consumable_order_details2__c
                        WHERE Dealer_Arrive__c = TRUE
                        AND  Dealer_Shipment__c= FALSE
                        AND  Dealer_Saled__c = FALSE
                        AND  Dealer_Returned__c = FALSE
                        AND  Cancellation_Flag__c = FALSE
                        AND  Bar_Code__c in :carCodeListLose
                        AND (Dealer_Info_text__c != :accountName
                            OR (Dealer_Info_text__c = :accountName
                                AND Arrive_Owner_Work_Location__c != :userWorkLocation)
                        )
                        ORDER BY Name ];
            Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>();
            for(Consumable_order_details2__c cod2 :reSet1){
                otherAgProMap.put(cod2.Bar_Code__c,cod2);
            reSet1 = [
                SELECT
                    Id,
                    Name,
                    Consumable_Product__c,
                    Bar_Code__c,
                    Consumable_Product__r.Name__c,
                    Asset_Model_No__c,
                    Isoverdue__c,
                    Box_Piece__c,
                    Bar_Code_search__c,
                    Dealer_Info_text__c
                FROM Consumable_order_details2__c
                WHERE
                    Dealer_Arrive__c = TRUE
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Dealer_Returned__c = FALSE
                    AND Cancellation_Flag__c = FALSE
                    AND Bar_Code__c IN :carCodeListLose
                    AND (Dealer_Info_text__c != :accountName
                    OR (Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c != :userWorkLocation))
                ORDER BY Name
            ];
            Map<String, Consumable_order_details2__c> otherAgProMap = new Map<String, Consumable_order_details2__c>();
            for (Consumable_order_details2__c cod2 : reSet1) {
                otherAgProMap.put(cod2.Bar_Code__c, cod2);
            }
            carCodeListLose.clear();
            for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
                if(ass.check==true){
            for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
                if (ass.check == true) {
                    ass.Diff = ass.countid - ass.Pandian;
                    for(integer i = 0 ; i < ProductCount_Res.size();i++){
                        if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){
                            if(carCodeListLose.contains(ProductCount_Res[i].Bar_Code_search__c)){
                    for (integer i = 0; i < ProductCount_Res.size(); i++) {
                        if (ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c) {
                            if (carCodeListLose.contains(ProductCount_Res[i].Bar_Code_search__c)) {
                                continue;
                            }else{
                                if(needreturnMap.containsKey(ProductCount_Res[i].Bar_Code__c)){
                                    consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品未返品'));
                            } else {
                                if (needreturnMap.containsKey(ProductCount_Res[i].Bar_Code__c)) {
                                    consumableorderdetailsRecordserrordummy.add(
                                        new ConsumableorderdetailsInfo(ProductCount_Res[i], '该产品未返品')
                                    );
                                    pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品未返品');
                                    carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
                                    continue;
                                }
                                if(otherAgProMap.containsKey(ProductCount_Res[i].Bar_Code__c)){
                                    consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品归属于' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '的库存。'));
                                    pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品归属于' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '的库存。');
                                if (otherAgProMap.containsKey(ProductCount_Res[i].Bar_Code__c)) {
                                    consumableorderdetailsRecordserrordummy.add(
                                        new ConsumableorderdetailsInfo(
                                            ProductCount_Res[i],
                                            '该产品归属于' +
                                                otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c +
                                                '的库存。'
                                        )
                                    );
                                    pandiandetailsMap.put(
                                        ProductCount_Res[i].Id,
                                        '该产品归属于' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '的库存。'
                                    );
                                    carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
                                    continue;
                                }
                                if (ProductCount_Res[i].Isoverdue__c == 0) {
                                    consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品已经过有效期,请销存。'));
                                    consumableorderdetailsRecordserrordummy.add(
                                        new ConsumableorderdetailsInfo(ProductCount_Res[i], '该产品已经过有效期,请销存。')
                                    );
                                    pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品已经过有效期,请销存。');
                                    carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
                                    ass.Diff--;
                                    continue;
                                }
                                consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失'));
                                consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i], '丢失'));
                                pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失');
                                carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
                            }
                        }
                    }
                }else{
                } else {
                    ass.Pandian = 0;
                    ass.Diff = 0;
                }
            }
            List<Consumable_order_details2__c> showcod2 = new List<Consumable_order_details2__c>();
            if (pandiandetailsMap.keySet().size() > 0) {
                showcod2 = [select Id,  Name,Consumable_Product__c,
                                Bar_Code__c,Consumable_Product__r.Name__c,
                                Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                                Bar_Code_search__c
                            FROM Consumable_order_details2__c
                            WHERE Id in :pandiandetailsMap.keySet()
                            order by Name];
                showcod2 = [
                    SELECT
                        Id,
                        Name,
                        Consumable_Product__c,
                        Bar_Code__c,
                        Consumable_Product__r.Name__c,
                        Asset_Model_No__c,
                        Isoverdue__c,
                        Box_Piece__c,
                        Bar_Code_search__c
                    FROM Consumable_order_details2__c
                    WHERE Id IN :pandiandetailsMap.keySet()
                    ORDER BY Name
                ];
            }
            initStandardController();
            showcod2nid = cod2s();
            system.debug('showcod2nid===>'+showcod2nid);
            for (Consumable_order_details2__c cod2 : showcod2nid) {
                codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id)));
                codPageRecords.add(new ConsumableorderdetailsInfo(cod2, pandiandetailsMap.get(cod2.Id)));
            }
            iSinventory = true;
            if(codPageRecords.size() > 0) done = true;
            if (codPageRecords.size() > 0)
                done = true;
            consumableorderdetailsRecordserrordummy.clear();
            //pandiandetailsList = new list<Consumable_order_details2__c>();
            pandiandetailsList = [select Id, Bar_Code__c,Consumable_Product__r.Name__c,
                                    Box_Piece__c,Lose_reason__c
                                FROM Consumable_order_details2__c
                                WHERE Id in :pandiandetailsMap.keySet()
                                order by Name];
            for(Consumable_order_details2__c codDet : pandiandetailsList){
            pandiandetailsList = [
                SELECT Id, Bar_Code__c, Consumable_Product__r.Name__c, Box_Piece__c, Lose_reason__c
                FROM Consumable_order_details2__c
                WHERE Id IN :pandiandetailsMap.keySet()
                ORDER BY Name
            ];
            for (Consumable_order_details2__c codDet : pandiandetailsList) {
                codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id);
            }
            List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>();
            for(Consumable_order_details2__c cod2 : pandiandetailsList){
            for (Consumable_order_details2__c cod2 : pandiandetailsList) {
                pandiandetailsListMid.add(cod2);
                if(pandiandetailsListMid.size() == 1000){
                if (pandiandetailsListMid.size() == 1000) {
                    pandiandetailsListShow.add(pandiandetailsListMid);
                    pandiandetailsListMid = new List<Consumable_order_details2__c>();
                }
            }
                if(pandiandetailsListMid.size() > 0){
                    pandiandetailsListShow.add(pandiandetailsListMid);
                }
                 //分页
            PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
            totalCount = codPageRecords.size();
            paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
            paginatedAccounts.recordStart = pageToken + 1;
            paginatedAccounts.pageNumber = pageToken / pageSize + 1;
            Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
            paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
            paginatedAccounts.totalRecords = totalCount;
            Integer startIdx;
            Integer endIdx;
            List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>();
            startIdx = pageToken;
            endIdx = startIdx + pageSize;
            if (endIdx > codPageRecords.size()) {
                endIdx = codPageRecords.size();
            }
            for (Integer i = startIdx; i < endIdx; i++) {
                pageCodeRecords.add(codPageRecords.get(i));
            }
            data.put('paginatedAccounts', paginatedAccounts);
            data.put('pageCodeRecords', pageCodeRecords);
            //end
            data.put('codPageRecords',JSON.serialize(codPageRecords));
            data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords));
            data.put('consumableorderdetailsRecordsview',JSON.serialize(consumableorderdetailsRecordsview));
            data.put('pandiandetailsMap',pandiandetailsMap);
            System.debug('iSinventory===>'+iSinventory);
            System.debug('codPageRecords===>'+codPageRecords);
            data.put('iSinventory',JSON.serialize(iSinventory));
            data.put('reSet1',reSet1);
            System.debug('reSet1===>'+reSet1);
            res.code = 200;
            res.status = 'Success1';
            return res;
        }
        //CHAN-B7J4NB 只有一个时,盘点不到
        //init();
        //CHAN-B7J4NB
        Map<String,String> showproductIdMap = new Map<String,String>();
        for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
            showproductIdMap.put(ass.prod.Id + ass.boxPiece, ass.prod.Id + ass.boxPiece);
        }
// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCodeListP' + BarCodeListP));
        /***************************************************************************/
        // BarCode的检索  所有在库
        reSet = [select Id,Consumable_Product__c,Consumable_Product__r.Name__c,
                        Box_Piece__c,Bar_Code_search__c,Isoverdue__c
                    from Consumable_order_details2__c
                    where Bar_Code_search__c in :BarCodeListP
                    AND Dealer_Arrive__c = true
                    AND Dealer_Shipment__c = false
                    AND Dealer_Saled__c = false
                    AND Dealer_Returned__c = false
                    AND Lose_Flag__c = false
                    AND Cancellation_Date__c = null
                    and Bar_Code__c !=null
                    AND Product_Type__c like : sqlagencyProType
                    AND Arrive_Owner_Work_Location__c =: userWorkLocation
                    AND  Dealer_Info_text__c = :accountName
                    order by Name];
                    System.debug('reSet===>'+reSet);
        Map<String, Integer> pandianProdIdCountMap = new Map<String, Integer>();        // ProdId 単位
        // 20200509 add gzw 记录需要销存数量
        Map<String, Integer> pandianoverdueCountMap = new Map<String, Integer>();        // ProdId 単位
        // 20200509 add gzw 记录需要销存数量
        Map<String,ConsumableorderdetailsInfo> barCodeListPandianMap = new Map<String,ConsumableorderdetailsInfo>();   // 明細バーコード 単位
        //盘点到的明细
        for(Consumable_order_details2__c rs : reSet){
            //BarCodeListPandian.add(rs.Bar_Code_search__c);
            for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
                if(rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece){
                    ass.check = true;
                }
            }
            barCodeListPandianMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs));
            if (rs.Isoverdue__c == 0) {
                consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'该产品已经过有效期,请销存。'));
                pandiandetailsMap.put(rs.Id, '该产品已经过有效期,请销存。');
                if (pandianoverdueCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) {
                    pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1);
                } else {
                    pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, pandianoverdueCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1);
                }
                continue;
            }
            if (pandianProdIdCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) {
                pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1);
            } else {
                pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, pandianProdIdCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1);
            }
        }
        // 经销商之间或者同一经销商不同工作地调货
        List<Consumable_order_details2__c> reSet1 = [SELECT Id,  Name,Consumable_Product__c,
                        Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c,
                        Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c,
                        Bar_Code_search__c,Dealer_Info_text__c
                    FROM Consumable_order_details2__c
                    WHERE (Dealer_Arrive__c = TRUE
                    or  Dealer_Shipment__c= TRUE
                    or  Dealer_Saled__c = TRUE)
                    AND  Dealer_Returned__c = FALSE
                    AND  Cancellation_Flag__c = FALSE
                    AND  Bar_Code_search__c in :BarCodeListP
                    AND (Dealer_Info_text__c != :accountName
                        OR (Dealer_Info_text__c = :accountName
                            AND Arrive_Owner_Work_Location__c != :userWorkLocation)
                    )
                    ORDER BY Name ];
        Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>();
        for(Consumable_order_details2__c cod2 :reSet1){
            otherAgProMap.put(cod2.Bar_Code__c,cod2);
        }
        // 需要入库的产品
        for(Consumable_order_details2__c cod2 : reSet1){
            for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
                if(cod2.Consumable_Product__c == ass.Prod.Id && cod2.Box_Piece__c == ass.boxPiece){
                    ass.check = true;
                }
            }
            if(!showproductIdMap.containsKey(cod2.Consumable_product__c + cod2.Box_Piece__c)){
                reFindProductList.add(cod2);
                proIdNotinpage.put(cod2.Consumable_Product__c, cod2.Box_Piece__c);
            }
            if(!barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c)
                && otherAgProMap.containsKey(cod2.Bar_Code__c)
                && (otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == true
                || otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == true) ){
                consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'无此产品的库存,请入库。'));
                pandiandetailsMap.put(cod2.Id, '无此产品的库存,请入库。');
            }
        }
        //寻回明细
        List<Consumable_order_details2__c> productAdjust = new List<Consumable_order_details2__c>();
        productAdjust = [select Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,Lose_reason__c,
                            Asset_Model_No__c,Box_Piece__c,Bar_Code_search__c,Isoverdue__c
                        from Consumable_order_details2__c
                        where Bar_Code_search__c in :BarCodeListP
                          and Bar_Code__c !=null
                          and Lose_Flag__c = true
                          AND Product_Type__c like : sqlagencyProType
                          AND  Dealer_Info_text__c = :accountName
                          AND Arrive_Owner_Work_Location__c =: userWorkLocation
                        order by Name];
        for (Consumable_order_details2__c rs : productAdjust){
            // 过期库存销存 20200427 gzw add srart
            if (rs.Isoverdue__c == 0 || rs.Lose_reason__c == '过期库存销存' ) {
                consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'过期或者销存产品,无法寻回入库'));
                pandiandetailsMap.put(rs.Id, '过期或者销存产品,无法寻回入库');
                carCodeListLose.add(rs.Bar_Code_search__c);
                continue;
            }
            // 过期库存销存 20200427 gzw add end
            for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
                if(rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece){
                    ass.check = true;
                }
            }
            if(!showproductIdMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c)){
                reFindProductList.add(rs);
                proIdNotinpage.put(rs.Consumable_Product__c, rs.Box_Piece__c);
            }
            if(barCodeListAdjustMap.containsKey(rs.Bar_Code_search__c)){
                continue;
            }else{
                barCodeListAdjustMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs));
                consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs,'寻回'));
                pandiandetailsMap.put(rs.Id, '寻回');
                consumableorderdetailsRecordsAdjust.add(new ConsumableorderdetailsInfo(rs));
            }
        }
        if(reFindProductList.size() > 0){
            Map<String,Product2__c> midMap = new Map<String,Product2__c>();
            List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
            Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
            Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
            List<Product2__c> product_Refind = [select Id, Name,Name__c,SFDA_Status__c,Packing_list_manual__c,Asset_Model_No__c
                                    from Product2__c
                                    WHERE Id in :proIdNotinpage.keySet()];
            for(Product2__c pro : product_Refind){
                midMap.put(pro.Id, pro);
            }
            for(Integer i = 0 ; i< reFindProductList.size();i++){
                //然后循环CountDel做Box和piece2个map
                if(MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '盒'){
                    if(newMidBoxMap.containsKey(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c)){
                        ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c).clone();
                        Jstage.countid = 0 ;
                        if(reFindProductList[i].Isoverdue__c == 1){
                            Jstage.limitCount = 0;
                        }
                        Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
                        newMidBoxMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage);
}else{
                                            ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(reFindProductList[i].Consumable_Product__c));
                        Jstage.countid = 0 ;
                        if(reFindProductList[i].Isoverdue__c == 1){
                            Jstage.limitCount = 0;
                        }
                        Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
                        newMidBoxMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage);
                    }
                }else if(MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '个'){
                    if(newMidPieceMap.containsKey(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c)){
                        ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(reFindProductList[i].Consumable_product__c+reFindProductList[i].Box_Piece__c).clone();
                        Jstage.countid = 0 ;
                        if(reFindProductList[i].Isoverdue__c == 1){
                            Jstage.limitCount = 0;
                        }
                        Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
                        newMidPieceMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage);
                    }else{
                        ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(reFindProductList[i].Consumable_Product__c));
                        Jstage.countid = 0 ;
                        if(reFindProductList[i].Isoverdue__c == 1){
                            Jstage.limitCount = 0;
                        }
                        Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
                        newMidPieceMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage);
                    }
                }
            }
            for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){
                bss.check = true;
                bss.overlimitCount = bss.countid - bss.limitCount;
                boxRecords.add(bss);
            }
            boxRecords.sort();
            for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
                bss.check = true;
                bss.overlimitCount = bss.countid - bss.limitCount;
            }
            for(ConsumableorderdetailsInfo bss : boxRecords){
                consumableorderdetailsRecords.add(bss);
                if(newMidPieceMap.containsKey(bss.Prod.Id + '个')){
                    consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个'));
                    //newMidPieceMap移除已经添加的Piece
                    newMidPieceMap.remove(bss.Prod.Id + '个');
                }
            }
            for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
                consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个'));
            }
        }
        //先取出未盘点到的产品
        for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
            if(ass.check == true){
                for(integer i = 0 ; i<ProductCount_Res.size();i++){
                    if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){
                        if(barCodeListPandianMap.get(ProductCount_Res[i].Bar_Code_search__c) != null){
                            continue;
                        }else{
                            carCodeListLose.add(ProductCount_Res[i].Bar_Code__c);
                            ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i]));
                            //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失'));
                            //pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失');
                        }
                    }
                }
            }
        }
        //已经出库的产品
        List<Consumable_order_details2__c>  reSet2 = [SELECT Id,  Name,Consumable_Product__c,
                        Bar_Code__c,Consumable_Product__r.Name__c,
                        Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                        Bar_Code_search__c,Dealer_Info_text__c
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = TRUE
                    AND  (Dealer_Shipment__c= TRUE
                    or  Dealer_Saled__c = TRUE)
                    AND  Dealer_Returned__c = FALSE
                    AND  Cancellation_Flag__c = FALSE
                    AND  Bar_Code_search__c in :BarCodeListP
                    AND Dealer_Info_text__c = :accountName
                    ORDER BY Name ];
        Map<String,Consumable_order_details2__c> needreturnMap = new Map<String,Consumable_order_details2__c>();
        for(Consumable_order_details2__c cod2 :reSet2){
            needreturnMap.put(cod2.Bar_Code__c,cod2);
        }
        //// 经销商之间或者同一经销商不同工作地调货
        //List<Consumable_order_details2__c> reSet1 = [SELECT Id,  Name,Consumable_Product__c,
        //                Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c,
        //                Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c,
        //                Bar_Code_search__c,Dealer_Info_text__c
        //            FROM Consumable_order_details2__c
        //            WHERE (Dealer_Arrive__c = TRUE
        //            or  Dealer_Shipment__c= TRUE
        //            or  Dealer_Saled__c = TRUE)
        //            AND  Dealer_Returned__c = FALSE
        //            AND  Cancellation_Flag__c = FALSE
        //            AND  Bar_Code_search__c in :BarCodeListP
        //            AND (Dealer_Info_text__c != :accountName
        //                OR (Dealer_Info_text__c = :accountName
        //                    AND Arrive_Owner_Work_Location__c != :userWorkLocation)
        //            )
        //            ORDER BY Name ];
        //Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>();
        //for(Consumable_order_details2__c cod2 :reSet1){
        //    otherAgProMap.put(cod2.Bar_Code__c,cod2);
        //}
        carCodeListLose.clear();
        //未盘点到的产品
        for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
            if(ass.check == true){
                for(integer i = 0 ; i<ProductCount_Res.size();i++){
                    if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){
                        if(barCodeListPandianMap.containsKey(ProductCount_Res[i].Bar_Code_search__c)){
                            continue;
                        }
                        if (ProductCount_Res[i].Isoverdue__c == 0) {
                            consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品已经过有效期,请销存。'));
                            pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品已经过有效期,请销存。');
                            if (pandianoverdueCountMap.containsKey(ProductCount_Res[i].Consumable_product__c + ProductCount_Res[i].Box_Piece__c) == false) {
                                pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, 1);
                            } else {
                                pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, pandianoverdueCountMap.get(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c) + 1);
                            }
                            continue;
                        }
                        consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失'));
                        pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失');
                    }
                }
                // 同时存在其他经销商库存产品
                for(Consumable_order_details2__c cod2 : reSet1){
                    if(cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c){
                        if(barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c)
                            && otherAgProMap.containsKey(cod2.Bar_Code__c)
                            && otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == false
                            && otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == false ){
                            consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。'));
                            pandiandetailsMap.put(cod2.Id, '该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。');
                            continue;
                        }
                    }
                }
                // 需要返品的产品
                for(Consumable_order_details2__c cod2 : reSet2){
                    if(cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c){
                        if(needreturnMap.containsKey(cod2.Bar_Code__c)){
                            consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'该产品目前出库状态,请返品。'));
                            pandiandetailsMap.put(cod2.Id, '该产品目前出库状态,请返品。');
                            continue;
                        }
                    }
                }
            }
        }
        //更新主明细单
        if(barCodeListPandianMap.size() > 0){
            for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
                if(ass.check == true){
                    integer countSum = 0;
                    if (pandianProdIdCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
                        countSum = pandianProdIdCountMap.get(ass.Prod.Id + ass.boxPiece);
                    }
                    integer overdueSum = 0;
                    if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
                        overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece);
                    }
                    ass.Pandian = countSum;
                    ass.Diff = ass.countid - countSum - overdueSum;
                    ass.refind = 0;
                }
            }
        }else{
            for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
                if(ass.check == true){
                    integer overdueSum = 0;
                    if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
                        overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece);
                    }
                    ass.Diff = ass.countid - ass.Pandian - overdueSum;
                }
            }
        }
        //寻回做成
        for(ConsumableorderdetailsInfo ass :consumableorderdetailsRecords){
            for(ConsumableorderdetailsInfo adjust :consumableorderdetailsRecordsAdjust){
                if(ass.Prod.Name__c == adjust.Prod.Name__c && ass.boxPiece == adjust.orderdetails2.Box_Piece__c){
                    if(reFindProduct.containsKey(adjust.orderdetails2.Bar_Code_search__c)){
                        continue;
                    }else {
                        ass.Pandian ++;
                        ass.refind ++;
                        reFindProduct.put(adjust.orderdetails2.Bar_Code_search__c,adjust.orderdetails2.Bar_Code_search__c);
                    }
                }
            }
        }
        if (pandiandetailsMap.keySet().size() > 0) {
            List<Consumable_order_details2__c> showcod2 = [select Id,  Name,Consumable_Product__c,
                                Bar_Code__c,Consumable_Product__r.Name__c,
                                Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                                Bar_Code_search__c
                            FROM Consumable_order_details2__c
                            WHERE Id in :pandiandetailsMap.keySet()
                            order by Name];
            initStandardController();
            showcod2nid = cod2s();
        }
        for (Consumable_order_details2__c cod2 : showcod2nid) {
            codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id)));
        }
        if(codPageRecords.size() > 0) done = true;
        iSinventory = true;
        consumableorderdetailsRecordserrordummy.clear();
        pandiandetailsList = [select Id, Bar_Code__c,Consumable_Product__r.Name__c,
                                Box_Piece__c,Lose_reason__c
                            FROM Consumable_order_details2__c
                            WHERE Id in :pandiandetailsMap.keySet()
                            order by Name];
        for(Consumable_order_details2__c codDet : pandiandetailsList){
            codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id);
        }
        List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>();
        for(Consumable_order_details2__c cod2 : pandiandetailsList){
            pandiandetailsListMid.add(cod2);
            if(pandiandetailsListMid.size() == 1000){
                pandiandetailsListShow.add(pandiandetailsListMid);
                pandiandetailsListMid = new List<Consumable_order_details2__c>();
            }
        }
            if(pandiandetailsListMid.size() > 0){
            if (pandiandetailsListMid.size() > 0) {
                pandiandetailsListShow.add(pandiandetailsListMid);
            }
            //分页
            PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
            totalCount = codPageRecords.size();
@@ -1007,101 +666,638 @@
            data.put('pageCodeRecords', pageCodeRecords);
            //end
            System.debug('=====>codPageRecords2'+codPageRecords);
            System.debug('=====>consumableorderdetailsRecords'+consumableorderdetailsRecords);
            data.put('codPageRecords',JSON.serialize(codPageRecords));
            data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords));
            System.debug('iSinventory===>'+iSinventory);
            data.put('iSinventory',JSON.serialize(iSinventory));
            System.debug('pandiandetailsMap===>'+pandiandetailsMap);
            data.put('pandiandetailsMap',pandiandetailsMap);
            data.put('reSet',reSet);
            data.put('consumableorderdetailsRecordsview',JSON.serialize(consumableorderdetailsRecordsview));
            System.debug('=====>consumableorderdetailsRecordsview'+consumableorderdetailsRecordsview);
            data.put('codPageRecords', JSON.serialize(codPageRecords));
            data.put('consumableorderdetailsRecords', JSON.serialize(consumableorderdetailsRecords));
            data.put('consumableorderdetailsRecordsview', JSON.serialize(consumableorderdetailsRecordsview));
            data.put('pandiandetailsMap', pandiandetailsMap);
            System.debug('iSinventory===>' + iSinventory);
            System.debug('codPageRecords===>' + codPageRecords);
            data.put('iSinventory', JSON.serialize(iSinventory));
            data.put('reSet1', reSet1);
            System.debug('reSet1===>' + reSet1);
            res.code = 200;
            res.status = 'Sucess';
            res.status = 'Success1';
            return res;
        }
        //CHAN-B7J4NB 只有一个时,盘点不到
        //init();
        //CHAN-B7J4NB
        Map<String, String> showproductIdMap = new Map<String, String>();
        for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
            showproductIdMap.put(ass.prod.Id + ass.boxPiece, ass.prod.Id + ass.boxPiece);
        }
        // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCodeListP' + BarCodeListP));
        /***************************************************************************/
        // BarCode的检索  所有在库
        reSet = [
            SELECT Id, Consumable_Product__c, Consumable_Product__r.Name__c, Box_Piece__c, Bar_Code_search__c, Isoverdue__c
            FROM Consumable_order_details2__c
            WHERE
                Bar_Code_search__c IN :BarCodeListP
                AND Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Cancellation_Date__c = NULL
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ];
        System.debug('reSet===>' + reSet);
        Map<String, Integer> pandianProdIdCountMap = new Map<String, Integer>(); // ProdId 単位
        // 20200509 add gzw 记录需要销存数量
        Map<String, Integer> pandianoverdueCountMap = new Map<String, Integer>(); // ProdId 単位
        // 20200509 add gzw 记录需要销存数量
        Map<String, ConsumableorderdetailsInfo> barCodeListPandianMap = new Map<String, ConsumableorderdetailsInfo>(); // 明細バーコード 単位
        //盘点到的明细
        for (Consumable_order_details2__c rs : reSet) {
            //BarCodeListPandian.add(rs.Bar_Code_search__c);
            for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
                if (rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece) {
                    ass.check = true;
                }
            }
            barCodeListPandianMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs));
            if (rs.Isoverdue__c == 0) {
                consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs, '该产品已经过有效期,请销存。'));
                pandiandetailsMap.put(rs.Id, '该产品已经过有效期,请销存。');
                if (pandianoverdueCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) {
                    pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1);
                } else {
                    pandianoverdueCountMap.put(
                        rs.Consumable_Product__c + rs.Box_Piece__c,
                        pandianoverdueCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1
                    );
                }
                continue;
            }
            if (pandianProdIdCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) {
                pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1);
            } else {
                pandianProdIdCountMap.put(
                    rs.Consumable_Product__c + rs.Box_Piece__c,
                    pandianProdIdCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1
                );
            }
        }
        // 经销商之间或者同一经销商不同工作地调货
        List<Consumable_order_details2__c> reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Dealer_Shipment__c,
                Dealer_Saled__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                Dealer_Arrive__c,
                Bar_Code_search__c,
                Dealer_Info_text__c
            FROM Consumable_order_details2__c
            WHERE
                (Dealer_Arrive__c = TRUE
                OR Dealer_Shipment__c = TRUE
                OR Dealer_Saled__c = TRUE)
                AND Dealer_Returned__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code_search__c IN :BarCodeListP
                AND (Dealer_Info_text__c != :accountName
                OR (Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c != :userWorkLocation))
            ORDER BY Name
        ];
        Map<String, Consumable_order_details2__c> otherAgProMap = new Map<String, Consumable_order_details2__c>();
        for (Consumable_order_details2__c cod2 : reSet1) {
            otherAgProMap.put(cod2.Bar_Code__c, cod2);
        }
        // 需要入库的产品
        for (Consumable_order_details2__c cod2 : reSet1) {
            for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
                if (cod2.Consumable_Product__c == ass.Prod.Id && cod2.Box_Piece__c == ass.boxPiece) {
                    ass.check = true;
                }
            }
            if (!showproductIdMap.containsKey(cod2.Consumable_product__c + cod2.Box_Piece__c)) {
                reFindProductList.add(cod2);
                proIdNotinpage.put(cod2.Consumable_Product__c, cod2.Box_Piece__c);
            }
            if (
                !barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) &&
                otherAgProMap.containsKey(cod2.Bar_Code__c) &&
                (otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == true ||
                otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == true)
            ) {
                consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2, '无此产品的库存,请入库。'));
                pandiandetailsMap.put(cod2.Id, '无此产品的库存,请入库。');
            }
        }
        //寻回明细
        List<Consumable_order_details2__c> productAdjust = new List<Consumable_order_details2__c>();
        productAdjust = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Lose_reason__c,
                Asset_Model_No__c,
                Box_Piece__c,
                Bar_Code_search__c,
                Isoverdue__c
            FROM Consumable_order_details2__c
            WHERE
                Bar_Code_search__c IN :BarCodeListP
                AND Bar_Code__c != NULL
                AND Lose_Flag__c = TRUE
                AND Product_Type__c LIKE :sqlagencyProType
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
            ORDER BY Name
        ];
        for (Consumable_order_details2__c rs : productAdjust) {
            // 过期库存销存 20200427 gzw add srart
            if (rs.Isoverdue__c == 0 || rs.Lose_reason__c == '过期库存销存') {
                consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs, '过期或者销存产品,无法寻回入库'));
                pandiandetailsMap.put(rs.Id, '过期或者销存产品,无法寻回入库');
                carCodeListLose.add(rs.Bar_Code_search__c);
                continue;
            }
            // 过期库存销存 20200427 gzw add end
            for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
                if (rs.Consumable_Product__c == ass.Prod.Id && rs.Box_Piece__c == ass.boxPiece) {
                    ass.check = true;
                }
            }
            if (!showproductIdMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c)) {
                reFindProductList.add(rs);
                proIdNotinpage.put(rs.Consumable_Product__c, rs.Box_Piece__c);
            }
            if (barCodeListAdjustMap.containsKey(rs.Bar_Code_search__c)) {
                continue;
            } else {
                barCodeListAdjustMap.put(rs.Bar_Code_search__c, new ConsumableorderdetailsInfo(rs));
                consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(rs, '寻回'));
                pandiandetailsMap.put(rs.Id, '寻回');
                consumableorderdetailsRecordsAdjust.add(new ConsumableorderdetailsInfo(rs));
            }
        }
        if (reFindProductList.size() > 0) {
            Map<String, Product2__c> midMap = new Map<String, Product2__c>();
            List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
            Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
            Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
            List<Product2__c> product_Refind = [
                SELECT Id, Name, Name__c, SFDA_Status__c, Packing_list_manual__c, Asset_Model_No__c
                FROM Product2__c
                WHERE Id IN :proIdNotinpage.keySet()
            ];
            for (Product2__c pro : product_Refind) {
                midMap.put(pro.Id, pro);
            }
            for (Integer i = 0; i < reFindProductList.size(); i++) {
                //然后循环CountDel做Box和piece2个map
                if (MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '盒') {
                    if (newMidBoxMap.containsKey(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c)) {
                        ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
                                reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c
                            )
                            .clone();
                        Jstage.countid = 0;
                        if (reFindProductList[i].Isoverdue__c == 1) {
                            Jstage.limitCount = 0;
                        }
                        Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
                        newMidBoxMap.put(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c, Jstage);
                    } else {
                        ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
                            MidMap.get(reFindProductList[i].Consumable_Product__c)
                        );
                        Jstage.countid = 0;
                        if (reFindProductList[i].Isoverdue__c == 1) {
                            Jstage.limitCount = 0;
                        }
                        Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
                        newMidBoxMap.put(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c, Jstage);
                    }
                } else if (MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '个') {
                    if (newMidPieceMap.containsKey(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c)) {
                        ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
                                reFindProductList[i].Consumable_product__c + reFindProductList[i].Box_Piece__c
                            )
                            .clone();
                        Jstage.countid = 0;
                        if (reFindProductList[i].Isoverdue__c == 1) {
                            Jstage.limitCount = 0;
                        }
                        Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
                        newMidPieceMap.put(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c, Jstage);
                    } else {
                        ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
                            MidMap.get(reFindProductList[i].Consumable_Product__c)
                        );
                        Jstage.countid = 0;
                        if (reFindProductList[i].Isoverdue__c == 1) {
                            Jstage.limitCount = 0;
                        }
                        Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
                        newMidPieceMap.put(reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c, Jstage);
                    }
                }
            }
            for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) {
                bss.check = true;
                bss.overlimitCount = bss.countid - bss.limitCount;
                boxRecords.add(bss);
            }
            boxRecords.sort();
            for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
                bss.check = true;
                bss.overlimitCount = bss.countid - bss.limitCount;
            }
            for (ConsumableorderdetailsInfo bss : boxRecords) {
                consumableorderdetailsRecords.add(bss);
                if (newMidPieceMap.containsKey(bss.Prod.Id + '个')) {
                    consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个'));
                    //newMidPieceMap移除已经添加的Piece
                    newMidPieceMap.remove(bss.Prod.Id + '个');
                }
            }
            for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
                consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个'));
            }
        }
        //先取出未盘点到的产品
        for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
            if (ass.check == true) {
                for (integer i = 0; i < ProductCount_Res.size(); i++) {
                    if (ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c) {
                        if (barCodeListPandianMap.get(ProductCount_Res[i].Bar_Code_search__c) != null) {
                            continue;
                        } else {
                            carCodeListLose.add(ProductCount_Res[i].Bar_Code__c);
                            ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i]));
                            //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失'));
                            //pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失');
                        }
                    }
                }
            }
        }
        //已经出库的产品
        List<Consumable_order_details2__c> reSet2 = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                Bar_Code_search__c,
                Dealer_Info_text__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND (Dealer_Shipment__c = TRUE
                OR Dealer_Saled__c = TRUE)
                AND Dealer_Returned__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code_search__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ];
        Map<String, Consumable_order_details2__c> needreturnMap = new Map<String, Consumable_order_details2__c>();
        for (Consumable_order_details2__c cod2 : reSet2) {
            needreturnMap.put(cod2.Bar_Code__c, cod2);
        }
        //// 经销商之间或者同一经销商不同工作地调货
        //List<Consumable_order_details2__c> reSet1 = [SELECT Id,  Name,Consumable_Product__c,
        //                Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c,
        //                Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c,
        //                Bar_Code_search__c,Dealer_Info_text__c
        //            FROM Consumable_order_details2__c
        //            WHERE (Dealer_Arrive__c = TRUE
        //            or  Dealer_Shipment__c= TRUE
        //            or  Dealer_Saled__c = TRUE)
        //            AND  Dealer_Returned__c = FALSE
        //            AND  Cancellation_Flag__c = FALSE
        //            AND  Bar_Code_search__c in :BarCodeListP
        //            AND (Dealer_Info_text__c != :accountName
        //                OR (Dealer_Info_text__c = :accountName
        //                    AND Arrive_Owner_Work_Location__c != :userWorkLocation)
        //            )
        //            ORDER BY Name ];
        //Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>();
        //for(Consumable_order_details2__c cod2 :reSet1){
        //    otherAgProMap.put(cod2.Bar_Code__c,cod2);
        //}
        carCodeListLose.clear();
        //未盘点到的产品
        for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
            if (ass.check == true) {
                for (integer i = 0; i < ProductCount_Res.size(); i++) {
                    if (ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c) {
                        if (barCodeListPandianMap.containsKey(ProductCount_Res[i].Bar_Code_search__c)) {
                            continue;
                        }
                        if (ProductCount_Res[i].Isoverdue__c == 0) {
                            consumableorderdetailsRecordserrordummy.add(
                                new ConsumableorderdetailsInfo(ProductCount_Res[i], '该产品已经过有效期,请销存。')
                            );
                            pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品已经过有效期,请销存。');
                            if (
                                pandianoverdueCountMap.containsKey(
                                    ProductCount_Res[i].Consumable_product__c + ProductCount_Res[i].Box_Piece__c
                                ) == false
                            ) {
                                pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, 1);
                            } else {
                                pandianoverdueCountMap.put(
                                    ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c,
                                    pandianoverdueCountMap.get(
                                        ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c
                                    ) + 1
                                );
                            }
                            continue;
                        }
                        consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i], '丢失'));
                        pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失');
                    }
                }
                // 同时存在其他经销商库存产品
                for (Consumable_order_details2__c cod2 : reSet1) {
                    if (cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c) {
                        if (
                            barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) &&
                            otherAgProMap.containsKey(cod2.Bar_Code__c) &&
                            otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == false &&
                            otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == false
                        ) {
                            consumableorderdetailsRecordserrordummy.add(
                                new ConsumableorderdetailsInfo(
                                    cod2,
                                    '该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。'
                                )
                            );
                            pandiandetailsMap.put(
                                cod2.Id,
                                '该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。'
                            );
                            continue;
                        }
                    }
                }
                // 需要返品的产品
                for (Consumable_order_details2__c cod2 : reSet2) {
                    if (cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c) {
                        if (needreturnMap.containsKey(cod2.Bar_Code__c)) {
                            consumableorderdetailsRecordserrordummy.add(
                                new ConsumableorderdetailsInfo(cod2, '该产品目前出库状态,请返品。')
                            );
                            pandiandetailsMap.put(cod2.Id, '该产品目前出库状态,请返品。');
                            continue;
                        }
                    }
                }
            }
        }
        //更新主明细单
        if (barCodeListPandianMap.size() > 0) {
            for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
                if (ass.check == true) {
                    integer countSum = 0;
                    if (pandianProdIdCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
                        countSum = pandianProdIdCountMap.get(ass.Prod.Id + ass.boxPiece);
                    }
                    integer overdueSum = 0;
                    if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
                        overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece);
                    }
                    ass.Pandian = countSum;
                    ass.Diff = ass.countid - countSum - overdueSum;
                    ass.refind = 0;
                }
            }
        } else {
            for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
                if (ass.check == true) {
                    integer overdueSum = 0;
                    if (pandianoverdueCountMap.containsKey(ass.Prod.Id + ass.boxPiece)) {
                        overdueSum = pandianoverdueCountMap.get(ass.Prod.Id + ass.boxPiece);
                    }
                    ass.Diff = ass.countid - ass.Pandian - overdueSum;
                }
            }
        }
        //寻回做成
        for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
            for (ConsumableorderdetailsInfo adjust : consumableorderdetailsRecordsAdjust) {
                if (ass.Prod.Name__c == adjust.Prod.Name__c && ass.boxPiece == adjust.orderdetails2.Box_Piece__c) {
                    if (reFindProduct.containsKey(adjust.orderdetails2.Bar_Code_search__c)) {
                        continue;
                    } else {
                        ass.Pandian++;
                        ass.refind++;
                        reFindProduct.put(adjust.orderdetails2.Bar_Code_search__c, adjust.orderdetails2.Bar_Code_search__c);
                    }
                }
            }
        }
        if (pandiandetailsMap.keySet().size() > 0) {
            List<Consumable_order_details2__c> showcod2 = [
                SELECT
                    Id,
                    Name,
                    Consumable_Product__c,
                    Bar_Code__c,
                    Consumable_Product__r.Name__c,
                    Asset_Model_No__c,
                    Isoverdue__c,
                    Box_Piece__c,
                    Bar_Code_search__c
                FROM Consumable_order_details2__c
                WHERE Id IN :pandiandetailsMap.keySet()
                ORDER BY Name
            ];
            initStandardController();
            showcod2nid = cod2s();
        }
        for (Consumable_order_details2__c cod2 : showcod2nid) {
            codPageRecords.add(new ConsumableorderdetailsInfo(cod2, pandiandetailsMap.get(cod2.Id)));
        }
        if (codPageRecords.size() > 0)
            done = true;
        iSinventory = true;
        consumableorderdetailsRecordserrordummy.clear();
        pandiandetailsList = [
            SELECT Id, Bar_Code__c, Consumable_Product__r.Name__c, Box_Piece__c, Lose_reason__c
            FROM Consumable_order_details2__c
            WHERE Id IN :pandiandetailsMap.keySet()
            ORDER BY Name
        ];
        for (Consumable_order_details2__c codDet : pandiandetailsList) {
            codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id);
        }
        List<Consumable_order_details2__c> pandiandetailsListMid = new List<Consumable_order_details2__c>();
        for (Consumable_order_details2__c cod2 : pandiandetailsList) {
            pandiandetailsListMid.add(cod2);
            if (pandiandetailsListMid.size() == 1000) {
                pandiandetailsListShow.add(pandiandetailsListMid);
                pandiandetailsListMid = new List<Consumable_order_details2__c>();
            }
        }
        if (pandiandetailsListMid.size() > 0) {
            pandiandetailsListShow.add(pandiandetailsListMid);
        }
        //分页
        PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
        totalCount = codPageRecords.size();
        paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
        paginatedAccounts.recordStart = pageToken + 1;
        paginatedAccounts.pageNumber = pageToken / pageSize + 1;
        Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
        paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
        paginatedAccounts.totalRecords = totalCount;
        Integer startIdx;
        Integer endIdx;
        List<ConsumableorderdetailsInfo> pageCodeRecords = new List<ConsumableorderdetailsInfo>();
        startIdx = pageToken;
        endIdx = startIdx + pageSize;
        if (endIdx > codPageRecords.size()) {
            endIdx = codPageRecords.size();
        }
        for (Integer i = startIdx; i < endIdx; i++) {
            pageCodeRecords.add(codPageRecords.get(i));
        }
        data.put('paginatedAccounts', paginatedAccounts);
        data.put('pageCodeRecords', pageCodeRecords);
        //end
        System.debug('=====>codPageRecords2' + codPageRecords);
        System.debug('=====>consumableorderdetailsRecords' + consumableorderdetailsRecords);
        data.put('codPageRecords', JSON.serialize(codPageRecords));
        data.put('consumableorderdetailsRecords', JSON.serialize(consumableorderdetailsRecords));
        System.debug('iSinventory===>' + iSinventory);
        data.put('iSinventory', JSON.serialize(iSinventory));
        System.debug('pandiandetailsMap===>' + pandiandetailsMap);
        data.put('pandiandetailsMap', pandiandetailsMap);
        data.put('reSet', reSet);
        data.put('consumableorderdetailsRecordsview', JSON.serialize(consumableorderdetailsRecordsview));
        System.debug('=====>consumableorderdetailsRecordsview' + consumableorderdetailsRecordsview);
        res.code = 200;
        res.status = 'Sucess';
        return res;
    }
    // 保存按钮
    @AuraEnabled
    public static ResponseBodyLWC save(Boolean iSinventory,String consumableorderdetailsRecordsLWC,String accountid,String agencyProType,Map<Id,String> pandiandetailsMap,List<Consumable_order_details2__c> reSet) {
        List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class);
    public static ResponseBodyLWC save(
        Boolean iSinventory,
        String consumableorderdetailsRecordsLWC,
        String accountid,
        String agencyProType,
        Map<Id, String> pandiandetailsMap,
        List<Consumable_order_details2__c> reSet
    ) {
        List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
            consumableorderdetailsRecordsLWC,
            List<ConsumableorderdetailsInfo>.class
        );
        agencyProType = agencyProType;
        accountid =accountid;
        accountid = accountid;
        pandiandetailsMap = pandiandetailsMap;
        reSet =reSet;
        System.debug('pandiandetailsMap===>'+pandiandetailsMap);
        reSet = reSet;
        System.debug('pandiandetailsMap===>' + pandiandetailsMap);
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        // 跳过明细2不必要更新
        StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
        if(!iSinventory){
            return new ResponseBodyLWC('Error',500, '请先录入BarCode', '');
        if (!iSinventory) {
            return new ResponseBodyLWC('Error', 500, '请先录入BarCode', '');
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请先点【BarCode录入】'));
            // return null;
        }
        integer Lo = 0;
        for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){
            if(header.check==true){
        for (ConsumableorderdetailsInfo header : consumableorderdetailsRecords) {
            if (header.check == true) {
                Lo++;
            }
        }
        if(Lo == 0){
        if (Lo == 0) {
            iSinventory = false;
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请选择要盘点的明细'));
            // return null;
            return new ResponseBodyLWC('Error',500, '请选择要盘点的明细', '');
            return new ResponseBodyLWC('Error', 500, '请选择要盘点的明细', '');
        }
        for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){
            if(header.check==true){
        for (ConsumableorderdetailsInfo header : consumableorderdetailsRecords) {
            if (header.check == true) {
                //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + '  '+header.prod.Name__c));
                //return null;
                if((header.DiffReason == ''||header.DiffReason ==null)&&header.Diff>0){
                    return new ResponseBodyLWC('Error',500, header.prod.Name__c + '请输入差异原因', '');
                if ((header.DiffReason == '' || header.DiffReason == null) && header.Diff > 0) {
                    return new ResponseBodyLWC('Error', 500, header.prod.Name__c + '请输入差异原因', '');
                    // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, header.prod.Name__c + '请输入差异原因'));
                    // return null;
                }else if ((header.DiffReason != ''&&header.DiffReason !=null)&&header.Diff==0){
                } else if ((header.DiffReason != '' && header.DiffReason != null) && header.Diff == 0) {
                    // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '无丢失产品,不需要填写差异原因'));
                    // return null;
                    return new ResponseBodyLWC('Error',500, header.prod.Name__c + '无丢失产品,不需要填写差异原因', '');
                    return new ResponseBodyLWC('Error', 500, header.prod.Name__c + '无丢失产品,不需要填写差异原因', '');
                }
            }
        }
        Integer orderDetNo = 1;
        Savepoint sp = Database.setSavepoint();
        Consumable_order__c Po = new Consumable_order__c();
        Po.Name ='*';
        Po.Name = '*';
        Po.Order_status__c = '批准';
        Po.Inventory_date__c = Date.today();
        Po.Order_type__c = '盘点';
        Po.Dealer_Info__c = accountid;
        Po.Order_ProType__c = agencyProType;
        Po.RecordTypeid = System.Label.RT_ConOrder_Inventory;
        try{
            insert  Po;
        try {
            insert Po;
            eSetId = Po.id;
            List<Consumable_order__c> Consumable_order = [SELECT Name FROM Consumable_order__c WHERE id =:Po.id];
            List<Consumable_orderdetails__c> InsList = New List<Consumable_orderdetails__c>();
            List<Consumable_order_details2__c> InsListUp = New List<Consumable_order_details2__c>();
            List<Consumable_order_details2__c> updListAdjust = New List<Consumable_order_details2__c>();
            Map<String,String> ErrorName = new Map<String,String>();
            Map<String,Boolean> CheckTF = new Map<String,Boolean>();
            for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){
                if(header.check==true){
            List<Consumable_order__c> Consumable_order = [SELECT Name FROM Consumable_order__c WHERE id = :Po.id];
            List<Consumable_orderdetails__c> InsList = new List<Consumable_orderdetails__c>();
            List<Consumable_order_details2__c> InsListUp = new List<Consumable_order_details2__c>();
            List<Consumable_order_details2__c> updListAdjust = new List<Consumable_order_details2__c>();
            Map<String, String> ErrorName = new Map<String, String>();
            Map<String, Boolean> CheckTF = new Map<String, Boolean>();
            for (ConsumableorderdetailsInfo header : consumableorderdetailsRecords) {
                if (header.check == true) {
                    Consumable_orderdetails__c insPan = new Consumable_orderdetails__c();
                    insPan = new Consumable_orderdetails__c();
                    String str = string.valueOf(orderDetNo);
                    if(str.length() == 1){
                    str = '0' + str;
                    if (str.length() == 1) {
                        str = '0' + str;
                    }
                    insPan.Name = Consumable_order[0].Name + '-'+ str;
                    insPan.Name = Consumable_order[0].Name + '-' + str;
                    insPan.Consumable_Product__c = header.ProdId;
                    ErrorName.put(insPan.Consumable_Product__c,header.DiffReason);
                    CheckTF.put(insPan.Consumable_product__c,true);
                    ErrorName.put(insPan.Consumable_Product__c, header.DiffReason);
                    CheckTF.put(insPan.Consumable_product__c, true);
                    insPan.Consumable_order__c = Po.Id;
                    insPan.Lose_reason__c = header.DiffReason;
                    insPan.Diff__c = header.Diff;
@@ -1109,60 +1305,67 @@
                    insPan.inventory_sum__c = header.Pandian;
                    insPan.Count_Sum__c = header.countid;
                    insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
                    orderDetNo ++;
                    orderDetNo++;
                    InsList.add(insPan);
                }
            }
            if(InsList.size()>0){
            if (InsList.size() > 0) {
                insert InsList;
            }
            List<Consumable_order_details2__c> showcod2 = [select Id,  Name,Consumable_Product__c,
                                Bar_Code__c,Consumable_Product__r.Name__c,
                                Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                                Bar_Code_search__c
                            FROM Consumable_order_details2__c
                            WHERE Id in :pandiandetailsMap.keySet()
                            order by Name];
            for(Consumable_order_details2__c cod : showcod2){
            List<Consumable_order_details2__c> showcod2 = [
                SELECT
                    Id,
                    Name,
                    Consumable_Product__c,
                    Bar_Code__c,
                    Consumable_Product__r.Name__c,
                    Asset_Model_No__c,
                    Isoverdue__c,
                    Box_Piece__c,
                    Bar_Code_search__c
                FROM Consumable_order_details2__c
                WHERE Id IN :pandiandetailsMap.keySet()
                ORDER BY Name
            ];
            for (Consumable_order_details2__c cod : showcod2) {
                Consumable_order_details2__c InsDetail = new Consumable_order_details2__c();
                InsDetail.Id =cod.Id;
                InsDetail.Id = cod.Id;
                InsDetail.Consumable_Inventory_order__c = po.Id;
                InsDetail.Inventory_date__c = Date.today();
                // 20210224 gzw CHAN-BXF3PG start
                // if(pandiandetailsMap.get(cod.Id) == '丢失' ){
                if(pandiandetailsMap.get(cod.Id) == '丢失' && CheckTF.containsKey(cod.Consumable_product__c)){
                // 20210224 gzw CHAN-BXF3PG end
                if (pandiandetailsMap.get(cod.Id) == '丢失' && CheckTF.containsKey(cod.Consumable_product__c)) {
                    // 20210224 gzw CHAN-BXF3PG end
                    InsDetail.Lose_reason__c = ErrorName.get(cod.Consumable_product__c);
                    InsDetail.Lose_Flag__c = true;
                }else if(pandiandetailsMap.get(cod.Id) == '寻回' ){
                } else if (pandiandetailsMap.get(cod.Id) == '寻回') {
                    InsDetail.Lose_reason__c = '';
                    InsDetail.Lose_Flag__c = false;
                }else{
                } else {
                    continue;
                }
                InsListUp.add(InsDetail);
            }
            for(Consumable_order_details2__c rs : reSet){
            for (Consumable_order_details2__c rs : reSet) {
                rs.Inventory_date__c = Date.today();
            }
            if(reSet.size() > 0){
            if (reSet.size() > 0) {
                update reSet;
            }
            if(InsListUp.size()>0){
                ControllerUtil.updateOrderDetailsSatus(InsListUp);// Commented By DTT - Li Jun for testing 20230407
            if (InsListUp.size() > 0) {
                ControllerUtil.updateOrderDetailsSatus(InsListUp); // Commented By DTT - Li Jun for testing 20230407
            }
        }catch (Exception e) {
        } catch (Exception e) {
            Database.rollback(sp);
            // ApexPages.addMessages(ex);
            return new ResponseBodyLWC('Error',500, e.getMessage()+e.getLineNumber(), '');
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
            // return null;
        }
        // FIXME impliment BarCodeListAdjust
        /************************************************************************************************/
        // return ProS();
        data.put('eSetId',eSetId);
        data.put('InsListUp',InsListUp);
        data.put('eSetId', eSetId);
        data.put('InsListUp', InsListUp);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
@@ -1174,15 +1377,15 @@
        // 返回盘点一览
        PageReference ref = new Pagereference('/apex/InventoryList?eSetId=' + eSetId);
        ref.setRedirect(true);
        return ref;
        return ref;
    }
    //CSV出力
    public PageReference doClick() {
        Pagereference pr = page.InventoryCSV;
        return pr;
    }
      //分页Bean
      public class PaginatedAccounts {
    //分页Bean
    public class PaginatedAccounts {
        @AuraEnabled
        public Integer nextPageToken;
        @AuraEnabled
@@ -1196,6 +1399,7 @@
    }
    // Data Bean
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -1208,7 +1412,7 @@
        @AuraEnabled
        public Decimal countid { get; set; }
        @AuraEnabled
        public String ProdId{get;set;}
        public String ProdId { get; set; }
        @AuraEnabled
        public Decimal Pandian { get; set; }
        @AuraEnabled
@@ -1227,14 +1431,13 @@
        public Decimal overlimitCount { get; set; }
        @AuraEnabled
        public String boxPiece { get; set; }
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) {
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) {
            orderdetails2 = e;
            Prod = e.Consumable_Product__r;
            //e.Lose_reason__c = str;
            DiffReason = str;
        }
        // 已存在消耗品明细用
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
            check = false;
@@ -1246,9 +1449,9 @@
            check = false;
            //orderdetails1 = new Consumable_orderdetails__c();
            Prod = e;
            canSelect = true;
            canSelect = true;
            ProdId = string.valueOf(e.id);
            countid =0;
            countid = 0;
            Pandian = 0;
            refind = 0;
            Diff = 0;
@@ -1257,11 +1460,11 @@
        }
        // 排序
        public Integer compareTo(Object compareTo) {
            ConsumableorderdetailsInfo compareToesd =(ConsumableorderdetailsInfo)compareTo;
            ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo;
            Integer returnValue = 0;
            if (countid  > compareToesd.countid ) {
            if (countid > compareToesd.countid) {
                returnValue = -1;
            } else if (countid  < compareToesd.countid ) {
            } else if (countid < compareToesd.countid) {
                returnValue = 1;
            }
            return returnValue;
force-app/main/default/classes/LexInventoryListController.cls
@@ -1,7 +1,7 @@
public without sharing class LexInventoryListController {
    /*****************検索用******************/
    public static Consumable_order__c coc { get; set; }
    public static String baseUrl {get;private set;}
    public static String baseUrl { get; private set; }
    /*****************画面表示Bean******************/
    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; }
    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsError { get; set; }
@@ -22,7 +22,7 @@
    // 画面初始化
    @AuraEnabled
    public static ResponseBodyLWC init(String eSetId) {
        system.debug('eSetId====>'+eSetId);
        system.debug('eSetId====>' + eSetId);
        ESetId = eSetId;
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
@@ -31,49 +31,70 @@
        coc = new Consumable_order__c();
        consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
        List<Consumable_order__c> qs = New List<Consumable_order__c>();
        qs = [select Name,Inventory_date__c,Order_date__c From Consumable_order__c Where Id =:ESetId];
        System.debug('qs===>'+qs);
        if (qs.size()>0){
        List<Consumable_order__c> qs = new List<Consumable_order__c>();
        qs = [SELECT Name, Inventory_date__c, Order_date__c FROM Consumable_order__c WHERE Id = :ESetId];
        System.debug('qs===>' + qs);
        if (qs.size() > 0) {
            coc = qs[0];
        }
        // 選択済みの明细を取得
        consumableorderdetailsSelected = [
            select Id, Name, Consumable_Product__c,
                Consumable_Product__r.Name, Sterilization_limit__c,
                Deliver_date__c,Consumable_Product__r.Name__c,
                Consumable_Product__r.Intra_Trade_List_RMB__c,Bar_Code__c,
                Consumable_Product__r.Asset_Model_No__c,Lose_Flag__c,
                recordtypeid,Lose_reason__c
            from Consumable_order_details2__c
            where  Consumable_Inventory_order__c = :ESetId
            order by Name ];
        System.debug('consumableorderdetailsSelected==>'+consumableorderdetailsSelected);
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Consumable_Product__r.Name__c,
                Consumable_Product__r.Intra_Trade_List_RMB__c,
                Bar_Code__c,
                Consumable_Product__r.Asset_Model_No__c,
                Lose_Flag__c,
                recordtypeid,
                Lose_reason__c
            FROM Consumable_order_details2__c
            WHERE Consumable_Inventory_order__c = :ESetId
            ORDER BY Name
        ];
        System.debug('consumableorderdetailsSelected==>' + consumableorderdetailsSelected);
        for (Integer i = 0; i < consumableorderdetailsSelected.size(); i++) {
            consumableorderdetailsRecordsError.add(new ConsumableorderdetailsInfo(consumableorderdetailsSelected[i]));
        }
        consumableorderdetails1 = [
            select Id, Name,Diff__c,inventory_sum__c,
                Count_Sum__c,Consumable_order__c,
                Consumable_Product__c,Consumable_Product__r.Name,Consumable_Count__c,
            SELECT
                Id,
                Name,
                Diff__c,
                inventory_sum__c,
                Count_Sum__c,
                Consumable_order__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Consumable_Count__c,
                Consumable_Product__r.Intra_Trade_List_RMB__c,
                Consumable_Product__r.Asset_Model_No__c,Consumable_Product__r.Name__c,
                Sum_of_money__c,recordtypeid,Lose_reason__c,Product_Refind__c
            from Consumable_orderdetails__c
            where  Consumable_order__c = :ESetId
            order by Name ];
                Consumable_Product__r.Asset_Model_No__c,
                Consumable_Product__r.Name__c,
                Sum_of_money__c,
                recordtypeid,
                Lose_reason__c,
                Product_Refind__c
            FROM Consumable_orderdetails__c
            WHERE Consumable_order__c = :ESetId
            ORDER BY Name
        ];
        for (Integer i = 0; i < consumableorderdetails1.size(); i++) {
            consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i]));
        }
        data.put('qs',qs);
        System.debug('consumableorderdetailsRecords====>'+consumableorderdetailsRecords);
        data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords));
        data.put('ConsumableorderdetailsRecordsError',JSON.serialize(ConsumableorderdetailsRecordsError));
        data.put('qs', qs);
        System.debug('consumableorderdetailsRecords====>' + consumableorderdetailsRecords);
        data.put('consumableorderdetailsRecords', JSON.serialize(consumableorderdetailsRecords));
        data.put('ConsumableorderdetailsRecordsError', JSON.serialize(ConsumableorderdetailsRecordsError));
        // if(ConsumableorderdetailsRecordsError.size()!=null){
        //     data.put('ConsumableorderdetailsRecordsError',JSON.serialize(ConsumableorderdetailsRecordsError));
        // }
        System.debug('ConsumableorderdetailsRecordsError====>'+ConsumableorderdetailsRecordsError);
        System.debug('ConsumableorderdetailsRecordsError====>' + ConsumableorderdetailsRecordsError);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
force-app/main/default/classes/LexInventoryViewController.cls
@@ -32,7 +32,7 @@
    // };
    public static String[] proLimitAndDate = new List<String>{};
    private static Map<String, Date> productkucun = new Map<String, Date>();
    public static Map<String, Date> productkucun = new Map<String, Date>();
    public static List<SelectOption> categoryOptionList { get; set; }
    @AuraEnabled
    public static Map<String, String> categoryOptionMap { get; set; }
@@ -49,7 +49,7 @@
    public static String category1 { get; set; }
    public static Boolean editAble { get; set; }
    // 经销商在库产品ID
    public static List<String> orderDetZaikuList{set;get;}
    public static List<String> orderDetZaikuList { get; set; }
    // 产品 ID
    public static String ESetId { get; set; }
    public static String idCheck { get; set; }
@@ -99,7 +99,6 @@
        category4OptionMap = new Map<String, String>();
        category5OptionMap = new Map<String, String>();
        // 取用户ID
        String userId = UserInfo.getUserId();
        User useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
@@ -148,7 +147,7 @@
        for (AggregateResult zaikuId : orderDetZaiku) {
            orderDetZaikuList.add(String.valueOf(zaikuId.get('Consumable_Product__c')));
        }
        System.debug('orderDetZaikuListinit = ' + orderDetZaikuList);
        System.debug('orderDetZaikuList = ' + orderDetZaikuList);
        List<Consumable_order_details2__c> CountDel = [
            SELECT
                Id,
@@ -174,7 +173,9 @@
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
        ];
        System.debug('MidMap = ' + MidMap);
        System.debug('CountDel111 = ' + CountDel);
        System.debug('orderDetZaikuList  = ' + orderDetZaikuList);
        List<Product2__c> product2Selected = [
            SELECT
                Id,
@@ -238,9 +239,7 @@
                }
                if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
                    ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
                            CountDel[i].Consumable_Product__c +
                            CountDel[i].Box_Piece__c +
                            tex
                            CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex
                        )
                        .clone();
                    Jstage.allnumber = Jstage.allnumber + 1;
@@ -405,23 +404,25 @@
        data.put('pageRecords', pageRecords);
        data.put('consumableorderdetailsRecords', consumableorderdetailsRecords);
        data.put('hasHos', hasHos);
        data.put('productLimtAndDate',proLimitAndDate);
        data.put('productLimtAndDate', proLimitAndDate);
        data.put('productkucun', productkucun);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        System.debug('productkucun = ' + productkucun);
        return res;
    }
    @AuraEnabled
    public static ResponseBodyLWC categoryAllload(String category3LWC,String agencyProTypeLWC) {
    public static ResponseBodyLWC categoryAllload(String category3LWC, String agencyProTypeLWC) {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        category3 =  category3LWC;
        agencyProType =  '%' + agencyProTypeLWC + '%';
        category3 = category3LWC;
        agencyProType = '%' + agencyProTypeLWC + '%';
        System.debug('category3LWC===>'+category3LWC);
        System.debug('agencyProType===>'+agencyProType);
        System.debug('category3LWC===>' + category3LWC);
        System.debug('agencyProType===>' + agencyProType);
        AggregateResult[] category4List = [
            SELECT Count(id), Category4_text__c c4c
            FROM Product2__c
@@ -465,8 +466,8 @@
            category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
            category5OptionMap.put(deliverycnt5, deliverycnt5);
        }
        System.debug('类别4'+category4OptionList);
        System.debug('类别5'+category5OptionList);
        System.debug('类别4' + category4OptionList);
        System.debug('类别5' + category5OptionList);
        data.put('category4OptionMap', category4OptionMap);
        data.put('category5OptionMap', category5OptionMap);
        res.status = 'Success';
@@ -527,15 +528,19 @@
        Integer pageSizeLWC,
        Integer pageTokenLWC,
        String sortFieldLWC,
        String sortOrderLWC
        String sortOrderLWC,
        Map<String, Date> productkucunLWC
    ) {
        try {
            System.debug('orderDetZaikuListLWC检索===>'+orderDetZaikuListLWC);
            System.debug('orderDetZaikuListLWC===>' + orderDetZaikuListLWC);
            System.debug('productkucun===>' + productkucun);
            pageSize = pageSizeLWC;
            pageToken = pageTokenLWC;
            sortField = sortFieldLWC;
            sortOrder = sortOrderLWC;
            productkucun = new Map<String, Date>();
            orderDetZaikuList = new List<String>();
            productkucun = productkucunLWC;
            orderDetZaikuList = orderDetZaikuListLWC;
            sqlagencyProType = '%' + agencyProType + '%';
@@ -598,7 +603,7 @@
            // if (String.isNotBlank(sortField) && String.isNotBlank(sortOrder)) {
            //     if(sortFieldLWC != 'limitCount'){
            //         soql += ' ORDER BY ' + sortField + ' ' + sortOrder;
            //     }
            // }
            System.debug('soql = ' + soql);
@@ -622,9 +627,7 @@
                    }
                    if (newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
                        ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
                                CountDel[i].Consumable_Product__c +
                                CountDel[i].Box_Piece__c +
                                tex
                                CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex
                            )
                            .clone();
                        Jstage.allnumber = Jstage.allnumber + 1;
@@ -654,9 +657,7 @@
                    }
                    if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
                        ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
                                CountDel[i].Consumable_Product__c +
                                CountDel[i].Box_Piece__c +
                                tex
                                CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex
                            )
                            .clone();
                        Jstage.allnumber = Jstage.allnumber + 1;
@@ -772,11 +773,11 @@
            paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
            paginatedAccounts.totalRecords = totalCount;
            List<ConsumableorderdetailsInfo> pageRecordsCompare = new List<ConsumableorderdetailsInfo>();
            List<ConsumableorderdetailsInfo> pageRecordsCompare = new List<ConsumableorderdetailsInfo>();
            System.debug('queryList = ' + JSON.serialize(queryList));
            for (Integer i = 0; i < queryList.size(); i++) {
                for(ConsumableorderdetailsInfo ci : pageRecords){
                    if(queryList[i].Id == ci.Prod.Id){
                for (ConsumableorderdetailsInfo ci : pageRecords) {
                    if (queryList[i].Id == ci.Prod.Id) {
                        System.debug('queryList[i].Id =' + queryList[i].Id);
                        System.debug('ci.Prod.Id =' + queryList[i].Id);
                        pageRecordsCompare.add(ci);
@@ -930,7 +931,6 @@
    //     }
    //     pageRecords.sort();
    // }
    //检索sql文做成
    private static String makeSoql(String CateName, String CateCode, String Category3, String Category4, String Category5) {
@@ -1083,7 +1083,6 @@
        @AuraEnabled
        public Boolean hospitalSpecialOffer { get; set; }
        @TestVisible
        public ConsumableorderdetailsInfo(Product2__c e) {
            esd = new Consumable_order_details2__c();
            Prod = e;
force-app/main/default/classes/LexLicenceReminderController.cls
@@ -1,41 +1,40 @@
public without sharing class LexLicenceReminderController {
    @AuraEnabled
    public static Results initReminder(){
    public static Results initReminder() {
        Results results = new Results();
        try {
            User useracc = [SELECT AccountId, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()];
            User useracc = [SELECT AccountId, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
            String accountId = useracc.AccountId;
            List<Account> accList = [SELECT Name,Medical_Equipment_Expiration_Date__c FROM Account WHERE Id =:accountId];
            List<Account> accList = [SELECT Name, Medical_Equipment_Expiration_Date__c FROM Account WHERE Id = :accountId];
            Account accountInfo = new Account();
            if(accList.size() == 1){
            if (accList.size() == 1) {
                accountInfo = accList[0];
            }else{
            } else {
                results.result = 'Fail';
                results.isShowReminder = false;
                results.errorMsg = '未获取到经销商信息';
                return results;
            }
            if(accountInfo.Medical_Equipment_Expiration_Date__c != null){
            if (accountInfo.Medical_Equipment_Expiration_Date__c != null) {
                Integer days = LexUtility.getLicenceReminderDays();
                Date today = Date.today();
                // Date today = Date.newInstance(2024, 7, 21);
                Integer numberDaysDue = today.daysBetween(accountInfo.Medical_Equipment_Expiration_Date__c);
                if(numberDaysDue > days){
                if (numberDaysDue > days) {
                    results.isShowReminder = false;
                }else{
                } else {
                    results.isShowReminder = true;
                    results.days = numberDaysDue;
                }
                results.result = 'Success';
            }else {
            } else {
                results.result = 'Fail';
                results.errorMsg = '未获取到医疗器械经营企业许可证有效期限';
            }
        } catch (Exception e) {
            results.result = 'Fail';
            results.isShowReminder = false;
            results.errorMsg = e.getLineNumber()+'---'+e.getMessage();
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
        return results;
    }
force-app/main/default/classes/LexOutboundorderImportController.cls
@@ -50,6 +50,7 @@
        res.status = 'Success';
        res.code = 200;
        res.msg = '';
        System.debug('res:' + res);
        return res;
    }
@@ -102,7 +103,7 @@
                            barcodePieceMap.put(csvRecordData[6], Integer.valueOf(csvRecordData[7]));
                        }
                    }
                    String[] csvRecordDataStr = new List<String>(13);
                    String[] csvRecordDataStr = new String[13];
                    for (Integer j = 0; j < csvRecordData.size(); j++) {
                        csvRecordDataStr[j] = csvRecordData[j];
                    }
@@ -190,8 +191,8 @@
            data.put('saveFLGbln', saveFLGbln);
            data.put('csvRecordStr', csvRecordStr);
            data.put('barcodeList', barcodeList);
            data.put('secondAgencyMap',secondAgencyMap);
            data.put('hospitalSysMap',hospitalSysMap);
            data.put('secondAgencyMap', secondAgencyMap);
            data.put('hospitalSysMap', hospitalSysMap);
            res.status = 'Success';
            res.code = 200;
            res.msg = errorMsg;
@@ -587,7 +588,7 @@
        res.entity = data;
        csvRecordStr = csvRecordStrLwc;
        orderRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(orderRecordsLwc, List<ConsumableorderdetailsInfo>.class);
        orderRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(orderRecordsLwc, List<ConsumableorderdetailsInfo>.class);
        System.debug('orderRecords = ' + orderRecords);
        sqlagencyProType = sqlagencyProTypeLwc;
        userWorkLocation = userWorkLocationLwc;
@@ -753,9 +754,7 @@
                string[] csvRecordData = csvRecordStr[i];
                if (orderdetMap.containsKey(csvRecordData[0] + csvRecordData[12] + csvRecordData[9])) {
                    orderdetMap.put(
                        csvRecordData[0] +
                        csvRecordData[12] +
                        csvRecordData[9],
                        csvRecordData[0] + csvRecordData[12] + csvRecordData[9],
                        orderdetMap.get(csvRecordData[0] + csvRecordData[12] + csvRecordData[9]) + Decimal.valueOf(csvRecordData[7])
                    );
                    continue;
@@ -786,7 +785,7 @@
            // ApexPages.addMessages(e);
            // return null;
            errorMsg += e.getMessage() + ' ' + e.getLineNumber() + ';';
            System.debug('orderdetRecords = null '  + e.getLineNumber());
            System.debug('orderdetRecords = null ' + e.getLineNumber());
            return null;
        }
    }
@@ -864,7 +863,7 @@
            return null;
        }
    }
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Consumable_order__c order { get; set; }
force-app/main/default/classes/LexOverdueStockController.cls
@@ -1,5 +1,4 @@
public with sharing class LexOverdueStockController {
    /*****************検索用******************/
    public static String barcode { get; set; }
@@ -17,19 +16,18 @@
    // 经销商信息
    private static Account accountInfo;
     //判断操作人员是否销存
    //判断操作人员是否销存
    public static Boolean iSinventory = false;
    public static List<Consumable_order_details2__c> overdueList = new List<Consumable_order_details2__c>();
    public static Integer pageRecordsSize  {
    public static Integer pageRecordsSize {
        get {
            return codPageRecords == null ? 0 : codPageRecords.size();
        }
    }
    public LexOverdueStockController() {
    }
    // 画面初始化
@@ -42,103 +40,118 @@
        codPageRecords = new List<orderBean>();
        overduePageRecords = new List<orderBean>();
        // 获取用户和经销商信息
        user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()];
        user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
        userWorkLocation = Useracc.Work_Location__c;
        agencyProType = Useracc.UserPro_Type__c;
        if(String.isBlank(Useracc.UserPro_Type__c)){
        if (String.isBlank(Useracc.UserPro_Type__c)) {
            agencyProType = 'ET';
        }
        sqlagencyProType = '%' + agencyProType + '%';
        accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid];
        accountInfo = [SELECT id, Name, Dealer_discount__c FROM account WHERE id = :Useracc.accountid];
        // 过期库存汇总信息
        List<AggregateResult>  orderDetZaiku = [SELECT count(Id) countsum,
                        Consumable_Product__c prodid,
                        Consumable_Product__r.Name_Text__c prodname,
                        Box_Piece__c boxPiece
                        FROM Consumable_order_details2__c
                        WHERE Dealer_Arrive__c = true
                        AND Dealer_Shipment__c = false
                        AND Dealer_Saled__c = false
                        AND Lose_Flag__c = false
                        AND Isoverdue__c = 0
                        AND Dealer_Returned__c = false
                        AND Cancellation_Flag__c = false
                        AND Bar_Code__c !=null
                        AND Product_Type__c like : sqlagencyProType
                        AND Dealer_Info_text__c = :accountInfo.Name
                        AND Arrive_Owner_Work_Location__c = :userWorkLocation
                        group by Consumable_Product__c,Box_Piece__c,Consumable_Product__r.Name_Text__c];
        List<AggregateResult> orderDetZaiku = [
            SELECT count(Id) countsum, Consumable_Product__c prodid, Consumable_Product__r.Name_Text__c prodname, Box_Piece__c boxPiece
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Isoverdue__c = 0
                AND Dealer_Returned__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                AND Dealer_Info_text__c = :accountInfo.Name
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
            GROUP BY Consumable_Product__c, Box_Piece__c, Consumable_Product__r.Name_Text__c
        ];
        for(AggregateResult overdue : orderDetZaiku){
        for (AggregateResult overdue : orderDetZaiku) {
            codPageRecords.add(new orderBean(overdue));
        }
        system.debug('codPageRecords====>'+codPageRecords);
        data.put('codPageRecords',JSON.serialize(codPageRecords));
        data.put('userWorkLocation',userWorkLocation);
        data.put('accountName',accountInfo.Name);
        data.put('agencyProType',agencyProType);
        data.put('orderDetZaiku',JSON.serialize(orderDetZaiku));
        system.debug('codPageRecords====>' + codPageRecords);
        data.put('codPageRecords', JSON.serialize(codPageRecords));
        data.put('userWorkLocation', userWorkLocation);
        data.put('accountName', accountInfo.Name);
        data.put('agencyProType', agencyProType);
        data.put('orderDetZaiku', JSON.serialize(orderDetZaiku));
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        return res;
    }
    // BarCode录入
    @AuraEnabled
    public static ResponseBodyLWC searchorderBean(String agencyProTypeLWC,String userWorkLocationLWC,String accountNameLWC,String barcodeLWC,String codPageRecordsLWC){
    public static ResponseBodyLWC searchorderBean(
        String agencyProTypeLWC,
        String userWorkLocationLWC,
        String accountNameLWC,
        String barcodeLWC,
        String codPageRecordsLWC
    ) {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        List<orderBean> codPageRecords = (List<orderBean>)JSON.deserialize(codPageRecordsLWC,List<orderBean>.class);
        List<orderBean> codPageRecords = (List<orderBean>) JSON.deserialize(codPageRecordsLWC, List<orderBean>.class);
        sqlagencyProType = '%' + agencyProTypeLWC + '%';
        system.debug('sqlagencyProType==>'+ sqlagencyProType);
        system.debug('sqlagencyProType==>' + sqlagencyProType);
        barcode = barcodeLWC;
        system.debug('barcode==>'+ barcode);
        system.debug('barcode==>' + barcode);
        userWorkLocation = userWorkLocationLWC;
        // add by Wang Xueqin 2023/04/12
        // 获取用户和经销商信息
        user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()];
        accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid];
        user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
        accountInfo = [SELECT id, Name, Dealer_discount__c FROM account WHERE id = :Useracc.accountid];
        iSinventory = true;
        Set<String> barCodeoverdue = new Set<String>();
        overduePageRecords = new List<orderBean>();
        List<String> barCodeListP = ParseBarCode( barcode );
        List<String> barCodeListP = ParseBarCode(barcode);
        // 页面显示数据初始化
        for (orderBean codPage : codPageRecords) {
            codPage.pandian = 0;
        }
        // 查询所有过期库存
        List<Consumable_order_details2__c>  orderDetZaiku = [select Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c,
                            Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Sterilization_limit__c,
                            Bar_Code_search__c
                        FROM Consumable_order_details2__c
                        WHERE Dealer_Arrive__c = true
                        AND Dealer_Shipment__c = false
                        AND Dealer_Saled__c = false
                        AND Lose_Flag__c = false
                        AND Isoverdue__c = 0
                        AND Dealer_Returned__c = false
                        AND Cancellation_Flag__c = false
                        AND Bar_Code__c !=null
                        AND Product_Type__c like : sqlagencyProType
                        AND Dealer_Info_text__c = :accountInfo.Name
                        AND Arrive_Owner_Work_Location__c = :userWorkLocation];
        List<Consumable_order_details2__c> orderDetZaiku = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Dealer_Info_text__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                Sterilization_limit__c,
                Bar_Code_search__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Isoverdue__c = 0
                AND Dealer_Returned__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                AND Dealer_Info_text__c = :accountInfo.Name
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
        ];
        // 没有输入条码时,循环页面,所有打钩产品全部销存
        // 取得所有
        overdueList = new List<Consumable_order_details2__c>();
        if (String.isBlank(barcode)) {
            System.debug('barcode空');
            for(orderBean codPage : codPageRecords){
            for (orderBean codPage : codPageRecords) {
                if (codPage.check) {
                    for(Consumable_order_details2__c cod2 : orderDetZaiku){
                        if(cod2.Consumable_Product__c == codPage.prodid && codPage.boxPiece == cod2.Box_Piece__c){
                            overduePageRecords.add(new orderBean(cod2,'过期库存销存'));
                    for (Consumable_order_details2__c cod2 : orderDetZaiku) {
                        if (cod2.Consumable_Product__c == codPage.prodid && codPage.boxPiece == cod2.Box_Piece__c) {
                            overduePageRecords.add(new orderBean(cod2, '过期库存销存'));
                            overdueList.add(cod2);
                        }
                    }
@@ -148,162 +161,174 @@
            // return;
            System.debug('overduePageRecords = ' + overduePageRecords);
            System.debug('overdueList = ' + overdueList);
        data.put('overduePageRecords',JSON.serialize(overduePageRecords));
        data.put('codPageRecords',JSON.serialize(codPageRecords));
        data.put('iSinventory',iSinventory);
        data.put('overdueList',overdueList);
        res.status = 'Success1';
        res.code = 200;
        // res.msg = '请输入BarCode号';
        System.debug('res = ' + res);
        return res;
            data.put('overduePageRecords', JSON.serialize(overduePageRecords));
            data.put('codPageRecords', JSON.serialize(codPageRecords));
            data.put('iSinventory', iSinventory);
            data.put('overdueList', overdueList);
            res.status = 'Success1';
            res.code = 200;
            // res.msg = '请输入BarCode号';
            System.debug('res = ' + res);
            return res;
        }
        // 输入barcode时
        // BarCode的检索  所有在库
        List<Consumable_order_details2__c> reSet = [select Id,Consumable_Product__c,
                        Consumable_Product__r.Name__c,Box_Piece__c,Bar_Code_search__c,
                        Dealer_Shipment__c,Dealer_Saled__c,Lose_Flag__c,Bar_Code__c,
                        Cancellation_Flag__c,Isoverdue__c,Sterilization_limit__c
                    from Consumable_order_details2__c
                    where Bar_Code_search__c in :BarCodeListP
                    AND Dealer_Arrive__c = true
                    AND Cancellation_Flag__c = false
                    and Dealer_Returned__c = false
                    and Bar_Code__c !=null
                    AND Product_Type__c like : sqlagencyProType
                    AND Arrive_Owner_Work_Location__c =: userWorkLocation
                    AND  Dealer_Info_text__c = :accountInfo.Name
                    order by Name];
                    System.debug('reSet===>'+reSet);
        List<Consumable_order_details2__c> reSet = [
            SELECT
                Id,
                Consumable_Product__c,
                Consumable_Product__r.Name__c,
                Box_Piece__c,
                Bar_Code_search__c,
                Dealer_Shipment__c,
                Dealer_Saled__c,
                Lose_Flag__c,
                Bar_Code__c,
                Cancellation_Flag__c,
                Isoverdue__c,
                Sterilization_limit__c
            FROM Consumable_order_details2__c
            WHERE
                Bar_Code_search__c IN :BarCodeListP
                AND Dealer_Arrive__c = TRUE
                AND Cancellation_Flag__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
                AND Dealer_Info_text__c = :accountInfo.Name
            ORDER BY Name
        ];
        System.debug('reSet===>' + reSet);
        for(Consumable_order_details2__c cod2 : reSet){
            if ((cod2.Dealer_Shipment__c == false &&  cod2.Dealer_Saled__c == false
                && cod2.Lose_Flag__c == false && cod2.Cancellation_Flag__c == false) &&  cod2.Isoverdue__c == 0) {
        for (Consumable_order_details2__c cod2 : reSet) {
            if (
                (cod2.Dealer_Shipment__c == false &&
                cod2.Dealer_Saled__c == false &&
                cod2.Lose_Flag__c == false &&
                cod2.Cancellation_Flag__c == false) && cod2.Isoverdue__c == 0
            ) {
                for (orderBean codPage : codPageRecords) {
                    if(cod2.Consumable_Product__c == codPage.prodid && cod2.Box_Piece__c == codPage.boxPiece){
                        overduePageRecords.add(new orderBean(cod2,'过期库存销存'));
                    if (cod2.Consumable_Product__c == codPage.prodid && cod2.Box_Piece__c == codPage.boxPiece) {
                        overduePageRecords.add(new orderBean(cod2, '过期库存销存'));
                        overdueList.add(cod2);
                        codPage.pandian ++;
                        codPage.pandian++;
                        codPage.check = true;
                    }
                }
            }else if (cod2.Dealer_Shipment__c ||  cod2.Dealer_Saled__c) {
                overduePageRecords.add(new orderBean(cod2,'产品已经出库'));
            }else{
                overduePageRecords.add(new orderBean(cod2,'不是过期库存'));
            } else if (cod2.Dealer_Shipment__c || cod2.Dealer_Saled__c) {
                overduePageRecords.add(new orderBean(cod2, '产品已经出库'));
            } else {
                overduePageRecords.add(new orderBean(cod2, '不是过期库存'));
            }
        }
        System.debug('overduePageRecords = ' + overduePageRecords);
        data.put('overduePageRecords',JSON.serialize(overduePageRecords));
        data.put('codPageRecords',JSON.serialize(codPageRecords));
        data.put('iSinventory',iSinventory);
        data.put('overdueList',overdueList);
        data.put('overduePageRecords', JSON.serialize(overduePageRecords));
        data.put('codPageRecords', JSON.serialize(codPageRecords));
        data.put('iSinventory', iSinventory);
        data.put('overdueList', overdueList);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        return res;
    }
    // 保存按钮
    @AuraEnabled
    public static ResponseBodyLWC save(Boolean iSinventory,string saveCodPageRecords,List<Consumable_order_details2__c> saveoverdueList) {
    public static ResponseBodyLWC save(Boolean iSinventory, string saveCodPageRecords, List<Consumable_order_details2__c> saveoverdueList) {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        system.debug('saveCodPageRecords=============>'+saveCodPageRecords);
        system.debug('saveoverdueList'+saveoverdueList);
        overdueList =  saveoverdueList;
        system.debug('saveCodPageRecords=============>' + saveCodPageRecords);
        system.debug('saveoverdueList' + saveoverdueList);
        overdueList = saveoverdueList;
        // if(saveoverdueList==null){
        //     return new ResponseBodyLWC('Error',500, '请选择要销存的明细', '');
        // }
        List<orderBean> codPageRecords = (List<orderBean>)JSON.deserialize(saveCodPageRecords,List<orderBean>.class);
        List<orderBean> codPageRecords = (List<orderBean>) JSON.deserialize(saveCodPageRecords, List<orderBean>.class);
        // List<Consumable_order_details2__c> overdueList = (List<Consumable_order_details2__c>)JSON.deserialize(saveoverdueList,List<Consumable_order_details2__c>.class);
         // add by Wang Xueqin 2023/04/12
        // add by Wang Xueqin 2023/04/12
        // 获取用户和经销商信息
        user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()];
        accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid];
        user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
        accountInfo = [SELECT id, Name, Dealer_discount__c FROM account WHERE id = :Useracc.accountid];
        // 跳过明细2不必要更新
        StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
        if(!iSinventory){
        if (!iSinventory) {
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请先点【BarCode录入】'));
            return new ResponseBodyLWC('Error',500, '请先录入BarCode', '');
            return new ResponseBodyLWC('Error', 500, '请先录入BarCode', '');
            // return null;
        }
        integer Lo = 0;
        for(orderBean header : codPageRecords){
            if(header.check==true){
        for (orderBean header : codPageRecords) {
            if (header.check == true) {
                Lo++;
            }
        }
        if(Lo == 0){
        if (Lo == 0) {
            iSinventory = false;
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'请选择要销存的明细。'));
            return new ResponseBodyLWC('Error',500, '请选择要销存的明细', '');
            return new ResponseBodyLWC('Error', 500, '请选择要销存的明细', '');
            // return null;
        }
        Integer orderDetNo = 1;
        Savepoint sp = Database.setSavepoint();
        Consumable_order__c po = new Consumable_order__c();
        po.Name ='*';
        po.Name = '*';
        po.Order_status__c = '批准';
        po.Inventory_date__c = Date.today();
        po.Order_type__c = '销存';
        po.Dealer_Info__c = accountInfo.Id;
        po.Order_ProType__c = agencyProType;
        po.RecordTypeid = System.Label.RT_ConOrder_Overdue;
        try{
            insert  po;
            Consumable_order__c order = [SELECT Name FROM Consumable_order__c WHERE id =:po.id];
            List<Consumable_orderdetails__c> InsList = New List<Consumable_orderdetails__c>();
            for(orderBean header : codPageRecords){
                if(header.check==true){
        try {
            insert po;
            Consumable_order__c order = [SELECT Name FROM Consumable_order__c WHERE id = :po.id];
            List<Consumable_orderdetails__c> InsList = new List<Consumable_orderdetails__c>();
            for (orderBean header : codPageRecords) {
                if (header.check == true) {
                    Consumable_orderdetails__c insPan = new Consumable_orderdetails__c();
                    String str = string.valueOf(orderDetNo);
                    if(str.length() == 1){
                    str = '0' + str;
                    if (str.length() == 1) {
                        str = '0' + str;
                    }
                    insPan.Name = order.Name + '-'+ str;
                    insPan.Name = order.Name + '-' + str;
                    insPan.Consumable_Product__c = header.prodId;
                    insPan.Consumable_order__c = po.Id;
                    insPan.Lose_reason__c = '过期库存销存';
                    insPan.Overdue_count__c = header.pandian;
                    insPan.Overdue_SUM__c = header.overlimitCount;
                    insPan.RecordTypeId = System.Label.RT_ConOrderDetail1_Inventory;
                    orderDetNo ++;
                    orderDetNo++;
                    InsList.add(insPan);
                }
            }
            // 生成明细1
            if(InsList.size()>0){
            if (InsList.size() > 0) {
                insert InsList;
            }
            for(Consumable_order_details2__c cod : overdueList){
            for (Consumable_order_details2__c cod : overdueList) {
                cod.Consumable_Inventory_order__c = po.Id;
                cod.Inventory_date__c = Date.today();
                cod.Lose_reason__c = '过期库存销存';
                cod.Lose_Flag__c = true;
            }
            if(overdueList.size()>0){
            if (overdueList.size() > 0) {
                ControllerUtil.updateOrderDetailsSatus(overdueList);
            }
        }catch (Exception ex) {
        } catch (Exception ex) {
            Database.rollback(sp);
            ApexPages.addMessages(ex);
            return null;
        }
        // return new Pagereference('/' + po.Id);
        data.put('Id',po.Id);
        data.put('Id', po.Id);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
@@ -311,24 +336,24 @@
    }
    // 将页面或取得BarCode去掉重复的,转换成List
    public static List<String> ParseBarCode(String Code){
        Map<String,Integer> barcodeCountMap = new Map<String,Integer>();
        String[] Cache = new String[]{};
    public static List<String> ParseBarCode(String Code) {
        Map<String, Integer> barcodeCountMap = new Map<String, Integer>();
        String[] Cache = new List<String>{};
        Cache = Code.split('\n');
        List <String> Buff = new List<String>();
        for(String A : Cache){
        List<String> Buff = new List<String>();
        for (String A : Cache) {
            A = A.trim().toUpperCase();
            if(barcodeCountMap.containsKey(A)){
                barcodeCountMap.put(A,barcodeCountMap.get(A) + 1);
            }else{
                barcodeCountMap.put(A,1);
            if (barcodeCountMap.containsKey(A)) {
                barcodeCountMap.put(A, barcodeCountMap.get(A) + 1);
            } else {
                barcodeCountMap.put(A, 1);
            }
            Buff.add(A + barcodeCountMap.get(A));
        }
        return Buff;
    }
     // Data Bean
    // Data Bean
    class orderBean implements Comparable {
        @AuraEnabled
        public Consumable_order_details2__c orderdetails2 { get; set; }
@@ -336,7 +361,7 @@
        public Product2__c Prod { get; set; }
        @AuraEnabled
        public Boolean check { get; set; }
        // 过期库存
        @AuraEnabled
        public Integer overlimitCount { get; set; }
@@ -353,7 +378,7 @@
        public String prodname { get; set; }
        @AuraEnabled
        public String prodid { get; set; }
        orderBean(Consumable_order_details2__c e,string str) {
        orderBean(Consumable_order_details2__c e, string str) {
            orderdetails2 = e;
            Prod = e.Consumable_Product__r;
            DiffReason = str;
@@ -368,11 +393,11 @@
        }
        // 排序
        public Integer compareTo(Object compareTo) {
            orderBean compareToesd =(orderBean)compareTo;
            orderBean compareToesd = (orderBean) compareTo;
            Integer returnValue = 0;
            if (overlimitCount  > compareToesd.overlimitCount ) {
            if (overlimitCount > compareToesd.overlimitCount) {
                returnValue = -1;
            } else if (overlimitCount  < compareToesd.overlimitCount ) {
            } else if (overlimitCount < compareToesd.overlimitCount) {
                returnValue = 1;
            }
            return returnValue;
force-app/main/default/classes/LexProductLimitEditController.cls
@@ -4,54 +4,55 @@
    //--------AddStart-----XHL--------------20180929-------------
    public static String userPro_Type { get; set; }
    public static Boolean EngFlag = false;
    public static Boolean ETFlag = false;
    public static Boolean ETFlag = false;
    //--------AddEnd-----XHL--------------20180929-------------
    // 画面初始化
    public LexProductLimitEditController (){
        accountid= ApexPages.currentPage().getParameters().get('accountid');
    public LexProductLimitEditController() {
        accountid = ApexPages.currentPage().getParameters().get('accountid');
        //--------AddStart-----XHL--------------20181008-------------
        userPro_Type= ApexPages.currentPage().getParameters().get('userPro_Type');
        if(String.isBlank(userPro_Type)){
        userPro_Type = ApexPages.currentPage().getParameters().get('userPro_Type');
        if (String.isBlank(userPro_Type)) {
            userPro_Type = 'ET';
        }
        if(userPro_Type == 'ENG'){
        if (userPro_Type == 'ENG') {
            EngFlag = true;
        }else{
        } else {
            ETFlag = true;
        }
        //--------AddEnd-----XHL--------------20181008-------------
    }
    @AuraEnabled
    public static ResponseBodyLWC  init(String accountid,string userPro_Type) {
        System.debug('userPro_Type==>'+userPro_Type);
        System.debug('accountid==>'+accountid);
    public static ResponseBodyLWC init(String accountid, string userPro_Type) {
        System.debug('userPro_Type==>' + userPro_Type);
        System.debug('accountid==>' + accountid);
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String,object> data = new Map<String,object>();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        if(String.isBlank(userPro_Type)){
        if (String.isBlank(userPro_Type)) {
            userPro_Type = 'ET';
        }
        if(userPro_Type == 'ENG'){
        if (userPro_Type == 'ENG') {
            EngFlag = true;
        }else{
        } else {
            ETFlag = true;
        }
        List<Account> accinfo = New List<Account>();
        List<Account> accinfo = new List<Account>();
        //--------UpdateStart-----XHL--------------20181008-------------
        accinfo = [SELECT Product_Limit_Date__c,Product_Limit_DateENG__c
                    FROM Account
                    WHERE id =:accountid];
        if(accinfo.size() > 0){
            if(EngFlag){
               product_Limit = accinfo [0].Product_Limit_DateENG__c;
            }else if(ETFlag){
               product_Limit = accinfo [0].Product_Limit_Date__c;
        accinfo = [
            SELECT Product_Limit_Date__c, Product_Limit_DateENG__c
            FROM Account
            WHERE id = :accountid
        ];
        if (accinfo.size() > 0) {
            if (EngFlag) {
                product_Limit = accinfo[0].Product_Limit_DateENG__c;
            } else if (ETFlag) {
                product_Limit = accinfo[0].Product_Limit_Date__c;
            }
        }
        System.debug('product_Limit==>'+product_Limit);
        data.put('product_Limit',product_Limit);
        System.debug('product_Limit==>' + product_Limit);
        data.put('product_Limit', product_Limit);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
force-app/main/default/classes/LexRemoveBoxController.cls
@@ -1,6 +1,6 @@
public without sharing class LexRemoveBoxController {
    //经销商产品分类
    public static String agencyProType {get;set;}
    public static String agencyProType { get; set; }
    public static String userPro_Typestr = null;
    public static String barcode { get; set; }
    /*****************画面表示Bean******************/
@@ -9,11 +9,11 @@
    public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; }
    //拆盒明细
    public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
    public static boolean saveFLGbln {get;set;}
    public static boolean saveFLGbln { get; set; }
    //错误信息
    public static String alertMessage {set;get;}
    public static String alertMessage { get; set; }
    //拆盒明细件数
    public static integer getinventorysize(){
    public static integer getinventorysize() {
        return ConsumableorderdetailsRecordsdummy.size();
    }
    public static Map<String, String> ExistIdMap = new Map<String, String>();
@@ -21,48 +21,47 @@
    public static Map<String, String> AllMap = new Map<String, String>();
    public static List<String> BarCodeListP = new List<String>();
    //不符合的barcode和型号
    public static list<String> notInlist = new list<String>();
    public static String baseUrl {get;private set;}
    public static list<String> notInlist = new List<String>();
    public static String baseUrl { get; private set; }
    private static String accountid = null;
    private static String accountName = null;
    //public String[] proidList =new String[]{};
    // 登录者工作地
    private static String userWorkLocation;
    public LexRemoveBoxController(){
    public LexRemoveBoxController() {
        baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
        ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
        ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
        consumableInventory = new List<ConsumableorderdetailsInfo>();
        saveFLGbln = FALSE;
        saveFLGbln = false;
    }
    @AuraEnabled
    public static ResponseBodyLWC init() {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String,object> data = new Map<String,object>();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        String userId = UserInfo.getUserId();
        List<user> Useracc = New List<user>();
        Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:userId];
        List<user> Useracc = new List<user>();
        Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
        accountid = Useracc[0].accountid;
        userWorkLocation = Useracc[0].Work_Location__c;
        agencyProType = Useracc[0].UserPro_Type__c;
        if(String.isBlank(Useracc[0].UserPro_Type__c)){
        if (String.isBlank(Useracc[0].UserPro_Type__c)) {
            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(',');
        data.put('ConsumableorderdetailsRecordsdummy',JSON.serialize(ConsumableorderdetailsRecordsdummy));
        data.put('accountName',accountName);
        data.put('userWorkLocation',userWorkLocation);
        data.put('agencyProType',agencyProType);
        data.put('ConsumableorderdetailsRecordsdummy', JSON.serialize(ConsumableorderdetailsRecordsdummy));
        data.put('accountName', accountName);
        data.put('userWorkLocation', userWorkLocation);
        data.put('agencyProType', agencyProType);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
@@ -70,15 +69,15 @@
    }
    // 将页面或取得BarCode去掉重复的,转换成List
    public static List<String> ParseBarCode(String Code){
        String[] Cache = new String[]{};
    public static List<String> ParseBarCode(String Code) {
        String[] Cache = new List<String>{};
        Cache = Code.split('\n');
        Set <String> Buff = new Set<String>();
        for(String A : Cache){
        Set<String> Buff = new Set<String>();
        for (String A : Cache) {
            Buff.add(A);
        }
        List<String> outPut = new List<String>();
        for(String B :Buff){
        for (String B : Buff) {
            B = B.trim();
            outPut.add(B);
        }
@@ -87,10 +86,14 @@
    //获取明细
    @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>();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        userPro_Typestr = '%' + agencyProType + '%';
        barcode = barcode;
@@ -99,21 +102,19 @@
        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;
        alertMessage='';
        alertMessage = '';
        //判断barcode是否为空
        if(barcode == null || barcode ==''){
            return new ResponseBodyLWC('Error',500, '请输入BarCode号', '');
        if (barcode == null || barcode == '') {
            return new ResponseBodyLWC('Error', 500, '请输入BarCode号', '');
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'请输入BarCode号。'));
            // return;
        }
@@ -125,417 +126,529 @@
        // ConsumableorderdetailsRecordsdummy.clear();
        // 产品类型不同
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,Product_Type__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    AND   Arrive_Owner_Work_Location__c = : userWorkLocation
                    AND (not Product_Type__c like : userPro_Typestr)
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Product_Type__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c,
                Arrive_Owner_Work_Location__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
                AND (NOT Product_Type__c LIKE :userPro_Typestr)
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                    String str = '该商品类型'+ reSet1[i].Product_Type__c +'与用户类型'+ agencyProType +'不符,不能拆盒';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                } else {
                    String str = '该商品类型' + reSet1[i].Product_Type__c + '与用户类型' + agencyProType + '不符,不能拆盒';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //未到货
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = FALSE
                    AND  Dealer_Shipment__c= FALSE
                    AND  Dealer_Saled__c = FALSE
                    AND  Dealer_Returned__c = false
                    AND  Lose_Flag__c = false
                    AND  Box_Piece__c = '盒'
                    AND  Bar_Code__c in :BarCodeListP
                    AND  Dealer_Info_text__c = :accountName
                    ORDER BY Name ];  //已发货,未到货
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = FALSE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Box_Piece__c = '盒'
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ]; //已发货,未到货
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品未到货,不能拆盒';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //已规格=1
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND  Dealer_Shipment__c= FALSE
                    AND  Dealer_Saled__c = FALSE
                    AND  Dealer_Returned__c = false
                    AND  Lose_Flag__c = false
                    AND  Box_Piece__c = '盒'
                    AND  ProductPacking_list_manual__c = 1
                    AND  Bar_Code__c in :BarCodeListP
                    AND  Dealer_Info_text__c = :accountName
                    ORDER BY Name ];  //没出库,没销售,就是在库,没拆盒,规格=1
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Box_Piece__c = '盒'
                AND ProductPacking_list_manual__c = 1
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ]; //没出库,没销售,就是在库,没拆盒,规格=1
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品规格为1,不能拆盒';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //已出货
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Shipment__c = true
                    AND   Dealer_Arrive__c = true
                    AND   Dealer_Returned__c = false
                    AND   Lose_Flag__c = false
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Shipment__c = TRUE
                AND Dealer_Arrive__c = TRUE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品已出货';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //已销售
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Saled__c = true
                    AND   Dealer_Returned__c = false
                    AND   Dealer_Arrive__c = true
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Saled__c = TRUE
                AND Dealer_Returned__c = FALSE
                AND Dealer_Arrive__c = TRUE
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品已销售';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        //已拆盒
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND  Dealer_Shipment__c= false
                    AND  Dealer_Saled__c = false
                    AND  Dealer_Returned__c = false
                    AND  Box_Piece__c = '个'
                    AND  ProductPacking_list_manual__c > 1
                    AND  Bar_Code__c in :BarCodeListP
                    AND  Dealer_Info_text__c = :accountName
                    ORDER BY Name ];  //没出库,没销售,就是在库,已拆盒
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Box_Piece__c = '个'
                AND ProductPacking_list_manual__c > 1
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
            ORDER BY Name
        ]; //没出库,没销售,就是在库,已拆盒
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品已拆盒';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        // 已经取消
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND   Cancellation_Flag__c = true
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    AND   Arrive_Owner_Work_Location__c = : userWorkLocation
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c,
                Arrive_Owner_Work_Location__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Cancellation_Flag__c = TRUE
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品已经取消,不能拆盒';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        // 工作地不同
        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
                        Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                        Deliver_date__c,Bar_Code__c,
                        Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
                        recordtypeid,Consumable_order_minor__r.Arrive_Order__c, Arrive_Owner_Work_Location__c
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    // gzw 无法拆盒,去掉销售明细 20210802
                    AND  Dealer_Shipment__c= false
                    AND  Dealer_Saled__c = false
                    AND  Dealer_Returned__c = false
                    // gzw 无法拆盒,去掉销售明细 20210802
                    AND   Bar_Code__c in :BarCodeListP
                    AND   Dealer_Info_text__c = :accountName
                    AND   Arrive_Owner_Work_Location__c != : userWorkLocation
                    ORDER BY Name ];
        if(reSet1.size() > 0){
        reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__r.Name__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                recordtypeid,
                Consumable_order_minor__r.Arrive_Order__c,
                Arrive_Owner_Work_Location__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                // gzw 无法拆盒,去掉销售明细 20210802
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                // gzw 无法拆盒,去掉销售明细 20210802
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c != :userWorkLocation
            ORDER BY Name
        ];
        if (reSet1.size() > 0) {
            for (Integer i = 0; i < reSet1.size(); i++) {
                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                    // 跳过已经处理的消耗品明细
                    continue;
                }else{
                } else {
                    String str = '该商品属于' + reSet1[i].Arrive_Owner_Work_Location__c + ',不能拆盒';
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                }
            }
        }
        reSet = [SELECT Id,
                        Name,
                        Intra_Trade_List_RMB__c,
                        Asset_Model_No__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Consumable_Product__r.Name__c,
                        Sterilization_limit__c,
                        Deliver_date__c,
                        Bar_Code__c,
                        Arrive_date__c,
                        Send_Date__c,
                        Consumable_order_minor__r.Name,
                        Consumable_order_minor__c,
                        Dealer_Arrive__c,
                        Guarantee_period_for_products__c,
                        CFDA_Status__c,
                        ProductPacking_list_manual__c,
                        Report_Product_Approbation__c,
                        Report_Product_Expiration__c,
                        Agencyinfo_fromSAP__c,
                        Frist_Storage_Agency__c,
                        Dealer_Info_text__c
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND Dealer_Shipment__c = false
                    AND Dealer_Saled__c = false
                    AND Dealer_Returned__c = false
                    AND Lose_Flag__c = false
                    AND Bar_Code__c in :BarCodeListP
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c = : userWorkLocation
                    AND Product_Type__c like : userPro_Typestr
                ];
        if(reSet.size()>0){
        reSet = [
            SELECT
                Id,
                Name,
                Intra_Trade_List_RMB__c,
                Asset_Model_No__c,
                Consumable_Product__c,
                Consumable_Product__r.Name,
                Consumable_Product__r.Name__c,
                Sterilization_limit__c,
                Deliver_date__c,
                Bar_Code__c,
                Arrive_date__c,
                Send_Date__c,
                Consumable_order_minor__r.Name,
                Consumable_order_minor__c,
                Dealer_Arrive__c,
                Guarantee_period_for_products__c,
                CFDA_Status__c,
                ProductPacking_list_manual__c,
                Report_Product_Approbation__c,
                Report_Product_Expiration__c,
                Agencyinfo_fromSAP__c,
                Frist_Storage_Agency__c,
                Dealer_Info_text__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Bar_Code__c IN :BarCodeListP
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
                AND Product_Type__c LIKE :userPro_Typestr
        ];
        if (reSet.size() > 0) {
            for (Integer i = 0; i < reSet.size(); i++) {
                if(ErrorIdMap.containsKey(reSet[i].Bar_Code__c) ){
                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{
                } else {
                    ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
                    ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
                    ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
                }
            }
        }
        AllMap.putAll(ExistIdMap);
        //得到不存在的BarCode
        for(Integer i = 0; i < BarCodeListP.size(); i++){
            if(ExistIdMap.containsKey(BarCodeListP[i])){
        for (Integer i = 0; i < BarCodeListP.size(); i++) {
            if (ExistIdMap.containsKey(BarCodeListP[i])) {
                continue;
            }else if(ErrorIdMap.containsKey(BarCodeListP[i])){
            } else if (ErrorIdMap.containsKey(BarCodeListP[i])) {
                continue;
            }else{
            } else {
                notInlist.add(BarCodeListP[i]);
            }
        }
        if(notInlist.size()>0){
                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '不存在。'));
                return new ResponseBodyLWC('Error',500, 'BarCode'+ notInlist + '不存在', '');
        if (notInlist.size() > 0) {
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode'+ notInlist + '不存在。'));
            return new ResponseBodyLWC('Error', 500, 'BarCode' + notInlist + '不存在', '');
        }
        data.put('ConsumableorderdetailsRecordsdummy',JSON.serialize(ConsumableorderdetailsRecordsdummy));
        data.put('ConsumableorderdetailsRecordserror',JSON.serialize(ConsumableorderdetailsRecordserror));
        data.put('dataSize',ConsumableorderdetailsRecordsdummy.size());
        data.put('ConsumableorderdetailsRecordsdummy', JSON.serialize(ConsumableorderdetailsRecordsdummy));
        data.put('ConsumableorderdetailsRecordserror', JSON.serialize(ConsumableorderdetailsRecordserror));
        data.put('dataSize', ConsumableorderdetailsRecordsdummy.size());
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        return res;
    }
    //拆盒确认
    @AuraEnabled
    public static ResponseBodyLWC removeBoxConfirm(String saveConsumableorderdetailsRecordsdummy,String accountName,String userWorkLocation,String agencyProType) {
    public static ResponseBodyLWC removeBoxConfirm(
        String saveConsumableorderdetailsRecordsdummy,
        String accountName,
        String userWorkLocation,
        String agencyProType
    ) {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String,object> data = new Map<String,object>();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        userPro_Typestr = '%' + agencyProType + '%';
        accountName = accountName;
        userWorkLocation =userWorkLocation;
        List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>)JSON.deserialize(saveConsumableorderdetailsRecordsdummy,List<ConsumableorderdetailsInfo>.class);
        userWorkLocation = userWorkLocation;
        List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
            saveConsumableorderdetailsRecordsdummy,
            List<ConsumableorderdetailsInfo>.class
        );
        List<Consumable_order_details2__c> ins = New List<Consumable_order_details2__c>();
        List<Consumable_order_details2__c> ins = new List<Consumable_order_details2__c>();
        Savepoint sp = Database.setSavepoint();
        if(ConsumableorderdetailsRecordsdummy.size()<1){
            return new ResponseBodyLWC('Error',500, '不存在拆盒明细', '');
        if (ConsumableorderdetailsRecordsdummy.size() < 1) {
            return new ResponseBodyLWC('Error', 500, '不存在拆盒明细', '');
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'不存在拆盒明细'));
            // return null;
        }
        List<String> BarCodeList = new List<String>();
        for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy)  {
        for (ConsumableorderdetailsInfo tmp : ConsumableorderdetailsRecordsdummy) {
            BarCodeList.add(tmp.esd.Bar_Code__c);
        }
        try{
        try {
            //取得在库信息
            List<Consumable_order_details2__c> orderDetails2 =  [SELECT
                        Id,
                        Name,
                        Bar_Code__c,
                        TracingCode__c,
                        Intra_Trade_List_RMB__c,
                        Purchase_Unitprice_From__c,
                        Guarantee_period_for_products__c,
                        Used_account__c,
                        Consumable_ZS_order__c,
                        Cancellation_Date__c,
                        Consumable_product__c,
                        Consumable_order_minor__c,
                        Direct_Arrive_Product__c,
                        Arrive_date__c,
                        Consumable_Arrived_order__c,
                        Unitprice_To_agency__c,
                        SerialLotNo__c,
                        Sterilization_limit__c,
                        Invoice_Date__c,
                        Lose_reason__c,
                        Asset_Model_No__c,
                        Deliver_date__c,
                        Inventory_date__c,
                        Consumable_Inventory_order__c,
                        Dealer_Arrive__c,
                        ProductPacking_list_manual__c,
                        Agencyinfo_fromSAP__c,
                        Frist_Storage_Agency__c,
                        Dealer_Info_text__c,
                        //add by rentx 2020-10-13 start
                        ContractNo_text__c
                        /*,ContractNo__c*/
                        //add by rentx 2020-10-13 end
                         // tcm start
                        ,Consumable_order_minor__r.ContractNo__c
                        // tcm end
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = true
                    AND Dealer_Shipment__c = false
                    AND Dealer_Saled__c = false
                    AND Dealer_Returned__c = false
                    AND Lose_Flag__c = false
            List<Consumable_order_details2__c> orderDetails2 = [
                SELECT
                    Id,
                    Name,
                    Bar_Code__c,
                    TracingCode__c,
                    Intra_Trade_List_RMB__c,
                    Purchase_Unitprice_From__c,
                    Guarantee_period_for_products__c,
                    Used_account__c,
                    Consumable_ZS_order__c,
                    Cancellation_Date__c,
                    Consumable_product__c,
                    Consumable_order_minor__c,
                    Direct_Arrive_Product__c,
                    Arrive_date__c,
                    Consumable_Arrived_order__c,
                    Unitprice_To_agency__c,
                    SerialLotNo__c,
                    Sterilization_limit__c,
                    Invoice_Date__c,
                    Lose_reason__c,
                    Asset_Model_No__c,
                    Deliver_date__c,
                    Inventory_date__c,
                    Consumable_Inventory_order__c,
                    Dealer_Arrive__c,
                    ProductPacking_list_manual__c,
                    Agencyinfo_fromSAP__c,
                    Frist_Storage_Agency__c,
                    Dealer_Info_text__c,
                    //add by rentx 2020-10-13 start
                    ContractNo_text__c,
                    /*,ContractNo__c*/
                    //add by rentx 2020-10-13 end
                    // tcm start
                    Consumable_order_minor__r.ContractNo__c
                // tcm end
                FROM Consumable_order_details2__c
                WHERE
                    Dealer_Arrive__c = TRUE
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Dealer_Returned__c = FALSE
                    AND Lose_Flag__c = FALSE
                    AND Box_Piece__c = '盒'
                    AND ProductPacking_list_manual__c > 1
                    AND Bar_Code__c in :BarCodeList
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c =: userWorkLocation
                    AND Product_Type__c like : userPro_Typestr
                ];
                    AND Bar_Code__c IN :BarCodeList
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
                    AND Product_Type__c LIKE :userPro_Typestr
            ];
            List<Consumable_order_details2__c> orderDetails2del = new List<Consumable_order_details2__c>();
            List<Consumable_order_details2__c> orderDetails2ins = new List<Consumable_order_details2__c>();
            for (Consumable_order_details2__c detail2tmp : orderDetails2) {
                Decimal num                              = detail2tmp.ProductPacking_list_manual__c;
                Decimal num = detail2tmp.ProductPacking_list_manual__c;
                Consumable_order_details2__c delDetails2 = new Consumable_order_details2__c();
                delDetails2.Id                           = detail2tmp.Id;
                delDetails2.Id = detail2tmp.Id;
                //删除拆盒前在库
                //delete delDetails2;
                orderDetails2del.add(delDetails2);
                for(integer i=0; i < num; i++){
                for (integer i = 0; i < num; i++) {
                    Consumable_order_details2__c insertDetails2 = new Consumable_order_details2__c();
                    insertDetails2 = detail2tmp.clone();
                    insertDetails2.Id                = null;
                    insertDetails2.Id = null;
                    //单位(盒/个)
                    insertDetails2.Box_Piece__c      = '个';
                    insertDetails2.Box_Piece__c = '个';
                    //拆盒番号
                    insertDetails2.RemoveBox_No__c   = i+1;
                    insertDetails2.RemoveBox_No__c = i + 1;
                    //拆盒日期
                    insertDetails2.RemoveBox_date__c =  Date.today();
                    insertDetails2.RemoveBox_date__c = Date.today();
                    //add by rentx 2020-10-13 start 拆盒/取消拆盒时,记录SAP合同号
                    // insertDetails2.ContractNo_text__c= detail2tmp.ContractNo__c;
                    // tcm start
                    if (String.isBlank(detail2tmp.Consumable_order_minor__r.ContractNo__c)) {
                        insertDetails2.ContractNo_text__c= detail2tmp.ContractNo_text__c;
                    }else {
                        insertDetails2.ContractNo_text__c= detail2tmp.Consumable_order_minor__r.ContractNo__c;
                        insertDetails2.ContractNo_text__c = detail2tmp.ContractNo_text__c;
                    } else {
                        insertDetails2.ContractNo_text__c = detail2tmp.Consumable_order_minor__r.ContractNo__c;
                    }
                    // tcm end
                    //登录拆盒后在库
@@ -544,31 +657,29 @@
                }
            }
            if (orderDetails2del.size()>0){
            if (orderDetails2del.size() > 0) {
                delete orderDetails2del;
            }
            if(orderDetails2ins.size()>0){
            if (orderDetails2ins.size() > 0) {
                insert orderDetails2ins;
            }
            saveFLGbln = true;
            alertMessage = '拆盒完成';
            data.put('saveFLGbln',saveFLGbln);
            data.put('saveFLGbln', saveFLGbln);
            res.status = 'Success';
            res.code = 200;
            res.msg = alertMessage;
            System.debug('res = ' + res);
            return res;
            // return null;
        }catch(Exception e){
        } catch (Exception e) {
            Database.rollback(sp);
            ApexPages.addMessages(e);
            return null;
        }
    }
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
@@ -585,18 +696,18 @@
        public String oldConsumableCount { get; set; }
        @AuraEnabled
        public String ErrorReason { get; set; }
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) {
            esd                = e;
            Prod               = e.Consumable_Product__r;
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e, string str) {
            esd = e;
            Prod = e.Consumable_Product__r;
            oldConsumableCount = e.name;
            ErrorReason        = str;
            ErrorReason = str;
        }
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
            esd                = e;
            Prod               = e.Consumable_Product__r;
            esd = e;
            Prod = e.Consumable_Product__r;
            oldConsumableCount = e.name;
        }
 /*
        /*
        public ConsumableorderdetailsInfo(Product2__c e,String barCode,Date sterilizationlimit,String serialNoorLot,String tracingCode) {
            esd = new Consumable_order_details2__c();
            ProductName = e.Name__c;
force-app/main/default/classes/LexSaleAndDeliveryController.cls
@@ -34,13 +34,13 @@
            data.put('userWorkLocation', userWorkLocation);
            System.debug(
                'userinfoId = ' +
                userinfoId +
                ' accountid = ' +
                accountid +
                ' agencyProType = ' +
                agencyProType +
                ' userWorkLocation = ' +
                userWorkLocation
                    userinfoId +
                    ' accountid = ' +
                    accountid +
                    ' agencyProType = ' +
                    agencyProType +
                    ' userWorkLocation = ' +
                    userWorkLocation
            );
            //默认检索显示未完成的指示单
            List<Consumable_order__c> raesList = new List<Consumable_order__c>();
force-app/main/default/classes/LexSaleOrderController.cls
@@ -201,6 +201,7 @@
        //BarCodelist做成
        barCodeListP = ParseBarCode(barcode);
        System.debug('barCodeListP:' + barCodeListP);
        //针对所有商品到货确认
        reSet1 = [
            SELECT
@@ -235,6 +236,7 @@
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
            ORDER BY RemoveBox_No__c DESC
        ];
        System.debug('reSet1:' + reSet1);
        List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
        Set<Id> proIds = new Set<Id>();
@@ -242,6 +244,7 @@
            Integer idx = 0;
            for (Consumable_order_details2__c cod2 : reSet1) {
                if (cod2.Bar_Code__c == barcode) {
                    System.debug('cod2.Bar_Code__c:' + cod2.Bar_Code__c);
                    newdet2.add(cod2);
                    reSet1.remove(idx);
                    proIds.add(cod2.Consumable_product__c);
@@ -678,13 +681,13 @@
                        if (n.find()) {
                            if (newdet2[j].TracingCode__c.length() == 5) {
                                String tr = newdet2[j].TracingCode__c;
                                String Ctr = tr.substring(tr.length() - 3,tr.length());
                                String Btr = tr.substring(tr.length() - 4,tr.length()-3);
                                String Atr = tr.substring(tr.length() - 5,tr.length()-4);
                                String Ctr = tr.substring(tr.length() - 3, tr.length());
                                String Btr = tr.substring(tr.length() - 4, tr.length() - 3);
                                String Atr = tr.substring(tr.length() - 5, tr.length() - 4);
                                if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) {
                                    String str = '管理编码有误,请检查条形码数据。';
                                    consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j],str));
                                    errorIdMap.put(newdet2[j].Bar_Code__c,newdet2[j].Bar_Code__c);
                                    consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
                                    errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
                                    continue;
                                }
                            }
@@ -1076,11 +1079,16 @@
        for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
            String key = '' + ass.orderdetails2.Bar_Code__c;
            Integer deliverycnt = BarcodeCntMap.get(key);
            if (ass.orderdetails2.Box_Piece__c == '个' &&(ass.outboundCount == null || String.valueof(ass.outboundCount) == '' || ass.outboundCount <= 0)) {
            if (
                ass.orderdetails2.Box_Piece__c == '个' &&
                (ass.outboundCount == null ||
                String.valueof(ass.outboundCount) == '' ||
                ass.outboundCount <= 0)
            ) {
                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '请输入产品 '+ ass.Prod.Name +' 的出货数量'));
                // return null;
                System.debug('ass.orderdetails2.Box_Piece__c = '  + ass.orderdetails2.Box_Piece__c);
                System.debug('ass.outboundCount = '  + ass.outboundCount);
                System.debug('ass.orderdetails2.Box_Piece__c = ' + ass.orderdetails2.Box_Piece__c);
                System.debug('ass.outboundCount = ' + ass.outboundCount);
                return new ResponseBodyLWC('Error', 500, '请输入产品 ' + ass.Prod.Name + ' 的出货数量', '');
            }
            if (ass.outboundCount > deliverycnt) {
@@ -1265,6 +1273,7 @@
        return consumableorderdetails2Nobox.size();
    }
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Consumable_orderdetails__c orderdetails1 { get; set; }
force-app/main/default/classes/LexSearchContractController.cls
@@ -1,26 +1,34 @@
public without sharing class LexSearchContractController {
    private static Boolean OSHFLG;//lt 20230517 安徽两票制 add
    private static Boolean OSHFLG; //lt 20230517 安徽两票制 add
    @AuraEnabled
    public static Results init(String ctype){
    public static Results init(String ctype) {
        Results results = new Results();
        try {
            //lt 20230517 安徽两票制 add ,OSHFLG__c
            User useracc = [SELECT accountid,OSHFLG__c FROM user WHERE id = :UserInfo.getUserId() ];
            User useracc = [SELECT accountid, OSHFLG__c FROM user WHERE id = :UserInfo.getUserId()];
            OSHFLG = Useracc.OSHFLG__c; //lt 20230517 安徽两票制 add;
            String accountId = Useracc.accountid;
            List<Account> attList = [SELECT id,Name,State_Master__c,State_Master__r.Name,Sales_Section__c,
                        Contract_Decide_Start_Date__c,Contract_Decide_End_Date__c
                    FROM Account
                    WHERE ParentId = :accountId
                    AND Contact_Type__c like :ctype
            List<Account> attList = [
                SELECT
                    id,
                    Name,
                    State_Master__c,
                    State_Master__r.Name,
                    Sales_Section__c,
                    Contract_Decide_Start_Date__c,
                    Contract_Decide_End_Date__c
                FROM Account
                WHERE
                    ParentId = :accountId
                    AND Contact_Type__c LIKE :ctype
                    AND Contract_Decide_Start_Date__c <= :Date.Today()
                    AND Contract_Decide_End_Date__c >= :Date.Today()
                    AND Secondary_contract__c = false
                    AND OSH_Dealer__c =: OSHFLG  //lt 20230517 安徽两票制 add
                    ];
                    AND Secondary_contract__c = FALSE
                    AND OSH_Dealer__c = :OSHFLG //lt 20230517 安徽两票制 add
            ];
            results.attList = attList;
            results.result = 'Success';
            results.result = 'Success';
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
@@ -29,12 +37,12 @@
    }
    @AuraEnabled
    public static Results searchContract(String searchName, String accountId, String ctype, Boolean OSHFLGStr){
    public static Results searchContract(String searchName, String accountId, String ctype, Boolean OSHFLGStr) {
        Results results = new Results();
        OSHFLG = OSHFLGStr;
        try {
            results.attList = Database.query(makeSoql(searchName,Date.today(),accountId,ctype));
            results.result = 'Success';
            results.attList = Database.query(makeSoql(searchName, Date.today(), accountId, ctype));
            results.result = 'Success';
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
@@ -42,17 +50,16 @@
        return results;
    }
    private static String makeSoql(String CateName,Date timetest,String accountId, String ctype){
    private static String makeSoql(String CateName, Date timetest, String accountId, String ctype) {
        String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Sales_Section__c,';
        soql += ' Contract_Decide_Start_Date__c,Contract_Decide_End_Date__c,OSH_Dealer__c FROM Account';
        soql += ' where ParentId = \'' + accountId + '\'' ;
        soql += ' AND OSH_Dealer__c = ' + OSHFLG + '' ; //lt 20230517 安徽两票制 add
        soql += ' AND Secondary_contract__c = false' ;
        soql += ' where ParentId = \'' + accountId + '\'';
        soql += ' AND OSH_Dealer__c = ' + OSHFLG + ''; //lt 20230517 安徽两票制 add
        soql += ' AND Secondary_contract__c = false';
        soql += ' AND Contact_Type__c like \'%' + String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) + '%\'';
        soql += ' AND Contract_Decide_Start_Date__c <=' + String.valueOf(timetest).substring(0, 10);
        soql += ' AND Contract_Decide_End_Date__c >= ' + String.valueOf(timetest).substring(0, 10);
        if(!String.isBlank(CateName)){
        if (!String.isBlank(CateName)) {
            soql += ' AND Name like \'%' + String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + '%\'';
        }
        return soql;
force-app/main/default/classes/LexSearchHospitalController.cls
@@ -1,16 +1,15 @@
public without sharing class LexSearchHospitalController {
    @AuraEnabled
    public static Results init(){
    public static Results init() {
        Results results = new Results();
        try {
            User useracc = [SELECT accountid,UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId() ];
            User useracc = [SELECT accountid, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
            String accountId = Useracc.accountid;
            String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Address__c FROM Account';
            soql += ' where id in (SELECT Hospital__c FROM hospitalprice__c WHERE account__c = :accountId) ' ;
            soql += ' where id in (SELECT Hospital__c FROM hospitalprice__c WHERE account__c = :accountId) ';
            soql += ' order by Name desc limit 100';
            results.attList = Database.query(soql);
            results.result = 'Success';
            results.result = 'Success';
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
@@ -19,7 +18,7 @@
    }
    @AuraEnabled
    public static Results searchHospital(String searchName, String accountId){
    public static Results searchHospital(String searchName, String accountId) {
        Results results = new Results();
        try {
            results.attList = Database.query(makeSoql(searchName, accountId));
@@ -31,16 +30,16 @@
        return results;
    }
    private static String makeSoql(String searchName,String accountId){
    private static String makeSoql(String searchName, String accountId) {
        String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name,Address__c FROM Account';
        soql += ' where id in (SELECT Hospital__c FROM hospitalprice__c WHERE account__c = :accountId) ' ;
        if(String.isNotBlank(searchName)){
            soql += ' AND Name like \'%' + searchName+ '%\'';
        soql += ' where id in (SELECT Hospital__c FROM hospitalprice__c WHERE account__c = :accountId) ';
        if (String.isNotBlank(searchName)) {
            soql += ' AND Name like \'%' + searchName + '%\'';
        }
        soql += ' order by Name desc limit 100';
        return soql;
    }
    public class Results {
        @AuraEnabled
        public String result;
force-app/main/default/classes/LexSummonsCreatController.cls
@@ -245,265 +245,510 @@
    // 画面初始化
    @AuraEnabled
    public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC) {
        // try {
        firstInit(ESetidJs);
        statusEdit = statusEdit;
        arriveorder = '';
        HospitalName = '';
        provinceOpts = new List<SelectOption>();
        provinceOptsMap = new Map<String, String>();
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        // public static Integer pagesize { get; set; }
        // public static Integer pageToken { get; set; }
        // public static String sortField { get; set; }
        // public static String sortOrder { get; set; }
        pagesize = pageSizeLWC;
        pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
    public static ResponseBodyLWC init(
        String ESetidJs,
        String statusEdit,
        Integer pageSizeLWC,
        Integer pageTokenLWC,
        String arriveorderLWC
    ) {
        try {
            firstInit(ESetidJs);
            statusEdit = statusEdit;
            arriveorder = arriveorderLWC;
            HospitalName = '';
            provinceOpts = new List<SelectOption>();
            provinceOptsMap = new Map<String, String>();
            ResponseBodyLWC res = new ResponseBodyLWC();
            Map<String, object> data = new Map<String, object>();
            res.entity = data;
            // public static Integer pagesize { get; set; }
            // public static Integer pageToken { get; set; }
            // public static String sortField { get; set; }
            // public static String sortOrder { get; set; }
            pagesize = pageSizeLWC;
            pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
        // sortKey = '1';
        // preSortKey = '1';
        // sortOrderAsc = false;
        // sortOrder = new List<String>(8);
        // sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '↓', '', '', '' };
        //cate1ForSort = '';
        sumPrice = 0;
        IdCheck = EsetId;
        if (ESetId != null && ESetId != '' && (statusEdit == '' || statusEdit == null)) {
            editAble = false;
        } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) {
            editAble = true;
        } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) {
            editAble = true;
        }
        userId = UserInfo.getUserId();
        localuser = [SELECT id, State_Hospital__c FROM User WHERE id = :UserInfo.getUserId()];
        //userId = '00510000005QO75';
        user Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
        accountid = Useracc.accountid;
        userWorkLocation = Useracc.Work_Location__c;
        agencyProType = Useracc.UserPro_Type__c;
        if (String.isBlank(Useracc.UserPro_Type__c)) {
            agencyProType = 'ET';
        }
        Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
        accountName = accountInfo.Name;
        //coc.Order_date__c = Date.today();
        list<Dealer_elationship__c> Dealerelationship = new List<Dealer_elationship__c>();
        Dealerelationship = [
            SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
            FROM Dealer_elationship__c
            WHERE Dealer_principal__c = :accountid
        ];
        List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
        AgencyHospitalLink = [SELECT Id, Hospital__c, Hospital__r.Name FROM Agency_Hospital_Link__c WHERE Agency__c = :accountid];
        //add by rentx 2021-3-1 start
        //判断当前经销商下是否有特价医院
        List<hospitalprice__c> hlist = [SELECT id, product__c FROM hospitalprice__c WHERE account__c = :accountid];
        if (hlist == null || hlist.size() == 0) {
            hasHos = false;
        } else {
            for (hospitalprice__c hp : hlist) {
                HosProMap.put(hp.product__c, '');
            // sortKey = '1';
            // preSortKey = '1';
            // sortOrderAsc = false;
            // sortOrder = new List<String>(8);
            // sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '↓', '', '', '' };
            //cate1ForSort = '';
            sumPrice = 0;
            IdCheck = EsetId;
            if (ESetId != null && ESetId != '' && (statusEdit == '' || statusEdit == null)) {
                editAble = false;
            } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) {
                editAble = true;
            } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) {
                editAble = true;
            }
            hasHos = true;
        }
        //add by rentx 2021-3-1 end
            userId = UserInfo.getUserId();
            localuser = [SELECT id, State_Hospital__c FROM User WHERE id = :UserInfo.getUserId()];
            //userId = '00510000005QO75';
            user Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
            accountid = Useracc.accountid;
            userWorkLocation = Useracc.Work_Location__c;
            agencyProType = Useracc.UserPro_Type__c;
            if (String.isBlank(Useracc.UserPro_Type__c)) {
                agencyProType = 'ET';
            }
            Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
            accountName = accountInfo.Name;
            //coc.Order_date__c = Date.today();
            list<Dealer_elationship__c> Dealerelationship = new List<Dealer_elationship__c>();
            Dealerelationship = [
                SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
                FROM Dealer_elationship__c
                WHERE Dealer_principal__c = :accountid
            ];
        saveBtnDisabled = false;
        SorderBtnDisabled = false;
        String sqlagencyProType = '%' + agencyProType + '%';
        coc = new Consumable_order__c();
        consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
        Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
        //add by rentx 2021-01-29
        Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>();
        //add by rentx 2021-01-29
            List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
            AgencyHospitalLink = [SELECT Id, Hospital__c, Hospital__r.Name FROM Agency_Hospital_Link__c WHERE Agency__c = :accountid];
        List<AggregateResult> orderdetailCount = [
            SELECT count(id), Consumable_Product__c cpc, Box_Piece__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Isoverdue__c = 1
                AND Product_Type__c LIKE :sqlagencyProType
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
            GROUP BY Consumable_Product__c, Box_Piece__c
        ];
        for (AggregateResult orderdetail : orderdetailCount) {
            zaikuId.add(String.valueOf(orderdetail.get('cpc')));
        }
        System.debug('sqlagencyProType = ' + sqlagencyProType);
        System.debug('userWorkLocation = ' + userWorkLocation);
        System.debug('accountName = ' + accountName);
        List<Consumable_order_details2__c> CountDel = [
            SELECT
                Id,
                Bar_Code__c,
                Name,
                Inventory_date__c,
                Consumable_Product__c,
                Consumable_Product__r.Asset_Model_No__c,
                Recordtypeid,
                Box_Piece__c,
                ProductPacking_list_manual__c,
                //add by rentx 2020-11-27 start
                hospitalSpecialOffer__c
            //add by rentx 2020-11-27 end
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Isoverdue__c = 1
                AND Product_Type__c LIKE :sqlagencyProType
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
                AND Dealer_Info_text__c = :accountName
        ];
        // 新規
        if (ESetId == null || ESetId == '') {
            SummonsFlag = 'hidden';
            String msoql = makeSoqlinventory();
            initStandardController(msoql);
            System.debug('msoql = ' + msoql);
            product2Selected = Database.query(msoql);
            if (String.isBlank(arriveorder)) {
                EditDelCommitBtnDisabled = true;
                for (Integer i = 0; i < product2Selected.size(); i++) {
                    MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
            //add by rentx 2021-3-1 start
            //判断当前经销商下是否有特价医院
            List<hospitalprice__c> hlist = [SELECT id, product__c FROM hospitalprice__c WHERE account__c = :accountid];
            if (hlist == null || hlist.size() == 0) {
                hasHos = false;
            } else {
                for (hospitalprice__c hp : hlist) {
                    HosProMap.put(hp.product__c, '');
                }
                for (Integer i = 0; i < CountDel.size(); i++) {
                    String str = '';
                    if (CountDel[i].hospitalSpecialOffer__c) {
                        str = 'isHos';
                    } else {
                        str = 'notHos';
                hasHos = true;
            }
            //add by rentx 2021-3-1 end
            saveBtnDisabled = false;
            SorderBtnDisabled = false;
            String sqlagencyProType = '%' + agencyProType + '%';
            coc = new Consumable_order__c();
            consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
            Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
            //add by rentx 2021-01-29
            Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>();
            //add by rentx 2021-01-29
            List<AggregateResult> orderdetailCount = [
                SELECT count(id), Consumable_Product__c cpc, Box_Piece__c
                FROM Consumable_order_details2__c
                WHERE
                    Dealer_Arrive__c = TRUE
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Lose_Flag__c = FALSE
                    AND Cancellation_Flag__c = FALSE
                    AND Bar_Code__c != NULL
                    AND Isoverdue__c = 1
                    AND Product_Type__c LIKE :sqlagencyProType
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
                GROUP BY Consumable_Product__c, Box_Piece__c
            ];
            for (AggregateResult orderdetail : orderdetailCount) {
                zaikuId.add(String.valueOf(orderdetail.get('cpc')));
            }
            System.debug('sqlagencyProType = ' + sqlagencyProType);
            System.debug('userWorkLocation = ' + userWorkLocation);
            System.debug('accountName = ' + accountName);
            List<Consumable_order_details2__c> CountDel = [
                SELECT
                    Id,
                    Bar_Code__c,
                    Name,
                    Inventory_date__c,
                    Consumable_Product__c,
                    Consumable_Product__r.Asset_Model_No__c,
                    Recordtypeid,
                    Box_Piece__c,
                    ProductPacking_list_manual__c,
                    //add by rentx 2020-11-27 start
                    hospitalSpecialOffer__c
                //add by rentx 2020-11-27 end
                FROM Consumable_order_details2__c
                WHERE
                    Dealer_Arrive__c = TRUE
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Dealer_Returned__c = FALSE
                    AND Lose_Flag__c = FALSE
                    AND Cancellation_Flag__c = FALSE
                    AND Bar_Code__c != NULL
                    AND Isoverdue__c = 1
                    AND Product_Type__c LIKE :sqlagencyProType
                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
                    AND Dealer_Info_text__c = :accountName
            ];
            // 新規
            if (ESetId == null || ESetId == '') {
                SummonsFlag = 'hidden';
                String msoql = makeSoqlinventory();
                initStandardController(msoql);
                System.debug('msoql = ' + msoql);
                product2Selected = Database.query(msoql);
                if (String.isBlank(arriveorder)) {
                    EditDelCommitBtnDisabled = true;
                    for (Integer i = 0; i < product2Selected.size(); i++) {
                        MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                    }
                    //明细2对应的产品存在于MidMap中
                    if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                        //设置map中key的后缀 用于区分医院特价和非医院特价
                        if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                            ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                    for (Integer i = 0; i < CountDel.size(); i++) {
                        String str = '';
                        if (CountDel[i].hospitalSpecialOffer__c) {
                            str = 'isHos';
                        } else {
                            //midmap2中没有对应的产品
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            str = 'notHos';
                        }
                        //明细2对应的产品存在于MidMap中
                        if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                            //设置map中key的后缀 用于区分医院特价和非医院特价
                            if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                                ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                                //midmap2中没有对应的产品
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        }
                        System.debug('MidMap2.size() = ' + MidMap2.size());
                        /*//然后循环CountDel去修改map里的allnumber
                            if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
                                Jstage.allnumber = Jstage.allnumber+1 ;
                                if(CountDel[i].Box_Piece__c == '盒'){
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                }else if(CountDel[i].Box_Piece__c == '个'){
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                }else{
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap.put(CountDel[i].Consumable_Product__c+str, Jstage);
                            }*/
                    }
                    //update by rentx 2021-01-29 end
                    //再把map里的值从新赋给ConsumableorderdetailsRecords
                    //update by rentx 2021-01-29
                    // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                    for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                        //update by rentx 2021-01-29
                        //if(bss.allnumber>0){
                        bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                        bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                        bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                        consumableorderdetailsSelectRecords.add(bss);
                        //}
                    }
                    Integer ishosnum = 0;
                    for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                        //ass.sortBy = sortOrderAsc;
                        //add by rentx 2021-3-10
                        if (ass.hospitalSpecialOffer) {
                            ishosnum = ishosnum + 1;
                        }
                    }
                    System.debug('MidMap2.size() = ' + MidMap2.size());
                    /*//然后循环CountDel去修改map里的allnumber
                        if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
                            Jstage.allnumber = Jstage.allnumber+1 ;
                            if(CountDel[i].Box_Piece__c == '盒'){
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            }else if(CountDel[i].Box_Piece__c == '个'){
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            }else{
                                Jstage.hospitalSpecialOffer = false;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap.put(CountDel[i].Consumable_Product__c+str, Jstage);
                        }*/
                }
                //update by rentx 2021-01-29 end
                //再把map里的值从新赋给ConsumableorderdetailsRecords
                //update by rentx 2021-01-29
                // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                    if (ishosnum > 0) {
                        hasHosPro = true;
                    } else {
                        hasHosPro = false;
                    }
                    consumableorderdetailsSelectRecords.sort();
                    //add by rentx
                    noOfRecords = consumableorderdetailsSelectRecords.size();
                    //add by rentx
                    System.debug('makepagerecords1');
                    makepagerecords();
                    //listCut();
                } else {
                    if (statusEdit == '' || statusEdit == null) {
                        editAble = false;
                    } else if (statusEdit != '' && statusEdit != null) {
                        editAble = true;
                    }
                    // upadte start by vivek 2019-7-15
                    // coc = [SELECT Id,Name,Summons_Order_type__c,SummonsStatus_c__c,Order_ForDealerText__c,
                    //             Dealer_Info__c,Order_ForDealer__c,Order_ForDealer__r.Name,Order_ForDealerTextID__c,
                    //             Order_ForHospital__c,SummonsForDirction__c,Order_date__c,Arrive_Order__c,
                    //             Order_status__c,Shipment_total_amount__c,Offers_Price__c,
                    //             Billed_Status__c,ShipmentAccount__c,Order_Dealer_Info__c,Order_ForCustomerText__c,ConInvoice_Code__c,Onchange_order__c
                    //         FROM Consumable_order__c
                    //         WHERE Id =:arriveorder AND Order_Owner_WorkLocal__c =: userWorkLocation
                    //         AND recordtypeid = :System.Label.RT_ConOrder_Arrive];
                    coc = [
                        SELECT
                            Id,
                            Name,
                            Summons_Order_type__c,
                            NoConfirmedPrice__c,
                            SummonsStatus_c__c,
                            Order_ForDealerText__c,
                            Dealer_Info__c,
                            Order_ForDealer__c,
                            Order_ForDealer__r.Name,
                            Order_ForDealerTextID__c,
                            Order_ForHospital__c,
                            SummonsForDirction__c,
                            Order_date__c,
                            Arrive_Order__c,
                            Order_status__c,
                            Shipment_total_amount__c,
                            Offers_Price__c,
                            Billed_Status__c,
                            ShipmentAccount__c,
                            Order_Dealer_Info__c,
                            Order_ForCustomerText__c,
                            ConInvoice_Code__c,
                            Onchange_order__c,
                            OutPattern__c
                        FROM Consumable_order__c
                        WHERE
                            Id = :arriveorder
                            AND Order_Owner_WorkLocal__c = :userWorkLocation
                            AND recordtypeid = :System.Label.RT_ConOrder_Arrive
                    ];
                    // update end by vivek 2019-7-15
                    //明细1获取
                    consumableorderdetailsSelected = [
                        SELECT
                            Id,
                            Dealer_Custom_Price__c,
                            Delivery_List_RMB__c,
                            Consumable_Product__r.Name__c,
                            Name,
                            Consumable_order__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Shipment_Count__c,
                            Consumable_Product__r.Intra_Trade_List_RMB__c,
                            Consumable_Product__r.Asset_Model_No__c,
                            Sum_of_money__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            Consumable_Product__r.SFDA_Status__c,
                            Consumable_count__c,
                            Invoiced_Procount__c,
                            RrturnPro_count__c,
                            InvoiceProNot_count__c,
                            //Unitprice_To_agency__c,
                            Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                            Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
                        FROM Consumable_Orderdetails__c
                        WHERE Consumable_order__c = :coc.Arrive_Order__c
                        ORDER BY Name
                    ];
                    for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                        orderzaikuId.add(cdc1.Consumable_Product__c);
                    }
                    msoql = makeSoqlorderdet();
                    product2Selected = Database.query(msoql);
                    size = product2Selected.size();
                    initStandardController(msoql);
                    for (Integer i = 0; i < product2Selected.size(); i++) {
                        MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                    }
                    //update by rentx 2021-01-29
                    //if(bss.allnumber>0){
                    bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                    bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                    bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                    consumableorderdetailsSelectRecords.add(bss);
                    //}
                }
                    /*for(Integer i = 0 ; i< CountDel.size();i++){
                            //然后循环CountDel去修改map里的allnumber
                            if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
                                Jstage.allnumber = Jstage.allnumber+1 ;
                                if(CountDel[i].Box_Piece__c == '盒'){
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                }else if(CountDel[i].Box_Piece__c == '个'){
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap.put(CountDel[i].Consumable_Product__c, Jstage);
                            }
                Integer ishosnum = 0;
                for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                    //ass.sortBy = sortOrderAsc;
                    //add by rentx 2021-3-10
                    if (ass.hospitalSpecialOffer) {
                        ishosnum = ishosnum + 1;
                        }*/
                    for (Integer i = 0; i < CountDel.size(); i++) {
                        String str = '';
                        if (CountDel[i].hospitalSpecialOffer__c) {
                            str = 'isHos';
                        } else {
                            str = 'notHos';
                        }
                        //明细2对应的产品存在于MidMap中
                        if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                            //设置map中key的后缀 用于区分医院特价和非医院特价
                            if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                                ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            } else {
                                //midmap2中没有对应的产品
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            }
                        }
                    }
                    //再把map里的值从新赋给ConsumableorderdetailsRecords
                    //update by rentx 2021-01-29
                    // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                    for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                        //update by rentx 2021-01-29
                        bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                        bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                        bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                        consumableorderdetailsSelectRecords.add(bss);
                    }
                    //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test11111' + consumableorderdetailsSelected.size()));
                    //return;
                    Integer ishosnum = 0;
                    for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                        //ass.sortBy = sortOrderAsc;
                        for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                            cdc1.Shipment_Count__c = cdc1.Consumable_count__c;
                            if (ass.prod.Id == cdc1.Consumable_Product__c) {
                                ass.check = true;
                                ass.orderdetails1 = cdc1;
                            }
                        }
                        if (ass.hospitalSpecialOffer == true) {
                            ishosnum = ishosnum + 1;
                        }
                    }
                    if (ishosnum > 0) {
                        hasHosPro = true;
                    } else {
                        hasHosPro = false;
                    }
                    consumableorderdetailsSelectRecords.sort();
                    //add by rentx
                    noOfRecords = consumableorderdetailsSelectRecords.size();
                    //add by rentx
                    System.debug('makepagerecords2');
                    makepagerecords();
                    consumablearriveproductdetailsSelected = [
                        SELECT
                            Id,
                            Name,
                            Intra_Trade_List_RMB__c,
                            Asset_Model_No__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Consumable_Product__r.Name__c,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Sterilization_limit__c,
                            Deliver_date__c,
                            Bar_Code__c,
                            Arrive_date__c,
                            Send_Date__c,
                            Consumable_order_minor__r.Name,
                            Consumable_order_minor__c,
                            Dealer_Arrive__c,
                            Delivery_List_RMB__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            //add by rentx start
                            hospitalSpecialOffer__c
                        //add by rentx end
                        FROM Consumable_order_details2__c
                        WHERE
                            Consumable_order_minor__c = :coc.Arrive_Order__c
                            AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                            AND Dealer_Arrive__c = TRUE
                        ORDER BY Name
                    ];
                    for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
                        if (
                            consumablearriveproductdetailsSelected[i].hospitalSpecialOffer__c &&
                            HosProMap.containsKey(consumablearriveproductdetailsSelected[i].Consumable_product__c)
                        ) {
                            coc.OutPattern__c = true;
                        }
                        consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
                    }
                }
                if (ishosnum > 0) {
                    hasHosPro = true;
                } else {
                    hasHosPro = false;
                }
                consumableorderdetailsSelectRecords.sort();
                //add by rentx
                noOfRecords = consumableorderdetailsSelectRecords.size();
                //add by rentx
                System.debug('makepagerecords1');
                makepagerecords();
                //listCut();
            } else {
                if (statusEdit == '' || statusEdit == null) {
                    editAble = false;
                } else if (statusEdit != '' && statusEdit != null) {
                    editAble = true;
                }
                // upadte start by vivek 2019-7-15
                // coc = [SELECT Id,Name,Summons_Order_type__c,SummonsStatus_c__c,Order_ForDealerText__c,
                //             Dealer_Info__c,Order_ForDealer__c,Order_ForDealer__r.Name,Order_ForDealerTextID__c,
                //             Order_ForHospital__c,SummonsForDirction__c,Order_date__c,Arrive_Order__c,
                //             Order_status__c,Shipment_total_amount__c,Offers_Price__c,
                //             Billed_Status__c,ShipmentAccount__c,Order_Dealer_Info__c,Order_ForCustomerText__c,ConInvoice_Code__c,Onchange_order__c
                //         FROM Consumable_order__c
                //         WHERE Id =:arriveorder AND Order_Owner_WorkLocal__c =: userWorkLocation
                //         AND recordtypeid = :System.Label.RT_ConOrder_Arrive];
                // 更新、
                SummonsFlag = 'visible';
                // update start by vivek 2019-7-15 add “NoConfirmedPrice__c” in select
                consumableInvoiceRecords = [
                    SELECT Id, Name, Invoice_Date__c, NoConfirmedPrice__c, Invoice_total_amount__c, Invoice_status__c
                    FROM Consumable_order__c
                    WHERE
                        Id IN (SELECT Invoice_Code_link__c FROM Consumable_order_LinkTable__c WHERE Outboundorder_Code_link__c = :ESetId)
                        AND Invoice_status__c != '草案中'
                ];
                System.debug('coc ESetId = ' + ESetId);
                System.debug('coc userWorkLocation = ' + userWorkLocation);
                coc = [
                    SELECT
                        Id,
@@ -531,871 +776,632 @@
                        Onchange_order__c,
                        OutPattern__c
                    FROM Consumable_order__c
                    WHERE
                        Id = :arriveorder
                        AND Order_Owner_WorkLocal__c = :userWorkLocation
                        AND recordtypeid = :System.Label.RT_ConOrder_Arrive
                    WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation AND Order_type__c = '传票'
                ];
                // update end by vivek 2019-7-15
                //明细1获取
                consumableorderdetailsSelected = [
                    SELECT
                        Id,
                        Dealer_Custom_Price__c,
                        Delivery_List_RMB__c,
                        Consumable_Product__r.Name__c,
                        Name,
                        Consumable_order__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Shipment_Count__c,
                        Consumable_Product__r.Intra_Trade_List_RMB__c,
                        Consumable_Product__r.Asset_Model_No__c,
                        Sum_of_money__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        Consumable_Product__r.SFDA_Status__c,
                        Consumable_count__c,
                        Invoiced_Procount__c,
                        RrturnPro_count__c,
                        InvoiceProNot_count__c,
                        //Unitprice_To_agency__c,
                        Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                        Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
                    FROM Consumable_Orderdetails__c
                    WHERE Consumable_order__c = :coc.Arrive_Order__c
                    ORDER BY Name
                ];
                for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                    orderzaikuId.add(cdc1.Consumable_Product__c);
                // update start by vivek 2019-7-15
                if (getExistarrive()) {
                    arriveorder = coc.Arrive_Order__c;
                }
                msoql = makeSoqlorderdet();
                product2Selected = Database.query(msoql);
                size = product2Selected.size();
                initStandardController(msoql);
                for (Integer i = 0; i < product2Selected.size(); i++) {
                    MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                }
                //update by rentx 2021-01-29
                /*for(Integer i = 0 ; i< CountDel.size();i++){
                        //然后循环CountDel去修改map里的allnumber
                        if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
                            Jstage.allnumber = Jstage.allnumber+1 ;
                            if(CountDel[i].Box_Piece__c == '盒'){
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            }else if(CountDel[i].Box_Piece__c == '个'){
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap.put(CountDel[i].Consumable_Product__c, Jstage);
                        }
                    }*/
                for (Integer i = 0; i < CountDel.size(); i++) {
                    String str = '';
                    if (CountDel[i].hospitalSpecialOffer__c) {
                        str = 'isHos';
                    } else {
                        str = 'notHos';
                // 到货订单来的时候
                if (getExistarrive()) {
                    if (editAble) {
                        alertMessage = '到货订单直接出库,出库单明细不可编辑';
                    }
                    //明细2对应的产品存在于MidMap中
                    if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                        //设置map中key的后缀 用于区分医院特价和非医院特价
                        if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                            ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        } else {
                            //midmap2中没有对应的产品
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        }
                    if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') {
                        system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
                        saveBtnDisabled = true;
                        SorderBtnDisabled = true;
                        EditDelCommitBtnDisabled = false;
                    }
                }
                    //医院二级经销商分类
                    Integer io = 0;
                    while (io < Dealerelationship.size()) {
                        if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
                            SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
                            coc.Order_ForDealer__c = null;
                            io = io + Dealerelationship.size();
                        }
                        io++;
                    }
                //再把map里的值从新赋给ConsumableorderdetailsRecords
                //update by rentx 2021-01-29
                // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                    //update by rentx 2021-01-29
                    bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                    bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                    bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                    consumableorderdetailsSelectRecords.add(bss);
                }
                //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test11111' + consumableorderdetailsSelected.size()));
                //return;
                    Integer ik = 0;
                    while (ik < AgencyHospitalLink.size()) {
                        if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
                            HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
                            HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
                            coc.Order_ForHospital__c = null;
                            ik = ik + AgencyHospitalLink.size();
                        }
                        ik++;
                    }
                    //出库单明细1取得
                    consumableorderdetailsSelected = [
                        SELECT
                            Id,
                            Dealer_Custom_Price__c,
                            Delivery_List_RMB__c,
                            Consumable_Product__r.Name__c,
                            Consumable_Product__r.SFDA_Status__c,
                            Name,
                            Consumable_order__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Shipment_Count__c,
                            Consumable_Product__r.Intra_Trade_List_RMB__c,
                            Consumable_Product__r.Asset_Model_No__c,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Shipment_amount__c,
                            //Unitprice_To_agency__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            Invoiced_Procount__c,
                            RrturnPro_count__c,
                            InvoiceProNot_count__c,
                            Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                            Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
                            isOutPattern__c
                        FROM Consumable_orderdetails__c
                        WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
                        ORDER BY Name
                    ];
                    Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
                Integer ishosnum = 0;
                for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                    //ass.sortBy = sortOrderAsc;
                    for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                        cdc1.Shipment_Count__c = cdc1.Consumable_count__c;
                        if (ass.prod.Id == cdc1.Consumable_Product__c) {
                            ass.check = true;
                            ass.orderdetails1 = cdc1;
                        sumPrice += cdc1.Shipment_amount__c;
                        orderzaikuId.add(cdc1.Consumable_Product__c);
                        //add by rentx 2021-2-26
                        String tempId = cdc1.Consumable_product__c;
                        if (cdc1.isOutPattern__c) {
                            cocMap.put(tempId + 'ishos', cdc1);
                        } else {
                            cocMap.put(tempId + 'nothos', cdc1);
                        }
                        //add by rentx 2021-2-26
                    }
                    String msoql = makeSoqlorderdet();
                    product2Selected = Database.query(msoql);
                    size = product2Selected.size();
                    initStandardController(msoql);
                    for (Integer i = 0; i < product2Selected.size(); i++) {
                        MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                    }
                    //update by rentx 2021-01-29
                    /*for(Integer i = 0 ; i< CountDel.size();i++){
                            //然后循环CountDel去修改map里的allnumber
                            if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                                ConsumableorderdetailsInfo Jstage =  MidMap.get(CountDel[i].Consumable_Product__c);
                                Jstage.allnumber = Jstage.allnumber+1 ;
                                if(CountDel[i].Box_Piece__c == '盒'){
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                }else if(CountDel[i].Box_Piece__c == '个'){
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap.put(CountDel[i].Consumable_Product__c, Jstage);
                            }
                        }*/
                    for (Integer i = 0; i < CountDel.size(); i++) {
                        String str = '';
                        if (CountDel[i].hospitalSpecialOffer__c) {
                            str = 'isHos';
                        } else {
                            str = 'notHos';
                        }
                        //明细2对应的产品存在于MidMap中
                        if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                            //设置map中key的后缀 用于区分医院特价和非医院特价
                            if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                                ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            } else {
                                //midmap2中没有对应的产品
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            }
                        }
                    }
                    if (ass.hospitalSpecialOffer == true) {
                        ishosnum = ishosnum + 1;
                    }
                }
                if (ishosnum > 0) {
                    hasHosPro = true;
                } else {
                    hasHosPro = false;
                }
                    //update by rentx 2021-01-29
                    consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
                    //再把map里的值从新赋给ConsumableorderdetailsRecords
                    //update by rentx 2021-01-29
                    // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                    for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                        //update by rentx 2021-01-29
                consumableorderdetailsSelectRecords.sort();
                //add by rentx
                noOfRecords = consumableorderdetailsSelectRecords.size();
                //add by rentx
                System.debug('makepagerecords2');
                makepagerecords();
                consumablearriveproductdetailsSelected = [
                    SELECT
                        Id,
                        Name,
                        Intra_Trade_List_RMB__c,
                        Asset_Model_No__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Consumable_Product__r.Name__c,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Sterilization_limit__c,
                        Deliver_date__c,
                        Bar_Code__c,
                        Arrive_date__c,
                        Send_Date__c,
                        Consumable_order_minor__r.Name,
                        Consumable_order_minor__c,
                        Dealer_Arrive__c,
                        Delivery_List_RMB__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        //add by rentx start
                        hospitalSpecialOffer__c
                    //add by rentx end
                    FROM Consumable_order_details2__c
                    WHERE
                        Consumable_order_minor__c = :coc.Arrive_Order__c
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                        AND Dealer_Arrive__c = TRUE
                    ORDER BY Name
                ];
                for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
                    if (
                        consumablearriveproductdetailsSelected[i].hospitalSpecialOffer__c &&
                        HosProMap.containsKey(consumablearriveproductdetailsSelected[i].Consumable_product__c)
                    ) {
                        coc.OutPattern__c = true;
                        //if(bss.allnumber > 0){
                        //bss.UnitpriceToagency = bss.orderdetails1.Unitprice_To_agency__c == null  || bss.orderdetails1.Unitprice_To_agency__c == 0 ? '' :bss.orderdetails1.Unitprice_To_agency__c.format();
                        bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                        bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                        bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                        //update by rentx 2021-2-26 start
                        if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
                            consumableorderdetailsSelectRecords.add(bss);
                        } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
                            consumableorderdetailsSelectRecords.add(bss);
                        }
                        //update by rentx 2021-2-26 end
                        // consumableorderdetailsSelectRecords.add(bss);
                        //}
                    }
                    consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
                    Integer ishosnum = 0;
                    for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                        for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                            //update by rentx 2012-3-1 start
                            // if(ass.prod.Id == cdc1.Consumable_Product__c){
                            //     ass.check = true;
                            //     ass.orderdetails1 = cdc1;
                            // }
                            if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
                                ass.check = true;
                                ass.orderdetails1 = cdc1;
                            }
                            //update by rentx 2012-3-1 end
                        }
                        if (ass.hospitalSpecialOffer == true) {
                            ishosnum = ishosnum + 1;
                        }
                    }
                    if (ishosnum > 0) {
                        hasHosPro = true;
                    } else {
                        hasHosPro = false;
                    }
                    //add by rentx
                    noOfRecords = consumableorderdetailsSelectRecords.size();
                    //add by rentx
                    System.debug('makepagerecords3');
                    makepagerecords();
                    //listCut();
                    // 消耗品明细2を取得
                    consumableorderdetails2RecordsList = [
                        SELECT
                            Id,
                            Name,
                            SerialLotNo__c,
                            Consumable_Product__r.Name__c,
                            TracingCode__c,
                            Sterilization_limit__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Return_date__c,
                            Invoice_Date__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            //add by rentx start
                            hospitalSpecialOffer__c
                        //add by rentx end
                        FROM Consumable_order_details2__c
                        WHERE Consumable_ZS_order__c = :ESetId
                        ORDER BY Name
                    ];
                    for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
                        consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
                    }
                    //产品明细取得
                    consumablearriveproductdetailsSelected = [
                        SELECT
                            Id,
                            Delivery_List_RMB__c,
                            Consumable_Product__r.Name__c,
                            Name,
                            Consumable_Product__r.SFDA_Status__c,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Sterilization_limit__c,
                            Consumable_Product__r.Intra_Trade_List_RMB__c,
                            Consumable_Product__r.Asset_Model_No__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            //add by rentx start
                            hospitalSpecialOffer__c
                        //add by rentx end
                        FROM Consumable_order_details2__c
                        WHERE Consumable_ZS_order__c = :ESetId
                        ORDER BY Name
                    ];
                    for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
                        consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
                    }
                } else {
                    // 不是到货订单来的时候
                    if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') {
                        system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
                        saveBtnDisabled = true;
                        SorderBtnDisabled = true;
                        EditDelCommitBtnDisabled = false;
                    }
                    //医院二级经销商分类
                    Integer io = 0;
                    while (io < Dealerelationship.size()) {
                        if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
                            SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
                            coc.Order_ForDealer__c = null;
                            io = io + Dealerelationship.size();
                        }
                        io++;
                    }
                    Integer ik = 0;
                    while (ik < AgencyHospitalLink.size()) {
                        if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
                            HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
                            HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
                            coc.Order_ForHospital__c = null;
                            ik = ik + AgencyHospitalLink.size();
                        }
                        ik++;
                    }
                    // 消耗品明细1を取得
                    consumableorderdetailsSelected = [
                        SELECT
                            Id,
                            Dealer_Custom_Price__c,
                            Delivery_List_RMB__c,
                            Consumable_Product__r.Name__c,
                            Consumable_Product__r.SFDA_Status__c,
                            Name,
                            Consumable_order__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Shipment_Count__c,
                            Consumable_Product__r.Intra_Trade_List_RMB__c,
                            Consumable_Product__r.Asset_Model_No__c,
                            Shipment_amount__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            Invoiced_Procount__c,
                            RrturnPro_count__c,
                            //Unitprice_To_agency__c,
                            InvoiceProNot_count__c,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                            Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
                            isOutPattern__c
                        FROM Consumable_orderdetails__c
                        WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
                        ORDER BY Name
                    ];
                    //add by rentx 202-2-26
                    Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
                    for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                        sumPrice += cdc1.Shipment_amount__c;
                        orderzaikuId.add(cdc1.Consumable_Product__c);
                        //add by rentx 2021-2-26
                        String tempId = cdc1.Consumable_product__c;
                        if (cdc1.isOutPattern__c) {
                            cocMap.put(tempId + 'ishos', cdc1);
                        } else {
                            cocMap.put(tempId + 'nothos', cdc1);
                        }
                        //add by rentx 2021-2-26
                    }
                    String msoql = makeSoqlorderdet();
                    product2Selected = Database.query(msoql);
                    size = product2Selected.size();
                    initStandardController(msoql);
                    for (Integer i = 0; i < product2Selected.size(); i++) {
                        MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                    }
                    for (Integer i = 0; i < CountDel.size(); i++) {
                        String str = '';
                        if (CountDel[i].hospitalSpecialOffer__c) {
                            str = 'isHos';
                        } else {
                            str = 'notHos';
                        }
                        //明细2对应的产品存在于MidMap中
                        if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                            //设置map中key的后缀 用于区分医院特价和非医院特价
                            if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                                ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            } else {
                                //midmap2中没有对应的产品
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            }
                        }
                    }
                    //再把map里的值从新赋给ConsumableorderdetailsRecords
                    //update by rentx 2021-01-29
                    // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                    for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                        //update by rentx 2021-01-29
                        //if(bss.allnumber>0){
                        bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                        bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                        bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                        //update by rentx 2021-2-26 start
                        if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
                            consumableorderdetailsSelectRecords.add(bss);
                        } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
                            consumableorderdetailsSelectRecords.add(bss);
                        }
                        // consumableorderdetailsSelectRecords.add(bss);
                        //}
                    }
                    // return null;
                    Integer ishosnum = 0;
                    for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                        //ass.sortBy = sortOrderAsc;
                        for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                            //update by rentx 2012-3-1 start
                            // if(ass.prod.Id == cdc1.Consumable_Product__c){
                            //     ass.check = true;
                            //     ass.orderdetails1 = cdc1;
                            // }
                            if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
                                ass.check = true;
                                ass.orderdetails1 = cdc1;
                            }
                            //update by rentx 2012-3-1 end
                        }
                        if (ass.hospitalSpecialOffer == true) {
                            ishosnum = ishosnum + 1;
                        }
                    }
                    if (ishosnum > 0) {
                        hasHosPro = true;
                    } else {
                        hasHosPro = false;
                    }
                    consumableorderdetailsSelectRecords.sort();
                    //add by rentx
                    noOfRecords = consumableorderdetailsSelectRecords.size();
                    //add by rentx
                    System.debug('makepagerecords4');
                    makepagerecords();
                    // 消耗品明细2を取得
                    consumableorderdetails2RecordsList = [
                        SELECT
                            Id,
                            Name,
                            SerialLotNo__c,
                            Consumable_Product__r.Name__c,
                            TracingCode__c,
                            Sterilization_limit__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Return_date__c,
                            Invoice_Date__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            //add by rentx start
                            hospitalSpecialOffer__c
                        //add by rentx end
                        FROM Consumable_order_details2__c
                        WHERE Consumable_ZS_order__c = :ESetId
                        ORDER BY Name
                    ];
                    for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
                        consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
                    }
                }
            }
        } else {
            // 更新、
            SummonsFlag = 'visible';
            // update start by vivek 2019-7-15 add “NoConfirmedPrice__c” in select
            consumableInvoiceRecords = [
                SELECT Id, Name, Invoice_Date__c, NoConfirmedPrice__c, Invoice_total_amount__c, Invoice_status__c
                FROM Consumable_order__c
                WHERE
                    Id IN (SELECT Invoice_Code_link__c FROM Consumable_order_LinkTable__c WHERE Outboundorder_Code_link__c = :ESetId)
                    AND Invoice_status__c != '草案中'
            ];
            System.debug('coc ESetId = ' + ESetId);
            System.debug('coc userWorkLocation = ' + userWorkLocation);
            coc = [
                SELECT
                    Id,
                    Name,
                    Summons_Order_type__c,
                    NoConfirmedPrice__c,
                    SummonsStatus_c__c,
                    Order_ForDealerText__c,
                    Dealer_Info__c,
                    Order_ForDealer__c,
                    Order_ForDealer__r.Name,
                    Order_ForDealerTextID__c,
                    Order_ForHospital__c,
                    SummonsForDirction__c,
                    Order_date__c,
                    Arrive_Order__c,
                    Order_status__c,
                    Shipment_total_amount__c,
                    Offers_Price__c,
                    Billed_Status__c,
                    ShipmentAccount__c,
                    Order_Dealer_Info__c,
                    Order_ForCustomerText__c,
                    ConInvoice_Code__c,
                    Onchange_order__c,
                    OutPattern__c
                FROM Consumable_order__c
                WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation AND Order_type__c = '传票'
            ];
            // update start by vivek 2019-7-15
            if (getExistarrive()) {
                arriveorder = coc.Arrive_Order__c;
            }
            // 到货订单来的时候
            if (getExistarrive()) {
                if (editAble) {
                    alertMessage = '到货订单直接出库,出库单明细不可编辑';
                }
                if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') {
                    system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
                    saveBtnDisabled = true;
                    SorderBtnDisabled = true;
                    EditDelCommitBtnDisabled = false;
                }
                //医院二级经销商分类
                Integer io = 0;
                while (io < Dealerelationship.size()) {
                    if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
                        SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
                        coc.Order_ForDealer__c = null;
                        io = io + Dealerelationship.size();
                    }
                    io++;
                }
                Integer ik = 0;
                while (ik < AgencyHospitalLink.size()) {
                    if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
                        HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
                        HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
                        coc.Order_ForHospital__c = null;
                        ik = ik + AgencyHospitalLink.size();
                    }
                    ik++;
                }
                //出库单明细1取得
                consumableorderdetailsSelected = [
                    SELECT
                        Id,
                        Dealer_Custom_Price__c,
                        Delivery_List_RMB__c,
                        Consumable_Product__r.Name__c,
                        Consumable_Product__r.SFDA_Status__c,
                        Name,
                        Consumable_order__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Shipment_Count__c,
                        Consumable_Product__r.Intra_Trade_List_RMB__c,
                        Consumable_Product__r.Asset_Model_No__c,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Shipment_amount__c,
                        //Unitprice_To_agency__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        Invoiced_Procount__c,
                        RrturnPro_count__c,
                        InvoiceProNot_count__c,
                        Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                        Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
                        isOutPattern__c
                    FROM Consumable_orderdetails__c
                    WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
                    ORDER BY Name
                ];
                Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
                for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                    sumPrice += cdc1.Shipment_amount__c;
                    orderzaikuId.add(cdc1.Consumable_Product__c);
                    //add by rentx 2021-2-26
                    String tempId = cdc1.Consumable_product__c;
                    if (cdc1.isOutPattern__c) {
                        cocMap.put(tempId + 'ishos', cdc1);
                    } else {
                        cocMap.put(tempId + 'nothos', cdc1);
                    }
                    //add by rentx 2021-2-26
                }
                String msoql = makeSoqlorderdet();
                product2Selected = Database.query(msoql);
                size = product2Selected.size();
                initStandardController(msoql);
                for (Integer i = 0; i < product2Selected.size(); i++) {
                    MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                }
                //update by rentx 2021-01-29
                /*for(Integer i = 0 ; i< CountDel.size();i++){
                        //然后循环CountDel去修改map里的allnumber
                        if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                            ConsumableorderdetailsInfo Jstage =  MidMap.get(CountDel[i].Consumable_Product__c);
                            Jstage.allnumber = Jstage.allnumber+1 ;
                            if(CountDel[i].Box_Piece__c == '盒'){
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            }else if(CountDel[i].Box_Piece__c == '个'){
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap.put(CountDel[i].Consumable_Product__c, Jstage);
                        }
                    }*/
                for (Integer i = 0; i < CountDel.size(); i++) {
                    String str = '';
                    if (CountDel[i].hospitalSpecialOffer__c) {
                        str = 'isHos';
                    } else {
                        str = 'notHos';
                    }
                    //明细2对应的产品存在于MidMap中
                    if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                        //设置map中key的后缀 用于区分医院特价和非医院特价
                        if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                            ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        } else {
                            //midmap2中没有对应的产品
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        }
                    }
                }
                //update by rentx 2021-01-29
                consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
                //再把map里的值从新赋给ConsumableorderdetailsRecords
                //update by rentx 2021-01-29
                // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                    //update by rentx 2021-01-29
                    //if(bss.allnumber > 0){
                    //bss.UnitpriceToagency = bss.orderdetails1.Unitprice_To_agency__c == null  || bss.orderdetails1.Unitprice_To_agency__c == 0 ? '' :bss.orderdetails1.Unitprice_To_agency__c.format();
                    bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                    bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                    bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                    //update by rentx 2021-2-26 start
                    if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
                        consumableorderdetailsSelectRecords.add(bss);
                    } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
                        consumableorderdetailsSelectRecords.add(bss);
                    }
                    //update by rentx 2021-2-26 end
                    // consumableorderdetailsSelectRecords.add(bss);
                    //}
                }
                Integer ishosnum = 0;
                for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                    for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                        //update by rentx 2012-3-1 start
                        // if(ass.prod.Id == cdc1.Consumable_Product__c){
                        //     ass.check = true;
                        //     ass.orderdetails1 = cdc1;
                        // }
                        if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
                            ass.check = true;
                            ass.orderdetails1 = cdc1;
                        }
                        //update by rentx 2012-3-1 end
                    }
                    if (ass.hospitalSpecialOffer == true) {
                        ishosnum = ishosnum + 1;
                    }
                }
                if (ishosnum > 0) {
                    hasHosPro = true;
                } else {
                    hasHosPro = false;
                }
                //add by rentx
                noOfRecords = consumableorderdetailsSelectRecords.size();
                //add by rentx
                System.debug('makepagerecords3');
                makepagerecords();
                //listCut();
                // 消耗品明细2を取得
                consumableorderdetails2RecordsList = [
                    SELECT
                        Id,
                        Name,
                        SerialLotNo__c,
                        Consumable_Product__r.Name__c,
                        TracingCode__c,
                        Sterilization_limit__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Return_date__c,
                        Invoice_Date__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        //add by rentx start
                        hospitalSpecialOffer__c
                    //add by rentx end
                    FROM Consumable_order_details2__c
                    WHERE Consumable_ZS_order__c = :ESetId
                    ORDER BY Name
                ];
                for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
                    consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
                }
                //产品明细取得
                consumablearriveproductdetailsSelected = [
                    SELECT
                        Id,
                        Delivery_List_RMB__c,
                        Consumable_Product__r.Name__c,
                        Name,
                        Consumable_Product__r.SFDA_Status__c,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Sterilization_limit__c,
                        Consumable_Product__r.Intra_Trade_List_RMB__c,
                        Consumable_Product__r.Asset_Model_No__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        //add by rentx start
                        hospitalSpecialOffer__c
                    //add by rentx end
                    FROM Consumable_order_details2__c
                    WHERE Consumable_ZS_order__c = :ESetId
                    ORDER BY Name
                ];
                for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
                    consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
            //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test++++++' + SecondDealer));
            if (SecondDealer == null || SecondDealer == '') {
                provinceOpts.add(new SelectOption('', '-无-'));
                provinceOptsMap.put('', '-无-');
                for (Integer i = 0; i < Dealerelationship.size(); i++) {
                    provinceOpts.add(
                        new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                    );
                    provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
                }
            } else {
                // 不是到货订单来的时候
                if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') {
                    system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
                    saveBtnDisabled = true;
                    SorderBtnDisabled = true;
                    EditDelCommitBtnDisabled = false;
                }
                //医院二级经销商分类
                Integer io = 0;
                while (io < Dealerelationship.size()) {
                    if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
                        SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
                        coc.Order_ForDealer__c = null;
                        io = io + Dealerelationship.size();
                    }
                    io++;
                }
                Integer ik = 0;
                while (ik < AgencyHospitalLink.size()) {
                    if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
                        HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
                        HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
                        coc.Order_ForHospital__c = null;
                        ik = ik + AgencyHospitalLink.size();
                    }
                    ik++;
                }
                // 消耗品明细1を取得
                consumableorderdetailsSelected = [
                    SELECT
                        Id,
                        Dealer_Custom_Price__c,
                        Delivery_List_RMB__c,
                        Consumable_Product__r.Name__c,
                        Consumable_Product__r.SFDA_Status__c,
                        Name,
                        Consumable_order__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Shipment_Count__c,
                        Consumable_Product__r.Intra_Trade_List_RMB__c,
                        Consumable_Product__r.Asset_Model_No__c,
                        Shipment_amount__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        Invoiced_Procount__c,
                        RrturnPro_count__c,
                        //Unitprice_To_agency__c,
                        InvoiceProNot_count__c,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                        Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
                        isOutPattern__c
                    FROM Consumable_orderdetails__c
                    WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
                    ORDER BY Name
                ];
                //add by rentx 202-2-26
                Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
                for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                    sumPrice += cdc1.Shipment_amount__c;
                    orderzaikuId.add(cdc1.Consumable_Product__c);
                    //add by rentx 2021-2-26
                    String tempId = cdc1.Consumable_product__c;
                    if (cdc1.isOutPattern__c) {
                        cocMap.put(tempId + 'ishos', cdc1);
                    } else {
                        cocMap.put(tempId + 'nothos', cdc1);
                    }
                    //add by rentx 2021-2-26
                }
                String msoql = makeSoqlorderdet();
                product2Selected = Database.query(msoql);
                size = product2Selected.size();
                initStandardController(msoql);
                for (Integer i = 0; i < product2Selected.size(); i++) {
                    MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                }
                for (Integer i = 0; i < CountDel.size(); i++) {
                    String str = '';
                    if (CountDel[i].hospitalSpecialOffer__c) {
                        str = 'isHos';
                    } else {
                        str = 'notHos';
                    }
                    //明细2对应的产品存在于MidMap中
                    if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                        //设置map中key的后缀 用于区分医院特价和非医院特价
                        if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                            ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        } else {
                            //midmap2中没有对应的产品
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        }
                provinceOpts.add(new SelectOption('', '-无-'));
                provinceOptsMap.put('', '-无-');
                for (Integer i = 0; i < Dealerelationship.size(); i++) {
                    if (Dealerelationship[i].Dealer_subordinate__c == SecondDealer) {
                        provinceOpts.add(
                            new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                        );
                        provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
                    }
                }
                //再把map里的值从新赋给ConsumableorderdetailsRecords
                //update by rentx 2021-01-29
                // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                    //update by rentx 2021-01-29
                    //if(bss.allnumber>0){
                    bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                    bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                    bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                    //update by rentx 2021-2-26 start
                    if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
                        consumableorderdetailsSelectRecords.add(bss);
                    } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
                        consumableorderdetailsSelectRecords.add(bss);
                for (Integer i = 0; i < Dealerelationship.size(); i++) {
                    if (Dealerelationship[i].Dealer_subordinate__c != SecondDealer) {
                        provinceOpts.add(
                            new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                        );
                        provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
                    }
                    // consumableorderdetailsSelectRecords.add(bss);
                    //}
                }
                // return null;
                Integer ishosnum = 0;
                for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                    //ass.sortBy = sortOrderAsc;
                    for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                        //update by rentx 2012-3-1 start
                        // if(ass.prod.Id == cdc1.Consumable_Product__c){
                        //     ass.check = true;
                        //     ass.orderdetails1 = cdc1;
                        // }
                        if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
                            ass.check = true;
                            ass.orderdetails1 = cdc1;
                        }
                        //update by rentx 2012-3-1 end
                    }
                    if (ass.hospitalSpecialOffer == true) {
                        ishosnum = ishosnum + 1;
                    }
                }
                if (ishosnum > 0) {
                    hasHosPro = true;
                } else {
                    hasHosPro = false;
                }
                consumableorderdetailsSelectRecords.sort();
                //add by rentx
                noOfRecords = consumableorderdetailsSelectRecords.size();
                //add by rentx
                System.debug('makepagerecords4');
                makepagerecords();
                // 消耗品明细2を取得
                consumableorderdetails2RecordsList = [
                    SELECT
                        Id,
                        Name,
                        SerialLotNo__c,
                        Consumable_Product__r.Name__c,
                        TracingCode__c,
                        Sterilization_limit__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Return_date__c,
                        Invoice_Date__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        //add by rentx start
                        hospitalSpecialOffer__c
                    //add by rentx end
                    FROM Consumable_order_details2__c
                    WHERE Consumable_ZS_order__c = :ESetId
                    ORDER BY Name
                ];
                for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
                    consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
                }
            }
        }
        //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test++++++' + SecondDealer));
        if (SecondDealer == null || SecondDealer == '') {
            provinceOpts.add(new SelectOption('', '-无-'));
            provinceOptsMap.put('', '-无-');
            for (Integer i = 0; i < Dealerelationship.size(); i++) {
                provinceOpts.add(
                    new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                );
                provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
            }
        } else {
            provinceOpts.add(new SelectOption('', '-无-'));
            provinceOptsMap.put('', '-无-');
            for (Integer i = 0; i < Dealerelationship.size(); i++) {
                if (Dealerelationship[i].Dealer_subordinate__c == SecondDealer) {
                    provinceOpts.add(
                        new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                    );
                    provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
            Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe();
            cansee = dfr.isAccessible();
            Schema.DescribeFieldResult dealerPrice = Consumable_orderdetails__c.Dealer_Custom_Price__c.getDescribe();
            dealerPricesee = dealerPrice.isAccessible();
            // 显示数据条数信息
            //    makeMessage();
            //附件
            attachmentinfo = [SELECT Id, Name, OwnerId FROM Attachment WHERE parentid = :ESetId];
            if (attachmentinfo.size() > 0) {
                for (Integer i = 0; i < attachmentinfo.size(); i++) {
                    attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
                }
            }
            for (Integer i = 0; i < Dealerelationship.size(); i++) {
                if (Dealerelationship[i].Dealer_subordinate__c != SecondDealer) {
                    provinceOpts.add(
                        new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                    );
                    provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
                }
            AggregateResult[] categoryList = [
                SELECT Count(id), Category3_text__c c3c
                FROM Product2__c
                WHERE Category3_text__c != NULL
                GROUP BY Category3_text__c
            ];
            categoryOptionList = new List<SelectOption>();
            categoryOptionList.add(new SelectOption('', '-无-'));
            categoryOptionMap = new Map<String, String>();
            categoryOptionMap.put('', '-无-');
            for (AggregateResult category3Search : categoryList) {
                String deliverycnt = String.valueOf(category3Search.get('c3c'));
                categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
                categoryOptionMap.put(deliverycnt, deliverycnt);
            }
        }
        Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe();
        cansee = dfr.isAccessible();
        Schema.DescribeFieldResult dealerPrice = Consumable_orderdetails__c.Dealer_Custom_Price__c.getDescribe();
        dealerPricesee = dealerPrice.isAccessible();
        // 显示数据条数信息
        //    makeMessage();
        //附件
        attachmentinfo = [SELECT Id, Name, OwnerId FROM Attachment WHERE parentid = :ESetId];
        if (attachmentinfo.size() > 0) {
            for (Integer i = 0; i < attachmentinfo.size(); i++) {
                attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
            category4OptionList = new List<SelectOption>();
            category4OptionList.add(new SelectOption('', '-无-'));
            category4OptionMap = new Map<String, String>();
            category4OptionMap.put('', '-无-');
            /*for(AggregateResult category4Search : category4List) {
                    String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
                    category4OptionList.add(new SelectOption(deliverycnt4,deliverycnt4));
                }*/
            category5OptionList = new List<SelectOption>();
            category5OptionList.add(new SelectOption('', '-无-'));
            category5OptionMap = new Map<String, String>();
            category5OptionMap.put('', '-无-');
            //分页
            PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
            totalCount = pageRecords.size();
            System.debug('pageToken = ' + pageToken);
            System.debug('pageSize = ' + pageSize);
            System.debug('totalCount = ' + totalCount);
            paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
            System.debug('paginatedAccounts.nextPageToken = ' + paginatedAccounts.nextPageToken);
            paginatedAccounts.recordStart = pageToken + 1;
            paginatedAccounts.pageNumber = pageToken / pageSize + 1;
            Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
            paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
            paginatedAccounts.totalRecords = totalCount;
            Integer startIdx;
            Integer endIdx;
            startIdx = pageToken;
            endIdx = pageToken + pageSize;
            List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
            if (endIdx > pageRecords.size()) {
                endIdx = pageRecords.size();
            }
            for (Integer i = startIdx; i < endIdx; i++) {
                pageRecordsTemp.add(pageRecords.get(i));
            }
            Boolean Existarrive = (coc.Arrive_Order__c != null);
            String ConsumableOut_report = System.Label.ConsumableOut_report;
            System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords);
            data.put('paginatedAccounts', paginatedAccounts);
            data.put('ConsumableOut_report', ConsumableOut_report);
            data.put('accountid', accountid);
            data.put('consumableproductdetailsRecords', consumableproductdetailsRecords);
            data.put('agencyProType', agencyProType);
            data.put('accountName', accountName);
            data.put('userWorkLocation', userWorkLocation);
            data.put('categoryOptionMap', categoryOptionMap);
            data.put('category4OptionMap', category4OptionMap);
            data.put('category5OptionMap', category5OptionMap);
            data.put('outOutPatternOptionMap', outOutPatternOptionMap);
            data.put('hasHosPro', hasHosPro);
            data.put('Existarrive', Existarrive);
            data.put('sumPrice', sumPrice);
            data.put('HospitalName', HospitalName);
            data.put('provinceOptsMap', provinceOptsMap);
            data.put('SummonsFlag', SummonsFlag);
            data.put('EditDelCommitBtnDisabled', EditDelCommitBtnDisabled);
            data.put('EditAble', EditAble);
            data.put('coc', coc);
            data.put('pageRecords', pageRecordsTemp);
            data.put('arriveorder', arriveorder);
            data.put('consumableorderdetails2Count', consumableorderdetails2Count);
            data.put('consumableorderdetails2Records', consumableorderdetails2Records);
            data.put('HospitalInfo', HospitalInfo);
            res.status = 'Success';
            res.code = 200;
            System.debug('res = ' + res);
            return res;
        } catch (Exception e) {
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
        }
        AggregateResult[] categoryList = [
            SELECT Count(id), Category3_text__c c3c
            FROM Product2__c
            WHERE Category3_text__c != NULL
            GROUP BY Category3_text__c
        ];
        categoryOptionList = new List<SelectOption>();
        categoryOptionList.add(new SelectOption('', '-无-'));
        categoryOptionMap = new Map<String, String>();
        categoryOptionMap.put('', '-无-');
        for (AggregateResult category3Search : categoryList) {
            String deliverycnt = String.valueOf(category3Search.get('c3c'));
            categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
            categoryOptionMap.put(deliverycnt, deliverycnt);
        }
        category4OptionList = new List<SelectOption>();
        category4OptionList.add(new SelectOption('', '-无-'));
        category4OptionMap = new Map<String, String>();
        category4OptionMap.put('', '-无-');
        /*for(AggregateResult category4Search : category4List) {
                String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
                category4OptionList.add(new SelectOption(deliverycnt4,deliverycnt4));
            }*/
        category5OptionList = new List<SelectOption>();
        category5OptionList.add(new SelectOption('', '-无-'));
        category5OptionMap = new Map<String, String>();
        category5OptionMap.put('', '-无-');
        //分页
        PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
        totalCount = pageRecords.size();
        System.debug('pageToken = ' + pageToken);
        System.debug('pageSize = ' + pageSize);
        System.debug('totalCount = ' + totalCount);
        paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
        System.debug('paginatedAccounts.nextPageToken = ' + paginatedAccounts.nextPageToken);
        paginatedAccounts.recordStart = pageToken + 1;
        paginatedAccounts.pageNumber = pageToken / pageSize + 1;
        Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
        paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
        paginatedAccounts.totalRecords = totalCount;
        Integer startIdx;
        Integer endIdx;
        startIdx = pageToken;
        endIdx = pageToken + pageSize;
        List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
        if (endIdx > pageRecords.size()) {
            endIdx = pageRecords.size();
        }
        for (Integer i = startIdx; i < endIdx; i++) {
            pageRecordsTemp.add(pageRecords.get(i));
        }
        Boolean Existarrive = (coc.Arrive_Order__c != null);
        String ConsumableOut_report = System.Label.ConsumableOut_report;
        System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords);
        data.put('paginatedAccounts', paginatedAccounts);
        data.put('ConsumableOut_report', ConsumableOut_report);
        data.put('accountid', accountid);
        data.put('consumableproductdetailsRecords', consumableproductdetailsRecords);
        data.put('agencyProType', agencyProType);
        data.put('accountName', accountName);
        data.put('userWorkLocation', userWorkLocation);
        data.put('categoryOptionMap', categoryOptionMap);
        data.put('category4OptionMap', category4OptionMap);
        data.put('category5OptionMap', category5OptionMap);
        data.put('outOutPatternOptionMap', outOutPatternOptionMap);
        data.put('hasHosPro', hasHosPro);
        data.put('Existarrive', Existarrive);
        data.put('sumPrice', sumPrice);
        data.put('HospitalName', HospitalName);
        data.put('provinceOptsMap', provinceOptsMap);
        data.put('SummonsFlag', SummonsFlag);
        data.put('EditDelCommitBtnDisabled', EditDelCommitBtnDisabled);
        data.put('EditAble', EditAble);
        data.put('coc', coc);
        data.put('pageRecords', pageRecordsTemp);
        data.put('arriveorder', arriveorder);
        data.put('consumableorderdetails2Count', consumableorderdetails2Count);
        data.put('consumableorderdetails2Records', consumableorderdetails2Records);
        data.put('HospitalInfo', HospitalInfo);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        return res;
        // } catch (Exception e) {
        //     return new ResponseBodyLWC('Error',500, e.getMessage(), '');
        // }
    }
    @AuraEnabled
@@ -1698,6 +1704,7 @@
        data.put('paginatedAccounts', paginatedAccounts);
        data.put('pageRecords', pageRecordsTemp);
        data.put('SearchDone', SearchDone);
        data.put('hasHosPro', hasHosPro);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
@@ -2121,11 +2128,7 @@
                    return new ResponseBodyLWC(
                        'Error',
                        500,
                        '经销商:' +
                        coc.Order_ForDealerText__c +
                        ' 没有消耗品:' +
                        proStr.substring(0, proStr.length() - 1) +
                        ' 的特价',
                        '经销商:' + coc.Order_ForDealerText__c + ' 没有消耗品:' + proStr.substring(0, proStr.length() - 1) + ' 的特价',
                        ''
                    );
                }
@@ -2177,22 +2180,22 @@
            for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
                if (ass.check == true) {
                    if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    if (
                        (ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) &&
                        coc.SummonsForDirction__c != '医院试用'
                    ) {
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (
                        ass.orderdetails1.Delivery_List_RMB__c == 0 &&
                        (coc.SummonsForDirction__c == '销售给二级经销商' ||
                        coc.SummonsForDirction__c == '直接销售给医院')
                    ) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) {
@@ -2217,9 +2220,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2235,9 +2236,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2340,14 +2339,13 @@
            for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
                if (ass.check == true) {
                    if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
                    if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
                    if (
                        (ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) &&
                        coc.SummonsForDirction__c != '医院试用'
                    ) {
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (
@@ -2355,8 +2353,6 @@
                        (coc.SummonsForDirction__c == '销售给二级经销商' ||
                        coc.SummonsForDirction__c == '直接销售给医院')
                    ) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') {
@@ -2375,9 +2371,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2392,9 +2386,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2542,7 +2534,7 @@
        //         FROM Account
        //         WHERE
        //             // Name = '奥林巴斯(北京)销售服务有限公司'
        //             // AND
        //             // AND
        //             Name LIKE :nameCondition
        //             AND RecordType.DeveloperName = 'AgencyContract'
        //             AND Contract_Decide_Start_Date__c >= :thisDatetime
@@ -2558,7 +2550,7 @@
        //         FROM Account
        //         WHERE
        //             // Name = '奥林巴斯(北京)销售服务有限公司'
        //             // AND
        //             // AND
        //             Name LIKE :nameCondition
        //             AND RecordType.DeveloperName = 'AgencyContract'
        //             AND Contract_Decide_Start_Date__c >= :thisDatetime
@@ -2569,7 +2561,6 @@
        //     ];
        // }
        Date today = Date.today();
        //Date today = Date.newInstance(2023, 3, 1);
        Integer thisMonth = today.month();
@@ -2578,7 +2569,7 @@
        Integer lastYear = today.year() - 1;
        Integer thisYear = today.year();
        Integer nextYear = today.year() + 1;
        Date lastDatetime = Date.newInstance(lastYear, 4, 1);
        Date thisDatetime = Date.newInstance(thisYear, 4, 1);
        Date thisDatetime2 = Date.newInstance(thisYear, 7, 1);
@@ -2588,14 +2579,14 @@
        System.debug('thisDatetime2 = ' + thisDatetime2);
        System.debug('nextDatetime = ' + nextDatetime);
        System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
        User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()];
        User UserProTypecTemp = [SELECT UserPro_Type__c FROM User WHERE id = :UserInfo.getUserId()];
        String sql = 'SELECT id, Parentid FROM Account WHERE Parent.Name LIKE :nameCondition ';
        if(thisMonth < 4){
        if (thisMonth < 4) {
            sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :thisDatetime2 ';
        }else if(thisMonth >= 4 && thisMonth <= 6){
        } else if (thisMonth >= 4 && thisMonth <= 6) {
            sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
        }else{
        } else {
            sql += 'AND Contract_Decide_Start_Date__c >= :thisDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
        }
        if (UserProTypecTemp.UserPro_Type__c == 'ENG') {
@@ -2695,6 +2686,20 @@
        return res;
    }
    //删除附件
    @AuraEnabled
    public static ResponseBodyLWC deleteAtt(String contentVersionId) {
        try {
            ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId];
            String contentDocumentId = conVersion.ContentDocumentId;
            ContentDocument conDocument = [SELECT Id FROM ContentDocument WHERE Id = :contentDocumentId];
            delete conDocument;
            return new ResponseBodyLWC('Success', 200, '', '');
        } catch (Exception e) {
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
        }
    }
    //跳转出货/销售
    @AuraEnabled
    public static ResponseBodyLWC GoodsDelivery(
@@ -2770,6 +2775,7 @@
    }
    // Data Bean
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -2910,6 +2916,7 @@
        }
    }
    @TestVisible
    class ConsumableorderdetailsInfoLwc {
        @AuraEnabled
        public Boolean check { get; set; }
force-app/main/default/classes/LexTopPageController.cls
@@ -2,7 +2,7 @@
    //经销商信息
    public static account accountInfo;
    /*****************画面表示Bean******************/
    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords =new List<ConsumableorderdetailsInfo>();
    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
    public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
    //page
    public static Integer pagesize { get; set; }
@@ -17,7 +17,7 @@
    // public static Boolean hasPrevious;
    // public static Boolean hasNext;
    public static List<ConsumableorderdetailsInfo> pageRecords;
    public static String soql {get;set;}
    public static String soql { get; set; }
    // 汇总使用
    public static Integer Total_num;
    public static Integer OrderNumber_arrived;
@@ -39,12 +39,12 @@
    public static List<Consumable_order__c> raesList;
    /*****************一周未到货订单一览对应end******************/
    //排序使用
    private static String[] orderby = new String[]{ 'Product2__c.Name__c'};
    private static String[] orderby = new List<String>{ 'Product2__c.Name__c' };
    //产品上下限
    public static String[] proLimitAndDate =new String[]{};
    public static String[] proLimitAndDate = new List<String>{};
    public static String product_Limit;
    //库存产品最早有效期限
    private static Map<String,Date> productkucun = new Map<String,Date>();
    private static Map<String, Date> productkucun = new Map<String, Date>();
    //消费期限小于一年的产品
    public static List<ConsumableorderdetailsInfo> overlimitdateorderdetails = new List<ConsumableorderdetailsInfo>();
    public static String accountid;
@@ -72,43 +72,60 @@
    public static Boolean hasHos;
    @AuraEnabled
    public static Results initAgency(){
    public static Results initAgency() {
        Results results = new Results();
        results.isNoteStay = LexUtility.getIsNoteStay();
        try {
            User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()];
            User useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
            accountid = useracc.accountid;
            List<Account> accList = new List<Account>();
            accList = [SELECT Name,Ban_On_Use_Reason__c,Deposit_Price__c,
                    Medical_Equipment_Num__c,Medical_Equipment_Expiration_Date__c,
                    Ban_On_Use_Date__c,Tax_Practice_No__c,Tax_Practice_Expiration_Date__c,
                    Business_Authorization_No__c,Business_Paper_Expiration_Date__c,
                    Credit_Check_No__c,Dealer_discount__c,
                    Phone,Address_Together__c,Is_Active_Formula__c,
                    Management_Code__c,Sales_Shop_Class__c,Postal_Code__c,
                    Fax,Address__c,Deposit_Receipt_Finished__c,
            accList = [
                SELECT
                    Name,
                    Ban_On_Use_Reason__c,
                    Deposit_Price__c,
                    Medical_Equipment_Num__c,
                    Medical_Equipment_Expiration_Date__c,
                    Ban_On_Use_Date__c,
                    Tax_Practice_No__c,
                    Tax_Practice_Expiration_Date__c,
                    Business_Authorization_No__c,
                    Business_Paper_Expiration_Date__c,
                    Credit_Check_No__c,
                    Dealer_discount__c,
                    Phone,
                    Address_Together__c,
                    Is_Active_Formula__c,
                    Management_Code__c,
                    Sales_Shop_Class__c,
                    Postal_Code__c,
                    Fax,
                    Address__c,
                    Deposit_Receipt_Finished__c,
                    Deposit_Receipt_Completion_Day__c,
                    Product_Limit_Date__c,
                    Product_Limit_DateENG__c
                    FROM account WHERE id =:accountid];
            if(accList.size() == 1){
                FROM account
                WHERE id = :accountid
            ];
            if (accList.size() == 1) {
                accountInfo = accList[0];
            }else{
            } else {
                results.result = 'Fail';
                results.errorMsg = '未获取到经销商信息';
                return results;
            }
            results.result = 'Success';
            results.accountInfo = accountInfo;
        }catch(Exception e){
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber()+'---'+e.getMessage();
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
        return results;
    }
    @AuraEnabled
    public static Results initPage(Integer pageSizeLWC,Integer pageTokenLWC){
    public static Results initPage(Integer pageSizeLWC, Integer pageTokenLWC) {
        pageSize = pageSizeLWC;
        pageToken = pageTokenLWC;
        Results results = new Results();
@@ -121,91 +138,115 @@
            // pagesize = Integer.valueof(system.label.orderdetLimitsize);
            // currentpage = 0;
            User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:UserInfo.getUserId()];
            User useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
            // String uid = '0051000000E7Pv9AAF';
            // User useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:uid];
            accountid = useracc.accountid;
            userWorkLocation = useracc.Work_Location__c;
            userPro_Type = useracc.UserPro_Type__c;
            if(String.isBlank(userPro_Type)){
            if (String.isBlank(userPro_Type)) {
                userPro_Type = 'ET';
            }
            userPro_Typestr = '%' + userPro_Type + '%';
            if(userPro_Type == 'ENG'){
            if (userPro_Type == 'ENG') {
                EngFlag = true;
            }else{
            } else {
                ETFlag = true;
            }
            //经销商·基本信息获取
            List<Account> accList = new List<Account>();
            accList = [SELECT Name,Ban_On_Use_Reason__c,Deposit_Price__c,
                    Medical_Equipment_Num__c,Medical_Equipment_Expiration_Date__c,
                    Ban_On_Use_Date__c,Tax_Practice_No__c,Tax_Practice_Expiration_Date__c,
                    Business_Authorization_No__c,Business_Paper_Expiration_Date__c,
                    Credit_Check_No__c,Dealer_discount__c,
                    Phone,Address_Together__c,Is_Active_Formula__c,
                    Management_Code__c,Sales_Shop_Class__c,Postal_Code__c,
                    Fax,Address__c,Deposit_Receipt_Finished__c,
            accList = [
                SELECT
                    Name,
                    Ban_On_Use_Reason__c,
                    Deposit_Price__c,
                    Medical_Equipment_Num__c,
                    Medical_Equipment_Expiration_Date__c,
                    Ban_On_Use_Date__c,
                    Tax_Practice_No__c,
                    Tax_Practice_Expiration_Date__c,
                    Business_Authorization_No__c,
                    Business_Paper_Expiration_Date__c,
                    Credit_Check_No__c,
                    Dealer_discount__c,
                    Phone,
                    Address_Together__c,
                    Is_Active_Formula__c,
                    Management_Code__c,
                    Sales_Shop_Class__c,
                    Postal_Code__c,
                    Fax,
                    Address__c,
                    Deposit_Receipt_Finished__c,
                    Deposit_Receipt_Completion_Day__c,
                    Product_Limit_Date__c,
                    Product_Limit_DateENG__c
                    FROM account WHERE id =:accountid];
            if(accList.size() == 1){
                FROM account
                WHERE id = :accountid
            ];
            if (accList.size() == 1) {
                accountInfo = accList[0];
            }else{
            } else {
                results.result = 'Fail';
                results.errorMsg = '未获取到经销商信息';
                return results;
            }
            accountName = accountInfo.Name;
            if(EngFlag){
                product_Limit = accountInfo.Product_Limit_DateENG__c;
            }else if(ETFlag){
            if (EngFlag) {
                product_Limit = accountInfo.Product_Limit_DateENG__c;
            } else if (ETFlag) {
                product_Limit = accountInfo.Product_Limit_Date__c;
            }
            if(product_Limit != null && product_Limit !=''){
            if (product_Limit != null && product_Limit != '') {
                proLimitAndDate = product_Limit.split(',');
            }
            List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
             //库存明细取得
            //库存明细取得
            orderDetZaikuList = new List<String>();
            List<AggregateResult>  orderDetZaiku = [SELECT count(Id),
                                                        Consumable_Product__c
                                                    FROM Consumable_order_details2__c
                                                    WHERE Dealer_Arrive__c = true
                                                    AND Dealer_Shipment__c = false
                                                    AND Dealer_Saled__c = false
                                                    AND Lose_Flag__c = false
                                                    AND Dealer_Returned__c = false
                                                    AND Cancellation_Flag__c = false
                                                    AND Bar_Code__c !=null
                                                    AND Product_Type__c like : userPro_Typestr
                                                    AND Dealer_Info_text__c = :accountName
                                                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
                                                    group by Consumable_Product__c];
            for(AggregateResult zaikuId : orderDetZaiku){
            List<AggregateResult> orderDetZaiku = [
                SELECT count(Id), Consumable_Product__c
                FROM Consumable_order_details2__c
                WHERE
                    Dealer_Arrive__c = TRUE
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Lose_Flag__c = FALSE
                    AND Dealer_Returned__c = FALSE
                    AND Cancellation_Flag__c = FALSE
                    AND Bar_Code__c != NULL
                    AND Product_Type__c LIKE :userPro_Typestr
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
                GROUP BY Consumable_Product__c
            ];
            for (AggregateResult zaikuId : orderDetZaiku) {
                orderDetZaikuList.add(String.valueOf(zaikuId.get('Consumable_Product__c')));
            }
            Map<String,Product2__c> MidMap = new Map<String,Product2__c>();
            List<Product2__c> product2Selected = [SELECT Id, Name,
                                    Name__c,
                                    Asset_Model_No__c,
                                    Category3__c,
                                    Category4__c,
                                    Category5__c,
                                    SFDA_Status__c,
                                    Product2__r.SFDA_Approbation_No__c,
                                    Product2__r.SFDA_Expiration_Date__c,
                                    Product2__r.Packing_list_manual__c
                                FROM Product2__c
                                WHERE Id in :orderDetZaikuList
                                ];
            Map<String, Product2__c> MidMap = new Map<String, Product2__c>();
            List<Product2__c> product2Selected = [
                SELECT
                    Id,
                    Name,
                    Name__c,
                    Asset_Model_No__c,
                    Category3__c,
                    Category4__c,
                    Category5__c,
                    SFDA_Status__c,
                    Product2__r.SFDA_Approbation_No__c,
                    Product2__r.SFDA_Expiration_Date__c,
                    Product2__r.Packing_list_manual__c
                FROM Product2__c
                WHERE Id IN :orderDetZaikuList
            ];
            for (Integer i = 0; i < product2Selected.size(); i++) {
                MidMap.put(product2Selected[i].Id, product2Selected[i]);
            }
            //返品库存统计
            List<Consumable_order_details2__c> CountDel = [SELECT Id,
            List<Consumable_order_details2__c> CountDel = [
                SELECT
                    Id,
                    Bar_Code__c,
                    Name,
                    Inventory_date__c,
@@ -214,78 +255,86 @@
                    Guarantee_period_for_products__c,
                    Isoverdue__c,
                    Box_Piece__c,
                    hospitalSpecialOffer__c
                    hospitalSpecialOffer__c
                FROM Consumable_order_details2__c
                WHERE  Dealer_Arrive__c = true
                AND Dealer_Shipment__c = false
                AND Dealer_Saled__c = false
                AND Dealer_Returned__c = false
                AND Lose_Flag__c = false
                AND Cancellation_Flag__c = false
                AND Bar_Code__c !=null
                AND Product_Type__c like : userPro_Typestr
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c = :userWorkLocation];
            Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
            Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
            Map<String,ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
            Map<String,ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
            for(Integer i = 0 ; i< CountDel.size();i++){
                WHERE
                    Dealer_Arrive__c = TRUE
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Dealer_Returned__c = FALSE
                    AND Lose_Flag__c = FALSE
                    AND Cancellation_Flag__c = FALSE
                    AND Bar_Code__c != NULL
                    AND Product_Type__c LIKE :userPro_Typestr
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
            ];
            Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
            Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
            Map<String, ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
            Map<String, ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
            for (Integer i = 0; i < CountDel.size(); i++) {
                //然后循环CountDel做Box和piece2个map
                if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '盒'){
                if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '盒') {
                    String tex = 'A';
                    if (CountDel[i].hospitalSpecialOffer__c) {
                        tex = 'B';
                    }
                    if(newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex)){
                        ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex).clone();
                        Jstage.allnumber = Jstage.allnumber+1 ;
                        if(CountDel[i].Isoverdue__c == 1){
                    if (newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
                        ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
                                CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex
                            )
                            .clone();
                        Jstage.allnumber = Jstage.allnumber + 1;
                        if (CountDel[i].Isoverdue__c == 1) {
                            Jstage.limitCount = Jstage.limitCount + 1;
                        }
                        Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                        newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
                    }else{
                        newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
                    } else {
                        ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
                        Jstage.allnumber = Jstage.allnumber+1 ;
                        if(CountDel[i].Isoverdue__c == 1){
                        Jstage.allnumber = Jstage.allnumber + 1;
                        if (CountDel[i].Isoverdue__c == 1) {
                            Jstage.limitCount = Jstage.limitCount + 1;
                        }
                        Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                        if (CountDel[i].hospitalSpecialOffer__c) {
                            Jstage.hospitalSpecialOffer = true;
                            newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
                        }else{
                            newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
                        } else {
                            Jstage.hospitalSpecialOffer = false;
                            newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
                            newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
                        }
                    }
                }else if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '个'){
                } else if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '个') {
                    String tex = 'A';
                    if (CountDel[i].hospitalSpecialOffer__c) {
                        tex = 'B';
                    }
                    if(newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex )){
                        ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex).clone();
                        Jstage.allnumber = Jstage.allnumber+1 ;
                        if(CountDel[i].Isoverdue__c == 1){
                    if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
                        ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
                                CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex
                            )
                            .clone();
                        Jstage.allnumber = Jstage.allnumber + 1;
                        if (CountDel[i].Isoverdue__c == 1) {
                            Jstage.limitCount = Jstage.limitCount + 1;
                        }
                        Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                        newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
                    }else{
                        newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
                    } else {
                        ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
                        Jstage.allnumber = Jstage.allnumber+1 ;
                        if(CountDel[i].Isoverdue__c == 1){
                        Jstage.allnumber = Jstage.allnumber + 1;
                        if (CountDel[i].Isoverdue__c == 1) {
                            Jstage.limitCount = Jstage.limitCount + 1;
                        }
                        Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                        if (CountDel[i].hospitalSpecialOffer__c) {
                            Jstage.hospitalSpecialOffer = true;
                            newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex, Jstage);
                        }else{
                            newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
                        } else {
                            Jstage.hospitalSpecialOffer = false;
                            newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c+ tex, Jstage);
                            newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
                        }
                    }
                }
@@ -294,8 +343,8 @@
            consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
            List<ConsumableorderdetailsInfo> newHosMidBoxList = new List<ConsumableorderdetailsInfo>();
            //把Boxmap里的值从新赋给boxRecords
            for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){
                if(bss.allnumber>0){
            for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) {
                if (bss.allnumber > 0) {
                    bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
                    bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                    bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
@@ -304,8 +353,8 @@
                }
            }
            boxRecords.sort();
            for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
                if(bss.allnumber>0){
            for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
                if (bss.allnumber > 0) {
                    bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
                    bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                    bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
@@ -316,31 +365,31 @@
            //add by rentx 2020-11-27 先判断医院特价的盒 和 个
            //2020-11-27 日 于 rentx 注释 start
            String temp = 'A';
            for(ConsumableorderdetailsInfo bss : boxRecords){
            for (ConsumableorderdetailsInfo bss : boxRecords) {
                consumableorderdetailsRecords.add(bss);
                //该产品是医院特价产品
                if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'个B')) {
                    if (newMidPieceMap.get(bss.Prod.Id+'个B').hospitalSpecialOffer) {
                        consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'个B'));
                        newMidPieceMap.remove(bss.Prod.Id+'个B');
                if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '个B')) {
                    if (newMidPieceMap.get(bss.Prod.Id + '个B').hospitalSpecialOffer) {
                        consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B'));
                        newMidPieceMap.remove(bss.Prod.Id + '个B');
                    }
                }
                if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'个A')) {
                if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '个A')) {
                    // if (newMidPieceMap.get(bss.Prod.Id+'个A')) {
                        consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'个A'));
                        newMidPieceMap.remove(bss.Prod.Id+'个A');
                    consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A'));
                    newMidPieceMap.remove(bss.Prod.Id + '个A');
                    // }
                }
            }
            for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
                if (newMidPieceMap.containsKey(bss.Prod.Id+'个B')) {
            for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
                if (newMidPieceMap.containsKey(bss.Prod.Id + '个B')) {
                    consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个B'));
                }
            }
            for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
                if (newMidPieceMap.containsKey(bss.Prod.Id+'个A')) {
            for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
                if (newMidPieceMap.containsKey(bss.Prod.Id + '个A')) {
                    consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '个A'));
                }
            }
@@ -348,25 +397,24 @@
            //2020-11-27 日 于 rentx 注释 end
            // consumableorderdetailsRecords.addAll(newMidPieceMap.values());
            //2020-11-27 日 于 rentx 注释 end
            notarriveorder();
            productLimtAndDate();
            datelimitSearch();
            //add by rentx
            Integer ishos = 0;
            for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){
                if(productkucun.get(bss.Prod.Id) != null){
            for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) {
                if (productkucun.get(bss.Prod.Id) != null) {
                    bss.guaranteeperiod = productkucun.get(bss.Prod.Id);
                }
                //add by rentx 2021-3-10 start
                if (bss.hospitalSpecialOffer) {
                    ishos = ishos+1;
                    ishos = ishos + 1;
                }
            }
            if (ishos > 0) {
                hasHos = true;
            }else{
            } else {
                hasHos = false;
            }
            //add by rentx 2021-3-10 end
@@ -381,28 +429,28 @@
            //总件数
            totalCount = consumableorderdetailsRecords.size();
            //页数
            // pagecount=(totalcount  +  pagesize  - 1) / pagesize;
            // pagecount=(totalcount  +  pagesize  - 1) / pagesize;
            //显示第一页
            // moveToFirst();
            makeCurrentPageRecords();
           //分页
            //分页
            PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
            System.debug('pageToken==>'+ pageToken);
            System.debug('pageSize===>'+ pageSize);
            System.debug('pageToken==>' + pageToken);
            System.debug('pageSize===>' + pageSize);
            paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
            paginatedAccounts.recordStart = pageToken + 1;
            paginatedAccounts.pageNumber = pageToken / pageSize + 1;
            Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
            System.debug('paginatedAccounts.recordStart'+  paginatedAccounts.recordStart);
            System.debug('paginatedAccounts.pageNumber'+  paginatedAccounts.pageNumber);
            System.debug('paginatedAccounts.nextPageToken===>'+paginatedAccounts.nextPageToken);
            System.debug('recordEnd'+ recordEnd);
            System.debug('paginatedAccounts.recordStart' + paginatedAccounts.recordStart);
            System.debug('paginatedAccounts.pageNumber' + paginatedAccounts.pageNumber);
            System.debug('paginatedAccounts.nextPageToken===>' + paginatedAccounts.nextPageToken);
            System.debug('recordEnd' + recordEnd);
            paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
            paginatedAccounts.totalRecords = totalCount;
           //end
           System.debug('PaginatedAccounts===>'+PaginatedAccounts);
            //end
            System.debug('PaginatedAccounts===>' + PaginatedAccounts);
            //赋值回传
            results.result = 'Success';
@@ -421,36 +469,38 @@
            results.deliveryDetailCount = Delivery_detail_count;
            results.orderNumberNotarrive = OrderNumber_notarrive;
            results.moreThanSevenDays = More_than_seven_days;
            //add by WangXueqin 2023/05/05
            //add by WangXueqin 2023/05/05
            results.userPro_Type = userPro_Type;
            results.paginatedAccounts = paginatedAccounts;
        } catch (Exception e) {
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber()+'---'+e.getMessage();
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
        return results;
    }
    //超过一周未到货订单
    public static void notarriveorder(){
    public static void notarriveorder() {
        //over_view = false;
        Date orderdate = Date.today().addDays(-7);
        List<Consumable_order_details2__c> orderdetails = [SELECT Id,Name,Consumable_order_minor__c
                                                            FROM Consumable_order_details2__c
                                                            WHERE Deliver_date__c < :orderdate
                                                            and Consumable_order_minor__c !=null
                                                            and Dealer_Info_text__c = :accountName
                                                            AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                                                            AND Dealer_Arrive__c = false
                                                            ];
        List<Consumable_order_details2__c> orderdetails = [
            SELECT Id, Name, Consumable_order_minor__c
            FROM Consumable_order_details2__c
            WHERE
                Deliver_date__c < :orderdate
                AND Consumable_order_minor__c != NULL
                AND Dealer_Info_text__c = :accountName
                AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                AND Dealer_Arrive__c = FALSE
        ];
        //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO , 'userPro_Type——————' + userPro_Type));
        Map<String, String> notarriveorderMap = new Map<String, String>();
        List<String> notarriveorderid = new List<String>();
        for(Integer i = 0; i < orderdetails.size(); i++){
            if(notarriveorderMap.containsKey(orderdetails[i].Consumable_order_minor__c)){
        for (Integer i = 0; i < orderdetails.size(); i++) {
            if (notarriveorderMap.containsKey(orderdetails[i].Consumable_order_minor__c)) {
                continue;
            }else{
            } else {
                notarriveorderMap.put(orderdetails[i].Consumable_order_minor__c, orderdetails[i].Consumable_order_minor__c);
                //notarriveorderid.add('\'' + orderdetails[i].Consumable_order_minor__c +'\'');
                notarriveorderid.add(orderdetails[i].Consumable_order_minor__c);
@@ -470,115 +520,137 @@
            column.add(fsm.getFieldPath());
            columns.add(fsm.getFieldPath().split('\\.'));
        }
        system.debug('columns=====================>'+columns);
        system.debug('columns=====================>' + columns);
        // 获得显示数据
        raesList = new List<Consumable_order__c>();
        String soql = 'select Id';
        for (String s : column) {
            soql += ',' + s;
        }
        soql += ' from Consumable_order__c where Order_type__c = \''+'订单'+'\' and  recordtypeid =\'' + System.Label.RT_ConOrder_Delivery + '\' and Dealer_Info__c =\'' + accountid +'\'  and  Delivery_detail_count__c > 0 and showFalseNotshowTrue__c = false  ';
        soql += ' and Order_ProType__c = \'' + userPro_Type  + '\' ' ;
        soql +=
            ' from Consumable_order__c where Order_type__c = \'' +
            '订单' +
            '\' and  recordtypeid =\'' +
            System.Label.RT_ConOrder_Delivery +
            '\' and Dealer_Info__c =\'' +
            accountid +
            '\'  and  Delivery_detail_count__c > 0 and showFalseNotshowTrue__c = false  ';
        soql += ' and Order_ProType__c = \'' + userPro_Type + '\' ';
        soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
        if(notarriveorderid.size() < 1){
            soql +=' AND Id = null ';
        }else{
        if (notarriveorderid.size() < 1) {
            soql += ' AND Id = null ';
        } else {
            String sqlTail = '(\'';
            for(Integer i = 0 ; i< notarriveorderid.size();i++){
                if(i<notarriveorderid.size()-1){
                    sqlTail += notarriveorderid[i]+'\',\'';
                }else{
                    sqlTail += notarriveorderid[i]+'\')';
            for (Integer i = 0; i < notarriveorderid.size(); i++) {
                if (i < notarriveorderid.size() - 1) {
                    sqlTail += notarriveorderid[i] + '\',\'';
                } else {
                    sqlTail += notarriveorderid[i] + '\')';
                }
            }
            //over_view = true;
            soql +=' AND Id in ' + sqlTail;
            soql += ' AND Id in ' + sqlTail;
        }
        system.debug('soql_____11111__' + soql);
        raesList = Database.query(soql);
        // update end by vivek2020-01-15
        // update end by vivek2020-01-15
        Total_num = 0;
        OrderNumber_arrived = 0;
        Delivery_detail_count = 0;
        OrderNumber_notarrive = 0;
        More_than_seven_days = 0;
        for(Consumable_order__c conorder :raesList){
            Total_num += (Integer)conorder.Total_num__c;
            OrderNumber_arrived += (Integer)conorder.OrderNumber_arrived__c;
            Delivery_detail_count += (Integer)conorder.Delivery_detail_count__c;
            OrderNumber_notarrive += (Integer)conorder.OrderNumber_notarrive__c;
            More_than_seven_days += (Integer)conorder.More_than_seven_days__c;
        for (Consumable_order__c conorder : raesList) {
            Total_num += (Integer) conorder.Total_num__c;
            OrderNumber_arrived += (Integer) conorder.OrderNumber_arrived__c;
            Delivery_detail_count += (Integer) conorder.Delivery_detail_count__c;
            OrderNumber_notarrive += (Integer) conorder.OrderNumber_notarrive__c;
            More_than_seven_days += (Integer) conorder.More_than_seven_days__c;
        }
        // update end by vivek2020-01-15
    }
    public static void productLimtAndDate(){
    public static void productLimtAndDate() {
        String nowName = null, nowRightAsstModelNo = null;
        Map<String,String> productLimt = new Map<String,String>();
        for(Integer i = 0; i < proLimitAndDate.size(); i++){
        Map<String, String> productLimt = new Map<String, String>();
        for (Integer i = 0; i < proLimitAndDate.size(); i++) {
            nowName = proLimitAndDate[i];
            if( nowName.indexOf( '|') >= 0) {
                nowRightAsstModelNo = nowName.subString( 0, nowName.indexOf( '|'));
                nowName = nowName.subString( nowName.indexOf( '|')+1);
            if (nowName.indexOf('|') >= 0) {
                nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
                nowName = nowName.subString(nowName.indexOf('|') + 1);
            }
            productLimt.put(nowRightAsstModelNo, nowName);
        }
        for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
            if(productLimt.containsKey(ass.Prod.Asset_Model_No__c)){
                ass.lowerlimit = decimal.valueOf(productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf( '|')));
                ass.upperlimit = decimal.valueOf(productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf( '|')+1));
           }
        for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
            if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) {
                ass.lowerlimit = decimal.valueOf(
                    productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|'))
                );
                ass.upperlimit = decimal.valueOf(
                    productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1)
                );
            }
        }
    }
    public static void datelimitSearch(){
    public static void datelimitSearch() {
        Set<String> barcodekucun = new Set<String>();
        //--------UpdateStart-----XHL--------------20180929-------------
         List<Consumable_order_details2__c> orderkucun = [SELECT Id,Bar_Code__c, Name,Consumable_Product__c,
                                                        Recordtypeid,Guarantee_period_for_products__c,
                                                        Sterilization_limit__c,Box_Piece__c
                                                        FROM Consumable_order_details2__c
                                                        WHERE Dealer_Arrive__c = true
                                                        AND Dealer_Shipment__c = false
                                                        AND Dealer_Saled__c = false
                                                        AND Dealer_Returned__c = false
                                                        AND Lose_Flag__c = false
                                                        AND Bar_Code__c !=null
                                                        AND Product_Type__c like :userPro_Typestr
                                                        AND Dealer_Info_text__c = :accountName
                                                        AND Arrive_Owner_Work_Location__c = :userWorkLocation
                                                        ORDER BY Consumable_Product__c, Sterilization_limit__c asc ];
        List<Consumable_order_details2__c> orderkucun = [
            SELECT
                Id,
                Bar_Code__c,
                Name,
                Consumable_Product__c,
                Recordtypeid,
                Guarantee_period_for_products__c,
                Sterilization_limit__c,
                Box_Piece__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :userPro_Typestr
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
            ORDER BY Consumable_Product__c, Sterilization_limit__c ASC
        ];
        //--------UpdateEnd-----XHL--------------20180929-------------
        for(Integer i = 0 ; i< orderkucun.size();i++){
            if(productkucun.containsKey(orderkucun[i].Consumable_Product__c)){
        for (Integer i = 0; i < orderkucun.size(); i++) {
            if (productkucun.containsKey(orderkucun[i].Consumable_Product__c)) {
                continue;
            }else{
            } else {
                productkucun.put(orderkucun[i].Consumable_Product__c, orderkucun[i].Sterilization_limit__c);
            }
        }
        barcodekucun.clear();
        for(Integer i = 0 ; i< orderkucun.size();i++){
            if(orderkucun[i].Sterilization_limit__c < Date.today().addYears(1)){
                if(barcodekucun.contains(orderkucun[i].Bar_Code__c)){
        for (Integer i = 0; i < orderkucun.size(); i++) {
            if (orderkucun[i].Sterilization_limit__c < Date.today().addYears(1)) {
                if (barcodekucun.contains(orderkucun[i].Bar_Code__c)) {
                    continue;
                }else{
                } else {
                    barcodekucun.add(orderkucun[i].Bar_Code__c);
                }
            }
        }
        List<AggregateResult>  overlimitdatedetails = [SELECT Asset_Model_No__c prodName ,
                                            Box_Piece__c BoxPiece,count(id) countid
                                        FROM Consumable_order_details2__c
                                        WHERE Bar_Code__c in :barcodekucun
                                        AND Dealer_Arrive__c = true
                                        AND Dealer_Shipment__c = false
                                        AND Dealer_Saled__c = false
                                        AND Dealer_Returned__c = false
                                        AND Lose_Flag__c = false
                                        GROUP BY Asset_Model_No__c,Box_Piece__c
                                        ORDER BY Asset_Model_No__c,Box_Piece__c];
        for(Integer i = 0 ; i< overlimitdatedetails.size();i++){
        List<AggregateResult> overlimitdatedetails = [
            SELECT Asset_Model_No__c prodName, Box_Piece__c BoxPiece, count(id) countid
            FROM Consumable_order_details2__c
            WHERE
                Bar_Code__c IN :barcodekucun
                AND Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
            GROUP BY Asset_Model_No__c, Box_Piece__c
            ORDER BY Asset_Model_No__c, Box_Piece__c
        ];
        for (Integer i = 0; i < overlimitdatedetails.size(); i++) {
            overlimitdateorderdetails.add(new ConsumableorderdetailsInfo(overlimitdatedetails[i]));
        }
    }
@@ -599,7 +671,7 @@
    // }
    //编辑当前页内容
    public static void makeCurrentPageRecords(){
    public static void makeCurrentPageRecords() {
        Integer startIdx;
        Integer endIdx;
        pageRecords = new List<ConsumableorderdetailsInfo>();
@@ -661,7 +733,7 @@
        @AuraEnabled
        public String BoxPiece { get; set; }
        @AuraEnabled
        public Boolean hospitalSpecialOffer { get; set ;}
        public Boolean hospitalSpecialOffer { get; set; }
        public ConsumableorderdetailsInfo(Product2__c e) {
            //check = false;
@@ -672,18 +744,17 @@
            allnumber = 0;
            limitCount = 0;
            overlimitCount = 0;
        }
        public ConsumableorderdetailsInfo(AggregateResult e) {
            countid =Integer.valueOf(e.get('countid'));
            countid = Integer.valueOf(e.get('countid'));
            prodName = String.valueOf(e.get('prodname'));
            BoxPiece = String.valueOf(e.get('BoxPiece'));
        }
        // 排序
        public Integer compareTo(Object compareTo) {
            ConsumableorderdetailsInfo compareToesd =(ConsumableorderdetailsInfo)compareTo;
            ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo;
            Integer returnValue = 0;
            if (allnumber > compareToesd.allnumber) {
                returnValue = -1;
@@ -738,7 +809,5 @@
        public List<ConsumableorderdetailsInfo> pageCodeRecords;
        @AuraEnabled
        public PaginatedAccounts paginatedAccounts;
    }
}
force-app/main/default/classes/LexUpAccountProLimit.cls
@@ -1,57 +1,55 @@
public without sharing class LexUpAccountProLimit {
    @AuraEnabled
    public static ResponseBodyLWC upAccount(String accountId,String productLimit,String userPro_Type){
    public static ResponseBodyLWC upAccount(String accountId, String productLimit, String userPro_Type) {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String,object> data = new Map<String,object>();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        //--------AddStart-----XHL--------------20180929-------------
        Boolean EngFlag = false;
        Boolean ETFlag = false;
        String userPro_Typestr = null;
        if(String.isBlank(userPro_Type)){
        Boolean ETFlag = false;
        String userPro_Typestr = null;
        if (String.isBlank(userPro_Type)) {
            userPro_Type = 'ET';
        }
        if(userPro_Type == 'ENG'){
        if (userPro_Type == 'ENG') {
            EngFlag = true;
        }else{
        } else {
            ETFlag = true;
        }
        //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type));
        //ApexPages.message(ApexPages.severity.ERROR,'userPro_Type:'+ userPro_Type));
        userPro_Typestr = '%' + userPro_Type + '%';
        //--------AddEnd-----XHL--------------20180929-------------
        //--------AddEnd-----XHL--------------20180929-------------
        system.debug('userPro_Type' + userPro_Type);
        String checkResoultstr =  checkResoult(productLimit);
        system.debug('checkResoultstr====>'+checkResoultstr);
        if(String.isNotBlank(checkResoultstr)){
            return new ResponseBodyLWC('Error',500,''+checkResoultstr+'', '');
        String checkResoultstr = checkResoult(productLimit);
        system.debug('checkResoultstr====>' + checkResoultstr);
        if (String.isNotBlank(checkResoultstr)) {
            return new ResponseBodyLWC('Error', 500, '' + checkResoultstr + '', '');
            // return checkResoultstr;
        }
        //String[] proidList =new String[]{};
        String[] proList =new String[]{};
        String[] pro_List =new String[]{};
        String[] proList = new List<String>{};
        String[] pro_List = new List<String>{};
        List<Account> acc = [
            SELECT
                    Id,
                    Name,
                    Product_Limit_Date__c
            FROM
                    Account
            WHERE
                    Id = : accountId
            SELECT Id, Name, Product_Limit_Date__c
            FROM Account
            WHERE Id = :accountId
            FOR UPDATE
        ];
        if(null == acc || acc.size() == 0) {
        if (null == acc || acc.size() == 0) {
            // return '没有经销商:' + accountId + '的数据。';
            return new ResponseBodyLWC('Error',500,'没有经销商:' + accountId + '的数据。', '');
            return new ResponseBodyLWC('Error', 500, '没有经销商:' + accountId + '的数据。', '');
        }
        //proidList = acc[0].view_product__c.split(',');
        //--------UpdateStart-----XHL--------------20180929-------------
        String sql = '';
        List<Product2__c> roduct2List = [SELECT Asset_Model_No__c
                                          FROM Product2__c
                                          WHERE Product_Type__c like :userPro_Typestr];
        List<Product2__c> roduct2List = [
            SELECT Asset_Model_No__c, Estimation_Entry_Possibility__c
            FROM Product2__c
            WHERE Product_Type__c LIKE :userPro_Typestr AND Estimation_Entry_Possibility__c = '○'
        ]; //Add  by WangXueqin 20230605
        //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'roduct2List:'+ roduct2List));
        //sql = 'SELECT Asset_Model_No__c '
        //    + ' FROM Product2__c '
@@ -59,84 +57,83 @@
        //if(EngFlag){
        //   sql += ' AND Pro2_Dealer_ENG__c =' + EngFlag ;
        //}else if(ETFlag){
        //   sql += ' AND Pro2_Dealer_Object__c = ' + ETFlag;
        //   sql += ' AND Pro2_Dealer_Object__c = ' + ETFlag;
        //}
        //system.debug('sqlZZZZZZ' + sql);
        //List<Product2__c> roduct2List = Database.query(sql);
        //List<Product2__c> roduct2List = Database.query(sql);
        //--------UpdateEnd-----XHL--------------20180929-------------
        Map<String, String> productMap = new Map<String, String>();
        proList = productLimit.split(',');
        system.debug('productLimitDDDDD' + productLimit);
        system.debug('proListFFFFF' + proList);
        if(proList.size() > 0 &&  String.isNotEmpty(proList[0])){
            for(Integer i = 0; i < proList.size(); i++){
                pro_List.add(proList[i].subString(0,proList[i].indexOf( '|')));
        if (proList.size() > 0 && String.isNotEmpty(proList[0])) {
            for (Integer i = 0; i < proList.size(); i++) {
                pro_List.add(proList[i].subString(0, proList[i].indexOf('|')));
            }
        }
        if(roduct2List.size() > 0){
            for(Product2__c pro2 :roduct2List){
        if (roduct2List.size() > 0) {
            for (Product2__c pro2 : roduct2List) {
                productMap.put(pro2.Asset_Model_No__c, pro2.Asset_Model_No__c);
            }
        }
        for(Integer i = 0; i < pro_List.size(); i++){
            if(!productMap.containsKey(pro_List[i])){
        for (Integer i = 0; i < pro_List.size(); i++) {
            if (!productMap.containsKey(pro_List[i])) {
                // return '经销商没有 ' + pro_List[i] + ' 的产品上限设定权限,或产品不存在!';
                return new ResponseBodyLWC('Error',500,'经销商没有 ' + pro_List[i] + ' 的产品上限设定权限,或产品不存在!', '');
                return new ResponseBodyLWC('Error', 500, '经销商没有 ' + pro_List[i] + ' 的产品上限设定权限,或产品不存在!', '');
            }
        }
        String  productLimitDa = '';
        for(String str : productLimit.split(',')){
            if(str != null && str != ''){
        String productLimitDa = '';
        for (String str : productLimit.split(',')) {
            if (str != null && str != '') {
                productLimitDa += ',' + str;
            }
        }
        }
        Savepoint sp = Database.setSavepoint();
        try{
        try {
            Account accinfo = new Account();
            accinfo.Id = accountId;
            if(EngFlag){
               accinfo.Product_Limit_DateENG__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1);
            }else if(ETFlag){
               accinfo.Product_Limit_Date__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1);
            if (EngFlag) {
                accinfo.Product_Limit_DateENG__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1);
            } else if (ETFlag) {
                accinfo.Product_Limit_Date__c = String.isBlank(productLimitDa) ? productLimitDa : productLimitDa.subString(1);
            }
            UPDATE accinfo;
            update accinfo;
            res.status = 'Success';
            res.code = 200;
            System.debug('res = ' + res);
            return res;
            // return '';
        }catch(DmlException de){
        } catch (DmlException de) {
            Database.rollback(sp);
            throw de;
        }
        }
    }
    public static String checkResoult (String productLimit){
    public static String checkResoult(String productLimit) {
        String[] proLimit = productLimit.split(',');
        String nowName = null, nowRightAsstModelNo = null;
        List<String> asstModelNo = new List<String>();
        Map<String,String> asstModelNoMap = new Map<String,String>();
        Map<String, String> asstModelNoMap = new Map<String, String>();
        List<String> asstModelNoCount = new List<String>();
        for(Integer i = 0; i < proLimit.size(); i++){
        for (Integer i = 0; i < proLimit.size(); i++) {
            nowName = proLimit[i];
            if( nowName.indexOf( '|') >= 0) {
                nowRightAsstModelNo = nowName.subString( 0, nowName.indexOf( '|'));
            if (nowName.indexOf('|') >= 0) {
                nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
            }
            asstModelNo.add(nowRightAsstModelNo);
        }
        for(Integer i = 0; i < asstModelNo.size(); i++){
            if(asstModelNoMap.containsKey(asstModelNo[i])){
        for (Integer i = 0; i < asstModelNo.size(); i++) {
            if (asstModelNoMap.containsKey(asstModelNo[i])) {
                asstModelNoCount.add(asstModelNo[i]);
            }else{
            } else {
                asstModelNoMap.put(asstModelNo[i], asstModelNo[i]);
            }
        }
        if(asstModelNoCount.size() > 0){
        if (asstModelNoCount.size() > 0) {
            return '产品:' + asstModelNoCount + '的数据重复。';
            // return new ResponseBodyLWC('Error',500,'产品:' + asstModelNoCount + '的数据重复。', '');
        }else{
        } else {
            return '';
        }
    }
force-app/main/default/classes/LexUtility.cls
@@ -1,13 +1,12 @@
public without sharing class LexUtility {
    //查询是否一直显示提示
    public static Boolean getIsNoteStay(){
    public static Boolean getIsNoteStay() {
        NoteStay__c noteStay = NoteStay__c.getInstance('NoteStay');
        return noteStay.IsStay__c;
    }
    //查询许可证提醒天数
    public static Integer getLicenceReminderDays(){
    public static Integer getLicenceReminderDays() {
        LicenceReminderDate__c days = LicenceReminderDate__c.getInstance('180Days');
        return days.ReminderDays__c.intValue();
    }
force-app/main/default/classes/LookupSearchResult.cls
@@ -55,7 +55,6 @@
    /**
     * Allow to sort search results based on title
     */
    @TestVisible
    public Integer compareTo(Object compareTo) {
        LookupSearchResult other = (LookupSearchResult) compareTo;
        if (this.getTitle() == null) {
force-app/main/default/classes/ResponseBodyLWC.cls
@@ -1,24 +1,25 @@
public class ResponseBodyLWC {
    @AuraEnabled
    public String status{get;set;}
    public String status { get; set; }
    @AuraEnabled
    public Integer code{get;set;}
    public Integer code { get; set; }
    @AuraEnabled
    public String msg{get;set;}
    public String msg { get; set; }
    @AuraEnabled
    public Object entity{get;set;}
    public Object entity { get; set; }
    @AuraEnabled
    public List<Object> entityList{get;set;}
    public ResponseBodyLWC(){}
    public ResponseBodyLWC(String status,Integer code, String msg, Object entity){
    public List<Object> entityList { get; set; }
    public ResponseBodyLWC() {
    }
    public ResponseBodyLWC(String status, Integer code, String msg, Object entity) {
        this.status = status;
        this.code = code;
        this.msg = msg;
        this.entity = entity;
    }
    public ResponseBodyLWC(String status,Integer code, String msg, List<Object> entityList){
    public ResponseBodyLWC(String status, Integer code, String msg, List<Object> entityList) {
        this.status = status;
        this.code = code;
        this.msg = msg;
force-app/main/default/classes/lexSearchAgencyHospitalController.cls
@@ -1,28 +1,32 @@
public without sharing class lexSearchAgencyHospitalController {
    //经销商用户产品分类(ET、ENG)
    public static String agencyProType {get;set;}
    public static String searchName {get;set;}
    public static String agencyProType { get; set; }
    public static String searchName { get; set; }
    private static String accountid = null;
    @AuraEnabled
    public static List<Account> at {get;set;}
    public static List<Account> at { get; set; }
    @AuraEnabled
    public static ResponseBodyLWC init(String ctype){
    public static ResponseBodyLWC init(String ctype) {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        User useracc = [SELECT accountid,UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId() ];
        User useracc = [SELECT accountid, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
        accountid = Useracc.accountid;
        agencyProType = Useracc.UserPro_Type__c;
        if(String.isBlank(Useracc.UserPro_Type__c)){
        if (String.isBlank(Useracc.UserPro_Type__c)) {
            agencyProType = 'ET';
        }
        String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name FROM Account';
        soql += ' where id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c = \'' + accountid + '\' AND Hosptial_Type__c like \'%' + String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) + '%\')' ;
        soql +=
            ' where id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c = \'' +
            accountid +
            '\' AND Hosptial_Type__c like \'%' +
            String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) +
            '%\')';
        soql += ' order by Name desc limit 100';
        at = Database.query(soql);
        data.put('at',at);
        data.put('at', at);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
@@ -30,25 +34,29 @@
    }
    @AuraEnabled
    public static ResponseBodyLWC serContact(String searchName,String ctype){
    public static ResponseBodyLWC serContact(String searchName, String ctype) {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        User useracc = [SELECT accountid,UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId() ];
        User useracc = [SELECT accountid, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
        accountid = Useracc.accountid;
        at = Database.query(makeSoql(searchName,accountid,ctype));
        data.put('at',at);
        at = Database.query(makeSoql(searchName, accountid, ctype));
        data.put('at', at);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        return res;
    }
    private static String makeSoql(String searchName,String accountid,String ctype){
    private static String makeSoql(String searchName, String accountid, String ctype) {
        String soql = 'SELECT id,Name,State_Master__c,State_Master__r.Name FROM Account';
        soql += ' where id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c = \'' + accountid + '\' AND Hosptial_Type__c like \'%' + String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) + '%\')' ;
        if(String.isNotBlank(searchName)){
        soql +=
            ' where id in (SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE Agency__c = \'' +
            accountid +
            '\' AND Hosptial_Type__c like \'%' +
            String.escapeSingleQuotes(ctype.replaceAll('%', '\\%')) +
            '%\')';
        if (String.isNotBlank(searchName)) {
            soql += ' AND Name like \'%' + String.escapeSingleQuotes(searchName.replaceAll('%', '\\%')) + '%\'';
        }
        soql += ' order by Name desc limit 100';
force-app/main/default/lwc/boxorpieceType/boxorpieceType.html
@@ -1,10 +1,11 @@
<template>
    <lightning-combobox
            name="progress"
            label="Status"
            value={value}
            placeholder="请选择单位"
            options={options}
            onchange={handleChange} >
        </lightning-combobox>
        name="progress"
        label="Status"
        value={value}
        placeholder="请选择单位"
        options={options}
        onchange={handleChange}
    >
    </lightning-combobox>
</template>
force-app/main/default/lwc/boxorpieceType/boxorpieceType.js
@@ -1,4 +1,4 @@
import { LightningElement,api } from 'lwc';
import { LightningElement, api } from 'lwc';
export default class BoxorpieceType extends LightningElement {
    value = '盒';
@@ -11,8 +11,8 @@
        ];
    }
    connectedCallback(){
        console.log('enter BoxorpieceType')
    connectedCallback() {
        console.log('enter BoxorpieceType');
    }
    handleChange(event) {
force-app/main/default/lwc/commonToast/commonToast.html
@@ -4,7 +4,13 @@
            <div class={outerClass} role="status">
                <span class="slds-assistive-text">{type}</span>
                <span class={innerClass} title={message}>
                    <lightning-icon icon-name={getIconName} alternative-text="icon" styleclass="slds-icon slds-icon_small" variant="inverse" size="small"></lightning-icon>
                    <lightning-icon
                        icon-name={getIconName}
                        alternative-text="icon"
                        styleclass="slds-icon slds-icon_small"
                        variant="inverse"
                        size="small"
                    ></lightning-icon>
                </span>
                <div class="slds-notify__content">
                    <h2 class="slds-text-heading_small">
@@ -12,9 +18,16 @@
                        </lightning-formatted-rich-text>
                    </h2>
                </div>
                <div class="slds-notify__close">
                    <lightning-button-icon icon-name="utility:close" size="small" variant="border-filled" class="slds-button slds-button_icon slds-button_icon-inverse" alternative-text="next" onclick={closeModel} ></lightning-button-icon>
                    <lightning-button-icon
                        icon-name="utility:close"
                        size="small"
                        variant="border-filled"
                        class="slds-button slds-button_icon slds-button_icon-inverse"
                        alternative-text="next"
                        onclick={closeModel}
                    ></lightning-button-icon>
                </div>
            </div>
        </div>
force-app/main/default/lwc/commonToast/commonToast.js
@@ -1,44 +1,50 @@
import { LightningElement,track,api} from 'lwc';
import { LightningElement, track, api } from 'lwc';
export default class CommonToast extends LightningElement {
    @track type='success';
    @track type = 'success';
    @track message;
    @track messageIsHtml=false;
    @track messageIsHtml = false;
    @track showToastBar = false;
    @api autoCloseTime = 5000;
    @track icon='';
    @track icon = '';
    @api
    showToast(type, message,icon,time) {
    showToast(type, message, icon, time) {
        this.type = type;
        this.message = message;
        this.icon=icon;
        this.autoCloseTime=time;
        this.icon = icon;
        this.autoCloseTime = time;
        this.showToastBar = true;
        setTimeout(() => {
            this.closeModel();
        }, this.autoCloseTime);
    }
    closeModel() {
        this.showToastBar = false;
        this.type = '';
        this.message = '';
    }
    get getIconName() {
        if(this.icon)
        {
        if (this.icon) {
            return this.icon;
        }
        return 'utility:' + this.type.toLowerCase();
    }
    get innerClass() {
        return 'slds-icon_container slds-icon-utility-' + this.type.toLowerCase() + ' slds-m-right_small slds-no-flex slds-align-top';
        return (
            'slds-icon_container slds-icon-utility-' +
            this.type.toLowerCase() +
            ' slds-m-right_small slds-no-flex slds-align-top'
        );
    }
    get outerClass() {
        return 'slds-notify slds-notify_toast slds-theme_' + this.type.toLowerCase();
        return (
            'slds-notify slds-notify_toast slds-theme_' +
            this.type.toLowerCase()
        );
    }
}
force-app/main/default/lwc/customLightningDatatable/customLightningDatatable.js
@@ -7,5 +7,5 @@
            template: boxorpieceType,
            typeAttributes: ['customValueA']
        }
    }
    };
}
force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.html
@@ -1,5 +1,15 @@
<template>
    <lightning-input step="0" type="number" name="count" label="出货数量"
    variant="label-hidden" onchange={outboundCountBlur} data-field="shipmentNumber" value={count}
    min="0" disabled={isDisable} style="min-width: 150px;"></lightning-input>
    <lightning-input
        step="0"
        type="number"
        name="count"
        label="出货数量"
        variant="label-hidden"
        onchange={outboundCountBlur}
        data-field="shipmentNumber"
        value={count}
        min="0"
        disabled={isDisable}
        style="min-width: 150px"
    ></lightning-input>
</template>
force-app/main/default/lwc/customOutboundCountComp/customOutboundCountComp.js
@@ -1,29 +1,30 @@
import { LightningElement,api } from 'lwc';
import { LightningElement, api } from 'lwc';
export default class CustomOutboundCountComp extends LightningElement {
    @api isDisable;
    @api recordId;
    @api count;
    connectedCallback(){
    connectedCallback() {
        console.log('enter CustomOutboundCountComp');
        console.log('isDisable = ' + this.isDisable);
        console.log('recordId = ' + this.recordId);
        console.log('count = ' + this.count);
    }
    outboundCountBlur(event){
        console.log('outboundCountBlur')
    outboundCountBlur(event) {
        console.log('outboundCountBlur');
        this.count = event.target.value;
        this.dispatchEvent(new CustomEvent('outboundcount', {
            composed: true,
            bubbles: true,
            cancelable: true,
            detail: {
                data: { count: this.count, recordId: this.recordId }
            }
        }));
        this.dispatchEvent(
            new CustomEvent('outboundcount', {
                composed: true,
                bubbles: true,
                cancelable: true,
                detail: {
                    data: { count: this.count, recordId: this.recordId }
                }
            })
        );
    }
}
force-app/main/default/lwc/customOutputGood/customOutputGood.html
@@ -1,23 +1,48 @@
<template>
    <template if:true={showTitle}>
        <template if:true={showLink}>
            <p style="height: 10px;"></p>
            <a style="margin-left: 10px;margin-top: 10px;margin-bottom: 10px;" onclick={clickLink}><lightning-formatted-text value={outputValue}></lightning-formatted-text></a>
            <p style="height: 10px;"></p>
            <p style="height: 10px"></p>
            <a
                style="margin-left: 10px; margin-top: 10px; margin-bottom: 10px"
                onclick={clickLink}
                ><lightning-formatted-text
                    value={outputValue}
                ></lightning-formatted-text
            ></a>
            <p style="height: 10px"></p>
        </template>
        <template if:false={showLink}>
            <div style="margin-left: 10px;margin-top: 10px;margin-bottom: 10px;font-size:16px;color:#696969;">
                <lightning-formatted-text value={outputValue}></lightning-formatted-text>
            <div
                style="
                    margin-left: 10px;
                    margin-top: 10px;
                    margin-bottom: 10px;
                    font-size: 16px;
                    color: #696969;
                "
            >
                <lightning-formatted-text
                    value={outputValue}
                ></lightning-formatted-text>
            </div>
        </template>
    </template>
    <template if:false={showTitle}>
        <div style="text-align: right;">
        <div style="text-align: right">
            <template if:true={showLink}>
                <a style="margin-left: 10px;margin-right: 10px;" onclick={clickLink}><lightning-formatted-number value={outputValue}></lightning-formatted-number></a>
                <a
                    style="margin-left: 10px; margin-right: 10px"
                    onclick={clickLink}
                    ><lightning-formatted-number
                        value={outputValue}
                    ></lightning-formatted-number
                ></a>
            </template>
            <template if:false={showLink}>
                <lightning-formatted-number style="margin-left: 10px;margin-right: 10px;" value={outputValue}></lightning-formatted-number>
                <lightning-formatted-number
                    style="margin-left: 10px; margin-right: 10px"
                    value={outputValue}
                ></lightning-formatted-number>
            </template>
        </div>
    </template>
force-app/main/default/lwc/customOutputGood/customOutputGood.js
@@ -1,42 +1,55 @@
import { LightningElement,api,track } from 'lwc';
import { LightningElement, api, track } from 'lwc';
export default class CustomOutputGood extends LightningElement {
    @api outputValue;
    @api outputType;
    @api recordId;
    get showTitle(){
        if(this.outputType == 'Title'){
    get showTitle() {
        if (this.outputType == 'Title') {
            return true;
        }else{
        } else {
            return false;
        }
    }
    get showLink(){
        if(this.outputType == 'Title'){
            if(this.outputValue == '订单明细汇总' || this.outputValue == '待操作入库订单汇总'){
    get showLink() {
        if (this.outputType == 'Title') {
            if (
                this.outputValue == '订单明细汇总' ||
                this.outputValue == '待操作入库订单汇总'
            ) {
                return false;
            }else{
                return true
            } else {
                return true;
            }
        }else{
            if(this.outputValue == 0 || this.outputValue == '0' || this.outputValue == ''){
        } else {
            if (
                this.outputValue == 0 ||
                this.outputValue == '0' ||
                this.outputValue == ''
            ) {
                return false;
            }else{
            } else {
                return true;
            }
        }
    }
    clickLink(event){
        this.dispatchEvent(new CustomEvent('clicklink', {
            composed: true,
            bubbles: true,
            cancelable: true,
            detail: {
                data: { value: this.outputValue, type: this.outputType, recordId:this.recordId}
            }
        }));
    clickLink(event) {
        this.dispatchEvent(
            new CustomEvent('clicklink', {
                composed: true,
                bubbles: true,
                cancelable: true,
                detail: {
                    data: {
                        value: this.outputValue,
                        type: this.outputType,
                        recordId: this.recordId
                    }
                }
            })
        );
    }
}
force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.html
@@ -1,10 +1,11 @@
<template>
    <lightning-input
    name="shipmentAmount"
    label="shipmentAmount"
    variant="label-hidden"
    value={shipmentAmount}
    read-only style="margin-left: 10px;">
        name="shipmentAmount"
        label="shipmentAmount"
        variant="label-hidden"
        value={shipmentAmount}
        read-only
        style="margin-left: 10px"
    >
    </lightning-input>
</template>
force-app/main/default/lwc/customShipmentAmountComp/customShipmentAmountComp.js
@@ -1,9 +1,12 @@
import { LightningElement,api } from 'lwc';
import { LightningElement, api } from 'lwc';
export default class CustomShipmentAmountComp extends LightningElement {
    @api shipmentAmount;
    connectedCallback(){
        console.log('进入 CustomShipmentAmountComp shipmentAmount = ' + this.shipmentAmount);
    connectedCallback() {
        console.log(
            '进入 CustomShipmentAmountComp shipmentAmount = ' +
                this.shipmentAmount
        );
    }
}
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.html
@@ -1,8 +1,17 @@
<template>
    <lightning-input  style="border:1px solid red" step="0" type="number" name="shipmentNumber" label="出货数量"
    variant="label-hidden" onchange={dataChange} data-field="shipmentNumber" value={shipmentNumber}
    onblur={shipmentNumberBlur} min="0" class="inputFont"></lightning-input>
    <!-- <lightning-input  style="border:1px solid red" name="shipmentNumber" label="出货数量"
    variant="label-hidden" onchange={dataChange} data-field="shipmentNumber" value={shipmentNumber}
    onblur={shipmentNumberBlur}></lightning-input> -->
    <c-common-toast></c-common-toast>
    <lightning-input
        style="border: 1px solid red; border-radius: 5px"
        step="any"
        type="number"
        name="shipmentNumber"
        label="出货数量"
        variant="label-hidden"
        onchange={dataChange}
        data-field="shipmentNumber"
        value={shipmentNumber}
        onblur={shipmentNumberBlur}
        min="0"
        class="inputFont"
    ></lightning-input>
</template>
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js
@@ -1,24 +1,86 @@
import { LightningElement,api,track } from 'lwc';
import { LightningElement, api, track } from 'lwc';
export default class CustomShipmentNumberComp extends LightningElement {
    @api recordId;
    @api shipmentNumber;
    @api isConinvoice;
    @api esdInvoiceProNotCount;
    connectedCallback(){
    connectedCallback() {
        console.log('shipmentNumber = ' + this.shipmentNumber);
    }
    shipmentNumberBlur(event){
        console.log('shipmentNumberBlur')
    shipmentNumberBlur(event) {
        debugger;
        console.log('shipmentNumberBlur');
        this.shipmentNumber = event.target.value;
        this.dispatchEvent(new CustomEvent('shipmentnumber', {
            composed: true,
            bubbles: true,
            cancelable: true,
            detail: {
                data: { shipmentnumber: this.shipmentNumber, recordId: this.recordId }
        if (this.isConinvoice) {
            if (this.hasDecimals(this.shipmentNumber)) {
                this.showMyToast('错误', '请输入整数', 'Error');
                this.shipmentNumber = 0;
            } else {
                if (this.esdInvoiceProNotCount < this.shipmentNumber) {
                    this.showMyToast(
                        '错误',
                        '发票数量不能超过还没发票数量!',
                        'Error'
                    );
                    this.shipmentNumber = 0;
                }
            }
        }));
        } else {
            //向下取整
            if (this.hasDecimals(this.shipmentNumber)) {
                this.showMyToast('错误', '请输入整数', 'Error');
                this.shipmentNumber = Math.floor(this.shipmentNumber);
            }
        }
        event.target.value = this.shipmentNumber;
        this.dispatchEvent(
            new CustomEvent('shipmentnumber', {
                composed: true,
                bubbles: true,
                cancelable: true,
                detail: {
                    data: {
                        shipmentnumber: this.shipmentNumber,
                        recordId: this.recordId
                    }
                }
            })
        );
    }
    hasDecimals(num) {
        return !Number.isInteger(Number(num));
    }
    showMyToast(title, message, variant) {
        this.isShowSpinner = false;
        this.showLoadingSpinner = false;
        this.showAttPop = false;
        this.filesUploaded = [];
        this.fileName = null;
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if (variant.toLowerCase() == 'success') {
            iconName = 'utility:check';
        } else {
            iconName = 'utility:error';
        }
        if (message != '') {
            content =
                '<h2><strong>' +
                title +
                '<strong/></h2><h5>' +
                message +
                '</h5>';
        } else {
            content = '<h2><strong>' + title + '<strong/></h2>';
        }
        this.template
            .querySelector('c-common-toast')
            .showToast(variant, content, iconName, 10000);
    }
}
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.html
@@ -1,5 +1,16 @@
<template>
    <lightning-input style="border:1px solid red"  step="0.01" type="number" name="shipmentUnitPrice"
        label="deliveryOrderNo" variant="label-hidden" data-field="shipmentUnitPrice" value={shippingUnitPrice}
        onblur={shipmentUnitPriceBlur} class="inputFont"></lightning-input>
    <lightning-input
        style="border: 1px solid red; border-radius: 5px"
        step="any"
        type="number"
        name="shipmentUnitPrice"
        label="deliveryOrderNo"
        variant="label-hidden"
        data-field="shipmentUnitPrice"
        value={shippingUnitPrice}
        onblur={shipmentUnitPriceBlur}
        min="0"
        class="inputFont"
        onchange={limitDecimals}
    ></lightning-input>
</template>
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js
@@ -1,24 +1,41 @@
import { LightningElement,api,track } from 'lwc';
import { LightningElement, api, track } from 'lwc';
export default class CustomShippingUnitPriceComp extends LightningElement {
    @api recordId;
    @api shippingUnitPrice;
    connectedCallback(){
    connectedCallback() {
        console.log('shippingUnitPrice = ' + this.shippingUnitPrice);
    }
    shipmentUnitPriceBlur(event){
        console.log('shipmentUnitPriceBlur')
    limitDecimals(event) {
        const value = parseFloat(event.target.value); // 将输入值转换为数字类型
        const roundedValue = Math.round(value * 100) / 100; // 将数字四舍五入到两位小数
        if (isNaN(value) || isNaN(roundedValue)) {
            // 如果数字无效,则清空输入框
            event.target.value = '';
        } else if (roundedValue !== value) {
            // 如果输入框的值超出了两位小数,则修改为两位小数
            event.target.value = roundedValue.toFixed(2);
        }
    }
    shipmentUnitPriceBlur(event) {
        console.log('shipmentUnitPriceBlur');
        this.shippingUnitPrice = event.target.value;
        this.dispatchEvent(new CustomEvent('shipmentunitprice', {
            composed: true,
            bubbles: true,
            cancelable: true,
            detail: {
                data: { shipmentunitprice: this.shippingUnitPrice, recordId: this.recordId }
            }
        }));
        this.dispatchEvent(
            new CustomEvent('shipmentunitprice', {
                composed: true,
                bubbles: true,
                cancelable: true,
                detail: {
                    data: {
                        shipmentunitprice: this.shippingUnitPrice,
                        recordId: this.recordId
                    }
                }
            })
        );
    }
}
force-app/main/default/lwc/customUnitComp/customUnitComp.js
@@ -1,4 +1,4 @@
import { LightningElement,api } from 'lwc';
import { LightningElement, api } from 'lwc';
export default class CustomUnitComp extends LightningElement {
    @api unitValue;
@@ -6,22 +6,24 @@
    @api recordId;
    @api isDisabled;
    connectedCallback(){
        if(this.isDisabled == null){
    connectedCallback() {
        if (this.isDisabled == null) {
            this.isDisabled = false;
        }
    }
    handleDataChange(event){
    handleDataChange(event) {
        console.log('unitValue = ' + event.target.value);
        this.unitValue = event.target.value;
        this.dispatchEvent(new CustomEvent('unitchange', {
            composed: true,
            bubbles: true,
            cancelable: true,
            detail: {
                data: { unitValue: this.unitValue, recordId: this.recordId }
            }
        }));
        this.dispatchEvent(
            new CustomEvent('unitchange', {
                composed: true,
                bubbles: true,
                cancelable: true,
                detail: {
                    data: { unitValue: this.unitValue, recordId: this.recordId }
                }
            })
        );
    }
}
force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.html
@@ -1,8 +1,13 @@
<template>
    <template if:true={isShowButton}>
        <lightning-button label="查看周报活动" title="周报" onclick={toWeeklyReport} class="slds-m-left_x-small"></lightning-button>
        <lightning-button
            label="查看周报活动"
            title="周报"
            onclick={toWeeklyReport}
            class="slds-m-left_x-small"
        ></lightning-button>
    </template>
    <template if:false={isShowButton}>
        <p style="text-align: center;">...</p>
        <p style="text-align: center">...</p>
    </template>
</template>
force-app/main/default/lwc/customWeeklyReportComp/customWeeklyReportComp.js
@@ -1,11 +1,13 @@
import { LightningElement, api, track } from 'lwc';
import { NavigationMixin } from "lightning/navigation";
import { NavigationMixin } from 'lightning/navigation';
import View_Weekly_Report from '@salesforce/label/c.View_Weekly_Report';
const customLabel = {
    View_Weekly_Report
}
export default class CustomWeeklyReportComp extends NavigationMixin(LightningElement) {
};
export default class CustomWeeklyReportComp extends NavigationMixin(
    LightningElement
) {
    @track label = customLabel;
    @api recordId;
@@ -14,19 +16,28 @@
    connectedCallback() {
        console.log('CustomWeeklyReportComp recordId = ' + this.recordId);
        console.log('CustomWeeklyReportComp hospitalName = ' + this.hospitalName);
        console.log(
            'CustomWeeklyReportComp hospitalName = ' + this.hospitalName
        );
    }
    toWeeklyReport() {
        console.log('去报表');
        let reportFilters = '[{"operator":"equals","value":"' + this.hospitalName + '","column":"Agency_Report__c.Hospital__c"}]';
        let reportFilters =
            '[{"operator":"equals","value":"' +
            this.hospitalName +
            '","column":"Agency_Report__c.Hospital__c"}]';
        let reportUrl = this.label.View_Weekly_Report;
        let url = "/report/" + reportUrl + "?reportFilters=" + encodeURIComponent(reportFilters);
        let url =
            '/report/' +
            reportUrl +
            '?reportFilters=' +
            encodeURIComponent(reportFilters);
        this[NavigationMixin.Navigate]({
            type: "standard__webPage",
            type: 'standard__webPage',
            attributes: {
                url: url,
            },
                url: url
            }
        });
    }
}
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.css
@@ -1,3 +1,5 @@
@import 'c/lexCssUtility';
lightning-output-field {
    pointer-events: none;
    --lwc-colorTextLabel:#696969;
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.html
@@ -1,11 +1,27 @@
<template>
    <template if:true={showSpinner}>
        <lightning-spinner size="medium" variant="brand"></lightning-spinner>
        <!-- <lightning-spinner size="medium" variant="brand"></lightning-spinner> -->
        <div class="slds-spinner_container">
            <div
                role="status"
                class="slds-spinner slds-spinner_medium slds-spinner_brand"
            >
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
            </div>
        </div>
    </template>
    <c-common-toast></c-common-toast>
    <template if:true={showPage}>
        <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
            <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
        <div
            style="
                border: 1px solid #d4d4d4;
                border-top: 3px solid #51606e;
                border-radius: 5px;
            "
        >
            <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
                <lightning-layout>
                    <lightning-layout-item padding="around-small">
                        <p style="font-size: 18px">
@@ -14,91 +30,175 @@
                    </lightning-layout-item>
                </lightning-layout>
            </div>
            <div style="padding:10px;">
                <lightning-accordion allow-multiple-sections-open active-section-name={activeSections}>
                    <lightning-record-view-form record-id={accountId} object-api-name="Account">
                        <lightning-accordion-section label="经销商详细信息" name="A">
            <div style="padding: 10px">
                <lightning-accordion
                    allow-multiple-sections-open
                    active-section-name={activeSections}
                >
                    <lightning-record-view-form
                        record-id={accountId}
                        object-api-name="Account"
                    >
                        <lightning-accordion-section
                            label="经销商详细信息"
                            name="A"
                        >
                            <lightning-layout multiple-rows="true">
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Management_Code__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Management_Code__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Name"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Name"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Ban_On_Use_Date__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Ban_On_Use_Date__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Ban_On_Use_Reason__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Ban_On_Use_Reason__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Dealer_discount__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Dealer_discount__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Sales_Shop_Class__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Sales_Shop_Class__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Deposit_Receipt_Finished__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Deposit_Receipt_Finished__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Deposit_Receipt_Completion_Day__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Deposit_Receipt_Completion_Day__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                            </lightning-layout>
                        </lightning-accordion-section>
                        <lightning-accordion-section label="营业许可证书状况" name="B">
                        <lightning-accordion-section
                            label="营业许可证书状况"
                            name="B"
                        >
                            <lightning-layout multiple-rows="true">
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Business_Authorization_No__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Business_Authorization_No__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Business_Paper_Expiration_Date__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Business_Paper_Expiration_Date__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Tax_Practice_No__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Tax_Practice_No__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Tax_Practice_Expiration_Date__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Tax_Practice_Expiration_Date__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Medical_Equipment_Num__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Medical_Equipment_Num__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Medical_Equipment_Expiration_Date__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Medical_Equipment_Expiration_Date__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                            </lightning-layout>
                        </lightning-accordion-section>
                        <lightning-accordion-section label="地址信息" name="C">
                            <lightning-layout multiple-rows="true">
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Postal_Code__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Postal_Code__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Phone"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Phone"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Address_Together__c"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Address_Together__c"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                                <lightning-layout-item size="5">
                                    <lightning-output-field field-name="Fax"></lightning-output-field>
                                    <lightning-output-field
                                        field-name="Fax"
                                    ></lightning-output-field>
                                </lightning-layout-item>
                                <lightning-layout-item size="1"></lightning-layout-item>
                                <lightning-layout-item
                                    size="1"
                                ></lightning-layout-item>
                            </lightning-layout>
                        </lightning-accordion-section>
                    </lightning-record-view-form>
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js
@@ -1,4 +1,4 @@
import { LightningElement,track } from 'lwc';
import { LightningElement, track } from 'lwc';
import initAgency from '@salesforce/apex/LexTopPageController.initAgency';
export default class LexAgencyInfo extends LightningElement {
@@ -17,7 +17,7 @@
    init() {
        this.showSpinner = true;
        initAgency()
            .then(result => {
            .then((result) => {
                this.showPage = true;
                this.isNoteStay = result.isNoteStay;
                if (result.result == 'Success') {
@@ -26,33 +26,47 @@
                    this.showSpinner = false;
                } else {
                    this.showSpinner = false;
                    console.log("Error:" + result.errorMsg);
                    this.showMyToast('初始化页面失败', result.errorMsg, 'error');
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast(
                        '初始化页面失败',
                        result.errorMsg,
                        'error'
                    );
                }
            })
            .catch(error => {
            .catch((error) => {
                this.showSpinner = false;
                console.log("Error:" + error);
                this.showMyToast('初始化页面失败', JSON.stringify(error), 'error');
            })
                console.log('Error:' + error);
                this.showMyToast(
                    '初始化页面失败',
                    JSON.stringify(error),
                    'error'
                );
            });
    }
    showMyToast(title, message, variant) {
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if(variant == 'success'){
           iconName = 'utility:check';
        }else{
           iconName = 'utility:error';
        if (variant == 'success') {
            iconName = 'utility:check';
        } else {
            iconName = 'utility:error';
        }
        if(message != ''){
           content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
        }else{
           content = '<h2><strong>'+title+'<strong/></h2>';
        if (message != '') {
            content =
                '<h2><strong>' +
                title +
                '<strong/></h2><h5>' +
                message +
                '</h5>';
        } else {
            content = '<h2><strong>' + title + '<strong/></h2>';
        }
        this.template.querySelector('c-common-toast').
        showToast(variant,content,iconName,10000);
        this.template
            .querySelector('c-common-toast')
            .showToast(variant, content, iconName, 10000);
        // var mode;
        // if(this.isNoteStay){
        //     mode ='sticky';
@@ -66,5 +80,5 @@
        //     mode: mode
        // });
        // this.dispatchEvent(evt);
     }
    }
}
force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.html
@@ -1,12 +1,23 @@
<template>
    <template if:true={isShowInputField}>
        <lightning-record-edit-form object-api-name="Agency_Opportunity__c">
            <lightning-input-field field-name={fieldName} variant="label-hidden" value={inputValue} onchange={inputChange}></lightning-input-field>
            <lightning-input-field
                field-name={fieldName}
                variant="label-hidden"
                value={inputValue}
                onchange={inputChange}
            ></lightning-input-field>
        </lightning-record-edit-form>
    </template>
    <template if:false={isShowInputField}>
        <lightning-record-view-form record-id={recordId} object-api-name="Agency_Opportunity__c">
            <lightning-output-field variant="label-hidden" field-name={fieldName}></lightning-output-field>
        <lightning-record-view-form
            record-id={recordId}
            object-api-name="Agency_Opportunity__c"
        >
            <lightning-output-field
                variant="label-hidden"
                field-name={fieldName}
            ></lightning-output-field>
        </lightning-record-view-form>
    </template>
</template>
force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.js
@@ -1,4 +1,4 @@
import { LightningElement,api } from 'lwc';
import { LightningElement, api } from 'lwc';
export default class LexAgencyOppCusCell extends LightningElement {
    @api recordId;
@@ -6,24 +6,31 @@
    @api inputValue;
    @api showType;
    get isShowInputField(){
        if(this.showType == 'inputField'){
    get isShowInputField() {
        if (this.showType == 'inputField') {
            return true;
        }else {
        } else {
            return false;
        }
    }
    inputChange(event){
    inputChange(event) {
        this.inputValue = event.detail.value;
        this.dispatchEvent(new CustomEvent('inputchange', {
            composed: true,
            bubbles: true,
            cancelable: true,
            detail: {
                data: {recordId:this.recordId,fieldName:this.fieldName,inputValue:this.inputValue,showType:this.showType}
            }
        }));
        this.dispatchEvent(
            new CustomEvent('inputchange', {
                composed: true,
                bubbles: true,
                cancelable: true,
                detail: {
                    data: {
                        recordId: this.recordId,
                        fieldName: this.fieldName,
                        inputValue: this.inputValue,
                        showType: this.showType
                    }
                }
            })
        );
    }
}
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html
@@ -1,11 +1,27 @@
<template>
    <template if:true={showSpinner}>
        <lightning-spinner size="medium" variant="brand"></lightning-spinner>
        <!-- <lightning-spinner size="medium" variant="brand"></lightning-spinner> -->
        <div class="slds-spinner_container">
            <div
                role="status"
                class="slds-spinner slds-spinner_medium slds-spinner_brand"
            >
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
            </div>
        </div>
    </template>
    <c-common-toast></c-common-toast>
    <template if:true={showPage}>
        <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
            <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
        <div
            style="
                border: 1px solid #d4d4d4;
                border-top: 3px solid #51606e;
                border-radius: 5px;
            "
        >
            <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
                <lightning-layout>
                    <lightning-layout-item padding="around-small">
                        <p style="font-size: 18px">
@@ -15,21 +31,48 @@
                </lightning-layout>
                <!-- <p style="font-size: 16px;"><strong>入库/返品</strong></p> -->
            </div>
            <div style="padding:10px;">
            <div style="padding: 10px">
                <!-- 按钮 -->
                <template if:false={returnFLGbln}>
                    <!-- <lightning-button style="margin: 5px;" label="到货确认" onclick={arriveGoodsConfim} disabled={saveFLGbln}></lightning-button> -->
                    <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="到货确认" onclick={arriveGoodsConfim} disabled={saveFLGbln}>到货确认</button>
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="到货确认"
                        onclick={arriveGoodsConfim}
                        disabled={saveFLGbln}
                    >
                        到货确认
                    </button>
                </template>
                <template if:true={returnFLGbln}>
                    <!-- <lightning-button style="margin: 5px;" label="登录返品" onclick={updateGoodsOfReturn}></lightning-button> -->
                    <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="登录返品" onclick={updateGoodsOfReturn}>登录返品</button>
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="登录返品"
                        onclick={updateGoodsOfReturn}
                    >
                        登录返品
                    </button>
                </template>
                <p style="height: 10px;"></p>
                <p style="height: 10px"></p>
                <!-- 订单信息 -->
                <template if:true={showOrderDetail}>
                    <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                        <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-top: 3px solid #51606e;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                        <div
                            style="
                                border-bottom: 1px solid #d4d4d4;
                                padding: 3px;
                            "
                        >
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
@@ -39,37 +82,73 @@
                            </lightning-layout>
                            <!-- <p style="font-size: 16px;"><strong>订单信息</strong></p> -->
                        </div>
                        <div style="padding:10px;">
                        <div style="padding: 10px">
                            <table>
                                <tbody>
                                    <tr>
                                        <td  style="width:10px;"></td>
                                        <td style="width:60px;">
                                            <div style="color:#696969;font-size:12px;">订单名称</div>
                                        <td style="width: 10px"></td>
                                        <td style="width: 60px">
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 12px;
                                                "
                                            >
                                                订单名称
                                            </div>
                                        </td>
                                        <td style="width:200px;">
                                            <lightning-formatted-text value={coc.Name}></lightning-formatted-text>
                                        <td style="width: 200px">
                                            <lightning-formatted-text
                                                value={coc.Name}
                                            ></lightning-formatted-text>
                                        </td>
                                        <td  style="width:30px;"></td>
                                        <td style="width:60px;">
                                            <div style="color:#696969;font-size:12px;">订单总数</div>
                                        <td style="width: 30px"></td>
                                        <td style="width: 60px">
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 12px;
                                                "
                                            >
                                                订单总数
                                            </div>
                                        </td>
                                        <td style="width:100px;">
                                            <lightning-formatted-number value={coc.Total_num__c}></lightning-formatted-number>
                                        <td style="width: 100px">
                                            <lightning-formatted-number
                                                value={coc.Total_num__c}
                                            ></lightning-formatted-number>
                                        </td>
                                        <td  style="width:30px;"></td>
                                        <td style="width:72px;">
                                            <div style="color:#696969;font-size:12px;">已到货数量</div>
                                        <td style="width: 30px"></td>
                                        <td style="width: 72px">
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 12px;
                                                "
                                            >
                                                已到货数量
                                            </div>
                                        </td>
                                        <td style="width:100px;">
                                            <lightning-formatted-number value={coc.OrderNumber_arrived__c}></lightning-formatted-number>
                                        <td style="width: 100px">
                                            <lightning-formatted-number
                                                value={coc.OrderNumber_arrived__c}
                                            ></lightning-formatted-number>
                                        </td>
                                        <td  style="width:30px;"></td>
                                        <td style="width:84px;">
                                            <div style="color:#696969;font-size:12px;">还没发货数量</div>
                                        <td style="width: 30px"></td>
                                        <td style="width: 84px">
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 12px;
                                                "
                                            >
                                                还没发货数量
                                            </div>
                                        </td>
                                        <td style="width:100px;">
                                            <lightning-formatted-number value={coc.OrderNumber_notarrive__c}></lightning-formatted-number>
                                        <td style="width: 100px">
                                            <lightning-formatted-number
                                                value={coc.OrderNumber_notarrive__c}
                                            ></lightning-formatted-number>
                                        </td>
                                        <td></td>
                                    </tr>
@@ -79,8 +158,15 @@
                    </div>
                </template>
                <!-- BarCode录入 -->
                <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                    <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                <div
                    style="
                        border: 1px solid #d4d4d4;
                        border-top: 3px solid #51606e;
                        border-radius: 5px;
                        margin-bottom: 7px;
                    "
                >
                    <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
@@ -90,20 +176,35 @@
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>BarCode录入</strong></p> -->
                    </div>
                    <div style="padding:10px;">
                    <div style="padding: 10px">
                        <table>
                            <tbody>
                                <tr>
                                    <td style="width:20px;"></td>
                                    <td style="width:60px;font-size:16px;">BarCode</td>
                                    <td style="width:30px;"></td>
                                    <td style="width:600px;">
                                        <lightning-textarea  class="inputFont" name="BarCode" value={barcode} label="" variant="label-hidden" onchange={barcodeChange}></lightning-textarea>
                                    <td style="width: 20px"></td>
                                    <td style="width: 60px; font-size: 16px">
                                        BarCode
                                    </td>
                                    <td style="width:30px;"></td>
                                    <td style="width:200px;">
                                    <td style="width: 30px"></td>
                                    <td style="width: 600px">
                                        <lightning-textarea
                                            class="inputFont"
                                            name="BarCode"
                                            value={barcode}
                                            label=""
                                            variant="label-hidden"
                                            onchange={barcodeChange}
                                        ></lightning-textarea>
                                    </td>
                                    <td style="width: 30px"></td>
                                    <td style="width: 200px">
                                        <!-- <lightning-button label="获取明细" title="获取明细" onclick={barcodeEntrys} style="width: 300px;"></lightning-button> -->
                                        <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="获取明细" onclick={barcodeEntrys}>获取明细</button>
                                        <button
                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                            label="获取明细"
                                            onclick={barcodeEntrys}
                                        >
                                            获取明细
                                        </button>
                                    </td>
                                    <td></td>
                                </tr>
@@ -113,32 +214,94 @@
                </div>
                <!-- 警告提醒 -->
                <template if:true={hasWarning}>
                    <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
                        <div style="border-bottom: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;color:#ff6a00;font-size:17px;">
                            <lightning-icon icon-name="utility:warning"></lightning-icon>
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                        <div
                            style="
                                border-bottom: 1px solid #d4d4d4;
                                border-radius: 5px;
                                margin-bottom: 7px;
                                color: #ff6a00;
                                font-size: 17px;
                            "
                        >
                            <lightning-icon
                                icon-name="utility:warning"
                            ></lightning-icon>
                            <strong>&nbsp;&nbsp;&nbsp;警告</strong>
                        </div>
                        <template for:each={warningMsgs} for:item="msg">
                            <p key={msg} style="color:#ff6a00;padding-left:7px;font-size:14px;">&nbsp;&nbsp;&nbsp;・&nbsp;{msg}</p>
                            <p
                                key={msg}
                                style="
                                    color: #ff6a00;
                                    padding-left: 7px;
                                    font-size: 14px;
                                "
                            >
                                &nbsp;&nbsp;&nbsp;・&nbsp;{msg}
                            </p>
                        </template>
                    </div>
                </template>
                <!-- 报错提醒 -->
                <template if:true={hasError}>
                    <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
                        <div style="border-bottom: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;color:red;font-size:17px;">
                            <lightning-icon icon-name="utility:error"></lightning-icon>
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                        <div
                            style="
                                border-bottom: 1px solid #d4d4d4;
                                border-radius: 5px;
                                margin-bottom: 7px;
                                color: red;
                                font-size: 17px;
                            "
                        >
                            <lightning-icon
                                icon-name="utility:error"
                            ></lightning-icon>
                            <strong>&nbsp;&nbsp;&nbsp;错误</strong>
                        </div>
                        <template for:each={errorMsgs} for:item="msg">
                            <p key={msg} style="color:red;padding-left:7px;font-size:14px;">&nbsp;&nbsp;&nbsp;・&nbsp;{msg}</p>
                            <p
                                key={msg}
                                style="
                                    color: red;
                                    padding-left: 7px;
                                    font-size: 14px;
                                "
                            >
                                &nbsp;&nbsp;&nbsp;・&nbsp;{msg}
                            </p>
                        </template>
                    </div>
                </template>
                <!-- 本次到货产品汇总 -->
                <template if:false={returnFLGbln}>
                    <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                        <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-top: 3px solid #51606e;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                        <div
                            style="
                                border-bottom: 1px solid #d4d4d4;
                                padding: 3px;
                            "
                        >
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
@@ -148,15 +311,37 @@
                            </lightning-layout>
                            <!-- <p style="font-size: 16px;"><strong>本次到货产品汇总</strong></p> -->
                        </div>
                        <div style="padding:10px;">
                            <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="recordId" columns={currentArrProdCols} data={detailsSummary}></lightning-datatable>
                        <div style="padding: 10px">
                            <lightning-datatable
                                class="wrapped-header-datatable"
                                style="
                                    word-wrap: break-word;
                                    word-break: break-all;
                                "
                                hide-checkbox-column
                                key-field="recordId"
                                columns={currentArrProdCols}
                                data={detailsSummary}
                            ></lightning-datatable>
                        </div>
                    </div>
                </template>
                <!-- 到货明细 -->
                <template if:false={returnFLGbln}>
                    <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                        <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-top: 3px solid #51606e;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                        <div
                            style="
                                border-bottom: 1px solid #d4d4d4;
                                padding: 3px;
                            "
                        >
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
@@ -165,15 +350,37 @@
                                </lightning-layout-item>
                            </lightning-layout>
                        </div>
                        <div style="padding:10px;">
                            <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="recordId" columns={arrDetailCols} data={consumableorderdetailsRecordsview}></lightning-datatable>
                        <div style="padding: 10px">
                            <lightning-datatable
                                class="wrapped-header-datatable"
                                style="
                                    word-wrap: break-word;
                                    word-break: break-all;
                                "
                                hide-checkbox-column
                                key-field="recordId"
                                columns={arrDetailCols}
                                data={consumableorderdetailsRecordsview}
                            ></lightning-datatable>
                        </div>
                    </div>
                </template>
                <!-- 返品明细 -->
                <template if:true={returnFLGbln}>
                    <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                        <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-top: 3px solid #51606e;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                        <div
                            style="
                                border-bottom: 1px solid #d4d4d4;
                                padding: 3px;
                            "
                        >
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
@@ -182,8 +389,20 @@
                                </lightning-layout-item>
                            </lightning-layout>
                        </div>
                        <div style="padding:10px;">
                            <c-lex-custom-lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="recordId" data={showGoodsofReturnListView} columns={returnDetailCols} onchangereturncount={returnCountChange} onchangevalue={returnReasonChange}></c-lex-custom-lightning-datatable>
                        <div style="padding: 10px">
                            <c-lex-custom-lightning-datatable
                                class="wrapped-header-datatable"
                                style="
                                    word-wrap: break-word;
                                    word-break: break-all;
                                "
                                hide-checkbox-column
                                key-field="recordId"
                                data={showGoodsofReturnListView}
                                columns={returnDetailCols}
                                onchangereturncount={returnCountChange}
                                onchangevalue={returnReasonChange}
                            ></c-lex-custom-lightning-datatable>
                        </div>
                    </div>
                </template>
@@ -203,8 +422,15 @@
                    </div>
                </div> -->
                <!-- 错误明细 -->
                <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                    <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                <div
                    style="
                        border: 1px solid #d4d4d4;
                        border-top: 3px solid #51606e;
                        border-radius: 5px;
                        margin-bottom: 7px;
                    "
                >
                    <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
@@ -214,8 +440,15 @@
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>错误明细</strong></p> -->
                    </div>
                    <div style="padding:10px;">
                        <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="recordId" columns={errorDetailCols} data={consumableorderdetailsRecordserror}></lightning-datatable>
                    <div style="padding: 10px">
                        <lightning-datatable
                            class="wrapped-header-datatable"
                            style="word-wrap: break-word; word-break: break-all"
                            hide-checkbox-column
                            key-field="recordId"
                            columns={errorDetailCols}
                            data={consumableorderdetailsRecordserror}
                        ></lightning-datatable>
                    </div>
                </div>
            </div>
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js
@@ -1,4 +1,4 @@
import { LightningElement,wire,track } from 'lwc';
import { LightningElement, wire, track } from 'lwc';
import { CurrentPageReference } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
@@ -6,9 +6,9 @@
import searchProduct from '@salesforce/apex/LexArriveGoodsController.searchProduct';
import arriveGoodsConfim from '@salesforce/apex/LexArriveGoodsController.arriveGoodsConfim';
import updateGoodsOfReturn from '@salesforce/apex/LexArriveGoodsController.updateGoodsOfReturn';
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
//table css
import { loadStyle } from 'lightning/platformResourceLoader';
import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
export default class LexArriveGoods extends NavigationMixin(LightningElement) {
    //页面变量
@@ -43,97 +43,302 @@
    @track isNoteStay = true;
    //是否有警告
    get hasWarning(){
        if(this.warningMsgs == null || this.warningMsgs.length == 0){
    get hasWarning() {
        if (this.warningMsgs == null || this.warningMsgs.length == 0) {
            return false;
        }
        if(this.warningMsgs.length > 0){
        if (this.warningMsgs.length > 0) {
            return true;
        }
    }
    //是否有错误
    get hasError(){
        if(this.errorMsgs == null || this.errorMsgs.length == 0){
    get hasError() {
        if (this.errorMsgs == null || this.errorMsgs.length == 0) {
            return false;
        }
        if(this.errorMsgs.length > 0){
        if (this.errorMsgs.length > 0) {
            return true;
        }
    }
    //本次到货产品汇总cols
    @track currentArrProdCols = [
        {label:'产品型号' , fieldName:'assetModelNo', hideDefaultActions: true,wrapText:true,initialWidth:220},
        {label:'产品名称' , fieldName:'prodName', hideDefaultActions: true,wrapText:true},
        {label:'到货数量' , fieldName:'arrivedCount', hideDefaultActions: true,wrapText:true,initialWidth:220,cellAttributes: { alignment: "right" }},
        {label:'到货金额' ,type:'number',typeAttributes:{minimumFractionDigits: 2}, fieldName:'arriveAmount', hideDefaultActions: true,wrapText:true,initialWidth:220,cellAttributes: { alignment: "right" }}
        {
            label: '产品型号',
            fieldName: 'assetModelNo',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 220
        },
        {
            label: '产品名称',
            fieldName: 'prodName',
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '到货数量',
            fieldName: 'arrivedCount',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 220,
            cellAttributes: { alignment: 'right' }
        },
        {
            label: '到货金额',
            type: 'number',
            typeAttributes: { minimumFractionDigits: 2 },
            fieldName: 'arriveAmount',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 220,
            cellAttributes: { alignment: 'right' }
        }
    ];
    //到货明细cols
    @track arrDetailCols = [
        {label:'消耗品名称' , fieldName:'prodName', hideDefaultActions: true,wrapText:true},
        {label:'规格' , fieldName:'productPackingListManual', hideDefaultActions: true,wrapText:true,initialWidth:120,cellAttributes: { alignment: "right" }},
        {label:'CFDA状态' , fieldName:'status', hideDefaultActions: true,wrapText:true,initialWidth:120},
        {label:'注册证编码号' , fieldName:'reportProductApprobation', hideDefaultActions: true,wrapText:true,initialWidth:180},
        {label:'注册证效期' , fieldName:'ReportProductExpirationDate', hideDefaultActions: true,wrapText:true,initialWidth:100},
        {label:'BarCode' , fieldName:'barCode', hideDefaultActions: true,wrap:true,initialWidth:400}
        {
            label: '消耗品名称',
            fieldName: 'prodName',
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '规格',
            fieldName: 'productPackingListManual',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 55,
            cellAttributes: { alignment: 'right' }
        },
        {
            label: 'CFDA状态',
            fieldName: 'status',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 120
        },
        {
            label: '注册证编码号',
            fieldName: 'reportProductApprobation',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 190
        },
        {
            label: '注册证效期',
            fieldName: 'ReportProductExpirationDate',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 110
        },
        {
            label: 'BarCode',
            fieldName: 'barCode',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 400
        }
    ];
    //返品明细cols
    get returnDetailCols(){
    get returnDetailCols() {
        var cols = [];
        cols.push({label:'出库单',fieldName:'orderUrl',type:'url',typeAttributes:{label:{fieldName:'orderNo'},target: "_blank"},hideDefaultActions: true,wrapText:true});
        // cols.push({label:'出库单' , fieldName:'orderNo', hideDefaultActions: true});
        cols.push({label:'出库日' , fieldName:'prodOutDate',wrapText:true, hideDefaultActions: true,initialWidth:110});
        cols.push({label:'消耗品名称' , fieldName:'prodName',wrapText:true, hideDefaultActions: true,wrapText:true,initialWidth:190});
        cols.push({label:'出库目的' , fieldName:'summonsForDirctionDet',wrapText:true, hideDefaultActions: true,initialWidth:130});
        cols.push({label:'客户名' , fieldName:'hospitalName', hideDefaultActions: true,wrapText:true,initialWidth:130});
        cols.push({label:'经销商' , fieldName:'orderDealer', hideDefaultActions: true,wrapText:true,initialWidth:100});
        cols.push({label:'BarCode' , fieldName:'barCode', hideDefaultActions: true,wrap:true,initialWidth:230});
        cols.push({label:'使用期限' , fieldName:'sterilizationLimit', hideDefaultActions: true,wrapText:true,initialWidth:110});
        cols.push({label:'单位' , fieldName:'boxPiece', hideDefaultActions: true,wrapText:true,initialWidth:50});
        cols.push({
            label:'返品数量',
            type: "customReturnGoodInput",
            label: '出库单',
            fieldName: 'orderUrl',
            type: 'url',
            typeAttributes: {
                inputValue: { fieldName: "returnCount" },
                boxPrice: { fieldName: "boxPiece" },
                recordId: { fieldName: "recordId" }
                label: { fieldName: 'orderNo' },
                target: '_blank'
            },
            hideDefaultActions: true,wrapText:true,initialWidth:100});
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 180
        });
        // cols.push({label:'出库单' , fieldName:'orderNo', hideDefaultActions: true});
        cols.push({
            label:'返品原因',
            type: "customTableInput",
            label: '出库日',
            fieldName: 'prodOutDate',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 110
        });
        cols.push({
            label: '消耗品名称',
            fieldName: 'prodName',
            wrapText: true,
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 190
        });
        cols.push({
            label: '出库目的',
            fieldName: 'summonsForDirctionDet',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 130
        });
        cols.push({
            label: '客户名',
            fieldName: 'hospitalName',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 130
        });
        cols.push({
            label: '经销商',
            fieldName: 'orderDealer',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 100
        });
        cols.push({
            label: 'BarCode',
            fieldName: 'barCode',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 230
        });
        cols.push({
            label: '使用期限',
            fieldName: 'sterilizationLimit',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 110
        });
        cols.push({
            label: '单位',
            fieldName: 'boxPiece',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 50
        });
        cols.push({
            label: '返品数量',
            type: 'customReturnGoodInput',
            typeAttributes: {
                    recordId: { fieldName: "recordId" },
                    inputValue: { fieldName: "returnReason" },
                    valueType: 'Text'
                },
            hideDefaultActions: true,wrapText:true,initialWidth:100});
            // cols.push({label:'返品原因' , fieldName:'returnReason', hideDefaultActions: true});
                inputValue: { fieldName: 'returnCount' },
                boxPrice: { fieldName: 'boxPiece' },
                recordId: { fieldName: 'recordId' }
            },
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 100
        });
        cols.push({
            label: '返品原因',
            type: 'customTableInput',
            typeAttributes: {
                recordId: { fieldName: 'recordId' },
                inputValue: { fieldName: 'returnReason' },
                valueType: 'Text'
            },
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 150
        });
        // cols.push({label:'返品原因' , fieldName:'returnReason', hideDefaultActions: true});
        return cols;
    }
    //入库明细cols
    get inDetailCols(){
    get inDetailCols() {
        var cols = [];
        cols.push({label:'消耗品名称' , fieldName:'prodName', hideDefaultActions: true,wrapText:true});
        cols.push({label:'BarCode' , fieldName:'barCodeNo', hideDefaultActions: true,wrapText:true,initialWidth:400});
        cols.push({label:'使用期限' , fieldName:'sterilizationlimitDate', hideDefaultActions: true,wrapText:true,initialWidth:100});
        cols.push({label:'serialNoorLotNo' , fieldName:'serialNoorLotNo', hideDefaultActions: true,wrapText:true,initialWidth:140});
        cols.push({label:'tracingCode' , fieldName:'tracingCodeNo', hideDefaultActions: true,wrapText:true,initialWidth:140});
        if(this.returnFLGbln){
            cols.push({label:'返品原因' , fieldName:'ReturnReason', hideDefaultActions: true,wrapText:true,initialWidth:150});
        cols.push({
            label: '消耗品名称',
            fieldName: 'prodName',
            hideDefaultActions: true,
            wrapText: true
        });
        cols.push({
            label: 'BarCode',
            fieldName: 'barCodeNo',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 500
        });
        cols.push({
            label: '使用期限',
            fieldName: 'sterilizationlimitDate',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 100
        });
        cols.push({
            label: 'serialNoorLotNo',
            fieldName: 'serialNoorLotNo',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 140
        });
        cols.push({
            label: 'tracingCode',
            fieldName: 'tracingCodeNo',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 140
        });
        if (this.returnFLGbln) {
            cols.push({
                label: '返品原因',
                fieldName: 'ReturnReason',
                hideDefaultActions: true,
                wrapText: true,
                initialWidth: 150
            });
        }
        return cols;
    }
    //错误明细cols
    @track errorDetailCols = [
        // {label:'消耗品订单' , fieldName:'consumableOrderMinor', hideDefaultActions: true,wrapText:true},
        {label:'消耗品订单',fieldName:'consumableOrderUrl',type:'url',typeAttributes:{label:{fieldName:'consumableOrderMinorName'},target: "_blank"},hideDefaultActions: true,wrapText:true,initialWidth:180},
        {label:'消耗品名称' , fieldName:'prodName', hideDefaultActions: true,wrapText:true},
        {label:'BarCode' , fieldName:'barCode', hideDefaultActions: true,wrapText:true,initialWidth:400},
        {label:'单位' , fieldName:'boxPiece', hideDefaultActions: true,wrapText:true,initialWidth:60},
        {label:'数量' , fieldName:'intMark', hideDefaultActions: true,wrapText:true,initialWidth:100,cellAttributes: { alignment: "right" }},
        {label:'错误原因' , fieldName:'ErrorReason', hideDefaultActions: true,initialWidth:280,wrapText:true}
        {
            label: '消耗品订单',
            fieldName: 'consumableOrderUrl',
            type: 'url',
            typeAttributes: {
                label: { fieldName: 'consumableOrderMinorName' },
                target: '_blank'
            },
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 180
        },
        {
            label: '消耗品名称',
            fieldName: 'prodName',
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: 'BarCode',
            fieldName: 'barCode',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 400
        },
        {
            label: '单位',
            fieldName: 'boxPiece',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 60
        },
        {
            label: '数量',
            fieldName: 'intMark',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 100,
            cellAttributes: { alignment: 'right' }
        },
        {
            label: '错误原因',
            fieldName: 'ErrorReason',
            hideDefaultActions: true,
            initialWidth: 280,
            wrapText: true
        }
    ];
    // 获取参数
@@ -146,308 +351,548 @@
        }
    }
    get showOrderDetail(){
        if(this.eSetId != '' && this.eSetId != null){
    get showOrderDetail() {
        if (this.eSetId != '' && this.eSetId != null) {
            return true;
        }else{
        } else {
            return false;
        }
    }
    renderedCallback(){
    renderedCallback() {
        if (!this.stylesLoaded) {
            Promise.all([loadStyle(this, WrappedHeaderTable)])
                .then(() => {
                    console.log("Custom styles loaded");
                    console.log('Custom styles loaded');
                    this.stylesLoaded = true;
                })
                .catch((error) => {
                    console.error("Error loading custom styles");
                    console.error('Error loading custom styles');
                });
        }
    }
    //初始化
    connectedCallback(){
        init({arrType:this.arrType, eSetId:this.eSetId})
        .then(result=>{
            this.isNoteStay = result.isNoteStay;
            this.arrController = result.arrGoodCon;
            console.log("this.arrController:"+this.arrController);
            if(result.result == 'Success'){
                this.saveFLGbln = result.saveFLGbln;
                this.returnFLGbln = result.returnFLGbln;
                this.coc = result.coc;
                this.cocId = result.coc.Id;
                this.warningMsgs = result.warningMsgList;
                this.errorMsgs = result.errorMsgList;
    connectedCallback() {
        init({ arrType: this.arrType, eSetId: this.eSetId })
            .then((result) => {
                this.isNoteStay = result.isNoteStay;
                this.arrController = result.arrGoodCon;
                console.log('this.arrController:' + this.arrController);
                if (result.result == 'Success') {
                    this.saveFLGbln = result.saveFLGbln;
                    this.returnFLGbln = result.returnFLGbln;
                    this.coc = result.coc;
                    this.cocId = result.coc.Id;
                    this.warningMsgs = result.warningMsgList;
                    this.errorMsgs = result.errorMsgList;
                    this.showSpinner = false;
                    this.showPage = true;
                } else {
                    this.warningMsgs = result.warningMsgList;
                    this.errorMsgs = result.errorMsgList;
                    this.showSpinner = false;
                    this.showPage = true;
                    console.log('error:' + result.errorMsg);
                    this.showMyToast(
                        '初始化页面失败',
                        result.errorMsg,
                        'error'
                    );
                }
            })
            .catch((error) => {
                this.showSpinner = false;
                this.showPage = true;
            }else{
                this.warningMsgs = result.warningMsgList;
                this.errorMsgs = result.errorMsgList;
                this.showSpinner = false;
                this.showPage = true;
                console.log("error:"+result.errorMsg);
                this.showMyToast('初始化页面失败',result.errorMsg,'error');
            }
        })
        .catch(error=>{
            this.showSpinner = false;
            this.showPage = true;
            console.log("error:"+JSON.stringify(error));
            this.showMyToast('初始化页面失败',JSON.stringify(error),'error');
        })
                console.log('error:' + JSON.stringify(error));
                this.showMyToast(
                    '初始化页面失败',
                    JSON.stringify(error),
                    'error'
                );
            });
    }
    //barcode change
    barcodeChange(event){
    barcodeChange(event) {
        this.barcode = event.detail.value;
    }
    //根据barcode搜索
    barcodeEntrys(){
    barcodeEntrys() {
        this.showSpinner = true;
        searchProduct({
            barcode : this.barcode,
            arrControllerStr : this.arrController
            barcode: this.barcode,
            arrControllerStr: this.arrController
        })
        .then(result=>{
            this.arrController = result.arrGoodCon;
            if(result.result == 'Success'){
                this.saveFLGbln = result.saveFLGbln;
                this.returnFLGbln = result.returnFLGbln;
                this.coc = result.coc;
                this.warningMsgs = result.warningMsgList;
                this.errorMsgs = result.errorMsgList;
                this.consumableInventory = result.consumableInventory;
                this.detailsSummary = result.detailsSummary;
                for(var i in this.detailsSummary){
                    if(this.detailsSummary[i].Prod != null){
                        this.detailsSummary[i]['recordId'] = this.detailsSummary[i].Prod.Id;
                        this.detailsSummary[i]['assetModelNo'] = this.detailsSummary[i].Prod.Asset_Model_No__c;
                        this.detailsSummary[i]['prodName'] = this.detailsSummary[i].Prod.Name__c;
                    }
                }
                console.log('this.detailsSummary:'+JSON.stringify(this.detailsSummary));
                this.consumableorderdetailsRecords = result.consumableorderdetailsRecords;
                var consumableorderdetailsRecordsview = [];
                for(var i in this.consumableorderdetailsRecords){
                    consumableorderdetailsRecordsview.push(this.consumableorderdetailsRecords[i]);
                }
                for(var i in this.consumableInventory){
                    consumableorderdetailsRecordsview.push(this.consumableInventory[i]);
                }
                this.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview;
                for(var i in this.consumableorderdetailsRecordsview){
                    if(this.consumableorderdetailsRecordsview[i].Prod != null){
                        this.consumableorderdetailsRecordsview[i]['recordId'] = this.consumableorderdetailsRecordsview[i].Prod.Id;
                        this.consumableorderdetailsRecordsview[i]['prodName'] = this.consumableorderdetailsRecordsview[i].Prod.Name__c;
                    }
                    if(this.consumableorderdetailsRecordsview[i].esd != null){
                        this.consumableorderdetailsRecordsview[i]['productPackingListManual'] = this.consumableorderdetailsRecordsview[i].esd.ProductPacking_list_manual__c;
                        this.consumableorderdetailsRecordsview[i]['status'] = this.consumableorderdetailsRecordsview[i].esd.CFDA_Status__c;
                        this.consumableorderdetailsRecordsview[i]['reportProductApprobation'] = this.consumableorderdetailsRecordsview[i].esd.Report_Product_Approbation__c;
                        this.consumableorderdetailsRecordsview[i]['barCode'] = this.consumableorderdetailsRecordsview[i].esd.Bar_Code__c;
                    }
                }
                console.log('len1:'+this.consumableorderdetailsRecords.length);
                console.log('len2:'+this.consumableorderdetailsRecordsview.length);
                console.log('this.consumableorderdetailsRecordsview:'+JSON.stringify(this.consumableorderdetailsRecordsview));
                this.showGoodsofReturnList = result.showGoodsofReturnList;
                var showGoodsofReturnListView = [];
                for(var i in this.showGoodsofReturnList){
                    showGoodsofReturnListView.push(this.showGoodsofReturnList[i]);
                }
                for(var i in this.consumableInventory){
                    showGoodsofReturnListView.push(this.consumableInventory[i]);
                }
                this.showGoodsofReturnListView = showGoodsofReturnListView;
                for(var i in this.showGoodsofReturnListView){
                    if(this.showGoodsofReturnListView[i].Prod != null){
                        this.showGoodsofReturnListView[i]['prodName'] = this.showGoodsofReturnListView[i].Prod.Name__c;
                    }
                    if(this.showGoodsofReturnListView[i].esd != null){
                        if(this.showGoodsofReturnListView[i].esd.Consumable_Shipment_order__c != '' && this.showGoodsofReturnListView[i].esd.Consumable_Shipment_order__c != null){
                            this.showGoodsofReturnListView[i]['recordId'] = this.showGoodsofReturnListView[i].esd.Consumable_Shipment_order__c;
                            this.showGoodsofReturnListView[i]['orderUrl'] = '/lexsummonscreat?ESetid='+this.showGoodsofReturnListView[i].esd.Consumable_Shipment_order__c;
                            this.showGoodsofReturnListView[i]['orderNo'] = this.showGoodsofReturnListView[i].esd.Consumable_Shipment_order__r.Name;
                        }else if(this.showGoodsofReturnListView[i].esd.Consumable_Sale_order__c != '' && this.showGoodsofReturnListView[i].esd.Consumable_Sale_order__c != null){
                            this.showGoodsofReturnListView[i]['recordId'] = this.showGoodsofReturnListView[i].esd.Consumable_Sale_order__c;
                            this.showGoodsofReturnListView[i]['orderUrl'] = '/lexsummonscreat?ESetid='+this.showGoodsofReturnListView[i].esd.Consumable_Sale_order__c;
                            this.showGoodsofReturnListView[i]['orderNo'] = this.showGoodsofReturnListView[i].esd.Consumable_Sale_order__r.Name;
            .then((result) => {
                this.arrController = result.arrGoodCon;
                if (result.result == 'Success') {
                    this.saveFLGbln = result.saveFLGbln;
                    this.returnFLGbln = result.returnFLGbln;
                    this.coc = result.coc;
                    this.warningMsgs = result.warningMsgList;
                    this.errorMsgs = result.errorMsgList;
                    this.consumableInventory = result.consumableInventory;
                    this.detailsSummary = result.detailsSummary;
                    for (var i in this.detailsSummary) {
                        if (this.detailsSummary[i].Prod != null) {
                            this.detailsSummary[i]['recordId'] =
                                this.detailsSummary[i].Prod.Id;
                            this.detailsSummary[i]['assetModelNo'] =
                                this.detailsSummary[i].Prod.Asset_Model_No__c;
                            this.detailsSummary[i]['prodName'] =
                                this.detailsSummary[i].Prod.Name__c;
                        }
                        this.showGoodsofReturnListView[i]['prodOutDate'] = this.showGoodsofReturnListView[i].esd.Product_OutDate__c;
                        this.showGoodsofReturnListView[i]['summonsForDirctionDet'] = this.showGoodsofReturnListView[i].esd.SummonsForDirction_det__c;
                        this.showGoodsofReturnListView[i]['hospitalName'] = this.showGoodsofReturnListView[i].esd.HospItal_Name__c;
                        this.showGoodsofReturnListView[i]['orderDealer'] = this.showGoodsofReturnListView[i].esd.Order_Dealer_Info__c;
                        this.showGoodsofReturnListView[i]['barCode'] = this.showGoodsofReturnListView[i].esd.Bar_Code__c;
                        this.showGoodsofReturnListView[i]['sterilizationLimit'] = this.showGoodsofReturnListView[i].esd.Sterilization_limit__c;
                        this.showGoodsofReturnListView[i]['boxPiece'] = this.showGoodsofReturnListView[i].esd.Box_Piece__c;
                        this.showGoodsofReturnListView[i]['returnCount'] = this.showGoodsofReturnListView[i].esd.Rrturn_count__c;
                        console.log('returnCount:'+this.showGoodsofReturnListView[i].esd.Rrturn_count__c);
                        this.showGoodsofReturnListView[i]['returnReason'] = this.showGoodsofReturnListView[i].esd.Return_reason__c;
                    }
                }
                console.log('len1:'+this.showGoodsofReturnList.length);
                console.log('len2:'+this.showGoodsofReturnListView.length);
                console.log('this.showGoodsofReturnListView:'+JSON.stringify(this.showGoodsofReturnListView));
                // this.consumableInventory = result.consumableInventory;
                // for(var i in this.consumableInventory){
                //     if(this.consumableInventory[i].Prod != null){
                //         this.consumableInventory[i]['recordId'] = this.consumableInventory[i].Prod.Id;
                //         this.consumableInventory[i]['prodName'] = this.consumableInventory[i].Prod.Name__c;
                //     }
                // }
                console.log('this.consumableInventory:'+JSON.stringify(this.consumableInventory));
                this.consumableorderdetailsRecordserror = result.consumableorderdetailsRecordserror;
                for(var i in this.consumableorderdetailsRecordserror){
                    if(this.consumableorderdetailsRecordserror[i].Prod != null){
                        this.consumableorderdetailsRecordserror[i]['recordId'] = this.consumableorderdetailsRecordserror[i].Prod.Id;
                        this.consumableorderdetailsRecordserror[i]['prodName'] = this.consumableorderdetailsRecordserror[i].Prod.Name__c;
                    console.log(
                        'this.detailsSummary:' +
                            JSON.stringify(this.detailsSummary)
                    );
                    this.consumableorderdetailsRecords =
                        result.consumableorderdetailsRecords;
                    var consumableorderdetailsRecordsview = [];
                    for (var i in this.consumableorderdetailsRecords) {
                        this.consumableorderdetailsRecords[i]['dataType'] =
                            'DataileRecords';
                        consumableorderdetailsRecordsview.push(
                            this.consumableorderdetailsRecords[i]
                        );
                    }
                    if(this.consumableorderdetailsRecordserror[i].esd != null){
                        this.consumableorderdetailsRecordserror[i]['consumableOrderMinor'] = this.consumableorderdetailsRecordserror[i].esd.Consumable_order_minor__c;
                        if(this.consumableorderdetailsRecordserror[i].esd.Consumable_order_minor__c != null){
                            this.consumableorderdetailsRecordserror[i]['consumableOrderMinorName'] = this.consumableorderdetailsRecordserror[i].esd.Consumable_order_minor__r.Name;
                            this.consumableorderdetailsRecordserror[i]['consumableOrderUrl'] = "/s/detail/"+this.consumableorderdetailsRecordserror[i].esd.Consumable_order_minor__c;
                    for (var i in this.consumableInventory) {
                        this.consumableInventory[i]['dataType'] = 'Inventory';
                        consumableorderdetailsRecordsview.push(
                            this.consumableInventory[i]
                        );
                    }
                    this.consumableorderdetailsRecordsview =
                        consumableorderdetailsRecordsview;
                    for (var i in this.consumableorderdetailsRecordsview) {
                        if (
                            this.consumableorderdetailsRecordsview[i].Prod !=
                            null
                        ) {
                            this.consumableorderdetailsRecordsview[i][
                                'recordId'
                            ] =
                                this.consumableorderdetailsRecordsview[
                                    i
                                ].Prod.Id;
                            this.consumableorderdetailsRecordsview[i][
                                'prodName'
                            ] =
                                this.consumableorderdetailsRecordsview[
                                    i
                                ].Prod.Name__c;
                        }
                        this.consumableorderdetailsRecordserror[i]['barCode'] = this.consumableorderdetailsRecordserror[i].esd.Bar_Code__c;
                        this.consumableorderdetailsRecordserror[i]['boxPiece'] = this.consumableorderdetailsRecordserror[i].esd.Box_Piece__c;
                        if (
                            this.consumableorderdetailsRecordsview[i][
                                'dataType'
                            ] == 'Inventory'
                        ) {
                            this.consumableorderdetailsRecordsview[i][
                                'barCode'
                            ] =
                                this.consumableorderdetailsRecordsview[
                                    i
                                ].barCodeNo;
                        } else if (
                            this.consumableorderdetailsRecordsview[i].esd !=
                            null
                        ) {
                            this.consumableorderdetailsRecordsview[i][
                                'barCode'
                            ] =
                                this.consumableorderdetailsRecordsview[
                                    i
                                ].esd.Bar_Code__c;
                        }
                        if (
                            this.consumableorderdetailsRecordsview[i].esd !=
                            null
                        ) {
                            this.consumableorderdetailsRecordsview[i][
                                'productPackingListManual'
                            ] =
                                this.consumableorderdetailsRecordsview[
                                    i
                                ].esd.ProductPacking_list_manual__c;
                            this.consumableorderdetailsRecordsview[i][
                                'status'
                            ] =
                                this.consumableorderdetailsRecordsview[
                                    i
                                ].esd.CFDA_Status__c;
                            this.consumableorderdetailsRecordsview[i][
                                'reportProductApprobation'
                            ] =
                                this.consumableorderdetailsRecordsview[
                                    i
                                ].esd.Report_Product_Approbation__c;
                        }
                    }
                    console.log(
                        'len1:' + this.consumableorderdetailsRecords.length
                    );
                    console.log(
                        'len2:' + this.consumableorderdetailsRecordsview.length
                    );
                    console.log(
                        'this.consumableorderdetailsRecordsview:' +
                            JSON.stringify(
                                this.consumableorderdetailsRecordsview
                            )
                    );
                    this.showGoodsofReturnList = result.showGoodsofReturnList;
                    var showGoodsofReturnListView = [];
                    for (var i in this.showGoodsofReturnList) {
                        this.showGoodsofReturnList[i]['dataType'] =
                            'GoodsoOfReturn';
                        showGoodsofReturnListView.push(
                            this.showGoodsofReturnList[i]
                        );
                    }
                    for (var i in this.consumableInventory) {
                        this.consumableInventory[i]['dataType'] = 'Inventory';
                        showGoodsofReturnListView.push(
                            this.consumableInventory[i]
                        );
                    }
                    this.showGoodsofReturnListView = showGoodsofReturnListView;
                    for (var i in this.showGoodsofReturnListView) {
                        if (this.showGoodsofReturnListView[i].Prod != null) {
                            this.showGoodsofReturnListView[i]['prodName'] =
                                this.showGoodsofReturnListView[i].Prod.Name__c;
                        }
                        if (
                            this.showGoodsofReturnListView[i]['dataType'] ==
                            'Inventory'
                        ) {
                            this.showGoodsofReturnListView[i]['barCode'] =
                                this.showGoodsofReturnListView[i].barCodeNo;
                        } else if (
                            this.showGoodsofReturnListView[i].esd != null
                        ) {
                            this.showGoodsofReturnListView[i]['barCode'] =
                                this.showGoodsofReturnListView[
                                    i
                                ].esd.Bar_Code__c;
                        }
                        if (this.showGoodsofReturnListView[i].esd != null) {
                            if (
                                this.showGoodsofReturnListView[i].esd
                                    .Consumable_Shipment_order__c != '' &&
                                this.showGoodsofReturnListView[i].esd
                                    .Consumable_Shipment_order__c != null
                            ) {
                                this.showGoodsofReturnListView[i]['recordId'] =
                                    this.showGoodsofReturnListView[
                                        i
                                    ].esd.Consumable_Shipment_order__c;
                                this.showGoodsofReturnListView[i]['orderUrl'] =
                                    '/lexsummonscreat?ESetid=' +
                                    this.showGoodsofReturnListView[i].esd
                                        .Consumable_Shipment_order__c;
                                this.showGoodsofReturnListView[i]['orderNo'] =
                                    this.showGoodsofReturnListView[
                                        i
                                    ].esd.Consumable_Shipment_order__r.Name;
                            } else if (
                                this.showGoodsofReturnListView[i].esd
                                    .Consumable_Sale_order__c != '' &&
                                this.showGoodsofReturnListView[i].esd
                                    .Consumable_Sale_order__c != null
                            ) {
                                this.showGoodsofReturnListView[i]['recordId'] =
                                    this.showGoodsofReturnListView[
                                        i
                                    ].esd.Consumable_Sale_order__c;
                                this.showGoodsofReturnListView[i]['orderUrl'] =
                                    '/lexsummonscreat?ESetid=' +
                                    this.showGoodsofReturnListView[i].esd
                                        .Consumable_Sale_order__c;
                                this.showGoodsofReturnListView[i]['orderNo'] =
                                    this.showGoodsofReturnListView[
                                        i
                                    ].esd.Consumable_Sale_order__r.Name;
                            }
                            this.showGoodsofReturnListView[i]['prodOutDate'] =
                                this.showGoodsofReturnListView[
                                    i
                                ].esd.Product_OutDate__c;
                            this.showGoodsofReturnListView[i][
                                'summonsForDirctionDet'
                            ] =
                                this.showGoodsofReturnListView[
                                    i
                                ].esd.SummonsForDirction_det__c;
                            this.showGoodsofReturnListView[i]['hospitalName'] =
                                this.showGoodsofReturnListView[
                                    i
                                ].esd.HospItal_Name__c;
                            this.showGoodsofReturnListView[i]['orderDealer'] =
                                this.showGoodsofReturnListView[
                                    i
                                ].esd.Order_Dealer_Info__c;
                            this.showGoodsofReturnListView[i][
                                'sterilizationLimit'
                            ] =
                                this.showGoodsofReturnListView[
                                    i
                                ].esd.Sterilization_limit__c;
                            this.showGoodsofReturnListView[i]['boxPiece'] =
                                this.showGoodsofReturnListView[
                                    i
                                ].esd.Box_Piece__c;
                            this.showGoodsofReturnListView[i]['returnCount'] =
                                this.showGoodsofReturnListView[
                                    i
                                ].esd.Rrturn_count__c;
                            console.log(
                                'returnCount:' +
                                    this.showGoodsofReturnListView[i].esd
                                        .Rrturn_count__c
                            );
                            this.showGoodsofReturnListView[i]['returnReason'] =
                                this.showGoodsofReturnListView[
                                    i
                                ].esd.Return_reason__c;
                        }
                    }
                    console.log('len1:' + this.showGoodsofReturnList.length);
                    console.log(
                        'len2:' + this.showGoodsofReturnListView.length
                    );
                    console.log(
                        'this.showGoodsofReturnListView:' +
                            JSON.stringify(this.showGoodsofReturnListView)
                    );
                    // this.consumableInventory = result.consumableInventory;
                    // for(var i in this.consumableInventory){
                    //     if(this.consumableInventory[i].Prod != null){
                    //         this.consumableInventory[i]['recordId'] = this.consumableInventory[i].Prod.Id;
                    //         this.consumableInventory[i]['prodName'] = this.consumableInventory[i].Prod.Name__c;
                    //     }
                    // }
                    console.log(
                        'this.consumableInventory:' +
                            JSON.stringify(this.consumableInventory)
                    );
                    this.consumableorderdetailsRecordserror =
                        result.consumableorderdetailsRecordserror;
                    for (var i in this.consumableorderdetailsRecordserror) {
                        if (
                            this.consumableorderdetailsRecordserror[i].Prod !=
                            null
                        ) {
                            this.consumableorderdetailsRecordserror[i][
                                'recordId'
                            ] =
                                this.consumableorderdetailsRecordserror[
                                    i
                                ].Prod.Id;
                            this.consumableorderdetailsRecordserror[i][
                                'prodName'
                            ] =
                                this.consumableorderdetailsRecordserror[
                                    i
                                ].Prod.Name__c;
                        }
                        if (
                            this.consumableorderdetailsRecordserror[i].esd !=
                            null
                        ) {
                            this.consumableorderdetailsRecordserror[i][
                                'consumableOrderMinor'
                            ] =
                                this.consumableorderdetailsRecordserror[
                                    i
                                ].esd.Consumable_order_minor__c;
                            if (
                                this.consumableorderdetailsRecordserror[i].esd
                                    .Consumable_order_minor__c != null
                            ) {
                                this.consumableorderdetailsRecordserror[i][
                                    'consumableOrderMinorName'
                                ] =
                                    this.consumableorderdetailsRecordserror[
                                        i
                                    ].esd.Consumable_order_minor__r.Name;
                                this.consumableorderdetailsRecordserror[i][
                                    'consumableOrderUrl'
                                ] =
                                    '/s/detail/' +
                                    this.consumableorderdetailsRecordserror[i]
                                        .esd.Consumable_order_minor__c;
                            }
                            this.consumableorderdetailsRecordserror[i][
                                'barCode'
                            ] =
                                this.consumableorderdetailsRecordserror[
                                    i
                                ].esd.Bar_Code__c;
                            this.consumableorderdetailsRecordserror[i][
                                'boxPiece'
                            ] =
                                this.consumableorderdetailsRecordserror[
                                    i
                                ].esd.Box_Piece__c;
                        }
                    }
                    console.log(
                        'this.consumableorderdetailsRecordserror:' +
                            JSON.stringify(
                                this.consumableorderdetailsRecordserror
                            )
                    );
                    this.showSpinner = false;
                    if (this.errorMsgs.length < 1) {
                        this.showMyToast('获取成功', '', 'success');
                    }
                } else {
                    this.showSpinner = false;
                    this.warningMsgs = result.warningMsgList;
                    this.errorMsgs = result.errorMsgList;
                    console.log('error:' + result.errorMsg);
                    this.showMyToast('获取失败', result.errorMsg, 'error');
                }
                console.log('this.consumableorderdetailsRecordserror:'+JSON.stringify(this.consumableorderdetailsRecordserror));
            })
            .catch((error) => {
                this.showSpinner = false;
                this.showMyToast('获取成功','','success');
            }else {
                this.showSpinner = false;
                this.warningMsgs = result.warningMsgList;
                this.errorMsgs = result.errorMsgList;
                console.log("error:"+result.errorMsg);
                this.showMyToast('获取失败',result.errorMsg,'error');
            }
        })
        .catch(error=>{
            this.showSpinner = false;
            console.log("error:"+error);
            this.showMyToast('获取失败',error,'error');
        })
                console.log('error:' + error);
                this.showMyToast('获取失败', error, 'error');
            });
    }
    //返品数量change
    returnCountChange(event){
    returnCountChange(event) {
        var value = event.detail.data.value;
        var boxPrice = event.detail.data.boxPrice;
        var recordId = event.detail.data.recordId;
        console.log("返品数量:"+value+boxPrice+"---"+recordId);
        for(var i in this.showGoodsofReturnList){
            if(this.showGoodsofReturnList[i]['recordId'] == recordId){
                if(this.showGoodsofReturnList[i].canEdit){
        console.log('返品数量:' + value + boxPrice + '---' + recordId);
        for (var i in this.showGoodsofReturnList) {
            if (this.showGoodsofReturnList[i]['recordId'] == recordId) {
                if (this.showGoodsofReturnList[i].canEdit) {
                    this.showGoodsofReturnList[i].esd.Rrturn_count__c = 1;
                    this.showGoodsofReturnList[i]['returnCount'] = this.showGoodsofReturnList[i].esd.Rrturn_count__c;
                }else{
                    this.showGoodsofReturnList[i]['returnCount'] =
                        this.showGoodsofReturnList[i].esd.Rrturn_count__c;
                } else {
                    this.showGoodsofReturnList[i].esd.Rrturn_count__c = value;
                    this.showGoodsofReturnList[i]['returnCount'] = this.showGoodsofReturnList[i].esd.Rrturn_count__c;
                    this.showGoodsofReturnList[i]['returnCount'] =
                        this.showGoodsofReturnList[i].esd.Rrturn_count__c;
                }
            }
        }
    }
    //返品原因change
    returnReasonChange(event){
    returnReasonChange(event) {
        var recordId = event.detail.data.recordId;
        var value = event.detail.data.value;
        console.log("返品原因:"+value+"---"+recordId);
        for(var i in this.showGoodsofReturnList){
            if(this.showGoodsofReturnList[i]['recordId'] == recordId){
        console.log('返品原因:' + value + '---' + recordId);
        for (var i in this.showGoodsofReturnList) {
            if (this.showGoodsofReturnList[i]['recordId'] == recordId) {
                this.showGoodsofReturnList[i].esd.Return_reason__c = value;
                this.showGoodsofReturnList[i]['returnReason'] = this.showGoodsofReturnList[i].esd.Return_reason__c;
                this.showGoodsofReturnList[i]['returnReason'] =
                    this.showGoodsofReturnList[i].esd.Return_reason__c;
            }
        }
    }
    // 到货确认
    arriveGoodsConfim(){
    arriveGoodsConfim() {
        this.showSpinner = true;
        arriveGoodsConfim({arrControllerStr : this.arrController})
        .then(result=>{
            this.arrController = result.arrGoodCon;
            if(result.result == 'Success'){
        arriveGoodsConfim({ arrControllerStr: this.arrController })
            .then((result) => {
                this.arrController = result.arrGoodCon;
                if (result.result == 'Success') {
                    this.showSpinner = false;
                    this.warningMsgs = result.warningMsgList;
                    this.errorMsgs = result.errorMsgList;
                    var url = result.url;
                    const config = {
                        type: 'standard__webPage',
                        attributes: {
                            url: url
                        }
                    };
                    this[NavigationMixin.Navigate](config);
                } else {
                    this.showSpinner = false;
                    this.warningMsgs = result.warningMsgList;
                    this.errorMsgs = result.errorMsgList;
                    console.log('error1:' + result.errorMsg);
                    this.showMyToast('到货确认失败', result.errorMsg, 'error');
                }
            })
            .catch((error) => {
                this.showSpinner = false;
                this.warningMsgs = result.warningMsgList;
                this.errorMsgs = result.errorMsgList;
                var url = result.url;
                const config = {
                    type: 'standard__webPage',
                    attributes: {
                       url: url
                    }
                };
                this[NavigationMixin.Navigate](config);
            }else {
                this.showSpinner = false;
                this.warningMsgs = result.warningMsgList;
                this.errorMsgs = result.errorMsgList;
                console.log("error1:"+result.errorMsg);
                this.showMyToast('到货确认失败',result.errorMsg,'error');
            }
        })
        .catch(error=>{
            this.showSpinner = false;
            console.log("error2:"+error);
            this.showMyToast('到货确认失败',error,'error');
        })
                console.log('error2:' + error);
                this.showMyToast('到货确认失败', error, 'error');
            });
    }
    // 登录返品
    updateGoodsOfReturn(){
    updateGoodsOfReturn() {
        this.showSpinner = true;
        updateGoodsOfReturn({arrControllerStr : this.arrController,showGoodsofReturnListStr : JSON.stringify(this.showGoodsofReturnList)})
        .then(result=>{
            this.showSpinner = false;
            this.arrController = result.arrGoodCon;
            if(result.result == 'Success'){
                this.warningMsgs = result.warningMsgList;
                this.errorMsgs = result.errorMsgList;
                var url = result.url;
                const config = {
                    type: 'standard__webPage',
                    attributes: {
                       url: url
                    }
                };
                this[NavigationMixin.Navigate](config);
            }else {
        updateGoodsOfReturn({
            arrControllerStr: this.arrController,
            showGoodsofReturnListStr: JSON.stringify(this.showGoodsofReturnList)
        })
            .then((result) => {
                this.showSpinner = false;
                this.warningMsgs = result.warningMsgList;
                this.errorMsgs = result.errorMsgList;
                console.log("error1:"+result.errorMsg);
                this.showMyToast('登录返品失败',result.errorMsg,'error');
            }
        })
        .catch(error=>{
            this.showSpinner = false;
            console.log("error2:"+JSON.stringify(error));
            this.showMyToast('登录返品失败',error,'error');
        })
                this.arrController = result.arrGoodCon;
                if (result.result == 'Success') {
                    this.warningMsgs = result.warningMsgList;
                    this.errorMsgs = result.errorMsgList;
                    var url = result.url;
                    const config = {
                        type: 'standard__webPage',
                        attributes: {
                            url: url
                        }
                    };
                    this[NavigationMixin.Navigate](config);
                } else {
                    console.log('error1:' + result.errorMsg);
                    this.showSpinner = false;
                    this.warningMsgs = result.warningMsgList;
                    this.errorMsgs = result.errorMsgList;
                    if (result.errorMsg.includes('无法保存此记录')) {
                        result.errorMsg = '无法保存记录';
                    }
                    this.showMyToast('登录返品失败', result.errorMsg, 'error');
                }
            })
            .catch((error) => {
                this.showSpinner = false;
                console.log('error2:' + JSON.stringify(error));
                this.showMyToast('登录返品失败', error, 'error');
            });
    }
    showMyToast(title, message, variant) {
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if(variant == 'success'){
           iconName = 'utility:check';
        }else{
           iconName = 'utility:error';
        if (variant == 'success') {
            iconName = 'utility:check';
        } else {
            iconName = 'utility:error';
        }
        if(message != ''){
           content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
        }else{
           content = '<h2><strong>'+title+'<strong/></h2>';
        if (message != '') {
            content =
                '<h2><strong>' +
                title +
                '<strong/></h2><h5>' +
                message +
                '</h5>';
        } else {
            content = '<h2><strong>' + title + '<strong/></h2>';
        }
        this.template.querySelector('c-common-toast').
        showToast(variant,content,iconName,10000);
        this.template
            .querySelector('c-common-toast')
            .showToast(variant, content, iconName, 10000);
        // var mode;
        // if(this.isNoteStay){
        //     mode ='sticky';
@@ -461,5 +906,5 @@
        //     mode: mode
        // });
        // this.dispatchEvent(evt);
     }
    }
}
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html
@@ -1,20 +1,57 @@
<template>
    <template if:true={showSpinner}>
        <lightning-spinner size="medium" variant="brand"></lightning-spinner>
        <!-- <lightning-spinner size="medium" variant="brand"></lightning-spinner> -->
        <div class="slds-spinner_container">
            <div
                role="status"
                class="slds-spinner slds-spinner_medium slds-spinner_brand"
            >
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
            </div>
        </div>
    </template>
    <c-common-toast></c-common-toast>
    <template if:true={showPage}>
        <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
            <div style="padding:10px;">
        <div
            style="
                border: 1px solid #d4d4d4;
                border-top: 3px solid #51606e;
                border-radius: 5px;
            "
        >
            <div style="padding: 10px">
                <!-- 按钮 -->
                <!-- <lightning-button style="margin: 5px;" label="入库" onclick={orderArrive}></lightning-button>
                <lightning-button style="margin: 5px;" label="返品" onclick={orderReturn}></lightning-button> -->
                <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;margin-right: 150px;" label="入库" onclick={orderArrive}>入库</button>
                <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="返品" onclick={orderReturn}>返品</button>
                <p style="height: 10px;"></p>
                <button
                    class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                    style="margin: 5px; margin-right: 150px"
                    label="入库"
                    onclick={orderArrive}
                >
                    入库
                </button>
                <button
                    class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                    style="margin: 5px"
                    label="返品"
                    onclick={orderReturn}
                >
                    返品
                </button>
                <p style="height: 10px"></p>
                <!-- 检索条件 -->
                <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                    <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                <div
                    style="
                        border: 1px solid #d4d4d4;
                        border-top: 3px solid #51606e;
                        border-radius: 5px;
                        margin-bottom: 7px;
                    "
                >
                    <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
@@ -24,30 +61,77 @@
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>检索条件</strong></p> -->
                    </div>
                    <div style="padding:10px;">
                    <div style="padding: 10px">
                        <table>
                            <tbody>
                                <tr>
                                    <td style="width: 10px;"></td>
                                    <td style="width: 120px;">
                                        <div style="color:#696969;font-size:16px;text-align: left;">消耗品订单名称</div>
                                    <td style="width: 10px"></td>
                                    <td style="width: 120px">
                                        <div
                                            style="
                                                color: #696969;
                                                font-size: 16px;
                                                text-align: left;
                                            "
                                        >
                                            消耗品订单名称
                                        </div>
                                    </td>
                                    <td>
                                        <lightning-input class="inputFont" type="text" variant="label-hidden" label="消耗品订单名称" value={category1} onchange={category1Change}></lightning-input>
                                        <lightning-input
                                            class="inputFont"
                                            type="text"
                                            variant="label-hidden"
                                            label="消耗品订单名称"
                                            value={category1}
                                            onchange={category1Change}
                                        ></lightning-input>
                                    </td>
                                    <td style="width: 30px;"></td>
                                    <td  style="width: 108px;">
                                        <div style="color:#696969;font-size:16px;text-align: left;">最新发货日期</div>
                                    <td style="width: 30px"></td>
                                    <td style="width: 108px">
                                        <div
                                            style="
                                                color: #696969;
                                                font-size: 16px;
                                                text-align: left;
                                            "
                                        >
                                            最新发货日期
                                        </div>
                                    </td>
                                    <td>
                                        <lightning-input class="inputFont" type="date" variant="label-hidden" label="最新发货日期" value={cate2} onchange={cate2Change}></lightning-input>
                                        <lightning-input
                                            class="inputFont"
                                            type="date"
                                            variant="label-hidden"
                                            label="最新发货日期"
                                            value={cate2}
                                            onchange={cate2Change}
                                        ></lightning-input>
                                    </td>
                                    <td style="width: 30px;"></td>
                                    <td style="width: 30px"></td>
                                    <td>
                                        <!-- <lightning-button style="margin-left: 10px;margin-right: 5px;" label="搜索" onclick={search}></lightning-button>
                                        <lightning-button style="margin-left: 5px;margin-right: 5px;" label="清空" onclick={clear}></lightning-button> -->
                                        <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="height:32px;margin-right: 30px;" label="搜索" onclick={search}>搜索</button>
                                        <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="height:32px;" label="清空" onclick={clear}>清空</button>
                                        <button
                                            class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                            style="
                                                height: 32px;
                                                margin-right: 30px;
                                            "
                                            label="搜索"
                                            onclick={search}
                                        >
                                            搜索
                                        </button>
                                        <button
                                            class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                                            style="height: 32px"
                                            label="清空"
                                            onclick={clear}
                                        >
                                            清空
                                        </button>
                                    </td>
                                </tr>
                            </tbody>
@@ -55,8 +139,15 @@
                    </div>
                </div>
                <!-- 订单明细 -->
                <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                    <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                <div
                    style="
                        border: 1px solid #d4d4d4;
                        border-top: 3px solid #51606e;
                        border-radius: 5px;
                        margin-bottom: 7px;
                    "
                >
                    <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
@@ -66,9 +157,16 @@
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>订单明细</strong></p> -->
                    </div>
                    <div style="padding:10px;">
                    <div style="padding: 10px">
                        <!-- <lightning-datatable hide-checkbox-column key-field="id" columns={colms}  data={raesList}></lightning-datatable> -->
                        <c-lex-custom-lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="Id" data={raesList} columns={colms} onclicklink={clickLick}></c-lex-custom-lightning-datatable>
                        <c-lex-custom-lightning-datatable
                            class="wrapped-header-datatable"
                            hide-checkbox-column
                            key-field="Id"
                            data={raesList}
                            columns={colms}
                            onclicklink={clickLick}
                        ></c-lex-custom-lightning-datatable>
                    </div>
                </div>
            </div>
@@ -76,24 +174,65 @@
    </template>
    <!-- 订单各种数量信息弹窗 -->
    <template if:true={showPop}>
        <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small" style="border: 1px solid #D4D4D4;">
        <section
            role="dialog"
            tabindex="-1"
            aria-labelledby="modal-heading-01"
            aria-modal="true"
            aria-describedby="modal-content-id-1"
            class="slds-modal slds-fade-in-open slds-modal_small"
            style="border: 1px solid #d4d4d4"
        >
            <div class="slds-modal__container">
                <header class="slds-modal__header" style="background-color: #F3F3F3;">
                    <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closePop}>
                        <lightning-icon icon-name="utility:close"
                <header
                    class="slds-modal__header"
                    style="background-color: #f3f3f3"
                >
                    <button
                        style=""
                        class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                        title="Close"
                        onclick={closePop}
                    >
                        <lightning-icon
                            icon-name="utility:close"
                            alternative-text="close"
                            variant="inverse"
                            size="small" ></lightning-icon>
                            size="small"
                        ></lightning-icon>
                        <span class="slds-assistive-text">Close</span>
                    </button>
                    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">{popTitle}</h2>
                    <h2
                        id="modal-heading-01"
                        class="slds-text-heading_medium slds-hyphenate"
                    >
                        {popTitle}
                    </h2>
                </header>
                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1" style="border: 1px solid #F3F3F3;">
                    <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="prodModel" columns={colms2}  data={recordList}></lightning-datatable>
                <div
                    class="slds-modal__content slds-p-around_medium"
                    id="modal-content-id-1"
                    style="border: 1px solid #f3f3f3"
                >
                    <lightning-datatable
                        class="wrapped-header-datatable"
                        hide-checkbox-column
                        key-field="prodModel"
                        columns={colms2}
                        data={recordList}
                    ></lightning-datatable>
                </div>
                <footer class="slds-modal__footer">
                    <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="关闭" onclick={closePop}></lightning-button> -->
                    <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="margin-left: 10px;" variant="neutral" label="关闭" onclick={closePop}>关闭</button>
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                        style="margin-left: 10px"
                        variant="neutral"
                        label="关闭"
                        onclick={closePop}
                    >
                        关闭
                    </button>
                </footer>
            </div>
        </section>
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js
@@ -1,4 +1,4 @@
import { LightningElement,wire,api,track } from 'lwc';
import { LightningElement, wire, api, track } from 'lwc';
import { CurrentPageReference } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
@@ -13,11 +13,13 @@
import initNotArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll';
import initMoreThan7 from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7';
import initMoreThan7All from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All';
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
//table css
import { loadStyle } from 'lightning/platformResourceLoader';
import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
export default class LexArriveGoodsMain extends NavigationMixin(LightningElement) {
export default class LexArriveGoodsMain extends NavigationMixin(
    LightningElement
) {
    //页面基础变量
    @track agencyProType;
    @track category1;
@@ -48,62 +50,107 @@
        // {label:'待系统操作入库数量',fieldName:'Delivery_detail_count__c'},
        // {label:'还没发货数量',fieldName:'OrderNumber_notarrive__c'},
        // {label:'发货七天还未到货数',fieldName:'More_than_seven_days__c'},
        {label:'消耗品订单名称',
            type: "customOutputGood",
        {
            label: '消耗品订单名称',
            type: 'customOutputGood',
            typeAttributes: {
                outputValue: { fieldName: "Name" },
                outputValue: { fieldName: 'Name' },
                type: 'Title',
                recordId: { fieldName: "Id" }
                recordId: { fieldName: 'Id' }
            },
            hideDefaultActions: true,initialWidth:200},
        {label:'SAP合同号',fieldName:'ContractNo__c',hideDefaultActions: true},
        {label:'订单总数',
            type: "customOutputGood",
            hideDefaultActions: true,
            initialWidth: 200,
            wrapText: true
        },
        {
            label: 'SAP合同号',
            fieldName: 'ContractNo__c',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 180
        },
        {
            label: '订单总数',
            type: 'customOutputGood',
            typeAttributes: {
                outputValue: { fieldName: "Total_num__c" },
                outputValue: { fieldName: 'Total_num__c' },
                type: 'TotalNum',
                recordId: { fieldName: "Id" }
                recordId: { fieldName: 'Id' }
            },
            hideDefaultActions: true, initialWidth: 100},
        {label:'已到货数量',
            type: "customOutputGood",
            hideDefaultActions: true,
            initialWidth: 100,
            cellAttributes: { alignment: 'right' }
        },
        {
            label: '已到货数量',
            type: 'customOutputGood',
            typeAttributes: {
                outputValue: { fieldName: "OrderNumber_arrived__c" },
                outputValue: { fieldName: 'OrderNumber_arrived__c' },
                type: 'ArrDet',
                recordId: { fieldName: "Id" }
                recordId: { fieldName: 'Id' }
            },
            hideDefaultActions: true, initialWidth: 110},
        {label:'待系统操作入库数量',
            type: "customOutputGood",
            hideDefaultActions: true,
            initialWidth: 110,
            cellAttributes: { alignment: 'right' }
        },
        {
            label: '待系统操作入库数量',
            type: 'customOutputGood',
            typeAttributes: {
                outputValue: { fieldName: "Delivery_detail_count__c" },
                outputValue: { fieldName: 'Delivery_detail_count__c' },
                type: 'DeliveryDet',
                recordId: { fieldName: "Id" }
                recordId: { fieldName: 'Id' }
            },
            hideDefaultActions: true, initialWidth: 180},
        {label:'还没发货数量',
            type: "customOutputGood",
            hideDefaultActions: true,
            initialWidth: 180,
            cellAttributes: { alignment: 'right' }
        },
        {
            label: '还没发货数量',
            type: 'customOutputGood',
            typeAttributes: {
                outputValue: { fieldName: "OrderNumber_notarrive__c" },
                outputValue: { fieldName: 'OrderNumber_notarrive__c' },
                type: 'NotArrDet',
                recordId: { fieldName: "Id" }
                recordId: { fieldName: 'Id' }
            },
            hideDefaultActions: true, initialWidth: 120},
        {label:'发货七天还未到货数',
            type: "customOutputGood",
            hideDefaultActions: true,
            initialWidth: 120,
            cellAttributes: { alignment: 'right' }
        },
        {
            label: '发货七天还未到货数',
            type: 'customOutputGood',
            typeAttributes: {
                outputValue: { fieldName: "More_than_seven_days__c" },
                outputValue: { fieldName: 'More_than_seven_days__c' },
                type: 'MoreThan7',
                recordId: { fieldName: "Id" }
                recordId: { fieldName: 'Id' }
            },
            hideDefaultActions: true, initialWidth: 180},
        {label:'最新发货日期',fieldName:'Shipment_date__c',hideDefaultActions: true, initialWidth: 140},
        {label:'首次发货日期',fieldName:'First_Delivery__c',hideDefaultActions: true, initialWidth: 140}
            hideDefaultActions: true,
            initialWidth: 180,
            cellAttributes: { alignment: 'right' }
        },
        {
            label: '最新发货日期',
            fieldName: 'Shipment_date__c',
            hideDefaultActions: true,
            initialWidth: 140
        },
        {
            label: '首次发货日期',
            fieldName: 'First_Delivery__c',
            hideDefaultActions: true,
            initialWidth: 140
        }
    ];
    @track colms2 = [
        {label:'产品型号',fieldName:'prodModel',hideDefaultActions: true},
        {label:'数量',fieldName:'recordCount',hideDefaultActions: true,initialWidth: 100}
        { label: '产品型号', fieldName: 'prodModel', hideDefaultActions: true },
        {
            label: '数量',
            fieldName: 'recordCount',
            hideDefaultActions: true,
            initialWidth: 100
        }
    ];
    //获取参数
@@ -115,270 +162,329 @@
    //     }
    // }
    renderedCallback(){
    renderedCallback() {
        if (!this.stylesLoaded) {
            Promise.all([loadStyle(this, WrappedHeaderTable)])
                .then(() => {
                    console.log("Custom styles loaded");
                    console.log('Custom styles loaded');
                    this.stylesLoaded = true;
                })
                .catch((error) => {
                    console.error("Error loading custom styles");
                    console.error('Error loading custom styles');
                });
        }
    }
    //初始化
    connectedCallback(){
        init()
            .then(result=>{
                this.isNoteStay = result.isNoteStay;
                if(result.result == 'Success'){
                    this.agencyProType = result.agencyProType;
                    this.accountId = result.accountId;
                    this.title = result.title;
                    this.userWorkLocation = result.userWorkLocation;
                    this.totalNum = result.totalNum;
                    this.orderNumberArrived = result.orderNumberArrived;
                    this.deliveryDetailCount = result.deliveryDetailCount;
                    this.orderNumberNotarrive = result.orderNumberNotarrive;
                    this.moreThanSevenDays = result.moreThanSevenDays;
                    this.raesList = result.raesList;
                    this.raesList.push({Id:'1',Name:'订单明细汇总',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays});
                    this.showSpinner = false;
                    this.showPage = true;
                }else{
                    this.showSpinner = false;
                    console.log("Error:"+result.errorMsg);
                    this.showMyToast('初始化页面失败',result.errorMsg,'error');
                }
            })
    connectedCallback() {
        init().then((result) => {
            this.isNoteStay = result.isNoteStay;
            if (result.result == 'Success') {
                this.agencyProType = result.agencyProType;
                this.accountId = result.accountId;
                this.title = result.title;
                this.userWorkLocation = result.userWorkLocation;
                this.totalNum = result.totalNum;
                this.orderNumberArrived = result.orderNumberArrived;
                this.deliveryDetailCount = result.deliveryDetailCount;
                this.orderNumberNotarrive = result.orderNumberNotarrive;
                this.moreThanSevenDays = result.moreThanSevenDays;
                this.raesList = result.raesList;
                this.raesList.push({
                    Id: '1',
                    Name: '订单明细汇总',
                    Total_num__c: this.totalNum,
                    OrderNumber_arrived__c: this.orderNumberArrived,
                    Delivery_detail_count__c: this.deliveryDetailCount,
                    OrderNumber_notarrive__c: this.orderNumberNotarrive,
                    More_than_seven_days__c: this.moreThanSevenDays
                });
                this.showSpinner = false;
                this.showPage = true;
            } else {
                this.showSpinner = false;
                console.log('Error:' + result.errorMsg);
                this.showMyToast('初始化页面失败', result.errorMsg, 'error');
            }
        });
    }
    //点击链接
    clickLick(event){
    clickLick(event) {
        var outputValue = event.detail.data.value;
        var outputType = event.detail.data.type;
        var recordId = event.detail.data.recordId;
        console.log("click:"+outputValue+"---"+outputType+"---"+recordId);
        if(outputType == 'Title'){
        console.log(
            'click:' + outputValue + '---' + outputType + '---' + recordId
        );
        if (outputType == 'Title') {
            const config = {
                type: 'standard__webPage',
                attributes: {
                   url: '/lexarrivegoods?ESetId='+recordId
                    url: '/lexarrivegoods?ESetId=' + recordId
                }
            };
            this[NavigationMixin.Navigate](config);
        }else if(outputType == 'TotalNum'){
        } else if (outputType == 'TotalNum') {
            this.popTitle = '所有产品一览';
            initTotalNum({ordId:recordId, type:'all'})
            .then(result=>{
                if(result.result == 'Success'){
            initTotalNum({ ordId: recordId, type: 'all' }).then((result) => {
                if (result.result == 'Success') {
                    // this.recordList = result.recordList;
                    var dataStr = JSON.stringify(result.recordList);
                    this.recordList = JSON.parse(dataStr);
                    console.log('data:'+JSON.stringify(this.recordList));
                    console.log('data:' + JSON.stringify(this.recordList));
                    this.showPop = true;
                }else{
                    this.showMyToast('加载所有产品一览页面失败',result.errorMsg,'error');
                } else {
                    this.showMyToast(
                        '加载所有产品一览页面失败',
                        result.errorMsg,
                        'error'
                    );
                }
            })
        }else if(outputType == 'ArrDet'){
            if(recordId == '1'){
            });
        } else if (outputType == 'ArrDet') {
            if (recordId == '1') {
                this.popTitle = '所有已到货产品一览';
                initArrDetAll({type:'all'})
                .then(result=>{
                    if(result.result == 'Success'){
                initArrDetAll({ type: 'all' }).then((result) => {
                    if (result.result == 'Success') {
                        // this.recordList = result.recordList;
                        var dataStr = JSON.stringify(result.recordList);
                        this.recordList = JSON.parse(dataStr);
                        console.log('data:'+JSON.stringify(this.recordList));
                        console.log('data:' + JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载所有已到货产品一览页面失败',result.errorMsg,'error');
                    } else {
                        this.showMyToast(
                            '加载所有已到货产品一览页面失败',
                            result.errorMsg,
                            'error'
                        );
                    }
                })
            }else{
                });
            } else {
                this.popTitle = '已到货产品一览';
                initArrDet({orderId:recordId})
                .then(result=>{
                    if(result.result == 'Success'){
                initArrDet({ orderId: recordId }).then((result) => {
                    if (result.result == 'Success') {
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        console.log('data:' + JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载已到货产品一览页面失败',result.errorMsg,'error');
                    } else {
                        this.showMyToast(
                            '加载已到货产品一览页面失败',
                            result.errorMsg,
                            'error'
                        );
                    }
                })
                });
            }
        }else if(outputType == 'DeliveryDet'){
            if(recordId == '1'){
        } else if (outputType == 'DeliveryDet') {
            if (recordId == '1') {
                this.popTitle = '所有已发货还没到货产品一览';
                initDeliveryDetAll({type:'all'})
                .then(result=>{
                    if(result.result == 'Success'){
                initDeliveryDetAll({ type: 'all' }).then((result) => {
                    if (result.result == 'Success') {
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        console.log('data:' + JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载所有已发货还没到货产品一览页面失败',result.errorMsg,'error');
                    } else {
                        this.showMyToast(
                            '加载所有已发货还没到货产品一览页面失败',
                            result.errorMsg,
                            'error'
                        );
                    }
                })
            }else{
                });
            } else {
                this.popTitle = '未到货产品一览';
                initDeliveryDet({orderId:recordId})
                .then(result=>{
                    if(result.result == 'Success'){
                initDeliveryDet({ orderId: recordId }).then((result) => {
                    if (result.result == 'Success') {
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        console.log('data:' + JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载未到货产品一览页面失败',result.errorMsg,'error');
                    } else {
                        this.showMyToast(
                            '加载未到货产品一览页面失败',
                            result.errorMsg,
                            'error'
                        );
                    }
                })
                });
            }
        }else if(outputType == 'NotArrDet'){
            if(recordId == '1'){
        } else if (outputType == 'NotArrDet') {
            if (recordId == '1') {
                this.popTitle = '所有还没发货产品一览';
                initNotArrDetAll({type:'all'})
                .then(result=>{
                    if(result.result == 'Success'){
                initNotArrDetAll({ type: 'all' }).then((result) => {
                    if (result.result == 'Success') {
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        console.log('data:' + JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载所有还没发货产品一览页面失败',result.errorMsg,'error');
                    } else {
                        this.showMyToast(
                            '加载所有还没发货产品一览页面失败',
                            result.errorMsg,
                            'error'
                        );
                    }
                })
            }else{
                });
            } else {
                this.popTitle = '还没发货数量';
                initNotArrDet({orderId:recordId})
                .then(result=>{
                    if(result.result == 'Success'){
                initNotArrDet({ orderId: recordId }).then((result) => {
                    if (result.result == 'Success') {
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        console.log('data:' + JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载还没发货数量页面失败',result.errorMsg,'error');
                    } else {
                        this.showMyToast(
                            '加载还没发货数量页面失败',
                            result.errorMsg,
                            'error'
                        );
                    }
                })
                });
            }
        }else if(outputType == 'MoreThan7'){
            if(recordId == '1'){
        } else if (outputType == 'MoreThan7') {
            if (recordId == '1') {
                this.popTitle = '所有发货七天还未到货数';
                initMoreThan7All({type:'all'})
                .then(result=>{
                    if(result.result == 'Success'){
                initMoreThan7All({ type: 'all' }).then((result) => {
                    if (result.result == 'Success') {
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        console.log('data:' + JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载所有发货七天还未到货数页面失败',result.errorMsg,'error');
                    } else {
                        this.showMyToast(
                            '加载所有发货七天还未到货数页面失败',
                            result.errorMsg,
                            'error'
                        );
                    }
                })
            }else{
                });
            } else {
                this.popTitle = '发货七天还未到货数';
                initMoreThan7({orderId:recordId})
                .then(result=>{
                    if(result.result == 'Success'){
                initMoreThan7({ orderId: recordId }).then((result) => {
                    if (result.result == 'Success') {
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        console.log('data:' + JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载发货七天还未到货数页面失败',result.errorMsg,'error');
                    } else {
                        this.showMyToast(
                            '加载发货七天还未到货数页面失败',
                            result.errorMsg,
                            'error'
                        );
                    }
                })
                });
            }
        }
    }
    //关闭弹窗
    closePop(){
    closePop() {
        this.showPop = false;
    }
    //消耗品订单名称变更
    category1Change(event){
    category1Change(event) {
        this.category1 = event.detail.value;
    }
    //最新发货日期变更
    cate2Change(event){
    cate2Change(event) {
        this.cate2 = event.detail.value;
    }
    //检索
    search(){
    search() {
        this.showSpinner = true;
        searchConsumableorderdetails({
            category1Str:this.category1,
            cate2Str:this.cate2,
            accountidStr:this.accountId,
            userWorkLocationStr:this.userWorkLocation,
            agencyProTypeStr:this.agencyProType})
        .then(result=>{
            category1Str: this.category1,
            cate2Str: this.cate2,
            accountidStr: this.accountId,
            userWorkLocationStr: this.userWorkLocation,
            agencyProTypeStr: this.agencyProType
        }).then((result) => {
            this.showSpinner = false;
            if(result.result == 'Success'){
            if (result.result == 'Success') {
                this.raesList = result.raesList;
                this.raesList.push({Id:'1',Name:'订单明细汇总',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays});
                if(this.raesList.length > 1){
                this.raesList.push({
                    Id: '1',
                    Name: '订单明细汇总',
                    Total_num__c: this.totalNum,
                    OrderNumber_arrived__c: this.orderNumberArrived,
                    Delivery_detail_count__c: this.deliveryDetailCount,
                    OrderNumber_notarrive__c: this.orderNumberNotarrive,
                    More_than_seven_days__c: this.moreThanSevenDays
                });
                if (this.raesList.length > 1) {
                    var count = this.raesList.length - 1;
                    this.showMyToast('搜索成功','共搜索到'+count+'条数据','success');
                }else{
                    this.showMyToast('未搜索到数据','','error');
                    this.showMyToast(
                        '搜索成功',
                        '共搜索到' + count + '条数据',
                        'success'
                    );
                } else {
                    this.showMyToast('未搜索到数据', '', 'error');
                }
            }else{
                this.showMyToast('搜索失败',result.errorMsg,'error');
            } else {
                this.showMyToast('搜索失败', result.errorMsg, 'error');
            }
        })
        });
    }
    //清空搜索框
    clear(){
    clear() {
        this.showSpinner = true;
        this.category1 = '';
        this.cate2 = null;
        searchConsumableorderdetails({
            category1Str:this.category1,
            cate2Str:this.cate2,
            accountidStr:this.accountId,
            userWorkLocationStr:this.userWorkLocation,
            agencyProTypeStr:this.agencyProType})
        .then(result=>{
            category1Str: this.category1,
            cate2Str: this.cate2,
            accountidStr: this.accountId,
            userWorkLocationStr: this.userWorkLocation,
            agencyProTypeStr: this.agencyProType
        }).then((result) => {
            this.showSpinner = false;
            if(result.result == 'Success'){
            if (result.result == 'Success') {
                this.raesList = result.raesList;
                this.raesList.push({Id:'1',Name:'订单明细汇总',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays});
                if(this.raesList.length > 1){
                this.raesList.push({
                    Id: '1',
                    Name: '订单明细汇总',
                    Total_num__c: this.totalNum,
                    OrderNumber_arrived__c: this.orderNumberArrived,
                    Delivery_detail_count__c: this.deliveryDetailCount,
                    OrderNumber_notarrive__c: this.orderNumberNotarrive,
                    More_than_seven_days__c: this.moreThanSevenDays
                });
                if (this.raesList.length > 1) {
                    var count = this.raesList.length - 1;
                    this.showMyToast('搜索成功','共搜索到'+count+'条数据','success');
                }else{
                    this.showMyToast('未搜索到数据','','error');
                    this.showMyToast(
                        '搜索成功',
                        '共搜索到' + count + '条数据',
                        'success'
                    );
                } else {
                    this.showMyToast('未搜索到数据', '', 'error');
                }
            }else{
                this.showMyToast('搜索失败',result.errorMsg,'error');
            } else {
                this.showMyToast('搜索失败', result.errorMsg, 'error');
            }
        })
        });
    }
    //入库
    orderArrive(){
    orderArrive() {
        const config = {
            type: 'standard__webPage',
            attributes: {
               url: '/lexarrivegoods?ArrType=Arr'
                url: '/lexarrivegoods?ArrType=Arr'
            }
        };
        this[NavigationMixin.Navigate](config);
    }
    //返品
    orderReturn(){
    orderReturn() {
        const config = {
            type: 'standard__webPage',
            attributes: {
               url: '/lexarrivegoods?ArrType=ReG'
                url: '/lexarrivegoods?ArrType=ReG'
            }
        };
        this[NavigationMixin.Navigate](config);
@@ -388,18 +494,24 @@
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if(variant == 'success'){
           iconName = 'utility:check';
        }else{
           iconName = 'utility:error';
        if (variant == 'success') {
            iconName = 'utility:check';
        } else {
            iconName = 'utility:error';
        }
        if(message != ''){
           content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
        }else{
           content = '<h2><strong>'+title+'<strong/></h2>';
        if (message != '') {
            content =
                '<h2><strong>' +
                title +
                '<strong/></h2><h5>' +
                message +
                '</h5>';
        } else {
            content = '<h2><strong>' + title + '<strong/></h2>';
        }
        this.template.querySelector('c-common-toast').
        showToast(variant,content,iconName,10000);
        this.template
            .querySelector('c-common-toast')
            .showToast(variant, content, iconName, 10000);
        // var mode;
        // if(this.isNoteStay){
        //     mode ='sticky';
@@ -413,5 +525,5 @@
        //     mode: mode
        // });
        // this.dispatchEvent(evt);
     }
    }
}
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.html
@@ -1,11 +1,27 @@
<template>
    <template if:true={showSpinner}>
        <lightning-spinner size="medium" variant="brand"></lightning-spinner>
        <!-- <lightning-spinner size="medium" variant="brand"></lightning-spinner> -->
        <div class="slds-spinner_container">
            <div
                role="status"
                class="slds-spinner slds-spinner_medium slds-spinner_brand"
            >
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
            </div>
        </div>
    </template>
    <c-common-toast></c-common-toast>
    <template if:true={showPage}>
        <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
            <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
        <div
            style="
                border: 1px solid #d4d4d4;
                border-top: 3px solid #51606e;
                border-radius: 5px;
            "
        >
            <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
                <lightning-layout>
                    <lightning-layout-item padding="around-small">
                        <p style="font-size: 18px">
@@ -15,14 +31,29 @@
                </lightning-layout>
                <!-- <p style="font-size: 16px;"><strong>到货</strong></p> -->
            </div>
            <div style="padding:10px;">
            <div style="padding: 10px">
                <!-- 按钮 -->
                <!-- <lightning-button style="margin: 5px;" label="出库" onclick={proSale} disabled={arrivetoorder}></lightning-button> -->
                <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="出库" onclick={proSale} disabled={arrivetoorder}>出库</button>
                <p style="height: 10px;"></p>
                <button
                    class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                    style="margin: 5px"
                    label="出库"
                    onclick={proSale}
                    disabled={arrivetoorder}
                >
                    出库
                </button>
                <p style="height: 10px"></p>
                <!-- 到货订单信息 -->
                <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                    <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                <div
                    style="
                        border: 1px solid #d4d4d4;
                        border-top: 3px solid #51606e;
                        border-radius: 5px;
                        margin-bottom: 7px;
                    "
                >
                    <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
@@ -32,34 +63,77 @@
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>到货订单信息</strong></p> -->
                    </div>
                    <div style="padding:10px;">
                    <div style="padding: 10px">
                        <table>
                            <tbody>
                                <tr>
                                    <td  style="width:10px;"></td>
                                    <td style="width:140px;">
                                        <div style="color:#696969;font-size:16px;">到货订单名称</div>
                                    <td style="width: 10px"></td>
                                    <td style="width: 140px">
                                        <div
                                            style="
                                                color: #696969;
                                                font-size: 16px;
                                            "
                                        >
                                            到货订单名称
                                        </div>
                                    </td>
                                    <td style="width:200px;">
                                        <lightning-formatted-text style="font-size: 16px;" value={coc.Name}></lightning-formatted-text>
                                    <td style="width: 200px">
                                        <lightning-formatted-text
                                            style="font-size: 16px"
                                            value={coc.Name}
                                        ></lightning-formatted-text>
                                    </td>
                                    <td  style="width:30px;"></td>
                                    <td style="width:140px;">
                                        <div style="color:#696969;font-size:16px;">本次入库产品金额</div>
                                    <td style="width: 30px"></td>
                                    <td style="width: 140px">
                                        <div
                                            style="
                                                color: #696969;
                                                font-size: 16px;
                                            "
                                        >
                                            本次入库产品金额
                                        </div>
                                    </td>
                                    <td style="width:100px;">
                                        <lightning-formatted-number style="font-size: 16px;" value={coc.Arrive_total_amount__c} minimum-fraction-digits="2"></lightning-formatted-number>
                                    <td style="width: 100px">
                                        <lightning-formatted-number
                                            style="font-size: 16px"
                                            value={coc.Arrive_total_amount__c}
                                            minimum-fraction-digits="2"
                                        ></lightning-formatted-number>
                                    </td>
                                    <td></td>
                                </tr>
                                <tr style="height: 20px;"></tr>
                                <tr style="height: 20px"></tr>
                                <tr>
                                    <td  style="width:10px;"></td>
                                    <td style="width:120px;">
                                        <div style="color:#696969;font-size:16px;">消耗品订单名称<lightning-helptext style="--lwc-spacingXxSmall:0px;" content={label.helpText}></lightning-helptext></div>
                                    <td style="width: 10px"></td>
                                    <td style="width: 120px">
                                        <div
                                            style="
                                                color: #696969;
                                                font-size: 16px;
                                            "
                                        >
                                            消耗品订单名称<lightning-helptext
                                                style="
                                                    --lwc-spacingXxSmall: 0px;
                                                "
                                                content={label.helpText}
                                            ></lightning-helptext>
                                        </div>
                                    </td>
                                    <td style="width:200px;">
                                        <lightning-formatted-text style="font-size: 16px;" value={coc.arriveOrder}></lightning-formatted-text>
                                    <td style="width: 200px">
                                        <a
                                            style="
                                                text-decoration: underline;
                                                color: black;
                                            "
                                            onclick={clickOrder}
                                            ><lightning-formatted-text
                                                style="font-size: 16px"
                                                value={coc.arriveOrder}
                                            ></lightning-formatted-text
                                        ></a>
                                        <!-- <lightning-formatted-text value={coc.Arrive_Order__r.Name}></lightning-formatted-text> -->
                                    </td>
                                    <td></td>
@@ -69,8 +143,15 @@
                    </div>
                </div>
                <!-- 在库商品库存一览 -->
                <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                    <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                <div
                    style="
                        border: 1px solid #d4d4d4;
                        border-top: 3px solid #51606e;
                        border-radius: 5px;
                        margin-bottom: 7px;
                    "
                >
                    <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
@@ -80,8 +161,15 @@
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>在库商品库存一览</strong></p> -->
                    </div>
                    <div style="padding:10px;">
                        <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="recordId" columns={colms} data={consumableorderdetailsRecords}></lightning-datatable>
                    <div style="padding: 10px">
                        <lightning-datatable
                            class="wrapped-header-datatable"
                            style="word-wrap: break-word; word-break: break-all"
                            hide-checkbox-column
                            key-field="recordId"
                            columns={colms}
                            data={consumableorderdetailsRecords}
                        ></lightning-datatable>
                    </div>
                </div>
            </div>
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js
@@ -1,16 +1,17 @@
import { LightningElement,wire,track } from 'lwc';
import { LightningElement, wire, track } from 'lwc';
import { CurrentPageReference } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import init from '@salesforce/apex/LexArriveGsDetailsController.init';
import proSale from '@salesforce/apex/LexArriveGsDetailsController.proSale';
import helpText from '@salesforce/label/c.LexArrivegsDetailsPageHelpText';
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
//table css
import { loadStyle } from 'lightning/platformResourceLoader';
import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
export default class LexArriveGsDetails extends NavigationMixin(LightningElement) {
export default class LexArriveGsDetails extends NavigationMixin(
    LightningElement
) {
    @track eSetId;
    @track showSpinner = true;
    @track showPage = false;
@@ -24,16 +25,67 @@
    //是否一直显示提示
    @track isNoteStay = true;
    @track colms = [
        {label:'消耗品名称' , fieldName:'prodName', hideDefaultActions: true,wrapText:true},
        {label:'规格' , fieldName:'packing_list', hideDefaultActions: true,wrapText:true,initialWidth:50,cellAttributes: { alignment: "right" }},
        {label:'CFDA状态' , fieldName:'statusCFDA', hideDefaultActions: true,wrapText:true,initialWidth:100},
        {label:'注册证编码号' , fieldName:'approbation_No', hideDefaultActions: true,wrapText:true,initialWidth:125},
        {label:'注册证效期' , fieldName:'expiration_DateStr', hideDefaultActions: true,wrapText:true,initialWidth:115},
        {label:'使用期限' , fieldName:'Sterilization_limitStr', hideDefaultActions: true,wrapText:true,initialWidth:115},
        {label:'BarCode' , fieldName:'barCode', hideDefaultActions: true,initialWidth:250},
        {label:'采购单价' ,type:'number',fieldName:'intraTradeList', hideDefaultActions: true,wrapText:true,initialWidth:120,typeAttributes:{minimumFractionDigits: 2},cellAttributes: { alignment: "right" }}
        {
            label: '消耗品名称',
            fieldName: 'prodName',
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '规格',
            fieldName: 'packing_list',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 50,
            cellAttributes: { alignment: 'right' }
        },
        {
            label: 'CFDA状态',
            fieldName: 'statusCFDA',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 100
        },
        {
            label: '注册证编码号',
            fieldName: 'approbation_No',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 125
        },
        {
            label: '注册证效期',
            fieldName: 'expiration_DateStr',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 115
        },
        {
            label: '使用期限',
            fieldName: 'Sterilization_limitStr',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 115
        },
        {
            label: 'BarCode',
            fieldName: 'barCode',
            hideDefaultActions: true,
            initialWidth: 250,
            wrapText: true
        },
        {
            label: '采购单价',
            type: 'number',
            fieldName: 'intraTradeList',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 120,
            typeAttributes: { minimumFractionDigits: 2 },
            cellAttributes: { alignment: 'right' }
        }
    ];
    label = {helpText};
    label = { helpText };
    // 获取参数
    @wire(CurrentPageReference)
@@ -41,116 +93,173 @@
        if (currentPageReference) {
            this.eSetId = currentPageReference.state?.EsetId;
        }
        console.log('CurrentPageReference:'+this.eSetId);
        console.log('CurrentPageReference:' + this.eSetId);
    }
    renderedCallback(){
    renderedCallback() {
        if (!this.stylesLoaded) {
            Promise.all([loadStyle(this, WrappedHeaderTable)])
                .then(() => {
                    console.log("Custom styles loaded");
                    console.log('Custom styles loaded');
                    this.stylesLoaded = true;
                })
                .catch((error) => {
                    console.error("Error loading custom styles");
                    console.error('Error loading custom styles');
                });
        }
    }
    //初始化
    connectedCallback(){
        init({eSetIdStr : this.eSetId})
        .then(result=>{
            this.showPage = true;
            this.isNoteStay = result.isNoteStay;
            if(result.result == 'Success'){
                this.coc = result.coc;
                if(this.coc.Arrive_Order__c != null && this.coc.Arrive_Order__c != ''){
                    this.coc['arriveOrder'] = this.coc.Arrive_Order__r.Name;
                }
                console.log('this.coc:'+JSON.stringify(this.coc));
                this.accountid = result.accountid;
                this.orderallcount = result.orderallcount;
                this.arrivetoorder = result.arrivetoorder;
                this.consumableorderdetailsCount = result.consumableorderdetailsCount;
                this.consumableorderdetailsRecords = result.consumableorderdetailsRecords;
                for(var i in this.consumableorderdetailsRecords){
                    if(this.consumableorderdetailsRecords[i].esd != null){
                        this.consumableorderdetailsRecords[i]['recordId'] = this.consumableorderdetailsRecords[i].esd.Id;
                        if(this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != null && this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != ''){
                            this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].esd.Consumable_Product__r.Name__c;
    connectedCallback() {
        init({ eSetIdStr: this.eSetId })
            .then((result) => {
                this.showPage = true;
                this.isNoteStay = result.isNoteStay;
                if (result.result == 'Success') {
                    this.coc = result.coc;
                    if (
                        this.coc.Arrive_Order__c != null &&
                        this.coc.Arrive_Order__c != ''
                    ) {
                        this.coc['arriveOrder'] = this.coc.Arrive_Order__r.Name;
                    }
                    console.log('this.coc:' + JSON.stringify(this.coc));
                    this.accountid = result.accountid;
                    this.orderallcount = result.orderallcount;
                    this.arrivetoorder = result.arrivetoorder;
                    this.consumableorderdetailsCount =
                        result.consumableorderdetailsCount;
                    this.consumableorderdetailsRecords =
                        result.consumableorderdetailsRecords;
                    for (var i in this.consumableorderdetailsRecords) {
                        if (this.consumableorderdetailsRecords[i].esd != null) {
                            this.consumableorderdetailsRecords[i]['recordId'] =
                                this.consumableorderdetailsRecords[i].esd.Id;
                            if (
                                this.consumableorderdetailsRecords[i].esd
                                    .Consumable_Product__c != null &&
                                this.consumableorderdetailsRecords[i].esd
                                    .Consumable_Product__c != ''
                            ) {
                                this.consumableorderdetailsRecords[i][
                                    'prodName'
                                ] =
                                    this.consumableorderdetailsRecords[
                                        i
                                    ].esd.Consumable_Product__r.Name__c;
                            }
                            // this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].prodName;
                            this.consumableorderdetailsRecords[i]['barCode'] =
                                this.consumableorderdetailsRecords[
                                    i
                                ].esd.Bar_Code__c;
                            this.consumableorderdetailsRecords[i][
                                'intraTradeList'
                            ] =
                                this.consumableorderdetailsRecords[
                                    i
                                ].esd.Intra_Trade_List_RMB__c;
                            console.log(
                                'Intra_Trade_List_RMB__c:' +
                                    this.consumableorderdetailsRecords[i].esd
                                        .Intra_Trade_List_RMB__c
                            );
                        }
                        // this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].prodName;
                        this.consumableorderdetailsRecords[i]['barCode'] = this.consumableorderdetailsRecords[i].esd.Bar_Code__c;
                        this.consumableorderdetailsRecords[i]['intraTradeList'] = this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c;
                        console.log("Intra_Trade_List_RMB__c:"+this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c);
                        if (
                            this.consumableorderdetailsRecords[i].Prod != null
                        ) {
                            this.consumableorderdetailsRecords[i][
                                'statusCFDA'
                            ] =
                                this.consumableorderdetailsRecords[
                                    i
                                ].Prod.SFDA_Status__c;
                        }
                    }
                    if(this.consumableorderdetailsRecords[i].Prod != null){
                        this.consumableorderdetailsRecords[i]['statusCFDA'] = this.consumableorderdetailsRecords[i].Prod.SFDA_Status__c;
                    }
                    this.showSpinner = false;
                } else {
                    this.showSpinner = false;
                    console.log('error:' + result.errorMsg);
                    this.showMyToast('初始化失败', result.errorMsg, 'error');
                }
            })
            .catch((error) => {
                this.showSpinner = false;
            }else {
                this.showSpinner = false;
                console.log("error:"+result.errorMsg);
                this.showMyToast('初始化失败',result.errorMsg,'error');
            }
        })
        .catch(error=>{
            this.showSpinner = false;
            this.showPage = true;
            console.log("error:"+error);
            this.showMyToast('初始化失败',error,'error');
        })
                this.showPage = true;
                console.log('error:' + error);
                this.showMyToast('初始化失败', error, 'error');
            });
    }
    proSale(){
    proSale() {
        this.showSpinner = true;
        proSale({
            cocStr : JSON.stringify(this.coc),
            orderallcountParm : this.orderallcount,
            consumableorderdetailsCountParm : this.consumableorderdetailsCount
            cocStr: JSON.stringify(this.coc),
            orderallcountParm: this.orderallcount,
            consumableorderdetailsCountParm: this.consumableorderdetailsCount,
            eSetIdStr: this.eSetId
        })
        .then(result=>{
            if(result.result == 'Success'){
                var url = result.url;
                const config = {
                    type: 'standard__webPage',
                    attributes: {
                       url: url
                    }
                };
                this[NavigationMixin.Navigate](config);
            }else {
            .then((result) => {
                if (result.result == 'Success') {
                    var url = result.url;
                    const config = {
                        type: 'standard__webPage',
                        attributes: {
                            url: url
                        }
                    };
                    this[NavigationMixin.Navigate](config);
                } else {
                    this.showSpinner = false;
                    console.log('error:' + result.errorMsg);
                    this.showMyToast('出库失败', result.errorMsg, 'error');
                }
            })
            .catch((error) => {
                this.showPage = true;
                this.showSpinner = false;
                console.log("error:"+error);
                this.showMyToast('出库失败',result.errorMsg,'error');
            }
        })
        .catch(error=>{
            this.showPage = true;
            this.showSpinner = false;
            console.log("error:"+error);
            this.showMyToast('出库失败',error,'error');
        })
                console.log('error:' + error);
                this.showMyToast('出库失败', error, 'error');
            });
    }
    clickOrder() {
        if (
            this.coc.Arrive_Order__c != null &&
            this.coc.Arrive_Order__c != ''
        ) {
            const config = {
                type: 'standard__webPage',
                attributes: {
                    url: '/detail/' + this.coc.Arrive_Order__c
                }
            };
            this[NavigationMixin.Navigate](config);
        }
    }
    showMyToast(title, message, variant) {
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if(variant == 'success'){
           iconName = 'utility:check';
        }else{
           iconName = 'utility:error';
        if (variant == 'success') {
            iconName = 'utility:check';
        } else {
            iconName = 'utility:error';
        }
        if(message != ''){
           content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
        }else{
           content = '<h2><strong>'+title+'<strong/></h2>';
        if (message != '') {
            content =
                '<h2><strong>' +
                title +
                '<strong/></h2><h5>' +
                message +
                '</h5>';
        } else {
            content = '<h2><strong>' + title + '<strong/></h2>';
        }
        this.template.querySelector('c-common-toast').
        showToast(variant,content,iconName,10000);
        this.template
            .querySelector('c-common-toast')
            .showToast(variant, content, iconName, 10000);
        // var mode;
        // if(this.isNoteStay){
        //     mode ='sticky';
@@ -164,5 +273,5 @@
        //     mode: mode
        // });
        // this.dispatchEvent(evt);
     }
    }
}
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html
@@ -1,11 +1,26 @@
<template>
    <template if:true={showSpinner}>
        <lightning-spinner size="medium" variant="brand"></lightning-spinner>
        <!-- <lightning-spinner size="medium" variant="brand"></lightning-spinner> -->
        <div class="slds-spinner_container">
            <div
                role="status"
                class="slds-spinner slds-spinner_medium slds-spinner_brand"
            >
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
            </div>
        </div>
    </template>
    <c-common-toast></c-common-toast>
    <div style="border: 1px solid #D4D4D4;border-radius:5px;">
        <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;">
    <div style="border: 1px solid #d4d4d4; border-radius: 5px">
        <div
            style="
                border-top: 3px solid #51606e;
                border-bottom: 1px solid #d4d4d4;
                padding: 3px;
            "
        >
            <div>
                <!-- <p style="font-size: 18px;"><strong>取消拆盒</strong></p> -->
                <lightning-layout>
@@ -17,15 +32,51 @@
                </lightning-layout>
            </div>
        </div>
        <div style="padding:10px;">
            <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
            <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
                <!-- <lightning-button variant="brand" class='lexstyle' style="margin-left:10px;" label="取消拆盒确认" title="取消拆盒确认" onclick={saveConfirm}></lightning-button></td> -->
                <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin-left:10px;margin-top:12px;margin-bottom:12px;" label="取消拆盒确认" onclick={saveConfirm}>取消拆盒确认</button>
        <div style="padding: 10px">
            <div
                style="
                    border: 1px solid #d4d4d4;
                    border-radius: 5px;
                    margin-bottom: 7px;
                "
            >
                <div
                    style="
                        border-top: 3px solid #51606e;
                        border-bottom: 1px solid #d4d4d4;
                        padding: 3px;
                    "
                >
                    <!-- <lightning-button variant="brand" class='lexstyle' style="margin-left:10px;" label="取消拆盒确认" title="取消拆盒确认" onclick={saveConfirm}></lightning-button></td> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="
                            margin-left: 10px;
                            margin-top: 12px;
                            margin-bottom: 12px;
                        "
                        label="取消拆盒确认"
                        onclick={saveConfirm}
                    >
                        取消拆盒确认
                    </button>
                </div>
            </div>
            </div>
            <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:5px;">
                <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
            <div
                style="
                    border: 1px solid #d4d4d4;
                    border-radius: 5px;
                    margin-bottom: 7px;
                    margin-top: 5px;
                "
            >
                <div
                    style="
                        border-top: 3px solid #51606e;
                        border-bottom: 1px solid #d4d4d4;
                        padding: 3px;
                    "
                >
                    <lightning-layout>
                        <lightning-layout-item padding="around-small">
                            <p style="font-size: 16px">
@@ -34,46 +85,71 @@
                        </lightning-layout-item>
                    </lightning-layout>
                </div>
                <!-- <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> -->
                    <table>
                        <colgroup>
                            <col width="160px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="70px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="90px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="85px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="70px" />
                            <col width="100px" />
                        </colgroup>
                        <tbody>
                            <tr>
                                <td></td>
                                <td align="right" class="searchName">BarCode</td>
                                <td style="width:600px"><lightning-textarea class="inputFont" name="BarCode" label=""
                                        onchange={handleChange}></lightning-textarea></td>
                                <td align="right"></td>
                                <td></td>
                                <td  style="width: 200px;">
                                    <button style="margin-top:14px;"  class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="获取明细" onclick={getDetails}>获取明细</button>
                                    <!-- <lightning-button variant="brand" class='lexstyle' label="获取明细" title="获取明细" onclick={getDetails}
                <table>
                    <colgroup>
                        <col width="160px" />
                        <col width="100px" />
                        <col width="10px" />
                        <col width="70px" />
                        <col width="100px" />
                        <col width="10px" />
                        <col width="90px" />
                        <col width="100px" />
                        <col width="10px" />
                        <col width="85px" />
                        <col width="100px" />
                        <col width="10px" />
                        <col width="70px" />
                        <col width="100px" />
                    </colgroup>
                    <tbody>
                        <tr>
                            <td></td>
                            <td align="right" class="searchName">BarCode</td>
                            <td style="width: 600px">
                                <lightning-textarea
                                    class="inputFont"
                                    name="BarCode"
                                    label=""
                                    onchange={handleChange}
                                ></lightning-textarea>
                            </td>
                            <td align="right"></td>
                            <td></td>
                            <td style="width: 200px">
                                <button
                                    style="margin-top: 14px"
                                    class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                    label="获取明细"
                                    onclick={getDetails}
                                >
                                    获取明细
                                </button>
                                <!-- <lightning-button variant="brand" class='lexstyle' label="获取明细" title="获取明细" onclick={getDetails}
                                       ></lightning-button> -->
                                </td>
                            </tr>
                        </tbody>
                    </table>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <!-- </div> -->
            </div>
            <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
                <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
            <div
                style="
                    border: 1px solid #d4d4d4;
                    border-radius: 5px;
                    margin-bottom: 7px;
                "
            >
                <div
                    style="
                        border-top: 3px solid #51606e;
                        border-bottom: 1px solid #d4d4d4;
                        padding: 3px;
                    "
                >
                    <lightning-layout>
                        <lightning-layout-item padding="around-small">
                            <p style="font-size: 18px">
@@ -82,26 +158,46 @@
                        </lightning-layout-item>
                    </lightning-layout>
                </div>
                <div style="padding:10px;">
                <div style="padding: 10px">
                    <!-- <div style="height: 300px;"> -->
                        <!-- <template if:true={showTable}> -->
                            <c-lex-custom-lightning-datatable key-field="prodid" data={data} columns={columns}
                            onrowselection={getSelectedRows} hide-checkbox-column="true"
                            selected-rows={selectedRows} class="wrapped-header-datatable">
                                </c-lex-custom-lightning-datatable>
                        <!-- </template> -->
                    <!-- <template if:true={showTable}> -->
                    <c-lex-custom-lightning-datatable
                        key-field="prodid"
                        data={data}
                        columns={columns}
                        onrowselection={getSelectedRows}
                        hide-checkbox-column="true"
                        selected-rows={selectedRows}
                        class="wrapped-header-datatable"
                        style="word-wrap: break-word; word-break: break-all"
                    >
                    </c-lex-custom-lightning-datatable>
                    <!-- </template> -->
                    <!-- </div> -->
                </div>
            </div>
            <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:10px">
                <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
            <div
                style="
                    border: 1px solid #d4d4d4;
                    border-radius: 5px;
                    margin-bottom: 7px;
                    margin-top: 10px;
                "
            >
                <div
                    style="
                        border-top: 3px solid #51606e;
                        border-bottom: 1px solid #d4d4d4;
                        padding: 3px;
                    "
                >
                    <table>
                        <tr>
                            <td>
                                <lightning-layout>
                                    <lightning-layout-item padding="around-small">
                                    <lightning-layout-item
                                        padding="around-small"
                                    >
                                        <p style="font-size: 18px">
                                            <strong>错误明细</strong>
                                        </p>
@@ -111,21 +207,21 @@
                        </tr>
                    </table>
                </div>
            <div style="padding:10px;">
                <lightning-datatable
                key-field="id" data={errorDetail} columns={column}
                onrowselection={getSelectedRows}   hide-checkbox-column="true"
               selected-rows={selectedRows}  class="wrapped-header-datatable">
        </lightning-datatable>
                <div style="padding: 10px">
                    <lightning-datatable
                        key-field="id"
                        data={errorDetail}
                        columns={column}
                        onrowselection={getSelectedRows}
                        hide-checkbox-column="true"
                        selected-rows={selectedRows}
                        class="wrapped-header-datatable"
                        style="word-wrap: break-word; word-break: break-all"
                    >
                    </lightning-datatable>
                </div>
            </div>
        </div>
        </div>
    </div>
</template>
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js
@@ -1,77 +1,76 @@
import { LightningElement, wire, api, track } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import oninit from "@salesforce/apex/LexCancelRemoveBoxController.init";
import searchDeatail from "@salesforce/apex/LexCancelRemoveBoxController.searchConsumableorderdetails"
import oninit from '@salesforce/apex/LexCancelRemoveBoxController.init';
import searchDeatail from '@salesforce/apex/LexCancelRemoveBoxController.searchConsumableorderdetails';
import saveConfirm from '@salesforce/apex/LexCancelRemoveBoxController.cancelRemoveBoxConfirm';
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
//table css
import { loadStyle } from 'lightning/platformResourceLoader';
import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
const columns = [
    {
      label: '消耗品名称',
      fieldName: 'Name__c',
      hideDefaultActions: true,
      wrapText:true
      // initialWidth: 350,
        label: '消耗品名称',
        fieldName: 'Name__c',
        hideDefaultActions: true,
        wrapText: true
        // initialWidth: 350,
    },
    {
      label: '规格',
      fieldName: 'ProductPacking_list_manual__c',
      hideDefaultActions: true,
      cellAttributes: { alignment: "right" },
      initialWidth: 50,
        label: '规格',
        fieldName: 'ProductPacking_list_manual__c',
        hideDefaultActions: true,
        cellAttributes: { alignment: 'right' },
        initialWidth: 50
    },
    {
      label: 'CFDA状态',
      fieldName: 'CFDA_Status__c',
      hideDefaultActions: true,
      initialWidth: 200,
        label: 'CFDA状态',
        fieldName: 'CFDA_Status__c',
        hideDefaultActions: true,
        initialWidth: 100,
        wrapText: true
    },
    {
      label: '注册证编码号',
      fieldName: 'Report_Product_Approbation__c',
      hideDefaultActions: true,
      initialWidth: 200,
        label: '注册证编码号',
        fieldName: 'Report_Product_Approbation__c',
        hideDefaultActions: true,
        initialWidth: 200,
        wrapText: true
    },
    {
      label: '注册证效期',
      fieldName: 'Report_Product_Expiration__c',
      hideDefaultActions: true,
      // initialWidth: 250,
        label: '注册证效期',
        fieldName: 'Report_Product_Expiration__c',
        hideDefaultActions: true,
        initialWidth: 110,
        wrapText: true
    },
    {
      label: 'BarCode',
      fieldName: 'Bar_Code__c',
      hideDefaultActions: true,
      initialWidth: 400,
        label: 'BarCode',
        fieldName: 'Bar_Code__c',
        hideDefaultActions: true,
        wrapText: true
    }
  ];
  const column = [
];
const column = [
    {
      label: '消耗品名称',
      fieldName: 'Name__c',
      hideDefaultActions: true,
        label: '消耗品名称',
        fieldName: 'Name__c',
        hideDefaultActions: true,
        wrapText: true
    },
    {
      label: 'BarCode',
      fieldName: 'Bar_Code__c',
      hideDefaultActions: true,
    }
    ,
        label: 'BarCode',
        fieldName: 'Bar_Code__c',
        wrapText: true,
        hideDefaultActions: true
        // initialWidth:600
    },
    {
      label: '错误原因',
      fieldName: 'ErrorReason',
      hideDefaultActions: true,
        label: '错误原因',
        fieldName: 'ErrorReason',
        hideDefaultActions: true
    }
  ];
];
export default class LexCancelRemoveBox extends LightningElement {
    columns = columns;
@@ -79,164 +78,175 @@
    @track selectedRows = [];
    @track data = [];
    @track errorDetail = [];
    // 显示
    @track showTable = false
    @track showTable = false;
    @track showSpinner = false;
    //数据构成
    @track accountName
    @track userWorkLocation
    @track agencyProType
    @track barcode = ''
    @track saveFLGbln = false
    @track accountName;
    @track userWorkLocation;
    @track agencyProType;
    @track barcode = '';
    @track saveFLGbln = false;
    @track dataSize = 0;
    renderedCallback() {
      if (!this.stylesLoaded) {
          Promise.all([loadStyle(this, WrappedHeaderTable)])
              .then(() => {
                  console.log("Custom styles loaded");
                  this.stylesLoaded = true;
              })
              .catch((error) => {
                  console.error("Error loading custom styles");
              });
      }
  }
        if (!this.stylesLoaded) {
            Promise.all([loadStyle(this, WrappedHeaderTable)])
                .then(() => {
                    console.log('Custom styles loaded');
                    this.stylesLoaded = true;
                })
                .catch((error) => {
                    console.error('Error loading custom styles');
                });
        }
    }
    connectedCallback() {
      console.log('初始化');
      // this.showTable = false;
      oninit().then((result) => {
        result = JSON.parse(JSON.stringify(result));
        console.log('result =' + JSON.stringify(result));
        if (result.status = 'Success') {
          console.log('result');
          this.agencyProType = result.entity.agencyProType;
          this.userWorkLocation = result.entity.userWorkLocation;
          this.accountName = result.entity.accountName;
          // this.data = JSON.parse(result.entity.codPageRecords);
          // this.showTable = true;
        } else {
          this.showMyToast('初始化失败',result.msg,'error');
        }
      }).catch((error) => {
        console.log('error = ' + JSON.stringify(error));
      });
        console.log('初始化');
        // this.showTable = false;
        oninit()
            .then((result) => {
                result = JSON.parse(JSON.stringify(result));
                console.log('result =' + JSON.stringify(result));
                if ((result.status = 'Success')) {
                    console.log('result');
                    this.agencyProType = result.entity.agencyProType;
                    this.userWorkLocation = result.entity.userWorkLocation;
                    this.accountName = result.entity.accountName;
                    // this.data = JSON.parse(result.entity.codPageRecords);
                    // this.showTable = true;
                } else {
                    this.showMyToast('初始化失败', result.msg, 'error');
                }
            })
            .catch((error) => {
                console.log('error = ' + JSON.stringify(error));
            });
    }
    //录入
  getDetails() {
    this.showSpinner = true;
    searchDeatail({
      accountName: this.accountName,
      userWorkLocation: this.userWorkLocation,
      agencyProType: this.agencyProType,
      barcode: this.barcode
    }).then((result) => {
      result = JSON.parse(JSON.stringify(result));
      console.log('result =' + JSON.stringify(result));
      if (result.status == 'Success') {
        console.log('成功');
        this.data = JSON.parse(result.entity.ConsumableorderdetailsRecordsdummy);
        this.errorDetail = JSON.parse(result.entity.ConsumableorderdetailsRecordserror);
        this.dataSize = result.entity.dataSize;
        for (let i in this.data) {
          this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
          this.data[i]['ProductPacking_list_manual__c'] = this.data[i].esd.ProductPacking_list_manual__c;
          this.data[i]['CFDA_Status__c'] = this.data[i].esd.CFDA_Status__c;
          this.data[i]['Report_Product_Approbation__c'] = this.data[i].esd.Report_Product_Approbation__c;
          this.data[i]['Report_Product_Expiration__c'] = this.data[i].esd.Report_Product_Expiration__c;
          this.data[i]['Bar_Code__c'] = this.data[i].esd.Bar_Code__c;
        }
        // this.showTable = true;
        for (let i in this.errorDetail) {
          this.errorDetail[i]['Name__c'] = this.errorDetail[i].Prod.Name__c;
          this.errorDetail[i]['Bar_Code__c'] = this.errorDetail[i].esd.Bar_Code__c;
          this.errorDetail[i]['ErrorReason'] = this.errorDetail[i].ErrorReason;
        }
        // this.showTables = true;
        this.showSpinner = false;
      } else{
        this.showMyToast('获取失败',result.msg,'error');
        this.showSpinner = false;
      }
    }).catch((error) => {
      console.log('error = ' + JSON.stringify(error));
    });
    getDetails() {
        this.showSpinner = true;
        searchDeatail({
            accountName: this.accountName,
            userWorkLocation: this.userWorkLocation,
            agencyProType: this.agencyProType,
            barcode: this.barcode
        })
            .then((result) => {
                result = JSON.parse(JSON.stringify(result));
                console.log('result =' + JSON.stringify(result));
                if (result.status == 'Success') {
                    console.log('成功');
                    this.data = JSON.parse(
                        result.entity.ConsumableorderdetailsRecordsdummy
                    );
                    this.errorDetail = JSON.parse(
                        result.entity.ConsumableorderdetailsRecordserror
                    );
                    this.dataSize = result.entity.dataSize;
                    for (let i in this.data) {
                        this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
                        this.data[i]['ProductPacking_list_manual__c'] =
                            this.data[i].esd.ProductPacking_list_manual__c;
                        this.data[i]['CFDA_Status__c'] =
                            this.data[i].esd.CFDA_Status__c;
                        this.data[i]['Report_Product_Approbation__c'] =
                            this.data[i].esd.Report_Product_Approbation__c;
                        this.data[i]['Report_Product_Expiration__c'] =
                            this.data[i].esd.Report_Product_Expiration__c;
                        this.data[i]['Bar_Code__c'] =
                            this.data[i].esd.Bar_Code__c;
                    }
                    // this.showTable = true;
                    for (let i in this.errorDetail) {
                        this.errorDetail[i]['Name__c'] =
                            this.errorDetail[i].Prod.Name__c;
                        this.errorDetail[i]['Bar_Code__c'] =
                            this.errorDetail[i].esd.Bar_Code__c;
                        this.errorDetail[i]['ErrorReason'] =
                            this.errorDetail[i].ErrorReason;
                    }
                    // this.showTables = true;
                    this.showSpinner = false;
                } else {
                    this.showMyToast('获取失败', result.msg, 'error');
                    this.showSpinner = false;
                }
            })
            .catch((error) => {
                console.log('error = ' + JSON.stringify(error));
            });
    }
    //获取当前输入值
    handleChange(event) {
        let value = event.detail.value;
        console.log('value' + value);
        this.barcode = value;
        console.log('this.barcode' + this.barcode);
    }
  }
   //获取当前输入值
   handleChange(event) {
    let value = event.detail.value;
    console.log('value' + value);
    this.barcode = value;
    console.log('this.barcode' + this.barcode);
  }
  saveConfirm() {
    let msg = "确认取消拆盒吗";
    if (this.dataSize>0) {
        if (confirm(msg) == true) {
    saveConfirm() {
        let msg = '确认取消拆盒吗';
        if (this.dataSize > 0) {
            if (confirm(msg) == true) {
                this.CancelRemoveBox();
            }
        } else {
            this.CancelRemoveBox();
        }
    } else {
        this.CancelRemoveBox();
    }
  }
    CancelRemoveBox(){
      this.showSpinner = true;
    saveConfirm({
      saveConsumableorderdetailsRecordsdummy: JSON.stringify(this.data),
      accountName: this.accountName,
      userWorkLocation: this.userWorkLocation,
      agencyProType: this.agencyProType
    }).then((result) => {
      result = JSON.parse(JSON.stringify(result));
      console.log('result保存 = ' + JSON.stringify(result));
      if (result.status == 'Success') {
         this.saveFLGbln = result.entity.saveFLGbln;
        //  this.showSpinner = false;
         if(this.saveFLGbln){
          this.showMyToast(result.msg,'','success');
          this.showSpinner = false;
         }
      } else {
        this.showMyToast('取消拆盒失败',result.msg,'error');
        this.showSpinner = false;
      }
    })
      .catch((error) => {
        console.log('error = ' + JSON.stringify(error));
      });
  }
  showMyToast(title, message, variant) {
    console.log('show custom message');
    var iconName = '';
    var content = '';
    if(variant == 'success'){
       iconName = 'utility:check';
    }else{
       iconName = 'utility:error';
    CancelRemoveBox() {
        this.showSpinner = true;
        saveConfirm({
            saveConsumableorderdetailsRecordsdummy: JSON.stringify(this.data),
            accountName: this.accountName,
            userWorkLocation: this.userWorkLocation,
            agencyProType: this.agencyProType
        })
            .then((result) => {
                result = JSON.parse(JSON.stringify(result));
                console.log('result保存 = ' + JSON.stringify(result));
                if (result.status == 'Success') {
                    this.saveFLGbln = result.entity.saveFLGbln;
                    //  this.showSpinner = false;
                    if (this.saveFLGbln) {
                        this.showMyToast(result.msg, '', 'success');
                        this.showSpinner = false;
                    }
                } else {
                    this.showMyToast('取消拆盒失败', result.msg, 'error');
                    this.showSpinner = false;
                }
            })
            .catch((error) => {
                console.log('error = ' + JSON.stringify(error));
            });
    }
    if(message != ''){
       content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
    }else{
       content = '<h2><strong>'+title+'<strong/></h2>';
    showMyToast(title, message, variant) {
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if (variant == 'success') {
            iconName = 'utility:check';
        } else {
            iconName = 'utility:error';
        }
        if (message != '') {
            content =
                '<h2><strong>' +
                title +
                '<strong/></h2><h5>' +
                message +
                '</h5>';
        } else {
            content = '<h2><strong>' + title + '<strong/></h2>';
        }
        this.template
            .querySelector('c-common-toast')
            .showToast(variant, content, iconName, 10000);
    }
    this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
    }
}
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.css
@@ -42,4 +42,9 @@
}
.fontWeight{
    font-size:16px;
}
.fileUpload {
    font-size: 16px;
    --lwc-formLabelFontSize:16px;
}
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html
@@ -3,62 +3,152 @@
<template>
    <c-common-toast></c-common-toast>
    <template if:true={isShowSpinner}>
        <lightning-spinner alternative-text="Loading" size="large"></lightning-spinner>
        <div
            role="status"
            class="slds-spinner slds-spinner_medium slds-spinner_brand"
        >
                            <span class="slds-assistive-text">Loading</span>    
                       
            <div class="slds-spinner__dot-a"></div>
                           
            <div class="slds-spinner__dot-b"></div>
                   
        </div>
    </template>
    <template if:false={isDetailsShow}>
        <template if:false={isConInvoiceList}>
            <!-- 搜索客户名 -->
            <template if:true={isModalOpen}>
                <!-- Modal/Popup Box LWC starts here -->
                <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true"
                    aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
                <section
                    role="dialog"
                    tabindex="-1"
                    aria-labelledby="modal-heading-01"
                    aria-modal="true"
                    aria-describedby="modal-content-id-1"
                    class="slds-modal slds-fade-in-open slds-modal_medium"
                    style="border: 1px solid #d4d4d4"
                >
                    <div class="slds-modal__container">
                        <!-- Modal/Popup Box LWC header here -->
                        <header class="slds-modal__header">
                            <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                                title="Close" onclick={closeModal}>
                                <lightning-icon icon-name="utility:close" alternative-text="close" variant="inverse"
                                    size="small"></lightning-icon>
                        <header
                            class="slds-modal__header"
                            style="background-color: #f3f3f3"
                        >
                            <button
                                style=""
                                class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                                title="Close"
                                onclick={closeModal}
                            >
                                <lightning-icon
                                    icon-name="utility:close"
                                    alternative-text="close"
                                    variant="inverse"
                                    size="small"
                                ></lightning-icon>
                                <span class="slds-assistive-text">Close</span>
                            </button>
                            <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">
                            <h2
                                id="modal-heading-01"
                                class="slds-text-heading_medium slds-hyphenate"
                            >
                                经销商医院检索
                            </h2>
                        </header>
                        <!-- Modal/Popup Box LWC body starts here -->
                        <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                            <lightning-layout>
                                <lightning-layout-item flexibility="auto" padding="around-small">
                                    <lightning-input type="text" label="医院名称" onchange={dataChange}
                                        data-field="searchHospitalName" value={searchHospitalName}
                                        variant="label-inline" class="inputFont"></lightning-input>
                                </lightning-layout-item>
                                <lightning-layout-item flexibility="auto" padding="around-small"
                                    style="padding-top: 16px;">
                                    <!-- <lightning-button label="检索" onclick={searchHospital}></lightning-button> -->
                                    <button class="slds-button slds-button_neutral" onclick={searchHospital}
                                        title="searchHospital" style="font-size: 16px;">
                                        检索
                                    </button>
                                </lightning-layout-item>
                            </lightning-layout>
                            <div class="tableColumn">
                                <lightning-layout class="datatable" style="height: 250px;">
                                    <lightning-datatable class="datatabel slds-border_top wrapped-header-datatable"
                                        key-field="id" data={hospitalList} columns={hospitalColumns}
                                        hide-checkbox-column="true" onrowaction={searchHandleRowAction}>
                        <div
                            class="slds-modal__content slds-p-around_medium"
                            id="modal-content-id-1"
                            style="border: 1px solid #f3f3f3"
                        >
                            <table style="width: 100%">
                                <tbody>
                                    <tr>
                                        <td style="width: 74px">
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 16px;
                                                    text-align: left;
                                                "
                                            >
                                                医院名称
                                            </div>
                                        </td>
                                        <td style="width: 60%">
                                            <lightning-input
                                                class="inputFont"
                                                label="医院名称"
                                                variant="label-hidden"
                                                placeholder="请输入医院名称"
                                                value={searchHospitalName}
                                                data-field="searchHospitalName"
                                                onchange={dataChange}
                                            ></lightning-input>
                                        </td>
                                        <td style="width: 10px"></td>
                                        <td>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                                style="height: 32px"
                                                label="搜索"
                                                onclick={searchHospital}
                                            >
                                                搜索
                                            </button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <p style="height: 20px"></p>
                            <!-- <p>已选择医院:{chooseHospital}</p> -->
                            <div
                                style="
                                    border: 1px solid #d4d4d4;
                                    border-top: 3px solid #51606e;
                                    border-radius: 5px;
                                    margin-bottom: 7px;
                                "
                            >
                                <div
                                    style="
                                        border-bottom: 1px solid #d4d4d4;
                                        padding: 3px;
                                    "
                                >
                                    <lightning-layout>
                                        <lightning-layout-item
                                            padding="around-small"
                                        >
                                            <p style="font-size: 18px">
                                                <strong>搜索结果</strong>
                                            </p>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                    <!-- <p style="font-size: 16px;"><strong>搜索结果</strong></p> -->
                                </div>
                                <div class="myTable" style="padding: 10px">
                                    <!-- <lightning-datatable class="wrapped-header-datatable" key-field="id"
                                        hide-checkbox-column="true" data={hospitalList} columns={hosCols}
                                        onrowaction={chooseHos}></lightning-datatable> -->
                                    <lightning-datatable
                                        class="datatabel slds-border_top wrapped-header-datatable"
                                        key-field="id"
                                        data={hospitalList}
                                        columns={hospitalColumns}
                                        hide-checkbox-column="true"
                                        onrowaction={searchHandleRowAction}
                                    >
                                    </lightning-datatable>
                                </lightning-layout>
                                </div>
                            </div>
                        </div>
                        <!-- Modal/Popup Box LWC footer starts here -->
                        <footer class="slds-modal__footer">
                            <button class="slds-button slds-button_neutral" onclick={closeModal} title="Cancel"
                                style="font-size: 16px;">
                                关闭
                            <button
                                class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                                label="取消"
                                onclick={closeModal}
                            >
                                取消
                            </button>
                        </footer>
                    </div>
@@ -66,136 +156,221 @@
                <div class="slds-backdrop slds-backdrop_open"></div>
            </template>
            <div class="outerBorderCss">
                <div style="padding:5px;">
                <div style="padding: 5px">
                    <div class="borderCss">
                        <div style="padding:10px;">
                        <div style="padding: 10px">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <template if:false={EditAble}>
                                    <lightning-layout>
                                        <lightning-layout-item size="12">
                                            <div class="slds-m-top_small slds-m-bottom_medium">
                                                <!-- <lightning-layout-item size="3">
                                                    <lightning-input label="" name="上传附件" onchange={handleFilesChange}
                                                        type="file" accept={acceptedType}
                                                        disabled={isDisabledReopen}></lightning-input>
                                                </lightning-layout-item>
                                                <lightning-layout-item size="3">
                                                    <span class="slds-form-element__label" data-form-label></span>
                                                    </br>
                                                    <lightning-button label="保存附件" style="margin-top: 20px"
                                                        onclick={saveAttachmentJs}
                                                        disabled={isDisabledReopen}></lightning-button>
                                                </lightning-layout-item> -->
                                                <lightning-layout multiple-rows="true">
                                                    <lightning-layout-item size="12">
                                                        <button
                                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                            onclick={SetEditAbleJs} disabled={isDisabledEdit}
                                                            style="width: 150px;">编辑</button>
                                                        <button
                                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                            onclick={approvalJs} disabled={isDisabledEdit}
                                                            style="width: 150px;">提交</button>
                                                        <button
                                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                            onclick={openReportJs} disabled={isOpenReportDisabled}
                                                            style="width: 150px;">显示明细</button>
                                                        <button
                                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                            onclick={reopenJs} disabled={isDisabledReopen}
                                                            style="width: 150px;">作废重开</button>
                                                        <button
                                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                            onclick={deleteButtonJs} disabled={isDisabledDelete}
                                                            style="width: 150px;">删除</button>
                                    <lightning-layout multiple-rows="true">
                                        <lightning-layout-item
                                            size="2"
                                        ></lightning-layout-item>
                                        <lightning-layout-item size="10">
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={SetEditAbleJs}
                                                disabled={isDisabledEdit}
                                                style="width: 150px"
                                            >
                                                编辑
                                            </button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                onclick={approvalJs}
                                                disabled={isDisabledEdit}
                                                style="width: 150px"
                                            >
                                                提交
                                            </button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                onclick={openReportJs}
                                                disabled={isOpenReportDisabled}
                                                style="width: 150px"
                                            >
                                                显示明细
                                            </button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                onclick={reopenJs}
                                                disabled={isDisabledReopen}
                                                style="width: 150px"
                                            >
                                                作废重开
                                            </button>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                                        <button
                                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                            disabled={isDisabledReopen} onclick={uploadOrder}
                                                            style="width: 150px;">上传附件</button>
                                    <lightning-layout
                                        multiple-rows="true"
                                        style="margin-top: 20px"
                                    >
                                        <lightning-layout-item
                                            size="2"
                                        ></lightning-layout-item>
                                        <lightning-layout-item size="10">
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={deleteButtonJs}
                                                disabled={isDisabledDelete}
                                                style="width: 150px"
                                            >
                                                删除
                                            </button>
                                                        <button
                                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                            onclick={saveAttachmentJs} disabled={isDisabledReopen}
                                                            style="width: 150px;">保存附件</button>
                                                    </lightning-layout-item>
                                                    <!-- <lightning-layout-item size="2">
                                                        <button
                                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                            disabled={isDisabledReopen}
                                                            onclick={uploadOrder} style="width: 150px;">上传附件</button>
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2">
                                                        <button
                                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                            onclick={saveAttachmentJs}
                                                            disabled={isDisabledReopen} style="margin-left: -50px;width: 150px;">保存附件</button>
                                                    </lightning-layout-item> -->
                                                </lightning-layout>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                disabled={isDisabledReopen}
                                                onclick={uploadOrder}
                                                style="width: 150px"
                                            >
                                                上传附件
                                            </button>
                                            </div>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                onclick={saveAttachmentJs}
                                                disabled={isDisabledReopen}
                                                style="width: 150px"
                                            >
                                                保存附件
                                            </button>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                </template>
                                <!-- 上传附件弹窗 -->
                                <template if:true={showAttPop}>
                                    <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-02"
                                        aria-modal="true" aria-describedby="modal-content-id-2"
                                    <section
                                        role="dialog"
                                        tabindex="-1"
                                        aria-labelledby="modal-heading-02"
                                        aria-modal="true"
                                        aria-describedby="modal-content-id-2"
                                        class="slds-modal slds-fade-in-open slds-modal_small"
                                        style="border: 1px solid #D4D4D4;">
                                        style="border: 1px solid #d4d4d4"
                                    >
                                        <template if:true={showPopSpinner}>
                                            <lightning-spinner size="medium" variant="brand"></lightning-spinner>
                                            <lightning-spinner
                                                size="medium"
                                                variant="brand"
                                            ></lightning-spinner>
                                        </template>
                                        <div class="slds-modal__container">
                                            <header class="slds-modal__header" style="background-color: #F3F3F3;">
                                                <button style=""
                                            <header
                                                class="slds-modal__header"
                                                style="
                                                    background-color: #f3f3f3;
                                                "
                                            >
                                                <button
                                                    style=""
                                                    class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                                                    title="Close" onclick={closePop}>
                                                    <lightning-icon icon-name="utility:close" alternative-text="close"
                                                        variant="inverse" size="small"></lightning-icon>
                                                    <span class="slds-assistive-text">Close</span>
                                                    title="Close"
                                                    onclick={closePop}
                                                >
                                                    <lightning-icon
                                                        icon-name="utility:close"
                                                        alternative-text="close"
                                                        variant="inverse"
                                                        size="small"
                                                    ></lightning-icon>
                                                    <span
                                                        class="slds-assistive-text"
                                                        >Close</span
                                                    >
                                                </button>
                                                <h2 id="modal-heading-02"
                                                    class="slds-text-heading_medium slds-hyphenate">上传附件</h2>
                                                <h2
                                                    id="modal-heading-02"
                                                    class="slds-text-heading_medium slds-hyphenate"
                                                >
                                                    上传附件
                                                </h2>
                                            </header>
                                            <div class="slds-modal__content slds-p-around_medium searchName"
                                                id="modal-content-id-2" style="border: 1px solid #F3F3F3;">
                                                <div class="slds-m-top_medium slds-m-bottom_x-large">
                                                    <div class="slds-p-around_medium lgc-bg">
                                                        <lightning-input type="file" label="附件上传"
                                            <div
                                                class="slds-modal__content slds-p-around_medium searchName"
                                                id="modal-content-id-2"
                                                style="
                                                    border: 1px solid #f3f3f3;
                                                "
                                            >
                                                <div
                                                    class="slds-m-top_medium slds-m-bottom_x-large"
                                                >
                                                    <div
                                                        class="slds-p-around_medium lgc-bg"
                                                    >
                                                        <lightning-input
                                                            class="fileUpload"
                                                            type="file"
                                                            label="附件上传"
                                                            accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
                                                            onchange={attChange}></lightning-input>
                                                            onchange={attChange}
                                                        ></lightning-input>
                                                    </div>
                                                    <p class="fontWeight">已选择文件:{fileName}
                                                    <p class="fontWeight">
                                                        已选择文件:{fileName}
                                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                        <template if:true={attDelBtn}>
                                                            <a onclick={removeAtt}>移除</a>
                                                        <template
                                                            if:true={attDelBtn}
                                                        >
                                                            <a
                                                                onclick={removeAtt}
                                                                >移除</a
                                                            >
                                                        </template>
                                                    </p>
                                                </div>
                                            </div>
                                            <footer class="slds-modal__footer">
                                                <lightning-button style="margin-left: 10px;" variant="neutral"
                                                <!-- <lightning-button style="margin-left: 10px;" variant="neutral"
                                                    label="取消" onclick={closePop}></lightning-button>
                                                <lightning-button style="margin-left: 10px;" variant="neutral"
                                                    label="上传" onclick={handleFilesChange}></lightning-button>
                                                    label="上传" onclick={handleFilesChange}></lightning-button> -->
                                                <button
                                                    class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                                                    style="margin-left: 10px"
                                                    label="取消"
                                                    onclick={closePop}
                                                >
                                                    取消
                                                </button>
                                                <button
                                                    class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                                    style="margin-left: 10px"
                                                    label="上传"
                                                    onclick={handleFilesChange}
                                                >
                                                    上传
                                                </button>
                                            </footer>
                                        </div>
                                    </section>
                                    <div class="slds-backdrop slds-backdrop_open"></div>
                                    <div
                                        class="slds-backdrop slds-backdrop_open"
                                    ></div>
                                </template>
                                <template if:true={EditAble}>
                                    <lightning-layout>
                                        <lightning-layout-item size="1" padding="around-small"></lightning-layout-item>
                                        <lightning-layout-item size="2" padding="around-small"></lightning-layout-item>
                                        <lightning-layout-item padding="around-small">
                                        <lightning-layout-item
                                            size="1"
                                            padding="around-small"
                                        ></lightning-layout-item>
                                        <lightning-layout-item
                                            size="2"
                                            padding="around-small"
                                        ></lightning-layout-item>
                                        <lightning-layout-item
                                            padding="around-small"
                                        >
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={SaveJs}>确定</button>
                                                onclick={SaveJs}
                                            >
                                                确定
                                            </button>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                </template>
@@ -232,7 +407,6 @@
                                    </template>
                                </lightning-layout> -->
                            </div>
                        </div>
                    </div>
@@ -247,133 +421,249 @@
                                </lightning-layout-item>
                            </lightning-layout>
                        </div>
                        <div style="padding:7px;">
                        <div style="padding: 7px">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <!--发票信息 显示用 -->
                                <template if:false={isEditInvoice}>
                                    <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
                                        onload={handleLoad2}>
                                    <lightning-record-edit-form
                                        object-api-name="Consumable_order__c"
                                        record-id={cocId}
                                        onload={handleLoad2}
                                    >
                                        <!-- 发票号 状态 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                                <lightning-output-field field-name="Name"></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                            >
                                                <lightning-output-field
                                                    field-name="Invoice_status__c"></lightning-output-field>
                                                    field-name="Name"
                                                ></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                                style="padding-left: 100px"
                                            >
                                                <lightning-output-field
                                                    field-name="Invoice_status__c"
                                                ></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 发票日期 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                            >
                                                <lightning-output-field
                                                    field-name="Invoice_Date__c"></lightning-output-field>
                                                    field-name="Invoice_Date__c"
                                                ></lightning-output-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 二级经销商 -->
                                        <template if:true={isShowSecondaryDistributor}>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        <template
                                            if:true={isShowSecondaryDistributor}
                                        >
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout multiple-rows="true">
                                                <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <lightning-layout
                                                multiple-rows="true"
                                            >
                                                <lightning-layout-item
                                                    class="hehe-layoutItem"
                                                    size="5"
                                                >
                                                    <lightning-output-field
                                                        field-name="Order_Dealer_Info__c"></lightning-output-field>
                                                        field-name="Order_Dealer_Info__c"
                                                    ></lightning-output-field>
                                                </lightning-layout-item>
                                            </lightning-layout>
                                        </template>
                                        <!-- 客户名 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                                <lightning-output-field field-name="ShipmentAccount__c"
                                                    class="hideHelpText"></lightning-output-field>
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                            >
                                                <lightning-output-field
                                                    field-name="ShipmentAccount__c"
                                                    class="hideHelpText"
                                                ></lightning-output-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 科室 发票票面金额 -->
                                        <lightning-layout multiple-rows="true" style="height:35.5px">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        <lightning-layout
                                            multiple-rows="true"
                                            style="height: 35.5px"
                                        >
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                            >
                                                <lightning-output-field
                                                    field-name="Order_ForCustomerText__c"></lightning-output-field>
                                                    field-name="Order_ForCustomerText__c"
                                                ></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="4" class="readOnly">
                                                <lightning-input label="发票票面金额(元)" value={sumPrice} read-only
                                                    variant="label-inline"></lightning-input>
                                            <lightning-layout-item
                                                size="5"
                                                class="readOnly"
                                                style="padding-left: 100px"
                                            >
                                                <lightning-input
                                                    label="发票票面金额(元)"
                                                    value={sumPrice}
                                                    read-only
                                                    variant="label-inline"
                                                ></lightning-input>
                                            </lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 备注 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                            >
                                                <lightning-output-field
                                                    field-name="Invoice_Note__c"></lightning-output-field>
                                                    field-name="Invoice_Note__c"
                                                ></lightning-output-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 发票附件 明细附件 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                            >
                                                <lightning-output-field
                                                    field-name="Invoice_attachment__c"></lightning-output-field>
                                                    field-name="Invoice_attachment__c"
                                                ></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                                style="padding-left: 100px"
                                            >
                                                <lightning-output-field
                                                    field-name="Invoicedet_attachment__c"></lightning-output-field>
                                                    field-name="Invoicedet_attachment__c"
                                                ></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 附件预览 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1">
                                            </lightning-layout-item>
                                            <lightning-layout-item size="11">
                                                <lightning-card class="attListTitle" variant="Narrow" title="附件列表"
                                                    icon-name="utility:attach">
                                                    <lightning-layout slot="footer" multiple-rows="true">
                                                        <template for:each={fileData} for:item="item" for:index="index">
                                                            <lightning-layout-item padding="around-none" size="2"
                                            <lightning-layout-item size="10">
                                                <lightning-card
                                                    class="attListTitle"
                                                    variant="Narrow"
                                                    title="附件列表"
                                                    icon-name="utility:attach"
                                                >
                                                    <lightning-layout
                                                        slot="footer"
                                                        multiple-rows="true"
                                                    >
                                                        <template
                                                            for:each={fileData}
                                                            for:item="item"
                                                            for:index="index"
                                                        >
                                                            <lightning-layout-item
                                                                padding="around-none"
                                                                size="2"
                                                                key={item.recordId}
                                                                style="text-align: left;padding:5px">
                                                                <lightning-icon title={item.Title}
                                                                    style="margin-left: 20px;" icon-name="doctype:gform"
                                                                style="
                                                                    text-align: left;
                                                                    padding: 5px;
                                                                "
                                                            >
                                                                <lightning-icon
                                                                    title={item.Title}
                                                                    style="
                                                                        margin-left: 20px;
                                                                    "
                                                                    icon-name="doctype:gform"
                                                                    alternative-text={item.Title}
                                                                    size="large"></lightning-icon><br />
                                                                <span title={item.Title}>
                                                                    {item.fileName}
                                                                </span>
                                                                    size="large"
                                                                ></lightning-icon
                                                                ><br />
                                                                <div
                                                                    title={item.Title}
                                                                    style="
                                                                        width: 100px;
                                                                        text-overflow: ellipsis;
                                                                        overflow: hidden;
                                                                        white-space: nowrap;
                                                                    "
                                                                >
                                                                    {item.Title}
                                                                </div>
                                                                <p>
                                                                    <!-- <a data-fileid ={item.documentId} onclick={previweAtt}> -->
                                                                    <a href={item.attUrl} target="_blank">
                                                                        预览
                                                                    </a>&nbsp;·&nbsp;
                                                                    <a href={item.downloadUrl}>
                                                                        下载
                                                                    </a>&nbsp;·&nbsp;
                                                                    <a data-fileid={item.recordId} onclick={deleteAtt}>
                                                                    <a
                                                                        href={item.attUrl}
                                                                        target="_blank"
                                                                    >
                                                                        预览 </a
                                                                    >&nbsp;·&nbsp;
                                                                    <a
                                                                        href={item.downloadUrl}
                                                                    >
                                                                        下载 </a
                                                                    >&nbsp;·&nbsp;
                                                                    <a
                                                                        data-fileid={item.Id}
                                                                        onclick={deleteAtt}
                                                                    >
                                                                        删除
                                                                    </a>
                                                                </p>
@@ -388,95 +678,177 @@
                                </template>
                                <!--发票信息 编辑用 -->
                                <template if:true={isEditInvoice}>
                                    <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
                                        onload={handleLoad2}>
                                    <lightning-record-edit-form
                                        object-api-name="Consumable_order__c"
                                        record-id={cocId}
                                        onload={handleLoad2}
                                    >
                                        <!-- 发票号 状态 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                                <lightning-input label="发票号" value={OrderCode} data-field="OrderCode"
                                                    onchange={dataChange} variant="label-inline" required
                                                    class="inputFont"></lightning-input>
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                            >
                                                <lightning-input
                                                    label="发票号"
                                                    value={OrderCode}
                                                    data-field="OrderCode"
                                                    onchange={dataChange}
                                                    variant="label-inline"
                                                    required
                                                    class="inputFont"
                                                ></lightning-input>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                                style="padding-left: 100px"
                                            >
                                                <lightning-output-field
                                                    field-name="Invoice_status__c"></lightning-output-field>
                                                    field-name="Invoice_status__c"
                                                ></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 发票日期 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                                <lightning-input type="date" label="发票日期" variant="label-inline"
                                                    value={InvoiceDate} onchange={invoiceDateChange} required
                                                    class="inputFont"></lightning-input>
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                            >
                                                <lightning-input
                                                    type="date"
                                                    label="发票日期"
                                                    variant="label-inline"
                                                    value={InvoiceDate}
                                                    onchange={invoiceDateChange}
                                                    required
                                                    class="inputFont"
                                                ></lightning-input>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 客户名 二级经销商 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                            >
                                                <div
                                                    class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
                                                    <lightning-icon size="x-small"
                                                    class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right"
                                                >
                                                    <lightning-icon
                                                        size="x-small"
                                                        class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default hideHelpText"
                                                        icon-name="utility:search"></lightning-icon>
                                                    <lightning-input type="text" name="HospitalName" label="客户名"
                                                        value={HospitalName} variant="label-inline"
                                                        onclick={searchHospitalNameModal} data-field="HospitalName"
                                                        onchange={clearAgencyI} class="inputFont"></lightning-input>
                                                        icon-name="utility:search"
                                                    ></lightning-icon>
                                                    <lightning-input
                                                        type="text"
                                                        name="HospitalName"
                                                        label="客户名"
                                                        value={HospitalName}
                                                        variant="label-inline"
                                                        onclick={searchHospitalNameModal}
                                                        data-field="HospitalName"
                                                        onchange={clearAgencyI}
                                                        class="inputFont"
                                                    ></lightning-input>
                                                </div>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                                <lightning-combobox data-field="secondaryDistributor"
                                                    name="secondaryDistributor" label="二级经销商"
                                                    value={secondaryDistributor} placeholder="请选择..."
                                                    options={provinceOptsMap} variant="label-inline"
                                                    onchange={dataChange} class="inputFont"></lightning-combobox>
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                                style="padding-left: 100px"
                                            >
                                                <lightning-combobox
                                                    data-field="secondaryDistributor"
                                                    name="secondaryDistributor"
                                                    label="二级经销商"
                                                    value={secondaryDistributor}
                                                    placeholder="请选择..."
                                                    options={provinceOptsMap}
                                                    variant="label-inline"
                                                    onchange={dataChange}
                                                    class="inputFont"
                                                ></lightning-combobox>
                                            </lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 科室 经销商(录入) -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                                <lightning-input-field onchange={dataChange}
                                                    data-field="ForCustomerText" value={ForCustomerText}
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                            >
                                                <lightning-input-field
                                                    onchange={dataChange}
                                                    data-field="ForCustomerText"
                                                    value={ForCustomerText}
                                                    field-name="Order_ForCustomerText__c"
                                                    class="inputFont"></lightning-input-field>
                                                    class="inputFont"
                                                ></lightning-input-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                                style="padding-left: 100px"
                                            >
                                                <lightning-output-field
                                                    field-name="Order_ForDealerText__c"></lightning-output-field>
                                                    field-name="Order_ForDealerText__c"
                                                ></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 备注 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item
                                                size="1"
                                            ></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="4">
                                                <lightning-input-field onchange={dataChange} data-field="InvoiceNote"
                                                    value={InvoiceNote} field-name="Invoice_Note__c"
                                                    class="inputFont"></lightning-input-field>
                                            <lightning-layout-item
                                                class="hehe-layoutItem"
                                                size="5"
                                            >
                                                <lightning-input-field
                                                    onchange={dataChange}
                                                    data-field="InvoiceNote"
                                                    value={InvoiceNote}
                                                    field-name="Invoice_Note__c"
                                                    class="inputFont"
                                                ></lightning-input-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </lightning-record-edit-form>
                                </template>
                            </div>
@@ -485,24 +857,31 @@
                    <!-- 出库单一览 -->
                    <div class="borderCss">
                        <div class="headerDorderCss">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>出库单一览</strong>
                                    </p>
                                </lightning-layout-item>
                                <lightning-layout-item size="2" padding="around-small">
                                <lightning-layout-item
                                    size="2"
                                    padding="around-small"
                                >
                                </lightning-layout-item>
                                <template if:false={hideCheckbox}>
                                    <lightning-layout-item padding="around-small">
                                    <lightning-layout-item
                                        padding="around-small"
                                    >
                                        <!-- <lightning-button label="&#12288;检索&#12288;"
                                            onclick={InvoiceorderSearchJs}></lightning-button> -->
                                        <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                            onclick={InvoiceorderSearchJs}>检索</button>
                                        <button
                                            class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                            onclick={InvoiceorderSearchJs}
                                        >
                                            检索
                                        </button>
                                    </lightning-layout-item>
                                </template>
                            </lightning-layout>
                        </div>
@@ -525,13 +904,25 @@
                        <div style="padding: 7px">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <lightning-datatable key-field="Id" data={outboundData} columns={outboundColumns}
                                    hide-checkbox-column={hideCheckbox} onrowselection={getSelectedRows}
                                    selected-rows={selectedRows} class="wrapped-header-datatable" data-field="outbound">
                                <lightning-datatable
                                    key-field="Id"
                                    data={outboundData}
                                    columns={outboundColumns}
                                    hide-checkbox-column={hideCheckbox}
                                    onrowselection={getSelectedRows}
                                    selected-rows={selectedRows}
                                    class="wrapped-header-datatable"
                                    data-field="outbound"
                                >
                                </lightning-datatable>
                                <lightning-datatable key-field="id" data={outboundDataSumPrice}
                                    columns={outboundColumns} hide-checkbox-column hide-table-header
                                    class="wrapped-header-datatable">
                                <lightning-datatable
                                    key-field="id"
                                    data={outboundDataSumPrice}
                                    columns={outboundColumns}
                                    hide-checkbox-column
                                    hide-table-header
                                    class="wrapped-header-datatable"
                                >
                                </lightning-datatable>
                            </div>
                        </div>
@@ -541,7 +932,9 @@
                        <div class="borderCss">
                            <div class="headerDorderCss">
                                <lightning-layout>
                                    <lightning-layout-item padding="around-small">
                                    <lightning-layout-item
                                        padding="around-small"
                                    >
                                        <p style="font-size: 18px">
                                            <strong>发票明细</strong>
                                        </p>
@@ -551,9 +944,13 @@
                            <div style="padding: 7px">
                                <div lwc:dom="manual" class="resultDiv"></div>
                                <div draggable="false">
                                    <lightning-datatable key-field="id" data={invoiceOrderdetail1Recoeds}
                                        columns={invoiceDetailsColumns} hide-checkbox-column
                                        class="wrapped-header-datatable">
                                    <lightning-datatable
                                        key-field="id"
                                        data={invoiceOrderdetail1Recoeds}
                                        columns={invoiceDetailsColumns}
                                        hide-checkbox-column
                                        class="wrapped-header-datatable"
                                    >
                                    </lightning-datatable>
                                </div>
                            </div>
@@ -610,21 +1007,25 @@
        <template if:true={isConInvoiceList}>
            <div class="outerBorderCss">
                <div style="padding:5px;">
                <div style="padding: 5px">
                    <!-- 新建发票 -->
                    <div class="borderCss">
                        <div style="padding:15px;">
                        <div style="padding: 15px">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <!-- <lightning-button label="新建发票" onclick={newInvoiceJs}></lightning-button> -->
                                <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                    onclick={newInvoiceJs}>新建发票</button>
                                <button
                                    class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                    onclick={newInvoiceJs}
                                >
                                    新建发票
                                </button>
                            </div>
                        </div>
                    </div>
                    <!-- 检索条件 -->
                    <div class="borderCss" style="margin-top: 5px;">
                    <div class="borderCss" style="margin-top: 5px">
                        <div class="headerDorderCss">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
@@ -637,77 +1038,150 @@
                        <div style="padding: 15px">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <lightning-layout multiple-rows>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-text-align_center">
                                            <div class="slds-grid slds-grid_vertical-align-center">
                                                <div class="slds-form-element__label ">出库日&#12288;从</div>
                                                <lightning-input type="date" variant="label-hidden" label="出库日 从"
                                                    onchange={dataChange} data-field="deliveryFromDate"
                                                    value={deliveryFromDate} class="inputFont"></lightning-input>
                                            <div
                                                class="slds-grid slds-grid_vertical-align-center"
                                            >
                                                <div
                                                    class="slds-form-element__label"
                                                >
                                                    出库日&#12288;从
                                                </div>
                                                <lightning-input
                                                    type="date"
                                                    variant="label-hidden"
                                                    label="出库日 从"
                                                    onchange={dataChange}
                                                    data-field="deliveryFromDate"
                                                    value={deliveryFromDate}
                                                    class="inputFont"
                                                    style="max-width: 150px"
                                                ></lightning-input>
                                            </div>
                                            </br>
                                            <div class="slds-grid slds-grid_vertical-align-center">
                                                <div class="slds-form-element__label ">&#12288;&#12288;&#12288;&#12288;到
                                            <!-- </br> -->
                                            <div
                                                class="slds-grid slds-grid_vertical-align-center"
                                            >
                                                <div
                                                    class="slds-form-element__label"
                                                >
                                                    &#12288;&#12288;&#12288;&#12288;到
                                                </div>
                                                <lightning-input type="date" variant="label-hidden" label="到"
                                                    onchange={dataChange} data-field="deliveryToDate"
                                                    value={deliveryToDate} class="inputFont"></lightning-input>
                                                <lightning-input
                                                    type="date"
                                                    variant="label-hidden"
                                                    label="到"
                                                    onchange={dataChange}
                                                    data-field="deliveryToDate"
                                                    value={deliveryToDate}
                                                    class="inputFont"
                                                    style="max-width: 150px"
                                                ></lightning-input>
                                            </div>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label ">发票号</div>
                                            <lightning-input variant="label-hidden" label="发票号" onchange={dataChange}
                                                data-field="category1" value={category1}
                                                class="inputFont"></lightning-input>
                                        <div
                                            class="slds-grid slds-grid_vertical-align-center"
                                        >
                                            <div
                                                class="slds-form-element__label"
                                            >
                                                发票号
                                            </div>
                                            <lightning-input
                                                variant="label-hidden"
                                                label="发票号"
                                                onchange={dataChange}
                                                data-field="category1"
                                                value={category1}
                                                class="inputFont"
                                                style="max-width: 150px"
                                            ></lightning-input>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label ">客户名</div>
                                            <lightning-input variant="label-hidden" label="客户名" onchange={dataChange}
                                                data-field="category2" value={category2}
                                                class="inputFont"></lightning-input>
                                        <div
                                            class="slds-grid slds-grid_vertical-align-center"
                                        >
                                            <div
                                                class="slds-form-element__label"
                                            >
                                                客户名
                                            </div>
                                            <lightning-input
                                                variant="label-hidden"
                                                label="客户名"
                                                onchange={dataChange}
                                                data-field="category2"
                                                value={category2}
                                                class="inputFont"
                                                style="max-width: 150px"
                                            ></lightning-input>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label ">状态</div>
                                            <lightning-combobox data-field="invoiceStatus" name="invoiceStatus"
                                                label="状态" value={invoiceStatusValue} placeholder="请选择..."
                                                options={Options} variant="label-hidden" onchange={dataChange}
                                                style="min-width: 100px;" class="inputFont"></lightning-combobox>
                                        <div
                                            class="slds-grid slds-grid_vertical-align-center"
                                        >
                                            <div
                                                class="slds-form-element__label"
                                            >
                                                状态
                                            </div>
                                            <lightning-combobox
                                                data-field="invoiceStatus"
                                                name="invoiceStatus"
                                                label="状态"
                                                value={invoiceStatusValue}
                                                placeholder="请选择..."
                                                options={Options}
                                                variant="label-hidden"
                                                onchange={dataChange}
                                                style="
                                                    min-width: 100px;
                                                    max-width: 200px;
                                                "
                                                class="inputFont"
                                            ></lightning-combobox>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <!-- <lightning-button label="检索"
                                                onclick={invoiceCodeSearchJs}></lightning-button> -->
                                        <div
                                            class="slds-grid slds-grid_vertical-align-center"
                                        >
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                                onclick={invoiceCodeSearchJs}>检索</button>
                                                onclick={invoiceCodeSearchJs}
                                                style="max-width: 110px"
                                            >
                                                检索
                                            </button>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <!-- <lightning-button label="清空" onclick={ClearJs}></lightning-button> -->
                                        <div
                                            class="slds-grid slds-grid_vertical-align-center"
                                        >
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                                                onclick={ClearJs}>清空</button>
                                                onclick={ClearJs}
                                                style="max-width: 110px"
                                            >
                                                清空
                                            </button>
                                        </div>
                                    </lightning-layout-item>
                                </lightning-layout>
                            </div>
                        </div>
                    </div>
                    <!-- 发票一览 -->
                    <div class="borderCss" style="margin-top: 5px;">
                    <div class="borderCss" style="margin-top: 5px">
                        <div class="headerDorderCss">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
@@ -720,8 +1194,13 @@
                        <div style="padding: 7px">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <lightning-datatable key-field="id" data={invoiceData} columns={invoiceColumns}
                                    hide-checkbox-column="true" class="wrapped-header-datatable">
                                <lightning-datatable
                                    key-field="id"
                                    data={invoiceData}
                                    columns={invoiceColumns}
                                    hide-checkbox-column="true"
                                    class="wrapped-header-datatable"
                                >
                                </lightning-datatable>
                            </div>
                        </div>
@@ -733,21 +1212,25 @@
    <template if:true={isDetailsShow}>
        <div class="outerBorderCss">
            <div style="padding:5px;">
            <div style="padding: 5px">
                <!-- 确定 -->
                <div class="borderCss">
                    <div style="padding:10px;">
                    <div style="padding: 10px">
                        <div lwc:dom="manual" class="resultDiv"></div>
                        <div draggable="false">
                            <!-- <lightning-button label="确定" onclick={detailsSaveJs}></lightning-button> -->
                            <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                onclick={detailsSaveJs}>确定</button>
                            <button
                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                onclick={detailsSaveJs}
                            >
                                确定
                            </button>
                        </div>
                    </div>
                </div>
                <!-- 发票信息 -->
                <div class="borderCss" style="margin-top: 5px;">
                <div class="borderCss" style="margin-top: 5px">
                    <div class="headerDorderCss">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
@@ -760,26 +1243,43 @@
                    <div style="padding: 7px">
                        <div lwc:dom="manual" class="resultDiv"></div>
                        <div draggable="false">
                            <lightning-record-edit-form object-api-name="Consumable_order__c"
                                record-id={detailsInvoiceId} onload={handleLoad2}>
                            <lightning-record-edit-form
                                object-api-name="Consumable_order__c"
                                record-id={detailsInvoiceId}
                                onload={handleLoad2}
                            >
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item size="2"></lightning-layout-item>
                                    <lightning-layout-item size="4">
                                        <lightning-output-field field-name="Name"></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item size="2"></lightning-layout-item>
                                    <lightning-layout-item size="4" class="hehe-layoutItem">
                                        <lightning-output-field field-name="ShipmentAccount__c"
                                            class="hideHelpText"></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item size="2"></lightning-layout-item>
                                    <lightning-layout-item size="4">
                                    <lightning-layout-item
                                        size="1"
                                    ></lightning-layout-item>
                                    <lightning-layout-item size="5">
                                        <lightning-output-field
                                            field-name="Order_ForCustomerText__c"></lightning-output-field>
                                            field-name="Name"
                                        ></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item
                                        size="1"
                                    ></lightning-layout-item>
                                    <lightning-layout-item
                                        size="5"
                                        class="hehe-layoutItem"
                                    >
                                        <lightning-output-field
                                            field-name="ShipmentAccount__c"
                                            class="hideHelpText"
                                        ></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item
                                        size="1"
                                    ></lightning-layout-item>
                                    <lightning-layout-item size="5">
                                        <lightning-output-field
                                            field-name="Order_ForCustomerText__c"
                                        ></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                            </lightning-record-edit-form>
@@ -788,7 +1288,7 @@
                </div>
                <!-- 出库单 -->
                <div class="borderCss" style="margin-top: 5px;">
                <div class="borderCss" style="margin-top: 5px">
                    <div class="headerDorderCss">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
@@ -801,17 +1301,28 @@
                    <div style="padding: 7px">
                        <div lwc:dom="manual" class="resultDiv"></div>
                        <div draggable="false">
                            <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={detailsCocId}>
                            <lightning-record-edit-form
                                object-api-name="Consumable_order__c"
                                record-id={detailsCocId}
                            >
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item size="2"></lightning-layout-item>
                                    <lightning-layout-item size="4">
                                        <lightning-output-field field-name="Name"></lightning-output-field>
                                    <lightning-layout-item
                                        size="1"
                                    ></lightning-layout-item>
                                    <lightning-layout-item size="5">
                                        <lightning-output-field
                                            field-name="Name"
                                        ></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item size="2"></lightning-layout-item>
                                    <lightning-layout-item size="4">
                                        <lightning-output-field field-name="Outbound_Date__c"></lightning-output-field>
                                    <lightning-layout-item
                                        size="1"
                                    ></lightning-layout-item>
                                    <lightning-layout-item size="5">
                                        <lightning-output-field
                                            field-name="Outbound_Date__c"
                                        ></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                            </lightning-record-edit-form>
@@ -820,7 +1331,7 @@
                </div>
                <!-- 出库单明细 -->
                <div class="borderCss" style="margin-top: 5px;">
                <div class="borderCss" style="margin-top: 5px">
                    <div class="headerDorderCss">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
@@ -836,14 +1347,30 @@
                            <!-- <lightning-datatable class="datatabel slds-border_top" key-field="id"
                                data={detaisData} columns={detailsColumns}>
                            </lightning-datatable> -->
                            <c-lex-custom-lightning-datatable key-field="Id" data={detailsData} columns={detailsColumns}
                                onunitchange={handleUnitChange} onshipmentnumber={handleShipmentNumber}
                                onrowselection={detailsGetSelectedRows} selected-rows={detailsSelectedRows}
                                style="word-wrap:break-word; word-break:break-all; " class="wrapped-header-datatable">
                            <c-lex-custom-lightning-datatable
                                key-field="Id"
                                data={detailsData}
                                columns={detailsColumns}
                                onunitchange={handleUnitChange}
                                onshipmentnumber={handleShipmentNumber}
                                onrowselection={detailsGetSelectedRows}
                                selected-rows={detailsSelectedRows}
                                style="
                                    word-wrap: break-word;
                                    word-break: break-all;
                                "
                                class="wrapped-header-datatable"
                                min-column-width="115"
                            >
                            </c-lex-custom-lightning-datatable>
                            <lightning-datatable class="datatabel slds-border_top wrapped-header-datatable"
                                key-field="id" data={invoiceAllpriceData} columns={detailsColumns} hide-checkbox-column
                                hide-table-header>
                            <lightning-datatable
                                class="datatabel slds-border_top wrapped-header-datatable"
                                key-field="id"
                                data={invoiceAllpriceData}
                                columns={detailsColumns}
                                hide-checkbox-column
                                hide-table-header
                            >
                            </lightning-datatable>
                        </div>
                    </div>
@@ -851,5 +1378,4 @@
            </div>
        </div>
    </template>
</template>
Diff truncated after the above file
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/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.html force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.html force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js force-app/main/default/lwc/lexCssUtility/lexCssUtility.css force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.html force-app/main/default/lwc/lexCustomAttachmentTypeComp/lexCustomAttachmentTypeComp.js force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.html force-app/main/default/lwc/lexCustomDiffReasonComp/lexCustomDiffReasonComp.js force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html force-app/main/default/lwc/lexCustomLightningDatatable/customAgencyOppInput.html force-app/main/default/lwc/lexCustomLightningDatatable/customInventoryColor.html force-app/main/default/lwc/lexCustomLightningDatatable/customOutboundCount.html force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentAmount.html force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html force-app/main/default/lwc/lexCustomLightningDatatable/customShippingUnitPrice.html force-app/main/default/lwc/lexCustomLightningDatatable/customTableCellIcon.html force-app/main/default/lwc/lexCustomLightningDatatable/customTableInput.html force-app/main/default/lwc/lexCustomLightningDatatable/customaccountUrl.html force-app/main/default/lwc/lexCustomLightningDatatable/customdeleteReason.html force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomDiffReason.html force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.html force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.html force-app/main/default/lwc/lexCustomTableInput/lexCustomTableInput.js force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.html force-app/main/default/lwc/lexDealerInquiryModifyState/lexDealerInquiryModifyState.js force-app/main/default/lwc/lexInventory/lexInventory.css force-app/main/default/lwc/lexInventory/lexInventory.html force-app/main/default/lwc/lexInventory/lexInventory.js force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.html force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js force-app/main/default/lwc/lexLookup/lexLookup.html force-app/main/default/lwc/lexLookup/lexLookup.js force-app/main/default/lwc/lexNewOrder/lexNewOrder.html force-app/main/default/lwc/lexNewOrder/lexNewOrder.js force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.css force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.html force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.html force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.html force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.html force-app/main/default/lwc/lexReturnGoodCusInput/lexReturnGoodCusInput.js force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.html force-app/main/default/lwc/lexTableCellIcon/lexTableCellIcon.js force-app/main/default/lwc/lexTopPage/lexTopPage.html force-app/main/default/lwc/lexTopPage/lexTopPage.js force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.html force-app/main/default/lwc/lwcDatatableUtility/lwcDatatableUtility.js force-app/main/default/lwc/myCustomTypeDatatable/customName.html force-app/main/default/lwc/myCustomTypeDatatable/customNumber.html force-app/main/default/lwc/myCustomTypeDatatable/customUnit.html force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.html force-app/main/default/lwc/myCustomTypeDatatable/myCustomTypeDatatable.js force-app/main/default/pages/DealerInquiryModifyState.page force-app/main/default/pages/DealerInquiryModifyState.page-meta.xml force-app/main/default/triggers/ContentDocumentLink.trigger force-app/main/default/triggers/ContentDocumentTrigger.trigger manifest/LEXC01packagelexcommunitynew.xml manifest/LEXC02packagelexcommunityupdate.xml