binxie
2023-06-26 b5c5eb130ca0848124f9d136af4be142ad5aac07
backup0626
143个文件已修改
35162 ■■■■■ 已修改文件
.sf/config.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/CreateTarget/CreateTarget.cmp 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/CreateTarget/CreateTarget.cmp-meta.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/CreateTarget/CreateTargetHelper.js 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReport.css 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ArriveGoodsControllerTest.cls 6464 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/DealerInquiryModifyStateController.cls 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGoodsMainController.cls 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexArriveGsDetailsController.cls 109 ●●●●● 补丁 | 查看 | 原始文档 | 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 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountInfoController.cls 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableAccountSOQL.cls 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableController.cls 220 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConsumableGoodsInfo.cls 683 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryController.cls 1734 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryListController.cls 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryViewController.cls 50 ●●●●● 补丁 | 查看 | 原始文档 | 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 325 ●●●● 补丁 | 查看 | 原始文档 | 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 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexTopPageController.cls 529 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexUpAccountProLimit.cls 121 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexUtility.cls 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ResponseBodyLWC.cls 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexSearchAgencyHospitalController.cls 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/labels/CustomLabels.labels-meta.xml 4 ●●●● 补丁 | 查看 | 原始文档 | 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 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.html 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/customShippingUnitPriceComp/customShippingUnitPriceComp.js 35 ●●●●● 补丁 | 查看 | 原始文档 | 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 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.html 181 ●●●● 补丁 | 查看 | 原始文档 | 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.css 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html 575 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js 1199 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js-meta.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html 198 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js 518 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.html 139 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js 298 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html 355 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js 411 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html 1088 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js 2198 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumable/lexConsumable.html 906 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumable/lexConsumable.js 3036 ●●●●● 补丁 | 查看 | 原始文档 | 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 173 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js 213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCssUtility/lexCssUtility.css 86 ●●●● 补丁 | 查看 | 原始文档 | 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 12 ●●●● 补丁 | 查看 | 原始文档 | 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 11 ●●●● 补丁 | 查看 | 原始文档 | 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/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 84 ●●●●● 补丁 | 查看 | 原始文档 | 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.html 304 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexInventory/lexInventory.js 1486 ●●●● 补丁 | 查看 | 原始文档 | 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 216 ●●●● 补丁 | 查看 | 原始文档 | 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 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOutboundorderImport/lexOutboundorderImport.js 289 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.html 333 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js 691 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.html 135 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js 206 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html 360 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js 457 ●●●● 补丁 | 查看 | 原始文档 | 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 173 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js 330 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js 42 ●●●●● 补丁 | 查看 | 原始文档 | 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 140 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTopPage/lexTopPage.js 626 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html 274 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js 1210 ●●●● 补丁 | 查看 | 原始文档 | 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 710 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/DealerInquiryModifyState.page-meta.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ContentDocumentLink.trigger 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ContentDocumentTrigger.trigger 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest/LEXC01packagelexcommunitynew.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest/LEXC02packagelexcommunityupdate.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.sf/config.json
@@ -1,3 +1,3 @@
{
  "target-org": "OlympusDev"
  "target-org": "OlympusStageEnv"
}
force-app/main/default/aura/CreateTarget/CreateTarget.cmp
@@ -1,4 +1,4 @@
<aura:component controller="CreateTargetCmp" implements="force:appHostable,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=""/>
@@ -44,7 +44,6 @@
    <div class="button_area">
        <ui:button label="{!v.button_text}" press="{!c.toggle_report}"/>
    </div>
    <div aura:id="modal_window" role="dialog" tabindex="-1" class="disp_none slds-modal slds-fade-in-open slds-modal--large" aria-labelledby="headerTarget">
        <div class="slds-modal__container">
            <div class="slds-modal__header">
@@ -60,11 +59,11 @@
                        <div class="slds-form-element__group">
                            <div class="slds-form-element__row">
                                <div class="slds-form-element slds-size--1-of-2">
                                    <label class="slds-form-element__label" for="input-hos">医院</label>
                                    <force:inputField value="{!v.record.Agency_Hospital__c}" aura:id="input-hos"/>
                                    <!-- <lightning:recordEditForm objectApiName="Agency_Opportunity__c" recordId="{!v.record.Id}">
                                        <lightning:inputField fieldName="Agency_Hospital__c"/>
                                    </lightning:recordEditForm> -->
                                    <label class="slds-form-element__label" for="input-hos">医院</label>
                                    <!-- <force:inputField value="{!v.record.Agency_Hospital__c}" aura:id="input-hos"/> -->
                                    <lightning:recordEditForm objectApiName="Agency_Opportunity__c">
                                        <lightning:inputField variant="label-hidden" fieldName="Agency_Hospital__c" value="{!v.record.Agency_Hospital__c}" aura:id="input-hos"/>
                                    </lightning:recordEditForm>
                                </div>
                            </div>
                            <!-- <h4 class="slds-section__title">访问目标</h4>
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>57.0</apiVersion>
    <apiVersion>42.0</apiVersion>
    <description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>
force-app/main/default/aura/CreateTarget/CreateTargetHelper.js
@@ -15,8 +15,9 @@
                    var select_ah_name = ah.Name;
                    // component.set('v.record.Agency_Hospital__c', select_ah);
                    //add by Deloitte 2023-6-8
                    let agencyHosp = component.get('v.record');
                    agencyHosp.Agency_Hospital__c = select_ah;
                    let agency = component.get("v.record");
                    agency.Agency_Hospital__c = select_ah;
                    // component.set("v.record", agency);
                    // alert(JSON.stringify(component.find('input-hos').get("v.body")[0].get('v.values')));
                    if ($A.get("$Browser.formFactor") == 'DESKTOP') {
                        console.log("flag1");
@@ -109,13 +110,6 @@
            }
        });
        $A.enqueueAction(action);
        var modal_window = component.find('modal_window');
        var modal_bg = component.find('modal_bg');
        if ($A.util.hasClass(modal_window, 'disp_none') && !component.get("v.recordId")) {
            $A.get('e.force:refreshView').fire();
        }
    },
    toggle_report : function(component, event, helper) {
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js
@@ -40,6 +40,46 @@
        });
        $A.enqueueAction(action);
    },
    doinitSave: function (component, event, helper) {
        document.title = "追溯日报";
        component.set('v.loginEdit', true);
        this.report_date_list(component, event, helper, 5);
        var action = component.get('c.getalldata');
        action.setCallback(this, function (response) {
            var state = response.getState();
            if (state == 'SUCCESS') {
                var res = response.getReturnValue();
                component.set('v.alldata', res.reports);
                component.set('v.fieldsmap', res.fieldsMap);
                component.set('v.allselectlist', res.allselectlist);
                component.set('v.doclist', res.doclist);
                //fy
                var xx = res.UserProType;
                component.set('v.UserProType', res.UserProType);
                var gg = component.get('v.UserProType');
                //fy
                component.find('select_agency_person').set('v.options', this.conv_selected(res.allselectlist.AgencyPerson__c));
                component.find('select_DealerPersonnel').set('v.options', this.conv_selected(res.allselectlist.DealerPersonnel__c));
                component.find('select_purpose_type').set('v.options', this.conv_selected(res.allselectlist.WorkRecord__c));
                component.find('select_ProductClassification').set('v.options', this.conv_selected(res.allselectlist.ProductClassification__c));
                component.find('select_stageName').set('v.options', this.conv_selected(res.allselectlist.StageName__c));
                component.set('v.selected_agency_person', res.allselectlist.AgencyPerson__c[0].label);
                component.set('v.dialog_type', '新建');
                this.get_reports(component, event, helper, component.find('select_date').get('v.value'), component.find('select_agency_person').get('v.value'));
                component.set('v.PIConfig', res.PIConfig);// 20220222 PI改造 by Bright
                component.set('v.loginEdit', false);
            }
            else {
                //component.set('v.errorMessage', 'doinit failed.');
                this.error('doinit failed.');
                this.showErrorToast(component);
                component.set('v.loginEdit', false);
            }
        });
        $A.enqueueAction(action);
    },
    //其他品牌产品类别 下拉框赋值
    selectProductCcategory: function (component) {
        var select_ProductClassification = component.find('select_ProductClassification').get('v.value');
@@ -76,7 +116,7 @@
            "date_str": date_str,
            "person_str": person_str,
        });
        component.set('v.login', true);
        component.set('v.loginEdit', true);
        action.setCallback(this, function (response) {
            
            var state = response.getState();
@@ -145,15 +185,15 @@
                                    component.set('v.report_count', res.reports.length);
                                }
                                //fy 20220414 end
                                component.set('v.login', false);
                                component.set('v.loginEdit', false);
                            }, staticResourceAgencyContact.token);
                        } else {
                            component.set('v.login', false);
                            component.set('v.loginEdit', false);
                        }
                    }
                } else {
                    component.set('v.list_message', 'no_data');
                    component.set('v.login', false);
                    component.set('v.loginEdit', false);
                }
            }
@@ -161,7 +201,7 @@
                //component.set('v.errorMessage', 'get_reports failed.');
                this.error('get_reports failed.');
                this.showErrorToast(component);
                component.set('v.login', false);
                component.set('v.loginEdit', false);
            }
        });
        $A.enqueueAction(action);
@@ -1013,7 +1053,7 @@
            return false;
        }
        // 保存処理
        component.set('v.login', true);
        component.set('v.loginEdit', true);
        if (component.get('v.mode') == 'edit') {
            var Agency_Report__c = component.get('v.select_report_data').Id;
            var action = component.get('c.editAgencyReport');
@@ -1047,6 +1087,7 @@
            action.setCallback(this, function (response) {
                var state = response.getState();
                if (state == 'SUCCESS') {
                    debugger
                    component.set('v.successMessage', '编辑保存成功');
                    this.showSuccessToast(component);
                    var report_id = response.getReturnValue();
@@ -1063,14 +1104,14 @@
                    component.set('v.update_select_report_data_id', report_id);
                    this.get_reports(component, event, helper, component.get('v.select_report_data').Submit_date__c, component.get('v.select_report_data').Person_In_Charge2__c);
                    component.find('save_button').set('v.disabled', false);
                    component.set('v.login', false);
                    component.set('v.loginEdit', false);
                }
                else {
                    //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);
                    component.set('v.loginEdit', false);
                }
            });
            $A.enqueueAction(action);
@@ -1143,15 +1184,16 @@
                            this.error('get_reports_now failed.');
                            this.showErrorToast(component);
                            component.find('save_button').set('v.disabled', false);
                            component.set('v.login', false);
                            component.set('v.loginEdit', false);
                        }
                    });
                    $A.enqueueAction(action2);
                    this.allclear(component);
                    component.find('select_WorkMark').set('v.value', false);
                    component.find('save_button').set('v.disabled', false);
                    component.set('v.login', false);
                    this.doinit(component, event, helper);
                    component.set('v.loginEdit', false);
                    debugger
                    this.doinitSave(component, event, helper);
                }
                else {
                    var error = response.getError();
@@ -1159,7 +1201,7 @@
                    this.error('保存日报失败');
                    this.showErrorToast(component);
                    component.find('save_button').set('v.disabled', false);
                    component.set('v.login', false);
                    component.set('v.loginEdit', false);
                }
            });
            $A.enqueueAction(action);
force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp
@@ -354,7 +354,9 @@
                        </div>
                        <!-- 医院 -->
                        <div aura:id="hospital_list" class="slds-form-element slds-lookup slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-5 marginTop" data-select="single">
                            <ui:inputText aura:id="hospital_input_text" label="医院" class="field" value="{!v.hospital}" updateOn="keyup"/>
                            <!-- <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}">
force-app/main/default/aura/WeeklyReport/WeeklyReport.css
@@ -152,4 +152,7 @@
.THIS .marginTop{
    margin-top: 10px;
}
.THIS .custom-input .uiInput {
    height: 2rem; /* 调整高度为你需要的值,如 2rem */
}
/* add by Deloitte-Link 2023-6-19 end*/
force-app/main/default/classes/ArriveGoodsControllerTest.cls
Diff too large
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/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 List<String>{ 'Product2__c.Name' };
    private static String[] columus = new String[]{ 'Product2__c.Name'};
    // 产品 ID
    private static String ESetId = '';
    private static String accountid = null;
@@ -21,25 +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 {
            // 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';
            }
            // 获得订单一览
@@ -62,18 +62,7 @@
            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
@@ -82,22 +71,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;
@@ -119,13 +108,7 @@
    }
    @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;
@@ -154,23 +137,16 @@
            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,72 +19,45 @@
        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
            }
@@ -92,7 +65,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;
@@ -117,28 +90,25 @@
        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';
@@ -174,7 +144,7 @@
        @AuraEnabled
        public Consumable_order_details2__c esd;
        @AuraEnabled
        public Product2__c Prod;
        public Product2__c Prod;
        @AuraEnabled
        public Decimal packing_list;
        @AuraEnabled
@@ -188,6 +158,7 @@
        @AuraEnabled
        public String prodName;
        // 已存在消耗品明细用
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
            esd = 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 { get; set; }
    public static String alertMessage {set;get;}
    //拆盒明细件数
    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,38 +44,39 @@
        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 List<String>{};
    public static List<String> ParseBarCode(String Code){
        String[] Cache = new String[]{};
        Cache = Code.split('\n');
        Set<String> Buff = new Set<String>();
        for (String A : Cache) {
        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);
        }
@@ -84,14 +85,9 @@
    //获取明细
    @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;
@@ -101,18 +97,20 @@
        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;
        }
@@ -124,416 +122,309 @@
        // 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);
                }
            }
        }
@@ -541,97 +432,89 @@
        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;
@@ -639,48 +522,46 @@
            }
            //取得通番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
@@ -690,28 +571,29 @@
                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; }
@@ -724,18 +606,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,11 +388,7 @@
        //         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]));
@@ -419,16 +415,17 @@
        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(
@@ -456,12 +453,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) {
@@ -536,6 +533,7 @@
                }
            } 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');
@@ -554,9 +552,7 @@
                        (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);
                    }
                }
@@ -697,12 +693,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;
                    }
@@ -853,8 +849,6 @@
                    delete invoiceLinkdetList;
                }
                //新建发票明细1
                System.debug('===>' + chukudanID);
                System.debug('===>' + chukudanID.size());
                if (chukudanID.size() > 0) {
                    newinvoicedetails1(chukudanID);
                }
@@ -889,7 +883,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);
                    }
@@ -1273,13 +1267,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();
@@ -1305,16 +1299,7 @@
    // 检索(未开发票出库单)
    @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>();
@@ -1324,12 +1309,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>();
@@ -1355,7 +1340,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);
@@ -1411,7 +1396,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>();
@@ -1444,11 +1429,7 @@
    // 提交按钮
    @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>();
@@ -1456,7 +1437,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>();
@@ -1520,8 +1501,6 @@
                        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;
@@ -1542,8 +1521,6 @@
                    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(
@@ -1557,16 +1534,7 @@
                    //     )
                    // );
                    // 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);
@@ -1602,7 +1570,7 @@
        System.debug('res = ' + res);
        return res;
    }
    @TestVisible
    class InvoiceOrderInfo implements Comparable {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -1615,12 +1583,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
@@ -1648,7 +1616,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,7 +101,6 @@
            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]));
        }
@@ -139,9 +138,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);
@@ -149,15 +148,12 @@
    }
    @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);
@@ -356,7 +352,6 @@
    }
    // Data Bean
    @TestVisible
    class ConsumableorderdetailsInfo {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -374,7 +369,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;
@@ -384,13 +379,12 @@
            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_UnitOptsMap = new Map<String, String>();
            Invoice_UnitOpts = new List<SelectOption>();
            Invoice_UnitOpts.add(new SelectOption('盒', '盒'));
            Invoice_UnitOpts.add(new SelectOption('个', '个'));
            Invoice_UnitOptsMap = new Map<String,String>();
            Invoice_UnitOptsMap.put('盒', '盒');
            Invoice_UnitOptsMap.put('个', '个');
        }
force-app/main/default/classes/LexConsumableAccountController.cls
@@ -168,9 +168,9 @@
            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') {
                if(String.valueOf(ar.get('thisAmount')) != '0.0'){
                    accountList.add(String.valueOf(ar.get('hospitalName')));
                    topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount'))));
                    topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount'))));
                }
            }
@@ -249,21 +249,21 @@
            if (fiscalYear == 'thisYear') {
                AggregateResult[] saleAmountList = LexConsumableAccountSOQL.getAccountTotalSales(thisDatetime, nextDatetime);
                if (saleAmountList[0].get('saleAmount') != null) {
                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);
                if (saleAmountList[0].get('saleAmount') != null) {
                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);
                if (saleAmountList[0].get('saleAmount') != null) {
                if(saleAmountList[0].get('saleAmount') != null){
                    topInfo.saleAmount = Decimal.valueOf(String.valueOf(saleAmountList[0].get('saleAmount')));
                    System.debug('topInfo.saleAmount = ' + topInfo.saleAmount);
                }
@@ -273,10 +273,11 @@
            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') {
                if(String.valueOf(ar.get('thisAmount')) != '0.0'){
                    accountList.add(String.valueOf(ar.get('hospitalName')));
                    topInfo.deList.add(Decimal.valueOf(String.valueOf(ar.get('thisAmount'))));
                }
            }
            System.debug('accountList = ' + accountList);
            System.debug('topInfo = ' + topInfo);
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,19 +1,20 @@
public with sharing class LexConsumableAccountSOQL {
    public static AggregateResult[] getAccountBySales(Datetime thisDatetime, Datetime nextDatetime) {
        AggregateResult[] arList = new List<AggregateResult>(
            [
                SELECT count(id), Consumable_order__r.Order_ForHospital__r.name hospitalName, sum(Sale_amount__c) thisAmount
                FROM Consumable_Orderdetails__c
                WHERE CreatedDate >= :thisDatetime AND CreatedDate < :nextDatetime AND Consumable_order__r.Order_ForHospital__r.name != ''
                GROUP BY Consumable_order__r.Order_ForHospital__r.Name
                ORDER BY sum(Sale_amount__c) DESC
                LIMIT 10
            ]
        );
    public static AggregateResult[] getAccountBySales(Datetime thisDatetime ,Datetime nextDatetime){
        AggregateResult[] arList = new List<AggregateResult>([
            SELECT count(id), Consumable_order__r.Order_ForHospital__r.name hospitalName, sum(Sale_amount__c) thisAmount
            FROM Consumable_Orderdetails__c
            WHERE
                CreatedDate >= :thisDatetime
                AND CreatedDate < :nextDatetime
                AND Consumable_order__r.Order_ForHospital__r.name != ''
            GROUP BY Consumable_order__r.Order_ForHospital__r.Name
            ORDER BY sum(Sale_amount__c) DESC
            LIMIT 10
        ]);
        return arList;
    }
    public static AggregateResult[] getAccountTotalSales(Datetime thisDatetime, Datetime nextDatetime) {
    public static AggregateResult[] getAccountTotalSales(Datetime thisDatetime ,Datetime nextDatetime){
        AggregateResult[] saleAmountList = [
            SELECT sum(Sale_amount__c) saleAmount
            FROM Consumable_Orderdetails__c
@@ -21,4 +22,6 @@
        ];
        return saleAmountList;
    }
}
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,16 +232,17 @@
            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
@@ -263,9 +264,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);
@@ -329,10 +330,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;
@@ -381,16 +382,7 @@
                }
                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();
@@ -466,12 +458,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);
@@ -551,21 +543,10 @@
                //         attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[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]));
                        }
                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]));
                    }
                }
                //
@@ -579,7 +560,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);
                        }
@@ -615,22 +596,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();
@@ -671,7 +652,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;
@@ -727,7 +708,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;
@@ -753,7 +734,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
@@ -948,7 +929,7 @@
        String consumableorderdetailsRecordsviewStr,
        Boolean editAbleStr,
        List<String> proLimitAndDateList
    ) {
    ){
        Results results = new Results();
        errorMsgList = new List<String>();
        warningMsgList = new List<String>();
@@ -967,11 +948,8 @@
        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 {
@@ -1015,7 +993,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]));
@@ -1090,12 +1068,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;
@@ -1119,7 +1097,7 @@
        String accountNameStr,
        List<String> proLimitAndDateList,
        Boolean editAbleStr
    ) {
    ){
        Results results = new Results();
        methodType = methodTypeStr;
        accountId = accountIdStr;
@@ -1145,7 +1123,7 @@
                    for (hospitalprice__c hc : hplist) {
                        hpids.add(hc.product__c);
                    }
                    if (hpids != null && hpids.size() > 0) {
                        soql += ' AND Id in : hpids ';
                    }
@@ -1270,10 +1248,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 = '没有搜索到相关数据';
            }
@@ -1300,10 +1278,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;
@@ -1464,8 +1442,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;
        }
@@ -1474,7 +1452,7 @@
    // 编辑按钮
    @AuraEnabled
    public static Results setEditAble(String eSetidStr) {
    public static Results setEditAble(String eSetidStr){
        Results results = new Results();
        ESetId = eSetidStr;
        try {
@@ -1523,7 +1501,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';
@@ -1536,7 +1514,7 @@
    //删除按钮
    @AuraEnabled
    public static Results delConsumable(String eSetidStr) {
    public static Results delConsumable(String eSetidStr){
        Results results = new Results();
        ESetId = eSetidStr;
        try {
@@ -1559,7 +1537,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>();
@@ -1640,23 +1618,10 @@
        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,
@@ -1671,7 +1636,7 @@
        String contractIdStr,
        String agencyProType1Str,
        Boolean OSHFLGStr
    ) {
    ){
        Results results = new Results();
        errorMsgList = new List<String>();
        warningMsgList = new List<String>();
@@ -1684,16 +1649,13 @@
        contractId = contractIdStr;
        agencyProType1 = agencyProType1Str;
        OSHFLG = OSHFLGStr;
        coc = (Consumable_order__c) JSON.deserialize(cocStr, Consumable_order__c.class);
        contactDealer = (List<String>) JSON.deserialize(contactDealerStr, List<String>.class);
        System.debug('consumableorderdetailsRecordsviewStr:' + consumableorderdetailsRecordsviewStr);
        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 {
@@ -1708,12 +1670,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('不存在的合同,请重新确认。');
@@ -1766,14 +1728,13 @@
            }
            //=======================================医院特价,有金额的话取金额
            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);
                }
            }
            //促销订货 根据经销商产品中的数据计算金额
@@ -1855,13 +1816,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;
@@ -1926,19 +1887,16 @@
                                        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;
@@ -2029,12 +1987,9 @@
                                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;
@@ -2064,17 +2019,17 @@
    //删除附件
    @AuraEnabled
    public static Results deleteAtt(String contentVersionId, String cocId) {
    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;
            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';
@@ -2085,11 +2040,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);
                }
@@ -2099,9 +2054,9 @@
                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;
            }
@@ -2162,6 +2117,7 @@
        @AuraEnabled
        public Decimal consumableCount { get; set; }
        // 已存产品明细
        public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
            check = true;
force-app/main/default/classes/LexConsumableGoodsInfo.cls
@@ -1,87 +1,59 @@
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 (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>();
            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;
@@ -94,35 +66,28 @@
    //已到货产品一览
    @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();
        }
@@ -131,16 +96,14 @@
    //已到货产品一览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;
@@ -149,91 +112,50 @@
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            //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
                ];
            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>();
            //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
                ];
            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 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();
        }
@@ -242,22 +164,20 @@
    //未到货产品一览
    @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();
        }
@@ -266,16 +186,14 @@
    //未到货产品一览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;
@@ -284,91 +202,50 @@
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            //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
                ];
            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>();
            //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 (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
                ];
            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
            //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();
        }
@@ -377,89 +254,77 @@
    //还没发货数量
    @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;
@@ -467,7 +332,7 @@
            }
            results.recordList = otherArrList;
            results.result = 'Success';
        } catch (Exception e) {
        }catch (Exception e){
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
@@ -476,16 +341,14 @@
    //还没发货数量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;
@@ -494,110 +357,69 @@
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            //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
                ];
            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>();
            //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
                ];
            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 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;
@@ -606,7 +428,7 @@
            }
            results.recordList = allOtherDetIifo;
            results.result = 'Success';
        } catch (Exception e) {
        }catch (Exception e){
            results.result = 'Fail';
            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
        }
@@ -615,30 +437,26 @@
    //发货七天还未到货数
    @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();
        }
@@ -647,16 +465,14 @@
    //发货七天还未到货数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;
@@ -665,106 +481,63 @@
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            //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
                ];
            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>();
            //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')) {
            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 {
                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());
                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 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();
        }
@@ -780,17 +553,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,45 +4,44 @@
    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******************/
    //页面主数据显示用
    // private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
    private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
    //盘点到的产品
    public static List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
    public static List<Consumable_order_details2__c> showcod2nid = new List<Consumable_order_details2__c>();
    public 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;
@@ -57,12 +56,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;
@@ -73,79 +72,65 @@
        //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';
@@ -157,21 +142,21 @@
        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];
        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,
@@ -185,135 +170,123 @@
        //     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
        ];
        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) {
        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++) {
        List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c,
                                                            SFDA_Status__c,Packing_list_manual__c,
                                                            Asset_Model_No__c
                                                        from Product2__c
                                                        //where Estimation_Entry_Possibility__c = '○'
                                                         where Id in:Product2cIdSet
                                                         and Product_Type__c like : sqlagencyProType
                                                        ];
        for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){
            midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]);
        }
        system.debug('productCount_Unfull_bak' + productCount_Unfull_bak.size());
        }
        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++) {
        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();
        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('ConsumableorderdetailsRecordsview',JSON.serialize(ConsumableorderdetailsRecordsview));
        data.put('userWorkLocation',userWorkLocation);
        data.put('agencyProType',agencyProType);
        data.put('accountName',accountName);
        data.put('accountid',accountid);
        data.put('consumableorderdetailsRecords',JSON.serialize(consumableorderdetailsRecords));
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        return res;
    }
    private static void listCut() {
    private static void listCut(){
        //拆分暂用list
        List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
        List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
@@ -324,41 +297,44 @@
        //选择产品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 List<String>{};
    public static  List<String> ParseBarCode(String Code){
        Map<String,Integer> barcodeCountMap = new Map<String,Integer>();
        String[] Cache = new String[]{};
        Cache = Code.split('\n');
        List<String> Buff = new List<String>();
        for (String A : Cache) {
        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
@@ -369,78 +345,53 @@
    //========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 + '%';
        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);
        System.debug('BarCodeListP===>' + BarCodeListP);
        List<String> BarCodeListP = ParseBarCode( barcode );
        //查询库存 追加返品库存
        List<Consumable_order_details2__c> ProductCount_Res = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Dealer_Info_text__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                Bar_Code_search__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
                AND Dealer_Info_text__c = :accountName
        ];
        System.debug('ProductCount_Res==>' + ProductCount_Res);
        List<Consumable_order_details2__c> ProductCount_Res = [select Id,  Name,Consumable_Product__c,
                                Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c,
                                Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                                Bar_Code_search__c
                            FROM Consumable_order_details2__c
                            WHERE Dealer_Arrive__c = true
                            AND Dealer_Shipment__c = false
                            AND Dealer_Saled__c = false
                            AND Dealer_Returned__c = false
                            AND Lose_Flag__c = false
                            AND Cancellation_Flag__c = false
                            AND Bar_Code__c !=null
                            AND Product_Type__c like : sqlagencyProType
                            AND Arrive_Owner_Work_Location__c =: userWorkLocation
                            AND  Dealer_Info_text__c = :accountName ];
        reFindProduct.clear();
        Map<String, ConsumableorderdetailsInfo> barCodeListAdjustMap = new Map<String, ConsumableorderdetailsInfo>();
        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>();
@@ -448,23 +399,20 @@
        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++) {
                        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)) {
                    for(integer i = 0 ; i < ProductCount_Res.size();i++){
                        if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){
                            if(carCodeListLose.contains(ProductCount_Res[i].Bar_Code__c)){
                                continue;
                            } else {
                            }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]));
@@ -476,170 +424,576 @@
            }
            //已经出库的产品
            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);
            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();
            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);
                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){
                pandiandetailsListShow.add(pandiandetailsListMid);
            }
            //分页
            PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
            totalCount = codPageRecords.size();
@@ -666,638 +1020,101 @@
            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);
            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 = 'Success1';
            res.status = 'Sucess';
            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;
@@ -1305,67 +1122,60 @@
                    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);
@@ -1377,15 +1187,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
@@ -1399,7 +1209,6 @@
    }
    // Data Bean
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -1412,7 +1221,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
@@ -1431,13 +1240,14 @@
        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;
@@ -1449,9 +1259,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;
@@ -1460,11 +1270,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,70 +31,49 @@
        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
@@ -49,7 +49,7 @@
    public static String category1 { get; set; }
    public static Boolean editAble { get; set; }
    // 经销商在库产品ID
    public static List<String> orderDetZaikuList { get; set; }
    public static List<String> orderDetZaikuList{set;get;}
    // 产品 ID
    public static String ESetId { get; set; }
    public static String idCheck { get; set; }
@@ -98,6 +98,7 @@
        categoryOptionMap = new Map<String, String>();
        category4OptionMap = new Map<String, String>();
        category5OptionMap = new Map<String, String>();
        // 取用户ID
        String userId = UserInfo.getUserId();
@@ -239,7 +240,9 @@
                }
                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;
@@ -404,8 +407,8 @@
        data.put('pageRecords', pageRecords);
        data.put('consumableorderdetailsRecords', consumableorderdetailsRecords);
        data.put('hasHos', hasHos);
        data.put('productLimtAndDate', proLimitAndDate);
        data.put('productkucun', productkucun);
        data.put('productLimtAndDate',proLimitAndDate);
        data.put('productkucun',productkucun);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
@@ -413,16 +416,16 @@
        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
@@ -466,8 +469,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';
@@ -532,13 +535,13 @@
        Map<String, Date> productkucunLWC
    ) {
        try {
            System.debug('orderDetZaikuListLWC===>' + orderDetZaikuListLWC);
            System.debug('productkucun===>' + productkucun);
            System.debug('orderDetZaikuListLWC===>'+orderDetZaikuListLWC);
            System.debug('productkucun===>'+productkucun);
            pageSize = pageSizeLWC;
            pageToken = pageTokenLWC;
            sortField = sortFieldLWC;
            sortOrder = sortOrderLWC;
            productkucun = new Map<String, Date>();
            productkucun =  new Map<String, Date>();
            orderDetZaikuList = new List<String>();
            productkucun = productkucunLWC;
@@ -603,7 +606,7 @@
            // if (String.isNotBlank(sortField) && String.isNotBlank(sortOrder)) {
            //     if(sortFieldLWC != 'limitCount'){
            //         soql += ' ORDER BY ' + sortField + ' ' + sortOrder;
            //     }
            // }
            System.debug('soql = ' + soql);
@@ -627,7 +630,9 @@
                    }
                    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;
@@ -657,7 +662,9 @@
                    }
                    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;
@@ -773,11 +780,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);
@@ -931,6 +938,7 @@
    //     }
    //     pageRecords.sort();
    // }
    //检索sql文做成
    private static String makeSoql(String CateName, String CateCode, String Category3, String Category4, String Category5) {
force-app/main/default/classes/LexLicenceReminderController.cls
@@ -1,40 +1,41 @@
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,7 +50,6 @@
        res.status = 'Success';
        res.code = 200;
        res.msg = '';
        System.debug('res:' + res);
        return res;
    }
@@ -103,7 +102,7 @@
                            barcodePieceMap.put(csvRecordData[6], Integer.valueOf(csvRecordData[7]));
                        }
                    }
                    String[] csvRecordDataStr = new String[13];
                    String[] csvRecordDataStr = new List<String>(13);
                    for (Integer j = 0; j < csvRecordData.size(); j++) {
                        csvRecordDataStr[j] = csvRecordData[j];
                    }
@@ -191,8 +190,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;
@@ -588,7 +587,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;
@@ -754,7 +753,9 @@
                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;
@@ -785,7 +786,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;
        }
    }
@@ -863,7 +864,7 @@
            return null;
        }
    }
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Consumable_order__c order { get; set; }
force-app/main/default/classes/LexOverdueStockController.cls
@@ -1,4 +1,5 @@
public with sharing class LexOverdueStockController {
    /*****************検索用******************/
    public static String barcode { get; set; }
@@ -16,18 +17,19 @@
    // 经销商信息
    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() {
    }
    // 画面初始化
@@ -40,118 +42,103 @@
        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);
                        }
                    }
@@ -159,176 +146,164 @@
                }
            }
            // 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;
        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;
        }
        // 输入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
        ];
        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);
        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, '请先点击获取明细', '');
            // 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);
@@ -336,24 +311,24 @@
    }
    // 将页面或取得BarCode去掉重复的,转换成List
    public static List<String> ParseBarCode(String Code) {
        Map<String, Integer> barcodeCountMap = new Map<String, Integer>();
        String[] Cache = new List<String>{};
    public static List<String> ParseBarCode(String Code){
        Map<String,Integer> barcodeCountMap = new Map<String,Integer>();
        String[] Cache = new String[]{};
        Cache = Code.split('\n');
        List<String> Buff = new List<String>();
        for (String A : Cache) {
        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; }
@@ -361,7 +336,7 @@
        public Product2__c Prod { get; set; }
        @AuraEnabled
        public Boolean check { get; set; }
        // 过期库存
        @AuraEnabled
        public Integer overlimitCount { get; set; }
@@ -378,7 +353,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;
@@ -393,11 +368,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,55 +4,54 @@
    //--------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 { get; set; }
    public static String alertMessage {set;get;}
    //拆盒明细件数
    public static integer getinventorysize() {
    public static integer getinventorysize(){
        return ConsumableorderdetailsRecordsdummy.size();
    }
    public static Map<String, String> ExistIdMap = new Map<String, String>();
@@ -21,47 +21,48 @@
    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);
@@ -69,15 +70,15 @@
    }
    // 将页面或取得BarCode去掉重复的,转换成List
    public static List<String> ParseBarCode(String Code) {
        String[] Cache = new List<String>{};
    public static List<String> ParseBarCode(String Code){
        String[] Cache = new String[]{};
        Cache = Code.split('\n');
        Set<String> Buff = new Set<String>();
        for (String A : Cache) {
        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);
        }
@@ -86,14 +87,10 @@
    //获取明细
    @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;
@@ -102,19 +99,21 @@
        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;
        }
@@ -126,529 +125,417 @@
        // 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
                    //登录拆盒后在库
@@ -657,29 +544,31 @@
                }
            }
            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
@@ -696,18 +585,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,7 +201,6 @@
        //BarCodelist做成
        barCodeListP = ParseBarCode(barcode);
        System.debug('barCodeListP:' + barCodeListP);
        //针对所有商品到货确认
        reSet1 = [
            SELECT
@@ -236,7 +235,6 @@
                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>();
@@ -244,7 +242,6 @@
            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);
@@ -681,13 +678,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;
                                }
                            }
@@ -1079,16 +1076,11 @@
        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) {
@@ -1273,7 +1265,6 @@
        return consumableorderdetails2Nobox.size();
    }
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Consumable_orderdetails__c orderdetails1 { get; set; }
force-app/main/default/classes/LexSearchContractController.cls
@@ -1,34 +1,26 @@
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();
@@ -37,12 +29,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();
@@ -50,16 +42,17 @@
        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,15 +1,16 @@
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();
@@ -18,7 +19,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));
@@ -30,16 +31,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,13 +245,7 @@
    // 画面初始化
    @AuraEnabled
    public static ResponseBodyLWC init(
        String ESetidJs,
        String statusEdit,
        Integer pageSizeLWC,
        Integer pageTokenLWC,
        String arriveorderLWC
    ) {
    public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC,String arriveorderLWC) {
        try {
            firstInit(ESetidJs);
            statusEdit = statusEdit;
@@ -1400,7 +1394,7 @@
            System.debug('res = ' + res);
            return res;
        } catch (Exception e) {
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
            return new ResponseBodyLWC('Error',500, e.getMessage() + e.getLineNumber(), '');
        }
    }
@@ -2128,7 +2122,11 @@
                    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) +
                        ' 的特价',
                        ''
                    );
                }
@@ -2185,10 +2183,7 @@
                    if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') {
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    if (
                        (ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) &&
                        coc.SummonsForDirction__c != '医院试用'
                    ) {
                    if ((ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) && coc.SummonsForDirction__c != '医院试用') {
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (
@@ -2220,7 +2215,9 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    ''
                                );
                            }
@@ -2236,7 +2233,9 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    ''
                                );
                            }
@@ -2342,10 +2341,7 @@
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
                    if (
                        (ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) &&
                        coc.SummonsForDirction__c != '医院试用'
                    ) {
                    if ((ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) && coc.SummonsForDirction__c != '医院试用') {
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (
@@ -2371,7 +2367,9 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    ''
                                );
                            }
@@ -2386,7 +2384,9 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    ''
                                );
                            }
@@ -2534,7 +2534,7 @@
        //         FROM Account
        //         WHERE
        //             // Name = '奥林巴斯(北京)销售服务有限公司'
        //             // AND
        //             // AND
        //             Name LIKE :nameCondition
        //             AND RecordType.DeveloperName = 'AgencyContract'
        //             AND Contract_Decide_Start_Date__c >= :thisDatetime
@@ -2550,7 +2550,7 @@
        //         FROM Account
        //         WHERE
        //             // Name = '奥林巴斯(北京)销售服务有限公司'
        //             // AND
        //             // AND
        //             Name LIKE :nameCondition
        //             AND RecordType.DeveloperName = 'AgencyContract'
        //             AND Contract_Decide_Start_Date__c >= :thisDatetime
@@ -2561,6 +2561,7 @@
        //     ];
        // }
        Date today = Date.today();
        //Date today = Date.newInstance(2023, 3, 1);
        Integer thisMonth = today.month();
@@ -2569,7 +2570,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);
@@ -2579,14 +2580,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') {
@@ -2688,15 +2689,15 @@
    //删除附件
    @AuraEnabled
    public static ResponseBodyLWC deleteAtt(String contentVersionId) {
    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];
            ContentDocument conDocument =  [SELECT Id FROM ContentDocument where Id = :contentDocumentId];
            delete conDocument;
            return new ResponseBodyLWC('Success', 200, '', '');
            return new ResponseBodyLWC('Success',200,'','');
        } catch (Exception e) {
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
            return new ResponseBodyLWC('Error',500, e.getMessage() + e.getLineNumber(), '');
        }
    }
@@ -2775,7 +2776,6 @@
    }
    // Data Bean
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -2916,7 +2916,6 @@
        }
    }
    @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 List<String>{ 'Product2__c.Name__c' };
    private static String[] orderby = new String[]{ 'Product2__c.Name__c'};
    //产品上下限
    public static String[] proLimitAndDate = new List<String>{};
    public static String[] proLimitAndDate =new 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,60 +72,43 @@
    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();
@@ -138,115 +121,91 @@
            // 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,
@@ -255,86 +214,78 @@
                    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);
                        }
                    }
                }
@@ -343,8 +294,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;
@@ -353,8 +304,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;
@@ -365,31 +316,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'));
                }
            }
@@ -397,24 +348,25 @@
            //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
@@ -429,28 +381,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';
@@ -469,38 +421,36 @@
            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);
@@ -520,137 +470,115 @@
            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]));
        }
    }
@@ -671,7 +599,7 @@
    // }
    //编辑当前页内容
    public static void makeCurrentPageRecords() {
    public static void makeCurrentPageRecords(){
        Integer startIdx;
        Integer endIdx;
        pageRecords = new List<ConsumableorderdetailsInfo>();
@@ -733,7 +661,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;
@@ -744,17 +672,18 @@
            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;
@@ -809,5 +738,7 @@
        public List<ConsumableorderdetailsInfo> pageCodeRecords;
        @AuraEnabled
        public PaginatedAccounts paginatedAccounts;
    }
}
force-app/main/default/classes/LexUpAccountProLimit.cls
@@ -1,55 +1,59 @@
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);
        system.debug('accountId'+accountId);
        if(String.isNotBlank(checkResoultstr)){
            return new ResponseBodyLWC('Error',500,''+checkResoultstr+'', '');
            // return checkResoultstr;
        }
        //String[] proidList =new String[]{};
        String[] proList = new List<String>{};
        String[] pro_List = new List<String>{};
        String[] proList =new String[]{};
        String[] pro_List =new String[]{};
        List<Account> acc = [
            SELECT Id, Name, Product_Limit_Date__c
            FROM Account
            WHERE Id = :accountId
            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, Estimation_Entry_Possibility__c
            FROM Product2__c
            WHERE Product_Type__c LIKE :userPro_Typestr AND Estimation_Entry_Possibility__c = '○'
        ]; //Add  by WangXueqin 20230605
        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 '
@@ -57,83 +61,84 @@
        //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,12 +1,13 @@
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/ResponseBodyLWC.cls
@@ -1,25 +1,24 @@
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,32 +1,28 @@
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);
@@ -34,29 +30,25 @@
    }
    @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/labels/CustomLabels.labels-meta.xml
@@ -12,14 +12,14 @@
        <language>zh_CN</language>
        <protected>false</protected>
        <shortDescription>发票显示明细</shortDescription>
        <value>00O0l000000zaGcEAI</value>
        <value>00O6D000000UPzaUAG</value>
    </labels>
    <labels>
        <fullName>View_Weekly_Report</fullName>
        <language>zh_CN</language>
        <protected>false</protected>
        <shortDescription>查看周报活动</shortDescription>
        <value>00O0l000000zo9aEAA</value>
        <value>00O6D000000UPzZUAW</value>
    </labels>
    <labels>
        <fullName>invoiceStart</fullName>
force-app/main/default/lwc/boxorpieceType/boxorpieceType.html
@@ -1,11 +1,10 @@
<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,13 +4,7 @@
            <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">
@@ -18,16 +12,9 @@
                        </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,50 +1,44 @@
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,15 +1,5 @@
<template>
    <lightning-input
        step="0"
        type="number"
        name="count"
        label="出货数量"
        variant="label-hidden"
        onchange={outboundCountBlur}
        data-field="shipmentNumber"
        value={count}
        min="0"
        disabled={isDisable}
        style="min-width: 150px"
    ></lightning-input>
    <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,30 +1,29 @@
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,48 +1,23 @@
<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,55 +1,42 @@
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,11 +1,10 @@
<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,12 +1,9 @@
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,17 +1,6 @@
<template>
    <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>
    <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
@@ -11,20 +11,16 @@
    }
    shipmentNumberBlur(event) {
        debugger;
        console.log('shipmentNumberBlur');
        debugger
        console.log('shipmentNumberBlur')
        this.shipmentNumber = event.target.value;
        if (this.isConinvoice) {
            if (this.hasDecimals(this.shipmentNumber)) {
                this.showMyToast('错误', '请输入整数', 'Error');
                this.shipmentNumber = 0;
            } else {
                if (this.esdInvoiceProNotCount < this.shipmentNumber) {
                    this.showMyToast(
                        '错误',
                        '发票数量不能超过还没发票数量!',
                        'Error'
                    );
            }else{
                if(this.esdInvoiceProNotCount < this.shipmentNumber){
                    this.showMyToast('错误', '发票数量不能超过还没发票数量!', 'Error');
                    this.shipmentNumber = 0;
                }
            }
@@ -32,23 +28,18 @@
            //向下取整
            if (this.hasDecimals(this.shipmentNumber)) {
                this.showMyToast('错误', '请输入整数', 'Error');
                this.shipmentNumber = Math.floor(this.shipmentNumber);
                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
                    }
                }
            })
        );
        this.dispatchEvent(new CustomEvent('shipmentnumber', {
            composed: true,
            bubbles: true,
            cancelable: true,
            detail: {
                data: { shipmentnumber: this.shipmentNumber, recordId: this.recordId }
            }
        }));
    }
    hasDecimals(num) {
@@ -70,17 +61,10 @@
            iconName = 'utility:error';
        }
        if (message != '') {
            content =
                '<h2><strong>' +
                title +
                '<strong/></h2><h5>' +
                message +
                '</h5>';
            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/customShippingUnitPriceComp/customShippingUnitPriceComp.html
@@ -1,16 +1,5 @@
<template>
    <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>
    <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,41 +1,34 @@
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);
    }
    limitDecimals(event) {
        const value = parseFloat(event.target.value); // 将输入值转换为数字类型
        const roundedValue = Math.round(value * 100) / 100; // 将数字四舍五入到两位小数
        if (isNaN(value) || isNaN(roundedValue)) {
            // 如果数字无效,则清空输入框
        if (isNaN(value) || isNaN(roundedValue)) { // 如果数字无效,则清空输入框
            event.target.value = '';
        } else if (roundedValue !== value) {
            // 如果输入框的值超出了两位小数,则修改为两位小数
        } else if (roundedValue !== value) { // 如果输入框的值超出了两位小数,则修改为两位小数
            event.target.value = roundedValue.toFixed(2);
        }
    }
    shipmentUnitPriceBlur(event) {
        console.log('shipmentUnitPriceBlur');
    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,24 +6,22 @@
    @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,13 +1,8 @@
<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,13 +1,11 @@
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;
@@ -16,28 +14,20 @@
    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);
        console.log('reportUrl = ' + reportUrl);
        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.html
@@ -2,10 +2,7 @@
    <template if:true={showSpinner}>
        <!-- <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"
            >
            <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>
@@ -14,14 +11,8 @@
    </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">
@@ -30,175 +21,91 @@
                    </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,47 +26,33 @@
                    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';
@@ -80,5 +66,5 @@
        //     mode: mode
        // });
        // this.dispatchEvent(evt);
    }
     }
}
force-app/main/default/lwc/lexAgencyOppCusCell/lexAgencyOppCusCell.html
@@ -1,23 +1,12 @@
<template>
    <template if:true={isShowInputField}>
        <lightning-record-edit-form object-api-name="Agency_Opportunity__c">
            <lightning-input-field
                field-name={fieldName}
                variant="label-hidden"
                value={inputValue}
                onchange={inputChange}
            ></lightning-input-field>
            <lightning-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,31 +6,24 @@
    @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.css
@@ -1 +1 @@
@import "c/lexCssUtility";
@import 'c/lexCssUtility';
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.html
@@ -1,337 +1,201 @@
<template>
  <template if:true={showSpinner}>
    <lightning-spinner size="medium" variant="brand"></lightning-spinner>
  </template>
  <c-common-toast></c-common-toast>
  <template if:true={showPage}>
    <div
      style="
        border: 1px solid #d4d4d4;
        border-top: 3px solid #51606e;
        border-radius: 5px;
      "
    >
      <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
        <lightning-layout>
          <lightning-layout-item padding="around-small">
            <p style="font-size: 18px">
              <strong>入库/返品</strong>
            </p>
          </lightning-layout-item>
        </lightning-layout>
        <!-- <p style="font-size: 16px;"><strong>入库/返品</strong></p> -->
      </div>
      <div style="padding: 10px">
        <!-- 按钮 -->
        <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>
        </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>
        </template>
        <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">
              <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> -->
    <template if:true={showSpinner}>
        <!-- <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 style="padding: 10px">
              <table>
                <tbody>
                  <tr>
                    <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>
                    <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>
                    <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>
                    <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>
                    <td></td>
                  </tr>
                </tbody>
              </table>
            </div>
          </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">
            <lightning-layout>
              <lightning-layout-item padding="around-small">
                <p style="font-size: 18px">
                  <strong>BarCode录入</strong>
                </p>
              </lightning-layout-item>
            </lightning-layout>
            <!-- <p style="font-size: 16px;"><strong>BarCode录入</strong></p> -->
          </div>
          <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>
                  <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>
                  </td>
                  <td></td>
                </tr>
              </tbody>
            </table>
          </div>
        </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>
              <strong>&nbsp;&nbsp;&nbsp;警告</strong>
    </template>
    <c-common-toast></c-common-toast>
    <template if:true={showPage}>
        <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
            <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                <lightning-layout>
                    <lightning-layout-item padding="around-small">
                        <p style="font-size: 18px">
                            <strong>入库/返品</strong>
                        </p>
                    </lightning-layout-item>
                </lightning-layout>
                <!-- <p style="font-size: 16px;"><strong>入库/返品</strong></p> -->
            </div>
            <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>
            </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>
              <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>
            </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">
              <lightning-layout>
                <lightning-layout-item padding="around-small">
                  <p style="font-size: 18px">
                    <strong>本次到货产品汇总</strong>
                  </p>
                </lightning-layout-item>
              </lightning-layout>
              <!-- <p style="font-size: 16px;"><strong>本次到货产品汇总</strong></p> -->
            </div>
            <div style="padding: 10px">
              <lightning-datatable
                class="wrapped-header-datatable"
                hide-checkbox-column
                key-field="recordId"
                columns={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">
              <lightning-layout>
                <lightning-layout-item padding="around-small">
                  <p style="font-size: 18px">
                    <strong>入库和到货明细</strong>
                  </p>
                </lightning-layout-item>
              </lightning-layout>
            </div>
            <div style="padding: 10px">
              <lightning-datatable
                class="wrapped-header-datatable"
                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">
              <lightning-layout>
                <lightning-layout-item padding="around-small">
                  <p style="font-size: 18px">
                    <strong>入库和返品明细</strong>
                  </p>
                </lightning-layout-item>
              </lightning-layout>
            </div>
            <div style="padding: 10px">
              <c-lex-custom-lightning-datatable
                class="wrapped-header-datatable"
                hide-checkbox-column
                key-field="recordId"
                data={showGoodsofReturnListView}
                columns={returnDetailCols}
                onchangereturncount={returnCountChange}
                onchangevalue={returnReasonChange}
              ></c-lex-custom-lightning-datatable>
            </div>
          </div>
        </template>
        <!-- 入库明细 -->
        <!-- <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
            <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>
                </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>
                </template>
                <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;">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>订单信息</strong>
                                    </p>
                                </lightning-layout-item>
                            </lightning-layout>
                            <!-- <p style="font-size: 16px;"><strong>订单信息</strong></p> -->
                        </div>
                        <div style="padding:10px;">
                            <table>
                                <tbody>
                                    <tr>
                                        <td  style="width:10px;"></td>
                                        <td style="width:60px;">
                                            <div style="color:#696969;font-size:12px;">订单名称</div>
                                        </td>
                                        <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>
                                        <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>
                                        <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>
                                        <td style="width:100px;">
                                            <lightning-formatted-number value={coc.OrderNumber_notarrive__c}></lightning-formatted-number>
                                        </td>
                                        <td></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </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;">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
                                    <strong>BarCode录入</strong>
                                </p>
                            </lightning-layout-item>
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>BarCode录入</strong></p> -->
                    </div>
                    <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>
                                    <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>
                                    </td>
                                    <td></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </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>
                            <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>
                        </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>
                            <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>
                        </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;">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>本次到货产品汇总</strong>
                                    </p>
                                </lightning-layout-item>
                            </lightning-layout>
                            <!-- <p style="font-size: 16px;"><strong>本次到货产品汇总</strong></p> -->
                        </div>
                        <div style="padding:10px;">
                            <lightning-datatable class="wrapped-header-datatable" 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;">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>入库和到货明细</strong>
                                    </p>
                                </lightning-layout-item>
                            </lightning-layout>
                        </div>
                        <div style="padding:10px;">
                            <lightning-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;">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>入库和返品明细</strong>
                                    </p>
                                </lightning-layout-item>
                            </lightning-layout>
                        </div>
                        <div style="padding:10px;">
                            <c-lex-custom-lightning-datatable 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>
                <!-- 入库明细 -->
                <!-- <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">
@@ -345,36 +209,23 @@
                        <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="recordId" columns={inDetailCols} data={consumableInventory}></lightning-datatable>
                    </div>
                </div> -->
        <!-- 错误明细 -->
        <div
          style="
            border: 1px solid #d4d4d4;
            border-top: 3px solid #51606e;
            border-radius: 5px;
            margin-bottom: 7px;
          "
        >
          <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
            <lightning-layout>
              <lightning-layout-item padding="around-small">
                <p style="font-size: 18px">
                  <strong>错误明细</strong>
                </p>
              </lightning-layout-item>
            </lightning-layout>
            <!-- <p style="font-size: 16px;"><strong>错误明细</strong></p> -->
          </div>
          <div style="padding: 10px">
            <lightning-datatable
              class="wrapped-header-datatable"
              hide-checkbox-column
              key-field="recordId"
              columns={errorDetailCols}
              data={consumableorderdetailsRecordserror}
            ></lightning-datatable>
          </div>
                <!-- 错误明细 -->
                <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                    <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
                                    <strong>错误明细</strong>
                                </p>
                            </lightning-layout-item>
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>错误明细</strong></p> -->
                    </div>
                    <div style="padding:10px;">
                        <lightning-datatable class="wrapped-header-datatable" style="word-wrap:break-word; word-break:break-all;" hide-checkbox-column key-field="recordId" columns={errorDetailCols} data={consumableorderdetailsRecordserror}></lightning-datatable>
                    </div>
                </div>
            </div>
        </div>
      </div>
    </div>
  </template>
</template>
    </template>
</template>
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js
@@ -1,773 +1,482 @@
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/LexArriveGoodsController.init";
import searchProduct from "@salesforce/apex/LexArriveGoodsController.searchProduct";
import arriveGoodsConfim from "@salesforce/apex/LexArriveGoodsController.arriveGoodsConfim";
import updateGoodsOfReturn from "@salesforce/apex/LexArriveGoodsController.updateGoodsOfReturn";
//table css
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/LexArriveGoodsController.init';
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";
export default class LexArriveGoods extends NavigationMixin(LightningElement) {
  //页面变量
  @track arrType;
  @track eSetId;
  @track returnFLGbln = false;
  @track saveFLGbln = false;
  @track barcode;
  @track arrController;
  stylesLoaded = false;
  @track showSpinner = true;
  @track showPage = false;
  //消耗品订单
  @track coc;
  @track cocId;
  //本次到货产品汇总
  @track detailsSummary = [];
  //到货明细
  @track consumableorderdetailsRecords = [];
  @track consumableorderdetailsRecordsview = [];
  //返品明细
  @track showGoodsofReturnList = [];
  @track showGoodsofReturnListView = [];
  //入库明细
  @track consumableInventory = [];
  //错误明细
  @track consumableorderdetailsRecordserror = [];
  //报错提醒
  @track errorMsgs = [];
  @track warningMsgs = [];
  //是否一直显示提示
  @track isNoteStay = true;
    //页面变量
    @track arrType;
    @track eSetId;
    @track returnFLGbln = false;
    @track saveFLGbln = false;
    @track barcode;
    @track arrController;
    stylesLoaded = false;
    @track showSpinner = true;
    @track showPage = false;
    //消耗品订单
    @track coc;
    @track cocId;
    //本次到货产品汇总
    @track detailsSummary = [];
    //到货明细
    @track consumableorderdetailsRecords = [];
    @track consumableorderdetailsRecordsview = [];
    //返品明细
    @track showGoodsofReturnList = [];
    @track showGoodsofReturnListView = [];
    //入库明细
    @track consumableInventory = [];
    //错误明细
    @track consumableorderdetailsRecordserror = [];
    //报错提醒
    @track errorMsgs = [];
    @track warningMsgs = [];
    //是否一直显示提示
    @track isNoteStay = true;
  //是否有警告
  get hasWarning() {
    if (this.warningMsgs == null || this.warningMsgs.length == 0) {
      return false;
    //是否有警告
    get hasWarning(){
        if(this.warningMsgs == null || this.warningMsgs.length == 0){
            return false;
        }
        if(this.warningMsgs.length > 0){
            return true;
        }
    }
    if (this.warningMsgs.length > 0) {
      return true;
    }
  }
  //是否有错误
  get hasError() {
    if (this.errorMsgs == null || this.errorMsgs.length == 0) {
      return false;
    //是否有错误
    get hasError(){
        if(this.errorMsgs == null || this.errorMsgs.length == 0){
            return false;
        }
        if(this.errorMsgs.length > 0){
            return true;
        }
    }
    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" }
    //本次到货产品汇总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" }}
    ];
    //到货明细cols
    @track arrDetailCols = [
        {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(){
        var cols = [];
        cols.push({label:'出库单',fieldName:'orderUrl',type:'url',typeAttributes:{label:{fieldName:'orderNo'},target: "_blank"},hideDefaultActions: true,wrapText:true,initialWidth:180});
        // 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,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: {
                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
  @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
    //入库明细cols
    get inDetailCols(){
        var cols = [];
        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
  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",
      typeAttributes: {
        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: 100
    });
    // cols.push({label:'返品原因' , fieldName:'returnReason', hideDefaultActions: true});
    return cols;
  }
  //入库明细cols
  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
      });
    }
    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
    }
  ];
    //错误明细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}
    ];
  // 获取参数
  @wire(CurrentPageReference)
  getStateParameters(currentPageReference) {
    console.log("CurrentPageReference");
    if (currentPageReference) {
      this.arrType = currentPageReference.state?.ArrType;
      this.eSetId = currentPageReference.state?.ESetId;
    // 获取参数
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
        console.log('CurrentPageReference');
        if (currentPageReference) {
            this.arrType = currentPageReference.state?.ArrType;
            this.eSetId = currentPageReference.state?.ESetId;
        }
    }
  }
  get showOrderDetail() {
    if (this.eSetId != "" && this.eSetId != null) {
      return true;
    } else {
      return false;
    get showOrderDetail(){
        if(this.eSetId != '' && this.eSetId != null){
            return true;
        }else{
            return false;
        }
    }
  }
  renderedCallback() {
    if (!this.stylesLoaded) {
      Promise.all([loadStyle(this, WrappedHeaderTable)])
        .then(() => {
          console.log("Custom styles loaded");
          this.stylesLoaded = true;
    renderedCallback(){
        if (!this.stylesLoaded) {
            Promise.all([loadStyle(this, WrappedHeaderTable)])
                .then(() => {
                    console.log("Custom styles loaded");
                    this.stylesLoaded = true;
                })
                .catch((error) => {
                    console.error("Error loading custom styles");
                });
        }
    }
    //初始化
    connectedCallback(){
        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) => {
          console.error("Error loading custom styles");
        });
        .catch(error=>{
            this.showSpinner = false;
            this.showPage = true;
            console.log("error:"+JSON.stringify(error));
            this.showMyToast('初始化页面失败',JSON.stringify(error),'error');
        })
    }
  }
  //初始化
  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;
        console.log("error:" + JSON.stringify(error));
        this.showMyToast("初始化页面失败", JSON.stringify(error), "error");
      });
  }
  //barcode change
  barcodeChange(event) {
    this.barcode = event.detail.value;
  }
  //根据barcode搜索
  barcodeEntrys() {
    this.showSpinner = true;
    searchProduct({
      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;
              }
              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;
            }
            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;
          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");
      });
  }
  //返品数量change
  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) {
          this.showGoodsofReturnList[i].esd.Rrturn_count__c = 1;
          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;
        }
      }
    //barcode change
    barcodeChange(event){
        this.barcode = event.detail.value;
    }
  }
  //返品原因change
  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) {
        this.showGoodsofReturnList[i].esd.Return_reason__c = value;
        this.showGoodsofReturnList[i]["returnReason"] =
          this.showGoodsofReturnList[i].esd.Return_reason__c;
      }
    }
  }
  // 到货确认
  arriveGoodsConfim() {
    this.showSpinner = true;
    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
    //根据barcode搜索
    barcodeEntrys(){
        this.showSpinner = true;
        searchProduct({
            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){
                    this.consumableorderdetailsRecords[i]['dataType'] = 'DataileRecords';
                    consumableorderdetailsRecordsview.push(this.consumableorderdetailsRecords[i]);
                }
                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;
                    }
                    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');
            }
          };
          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");
      });
  }
        })
        .catch(error=>{
            this.showSpinner = false;
            console.log("error:"+error);
            this.showMyToast('获取失败',error,'error');
        })
    }
  // 登录返品
  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
    //返品数量change
    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){
                    this.showGoodsofReturnList[i].esd.Rrturn_count__c = 1;
                    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[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:" + 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";
    //返品原因change
    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){
                this.showGoodsofReturnList[i].esd.Return_reason__c = value;
                this.showGoodsofReturnList[i]['returnReason'] = this.showGoodsofReturnList[i].esd.Return_reason__c;
            }
        }
    }
    if (message != "") {
      content =
        "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>";
    } else {
      content = "<h2><strong>" + title + "<strong/></h2>";
    // 到货确认
    arriveGoodsConfim(){
        this.showSpinner = true;
        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;
            console.log("error2:"+error);
            this.showMyToast('到货确认失败',error,'error');
        })
    }
    this.template
      .querySelector("c-common-toast")
      .showToast(variant, content, iconName, 10000);
    // var mode;
    // if(this.isNoteStay){
    //     mode ='sticky';
    // }else{
    //     mode = 'dismissable';
    // }
    // const evt = new ShowToastEvent({
    //     title: title,
    //     message: message,
    //     variant: variant,
    //     mode: mode
    // });
    // this.dispatchEvent(evt);
  }
}
    // 登录返品
    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 {
                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(message != ''){
           content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
        }else{
           content = '<h2><strong>'+title+'<strong/></h2>';
        }
        this.template.querySelector('c-common-toast').
        showToast(variant,content,iconName,10000);
        // var mode;
        // if(this.isNoteStay){
        //     mode ='sticky';
        // }else{
        //     mode = 'dismissable';
        // }
        // const evt = new ShowToastEvent({
        //     title: title,
        //     message: message,
        //     variant: variant,
        //     mode: mode
        // });
        // this.dispatchEvent(evt);
     }
}
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js-meta.xml
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>56.0</apiVersion>
    <isExposed>true</isExposed>
@@ -6,4 +6,4 @@
        <target>lightningCommunity__Page</target>
        <target>lightningCommunity__Default</target>
    </targets>
</LightningComponentBundle>
</LightningComponentBundle>
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html
@@ -2,10 +2,7 @@
    <template if:true={showSpinner}>
        <!-- <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"
            >
            <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>
@@ -14,44 +11,17 @@
    </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">
@@ -61,77 +31,30 @@
                        </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>
@@ -139,15 +62,8 @@
                    </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">
@@ -157,16 +73,9 @@
                        </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>
@@ -174,65 +83,24 @@
    </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,13 +13,11 @@
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;
@@ -50,107 +48,62 @@
        // {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,
            wrapText: true
        },
        {
            label: 'SAP合同号',
            fieldName: 'ContractNo__c',
            hideDefaultActions: true,
            wrapText: true,
            initialWidth: 180
        },
        {
            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,
            cellAttributes: { alignment: 'right' }
        },
        {
            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,
            cellAttributes: { alignment: 'right' }
        },
        {
            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,
            cellAttributes: { alignment: 'right' }
        },
        {
            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,
            cellAttributes: { alignment: 'right' }
        },
        {
            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,
            cellAttributes: { alignment: 'right' }
        },
        {
            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}
    ];
    //获取参数
@@ -162,329 +115,270 @@
    //     }
    // }
    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);
@@ -494,24 +388,18 @@
        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';
@@ -525,5 +413,5 @@
        //     mode: mode
        // });
        // this.dispatchEvent(evt);
    }
     }
}
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.html
@@ -2,10 +2,7 @@
    <template if:true={showSpinner}>
        <!-- <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"
            >
            <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>
@@ -14,14 +11,8 @@
    </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">
@@ -31,29 +22,14 @@
                </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">
@@ -63,77 +39,34 @@
                        </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">
                                        <a
                                            style="
                                                text-decoration: underline;
                                                color: black;
                                            "
                                            onclick={clickOrder}
                                            ><lightning-formatted-text
                                                style="font-size: 16px"
                                                value={coc.arriveOrder}
                                            ></lightning-formatted-text
                                        ></a>
                                    <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>
@@ -143,15 +76,8 @@
                    </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">
@@ -161,15 +87,8 @@
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>在库商品库存一览</strong></p> -->
                    </div>
                    <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 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,17 +1,16 @@
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;
@@ -25,67 +24,16 @@
    //是否一直显示提示
    @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,
            wrapText: true
        },
        {
            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)
@@ -93,145 +41,107 @@
        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;
                            }
                            // this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].prodName;
                            this.consumableorderdetailsRecords[i]['barCode'] =
                                this.consumableorderdetailsRecords[
                                    i
                                ].esd.Bar_Code__c;
                            this.consumableorderdetailsRecords[i][
                                'intraTradeList'
                            ] =
                                this.consumableorderdetailsRecords[
                                    i
                                ].esd.Intra_Trade_List_RMB__c;
                            console.log(
                                'Intra_Trade_List_RMB__c:' +
                                    this.consumableorderdetailsRecords[i].esd
                                        .Intra_Trade_List_RMB__c
                            );
                        }
                        if (
                            this.consumableorderdetailsRecords[i].Prod != null
                        ) {
                            this.consumableorderdetailsRecords[i][
                                'statusCFDA'
                            ] =
                                this.consumableorderdetailsRecords[
                                    i
                                ].Prod.SFDA_Status__c;
                        }
                    }
                    this.showSpinner = false;
                } else {
                    this.showSpinner = false;
                    console.log('error:' + result.errorMsg);
                    this.showMyToast('初始化失败', result.errorMsg, 'error');
    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;
                }
            })
            .catch((error) => {
                console.log('this.coc:'+JSON.stringify(this.coc));
                this.accountid = result.accountid;
                this.orderallcount = result.orderallcount;
                this.arrivetoorder = result.arrivetoorder;
                this.consumableorderdetailsCount = result.consumableorderdetailsCount;
                this.consumableorderdetailsRecords = result.consumableorderdetailsRecords;
                for(var i in this.consumableorderdetailsRecords){
                    if(this.consumableorderdetailsRecords[i].esd != null){
                        this.consumableorderdetailsRecords[i]['recordId'] = this.consumableorderdetailsRecords[i].esd.Id;
                        if(this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != null && this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != ''){
                            this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].esd.Consumable_Product__r.Name__c;
                        }
                        // this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].prodName;
                        this.consumableorderdetailsRecords[i]['barCode'] = this.consumableorderdetailsRecords[i].esd.Bar_Code__c;
                        this.consumableorderdetailsRecords[i]['intraTradeList'] = this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c;
                        console.log("Intra_Trade_List_RMB__c:"+this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c);
                    }
                    if(this.consumableorderdetailsRecords[i].Prod != null){
                        this.consumableorderdetailsRecords[i]['statusCFDA'] = this.consumableorderdetailsRecords[i].Prod.SFDA_Status__c;
                    }
                }
                this.showSpinner = false;
                this.showPage = true;
                console.log('error:' + error);
                this.showMyToast('初始化失败', error, 'error');
            });
            }else {
                this.showSpinner = false;
                console.log("error:"+result.errorMsg);
                this.showMyToast('初始化失败',result.errorMsg,'error');
            }
        })
        .catch(error=>{
            this.showSpinner = false;
            this.showPage = true;
            console.log("error:"+error);
            this.showMyToast('初始化失败',error,'error');
        })
    }
    proSale() {
    proSale(){
        this.showSpinner = true;
        proSale({
            cocStr: JSON.stringify(this.coc),
            orderallcountParm: this.orderallcount,
            consumableorderdetailsCountParm: this.consumableorderdetailsCount,
            eSetIdStr: this.eSetId
            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 {
                    this.showSpinner = false;
                    console.log('error:' + result.errorMsg);
                    this.showMyToast('出库失败', result.errorMsg, 'error');
                }
            })
            .catch((error) => {
                this.showPage = true;
        .then(result=>{
            if(result.result == 'Success'){
                var url = result.url;
                const config = {
                    type: 'standard__webPage',
                    attributes: {
                       url: url
                    }
                };
                this[NavigationMixin.Navigate](config);
            }else {
                this.showSpinner = false;
                console.log('error:' + error);
                this.showMyToast('出库失败', error, 'error');
            });
                console.log("error:"+result.errorMsg);
                this.showMyToast('出库失败',result.errorMsg,'error');
            }
        })
        .catch(error=>{
            this.showPage = true;
            this.showSpinner = false;
            console.log("error:"+error);
            this.showMyToast('出库失败',error,'error');
        })
    }
    clickOrder() {
        if (
            this.coc.Arrive_Order__c != null &&
            this.coc.Arrive_Order__c != ''
        ) {
    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
                   url: '/detail/'+this.coc.Arrive_Order__c
                }
            };
            this[NavigationMixin.Navigate](config);
@@ -242,24 +152,18 @@
        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';
@@ -273,5 +177,5 @@
        //     mode: mode
        // });
        // this.dispatchEvent(evt);
    }
     }
}
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html
@@ -1,227 +1,138 @@
<template>
    <template if:true={showSpinner}>
        <!-- <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>
                <!-- <p style="font-size: 18px;"><strong>取消拆盒</strong></p> -->
                <lightning-layout>
                    <lightning-layout-item padding="around-small">
                        <p style="font-size: 18px">
                            <strong>取消拆盒</strong>
                        </p>
                    </lightning-layout-item>
                </lightning-layout>
            </div>
        </div>
        <div style="padding: 10px">
            <div
                style="
                    border: 1px solid #d4d4d4;
                    border-radius: 5px;
                    margin-bottom: 7px;
                "
            >
                <div
                    style="
                        border-top: 3px solid #51606e;
                        border-bottom: 1px solid #d4d4d4;
                        padding: 3px;
                    "
                >
                    <!-- <lightning-button variant="brand" class='lexstyle' style="margin-left:10px;" label="取消拆盒确认" title="取消拆盒确认" onclick={saveConfirm}></lightning-button></td> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="
                            margin-left: 10px;
                            margin-top: 12px;
                            margin-bottom: 12px;
                        "
                        label="取消拆盒确认"
                        onclick={saveConfirm}
                    >
                        取消拆盒确认
                    </button>
                </div>
            </div>
            <div
                style="
                    border: 1px solid #d4d4d4;
                    border-radius: 5px;
                    margin-bottom: 7px;
                    margin-top: 5px;
                "
            >
                <div
                    style="
                        border-top: 3px solid #51606e;
                        border-bottom: 1px solid #d4d4d4;
                        padding: 3px;
                    "
                >
                    <lightning-layout>
                        <lightning-layout-item padding="around-small">
                            <p style="font-size: 16px">
                                <strong>BarCode录入</strong>
                            </p>
                        </lightning-layout-item>
                    </lightning-layout>
                </div>
  <template if:true={showSpinner}>
      <!-- <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;"> -->
                <table>
                    <colgroup>
                        <col width="160px" />
                        <col width="100px" />
                        <col width="10px" />
                        <col width="70px" />
                        <col width="100px" />
                        <col width="10px" />
                        <col width="90px" />
                        <col width="100px" />
                        <col width="10px" />
                        <col width="85px" />
                        <col width="100px" />
                        <col width="10px" />
                        <col width="70px" />
                        <col width="100px" />
                    </colgroup>
                    <tbody>
                        <tr>
                            <td></td>
                            <td align="right" class="searchName">BarCode</td>
                            <td style="width: 600px">
                                <lightning-textarea
                                    class="inputFont"
                                    name="BarCode"
                                    label=""
                                    onchange={handleChange}
                                ></lightning-textarea>
                            </td>
                            <td align="right"></td>
                            <td></td>
                            <td style="width: 200px">
                                <button
                                    style="margin-top: 14px"
                                    class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                    label="获取明细"
                                    onclick={getDetails}
                                >
                                    获取明细
                                </button>
                                <!-- <lightning-button variant="brand" class='lexstyle' label="获取明细" title="获取明细" onclick={getDetails}
                                       ></lightning-button> -->
                            </td>
                        </tr>
                    </tbody>
                </table>
                <!-- </div> -->
            </div>
      <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;">
          <div>
              <!-- <p style="font-size: 18px;"><strong>取消拆盒</strong></p> -->
              <lightning-layout>
                  <lightning-layout-item padding="around-small">
                      <p style="font-size: 18px">
                          <strong>取消拆盒</strong>
                      </p>
                  </lightning-layout-item>
              </lightning-layout>
          </div>
      </div>
      <div style="padding:10px;">
          <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
          <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
              <!-- <lightning-button variant="brand" class='lexstyle' style="margin-left:10px;" label="取消拆盒确认" title="取消拆盒确认" onclick={saveConfirm}></lightning-button></td> -->
              <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin-left:10px;margin-top:12px;margin-bottom:12px;" label="取消拆盒确认" onclick={saveConfirm}>取消拆盒确认</button>
          </div>
          </div>
          <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:5px;">
              <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
                  <lightning-layout>
                      <lightning-layout-item padding="around-small">
                          <p style="font-size: 16px">
                              <strong>BarCode录入</strong>
                          </p>
                      </lightning-layout-item>
                  </lightning-layout>
              </div>
              <!-- <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> -->
                  <table>
                      <colgroup>
                          <col width="160px" />
                          <col width="100px" />
                          <col width="10px" />
                          <col width="70px" />
                          <col width="100px" />
                          <col width="10px" />
                          <col width="90px" />
                          <col width="100px" />
                          <col width="10px" />
                          <col width="85px" />
                          <col width="100px" />
                          <col width="10px" />
                          <col width="70px" />
                          <col width="100px" />
                      </colgroup>
                      <tbody>
                          <tr>
                              <td></td>
                              <td align="right" class="searchName">BarCode</td>
                              <td style="width:600px"><lightning-textarea class="inputFont" name="BarCode" label=""
                                      onchange={handleChange}></lightning-textarea></td>
                              <td align="right"></td>
                              <td></td>
                              <td  style="width: 200px;">
                                  <button style="margin-top:14px;"  class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="获取明细" onclick={getDetails}>获取明细</button>
                                  <!-- <lightning-button variant="brand" class='lexstyle' label="获取明细" title="获取明细" onclick={getDetails}
                                     ></lightning-button> -->
                              </td>
                          </tr>
                      </tbody>
                  </table>
              <!-- </div> -->
          </div>
            <div
                style="
                    border: 1px solid #d4d4d4;
                    border-radius: 5px;
                    margin-bottom: 7px;
                "
            >
                <div
                    style="
                        border-top: 3px solid #51606e;
                        border-bottom: 1px solid #d4d4d4;
                        padding: 3px;
                    "
                >
                    <lightning-layout>
                        <lightning-layout-item padding="around-small">
                            <p style="font-size: 18px">
                                <strong>取消拆盒明细</strong>
                            </p>
                        </lightning-layout-item>
                    </lightning-layout>
                </div>
                <div style="padding: 10px">
                    <!-- <div style="height: 300px;"> -->
                    <!-- <template if:true={showTable}> -->
                    <c-lex-custom-lightning-datatable
                        key-field="prodid"
                        data={data}
                        columns={columns}
                        onrowselection={getSelectedRows}
                        hide-checkbox-column="true"
                        selected-rows={selectedRows}
                        class="wrapped-header-datatable"
                        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;
                    "
                >
                    <table>
                        <tr>
                            <td>
                                <lightning-layout>
                                    <lightning-layout-item
                                        padding="around-small"
                                    >
                                        <p style="font-size: 18px">
                                            <strong>错误明细</strong>
                                        </p>
                                    </lightning-layout-item>
                                </lightning-layout>
                            </td>
                        </tr>
                    </table>
                </div>
          <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
              <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;">
                  <lightning-layout>
                      <lightning-layout-item padding="around-small">
                          <p style="font-size: 18px">
                              <strong>取消拆盒明细</strong>
                          </p>
                      </lightning-layout-item>
                  </lightning-layout>
              </div>
              <div style="padding:10px;">
                <div style="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 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" 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;">
                  <table>
                      <tr>
                          <td>
                              <lightning-layout>
                                  <lightning-layout-item padding="around-small">
                                      <p style="font-size: 18px">
                                          <strong>错误明细</strong>
                                      </p>
                                  </lightning-layout-item>
                              </lightning-layout>
                          </td>
                      </tr>
                  </table>
              </div>
          <div style="padding:10px;">
              <lightning-datatable
              key-field="id" data={errorDetail} columns={column}
              onrowselection={getSelectedRows}   hide-checkbox-column="true"
             selected-rows={selectedRows}  class="wrapped-header-datatable" style="word-wrap:break-word; word-break:break-all; ">
      </lightning-datatable>
          </div>
      </div>
      </div>
  </div>
</template>
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js
@@ -1,76 +1,84 @@
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: 100,
        wrapText: true
      label: 'CFDA状态',
      fieldName: 'CFDA_Status__c',
      hideDefaultActions: true,
      initialWidth: 100,
      wrapText:true
    },
    {
        label: '注册证编码号',
        fieldName: 'Report_Product_Approbation__c',
        hideDefaultActions: true,
        initialWidth: 200,
        wrapText: true
      label: '注册证编码号',
      fieldName: 'Report_Product_Approbation__c',
      hideDefaultActions: true,
      initialWidth: 200,
      wrapText:true
    },
    {
        label: '注册证效期',
        fieldName: 'Report_Product_Expiration__c',
        hideDefaultActions: true,
        initialWidth: 110,
        wrapText: true
      label: '注册证效期',
      fieldName: 'Report_Product_Expiration__c',
      hideDefaultActions: true,
      initialWidth: 110,
      wrapText:true
    },
    {
        label: 'BarCode',
        fieldName: 'Bar_Code__c',
        hideDefaultActions: true,
        wrapText: true
      label: 'BarCode',
      fieldName: 'Bar_Code__c',
      hideDefaultActions: true,
      wrapText:true
    }
];
  ];
  const column = [
    {
      label: '消耗品名称',
      fieldName: 'Name__c',
      hideDefaultActions: true,
      wrapText:true
    },
    {
      label: 'BarCode',
      fieldName: 'Bar_Code__c',
      wrapText:true,
      hideDefaultActions: true,
      // initialWidth:600
const column = [
    {
        label: '消耗品名称',
        fieldName: 'Name__c',
        hideDefaultActions: true,
        wrapText: 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;
@@ -78,175 +86,164 @@
    @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));
            });
    }
    //获取当前输入值
    handleChange(event) {
        let value = event.detail.value;
        console.log('value' + value);
        this.barcode = value;
        console.log('this.barcode' + this.barcode);
    }
  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));
    });
    saveConfirm() {
        let msg = '确认取消拆盒吗';
        if (this.dataSize > 0) {
            if (confirm(msg) == true) {
                this.CancelRemoveBox();
            }
        } else {
  }
   //获取当前输入值
   handleChange(event) {
    let value = event.detail.value;
    console.log('value' + value);
    this.barcode = value;
    console.log('this.barcode' + this.barcode);
  }
  saveConfirm() {
    let msg = "确认取消拆盒吗";
    if (this.dataSize>0) {
        if (confirm(msg) == true) {
            this.CancelRemoveBox();
        }
    } else {
        this.CancelRemoveBox();
    }
    CancelRemoveBox() {
        this.showSpinner = true;
        saveConfirm({
            saveConsumableorderdetailsRecordsdummy: JSON.stringify(this.data),
            accountName: this.accountName,
            userWorkLocation: this.userWorkLocation,
            agencyProType: this.agencyProType
        })
            .then((result) => {
                result = JSON.parse(JSON.stringify(result));
                console.log('result保存 = ' + JSON.stringify(result));
                if (result.status == 'Success') {
                    this.saveFLGbln = result.entity.saveFLGbln;
                    //  this.showSpinner = false;
                    if (this.saveFLGbln) {
                        this.showMyToast(result.msg, '', 'success');
                        this.showSpinner = false;
                    }
                } else {
                    this.showMyToast('取消拆盒失败', result.msg, 'error');
                    this.showSpinner = false;
                }
            })
            .catch((error) => {
                console.log('error = ' + JSON.stringify(error));
            });
  }
    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';
    }
    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);
    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/lexConInvoiceView/lexConInvoiceView.html
@@ -3,122 +3,55 @@
<template>
    <c-common-toast></c-common-toast>
    <template if:true={isShowSpinner}>
        <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 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}>
                <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"
                >
                <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true"
                    aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_medium"
                    style="border: 1px solid #D4D4D4;">
                    <div class="slds-modal__container">
                        <header
                            class="slds-modal__header"
                            style="background-color: #f3f3f3"
                        >
                            <button
                                style=""
                                class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                                title="Close"
                                onclick={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>
                            <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">经销商医院检索</h2>
                        </header>
                        <div
                            class="slds-modal__content slds-p-around_medium"
                            id="modal-content-id-1"
                            style="border: 1px solid #f3f3f3"
                        >
                            <table style="width: 100%">
                        <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 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>
                                        <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 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;
                                    "
                                >
                                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"
                                        >
                                        <lightning-layout-item padding="around-small">
                                            <p style="font-size: 18px">
                                                <strong>搜索结果</strong>
                                            </p>
@@ -126,199 +59,109 @@
                                    </lightning-layout>
                                    <!-- <p style="font-size: 16px;"><strong>搜索结果</strong></p> -->
                                </div>
                                <div class="myTable" style="padding: 10px">
                                <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 class="datatabel slds-border_top wrapped-header-datatable"
                                        key-field="id" data={hospitalList} columns={hospitalColumns} hide-checkbox-column="true"
                                        onrowaction={searchHandleRowAction}>
                                    </lightning-datatable>
                                </div>
                            </div>
                        </div>
                        <footer class="slds-modal__footer">
                            <button
                                class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                                label="取消"
                                onclick={closeModal}
                            >
                                取消
                            </button>
                            <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" label="取消"
                                onclick={closeModal}>取消</button>
                        </footer>
                    </div>
                </section>
                <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 multiple-rows="true">
                                        <lightning-layout-item
                                            size="2"
                                        ></lightning-layout-item>
                                        <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>
                                                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>
                                                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>
                                                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>
                                                onclick={reopenJs} disabled={isDisabledReopen}
                                                style="width: 150px;">作废重开</button>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                    <lightning-layout
                                        multiple-rows="true"
                                        style="margin-top: 20px"
                                    >
                                        <lightning-layout-item
                                            size="2"
                                        ></lightning-layout-item>
                                    <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>
                                                onclick={deleteButtonJs} disabled={isDisabledDelete}
                                                style="width: 150px;">删除</button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                disabled={isDisabledReopen}
                                                onclick={uploadOrder}
                                                style="width: 150px"
                                            >
                                                上传附件
                                            </button>
                                                disabled={isDisabledReopen} onclick={uploadOrder}
                                                style="width: 150px;">上传附件</button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                onclick={saveAttachmentJs}
                                                disabled={isDisabledReopen}
                                                style="width: 150px"
                                            >
                                                保存附件
                                            </button>
                                                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
                                                            class="fileUpload"
                                                            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>
@@ -328,49 +171,24 @@
                                                    label="取消" onclick={closePop}></lightning-button>
                                                <lightning-button style="margin-left: 10px;" variant="neutral"
                                                    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>
                                                <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>
@@ -407,6 +225,7 @@
                                    </template>
                                </lightning-layout> -->
                            </div>
                        </div>
                    </div>
@@ -421,180 +240,103 @@
                                </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="5"
                                            >
                                                <lightning-output-field
                                                    field-name="Name"
                                                ></lightning-output-field>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <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-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-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="5"
                                            >
                                            <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="5"
                                                >
                                            <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="5"
                                            >
                                                <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="5"
                                            >
                                            <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="5"
                                                class="readOnly"
                                                style="padding-left: 100px"
                                            >
                                                <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-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="5"
                                            >
                                            <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="5"
                                            >
                                            <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
                                                class="hehe-layoutItem"
                                                size="5"
                                                style="padding-left: 100px"
                                            >
                                            <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-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 附件预览 -->
@@ -602,68 +344,30 @@
                                            <lightning-layout-item size="1">
                                            </lightning-layout-item>
                                            <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"
                                                <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 />
                                                                <div
                                                                    title={item.Title}
                                                                    style="
                                                                        width: 100px;
                                                                        text-overflow: ellipsis;
                                                                        overflow: hidden;
                                                                        white-space: nowrap;
                                                                    "
                                                                >
                                                                    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.Id}
                                                                        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>
@@ -678,177 +382,95 @@
                                </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="5"
                                            >
                                                <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
                                                class="hehe-layoutItem"
                                                size="5"
                                                style="padding-left: 100px"
                                            >
                                            <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-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="5"
                                            >
                                                <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="5"
                                            >
                                            <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
                                                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 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-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="5"
                                            >
                                                <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
                                                class="hehe-layoutItem"
                                                size="5"
                                                style="padding-left: 100px"
                                            >
                                            <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-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="5"
                                            >
                                                <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>
@@ -857,31 +479,25 @@
                    <!-- 出库单一览 -->
                    <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>
                                            onclick={InvoiceorderSearchJs}>检索</button>
                                    </lightning-layout-item>
                                </template>
                            </lightning-layout>
                        </div>
@@ -904,25 +520,13 @@
                        <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>
@@ -932,9 +536,7 @@
                        <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>
@@ -944,13 +546,9 @@
                            <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>
@@ -1007,25 +605,21 @@
        <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">
@@ -1038,150 +632,77 @@
                        <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"
                                                    style="max-width: 150px"
                                                ></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"
                                                    style="max-width: 150px"
                                                ></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"
                                                style="max-width: 150px"
                                            ></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"
                                                style="max-width: 150px"
                                            ></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;
                                                    max-width: 200px;
                                                "
                                                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"
                                        >
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                                onclick={invoiceCodeSearchJs}
                                                style="max-width: 110px"
                                            >
                                                检索
                                            </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"
                                        >
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                                                onclick={ClearJs}
                                                style="max-width: 110px"
                                            >
                                                清空
                                            </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">
@@ -1194,13 +715,8 @@
                        <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>
@@ -1212,25 +728,21 @@
    <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">
@@ -1243,43 +755,26 @@
                    <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="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>
                                <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 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="1"></lightning-layout-item>
                                    <lightning-layout-item 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>
                            </lightning-record-edit-form>
@@ -1288,7 +783,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">
@@ -1301,28 +796,17 @@
                    <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="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>
                                <lightning-layout multiple-rows="true">
                                    <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="Outbound_Date__c"
                                        ></lightning-output-field>
                                        <lightning-output-field field-name="Outbound_Date__c"></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                            </lightning-record-edit-form>
@@ -1331,7 +815,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">
@@ -1347,30 +831,15 @@
                            <!-- <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"
                                min-column-width="115"
                            >
                            <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>
@@ -1378,4 +847,5 @@
            </div>
        </div>
    </template>
</template>
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
@@ -1,291 +1,290 @@
import { LightningElement, api, track, wire } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init from '@salesforce/apex/LexConInvoiceViewController.init';
import save from '@salesforce/apex/LexConInvoiceViewController.save';
import saveFile from '@salesforce/apex/LexConInvoiceViewController.saveFile';
import saveAttachment from '@salesforce/apex/LexConInvoiceViewController.saveAttachment';
import InvoiceorderSearch from '@salesforce/apex/LexConInvoiceViewController.InvoiceorderSearch';
import deleteButton from '@salesforce/apex/LexConInvoiceViewController.deleteButton';
import approval from '@salesforce/apex/LexConInvoiceViewController.approval';
import conInvoiceListInit from '@salesforce/apex/LexConInvoiceList.init';
import invoiceCodeSearch from '@salesforce/apex/LexConInvoiceList.invoiceCodeSearch';
import hospitalInit from '@salesforce/apex/lexSearchAgencyHospitalController.init';
import serContact from '@salesforce/apex/lexSearchAgencyHospitalController.serContact';
import detailsInit from '@salesforce/apex/LexConInvoicedetailsController.init';
import detailsSave from '@salesforce/apex/LexConInvoicedetailsController.save';
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import init from "@salesforce/apex/LexConInvoiceViewController.init";
import save from "@salesforce/apex/LexConInvoiceViewController.save";
import saveFile from "@salesforce/apex/LexConInvoiceViewController.saveFile";
import saveAttachment from "@salesforce/apex/LexConInvoiceViewController.saveAttachment";
import InvoiceorderSearch from "@salesforce/apex/LexConInvoiceViewController.InvoiceorderSearch";
import deleteButton from "@salesforce/apex/LexConInvoiceViewController.deleteButton";
import approval from "@salesforce/apex/LexConInvoiceViewController.approval";
import conInvoiceListInit from "@salesforce/apex/LexConInvoiceList.init";
import invoiceCodeSearch from "@salesforce/apex/LexConInvoiceList.invoiceCodeSearch";
import hospitalInit from "@salesforce/apex/lexSearchAgencyHospitalController.init";
import serContact from "@salesforce/apex/lexSearchAgencyHospitalController.serContact";
import detailsInit from "@salesforce/apex/LexConInvoicedetailsController.init";
import detailsSave from "@salesforce/apex/LexConInvoicedetailsController.save";
import deleteAtt from '@salesforce/apex/LexSummonsCreatController.deleteAtt';
import { NavigationMixin } from 'lightning/navigation';
//table css
import { loadStyle } from 'lightning/platformResourceLoader';
import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
import { NavigationMixin } from "lightning/navigation";
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
import LexConInvoiceViewReport from '@salesforce/label/c.LexConInvoiceViewReport';
const hospitalColumns = [
    {
        label: '',
        fieldName: 'Id1',
        type: 'button',
        label: "",
        fieldName: "Id1",
        type: "button",
        initialWidth: 90,
        hideDefaultActions: true,
        typeAttributes: {
            label: '选择',
            name: 'Id2',
            size: 1
        }
            label: "选择",
            name: "Id2",
            size: 1,
        },
    },
    {
        label: '医院名称',
        fieldName: 'Name',
        label: "医院名称",
        fieldName: "Name",
        hideDefaultActions: true,
        wrapText: true
        wrapText: true,
    },
    {
        label: '省份',
        fieldName: 'stateMasterName',
        hideDefaultActions: true
        label: "省份",
        fieldName: "stateMasterName",
        hideDefaultActions: true,
    }
];
const invoiceDetailsColumns = [
    {
        label: '出库日期',
        fieldName: 'esdetProductOutDate',
        hideDefaultActions: true,
        wrapText: true
    },
    {
        label: '出库单编码',
        fieldName: 'esdetInvoicedet1ODlinkName',
        wrapText: true,
        hideDefaultActions: true,
        wrapText: true
    },
    {
        label: '产品型号',
        fieldName: 'esdetAssetModelNo',
        label: "出库日期",
        fieldName: "esdetProductOutDate",
        hideDefaultActions: true,
        wrapText: true,
        initialWidth: 400
    },
    {
        label: '单位',
        fieldName: 'esdetInvoiceUnit',
        label: "出库单编码",
        fieldName: "esdetInvoicedet1ODlinkName",
        wrapText: true,
        hideDefaultActions: true,
        wrapText: true,
        initialWidth: 50
    },
    {
        label: '发票单价',
        fieldName: 'esdetInvoiceUnitprice',
        label: "产品型号",
        fieldName: "esdetAssetModelNo",
        hideDefaultActions: true,
        wrapText: true,
        type: 'number',
        initialWidth: 400,
    },
    {
        label: "单位",
        fieldName: "esdetInvoiceUnit",
        hideDefaultActions: true,
        wrapText: true,
        initialWidth: 50,
    },
    {
        label: "发票单价",
        fieldName: "esdetInvoiceUnitprice",
        hideDefaultActions: true,
        wrapText: true,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2
        }
            minimumFractionDigits: 2,
        },
    },
    {
        label: '发票数量',
        fieldName: 'esdetInvoicedCount',
        label: "发票数量",
        fieldName: "esdetInvoicedCount",
        cellAttributes: { alignment: 'right' },
        hideDefaultActions: true,
        wrapText: true
        wrapText: true,
    },
    {
        label: '发票票面金额(元)',
        fieldName: 'esdetInvoicedProCostRMB',
        label: "发票票面金额(元)",
        fieldName: "esdetInvoicedProCostRMB",
        hideDefaultActions: true,
        wrapText: true,
        cellAttributes: { alignment: 'right' },
        initialWidth: 145,
        type: 'number',
        initialWidth:145,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2
        }
    }
            minimumFractionDigits: 2,
        },
    },
];
const invoiceColumns = [
    {
        label: '发票日期',
        fieldName: 'Invoice_Date__c',
        label: "发票日期",
        fieldName: "Invoice_Date__c",
        hideDefaultActions: true,
        initialWidth: 150
    },
    {
        label: '发票号',
        label: "发票号",
        type: 'url',
        fieldName: 'NameUrl',
        fieldName: "NameUrl",
        typeAttributes: {
            label: { fieldName: 'Name' }
            label: { fieldName: "Name" },
        },
        hideDefaultActions: true
    },
    {
        label: '客户名',
        fieldName: 'ShipmentAccount__c',
        hideDefaultActions: true,
        wrapText: true
    },
    {
        label: '发票状态',
        fieldName: 'Invoice_status__c',
        label: "客户名",
        fieldName: "ShipmentAccount__c",
        hideDefaultActions: true,
        wrapText: true,
    },
    {
        label: "发票状态",
        fieldName: "Invoice_status__c",
        hideDefaultActions: true,
        initialWidth: 100
    },
    {
        label: '发票账面金额(元)',
        fieldName: 'Invoice_total_amount__c',
        label: "发票账面金额(元)",
        fieldName: "Invoice_total_amount__c",
        hideDefaultActions: true,
        type: 'number',
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2
            minimumFractionDigits: 2,
        },
        initialWidth: 180
    },
    {
        label: '发票附件',
        fieldName: 'Invoice_attachment__c',
        label: "发票附件",
        fieldName: "Invoice_attachment__c",
        type: 'boolean',
        hideDefaultActions: true,
        initialWidth: 120
    },
    {
        label: '发票明细附件',
        fieldName: 'Invoicedet_attachment__c',
        label: "发票明细附件",
        fieldName: "Invoicedet_attachment__c",
        type: 'boolean',
        hideDefaultActions: true,
        initialWidth: 120
    }
    },
];
const detailsColumns = [
    {
        label: '产品型号',
        fieldName: 'esdAssetModelNo',
        label: "产品型号",
        fieldName: "esdAssetModelNo",
        hideDefaultActions: true,
        initialWidth: 200,
        wrapText: true
        wrapText: true,
    },
    {
        label: '规格',
        fieldName: 'packingListManual',
        label: "规格",
        fieldName: "packingListManual",
        hideDefaultActions: true,
        initialWidth: 30
    },
    {
        label: '出货单价(元)',
        fieldName: 'esdDeliveryListRMB',
        label: "出货单价(元)",
        fieldName: "esdDeliveryListRMB",
        hideDefaultActions: true,
        type: 'number',
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2
        }
            minimumFractionDigits: 2,
        },
    },
    {
        label: '出货数量',
        fieldName: 'esdShipmentCount',
        hideDefaultActions: true
    },
    {
        label: '返品数量',
        fieldName: 'esdRrturnProCount',
        hideDefaultActions: true
    },
    {
        label: '出库单位',
        fieldName: 'esdBoxPiece',
        hideDefaultActions: true
    },
    {
        label: '已发票数量',
        fieldName: 'esdInvoicedProcount',
        label: "出货数量",
        fieldName: "esdShipmentCount",
        hideDefaultActions: true,
        type: 'number',
        typeAttributes: {
            minimumFractionDigits: 2
        }
    },
    {
        label: '还没发票数量',
        fieldName: 'esdInvoiceProNotCount',
        label: "返品数量",
        fieldName: "esdRrturnProCount",
        hideDefaultActions: true,
        type: 'number',
        typeAttributes: {
            minimumFractionDigits: 2
        }
    },
    {
        label: '开票单位',
        label: "出库单位",
        fieldName: "esdBoxPiece",
        hideDefaultActions: true,
        type: 'customUnit',
        typeAttributes: {
            unitValue: { fieldName: 'unitValue' },
            unitOptions: { fieldName: 'unitOptions' },
            recordId: { fieldName: 'recordId' },
            isDisabled: { fieldName: 'isDisabled' }
        }
    },
    {
        label: '发票单价',
        fieldName: 'esdInvoiceUnitprice',
        label: "已发票数量",
        fieldName: "esdInvoicedProcount",
        hideDefaultActions: true,
        type: 'number',
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2
            minimumFractionDigits: 2,
        },
    },
    {
        label: "还没发票数量",
        fieldName: "esdInvoiceProNotCount",
        hideDefaultActions: true,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2,
        },
    },
    {
        label: "开票单位",
        hideDefaultActions: true,
        type: "customUnit",
        typeAttributes: {
            unitValue: { fieldName: "unitValue" },
            unitOptions: { fieldName: "unitOptions" },
            recordId: { fieldName: "recordId" },
            isDisabled: { fieldName: "isDisabled" },
        },
    },
    {
        label: "发票单价",
        fieldName: "esdInvoiceUnitprice",
        hideDefaultActions: true,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2,
        },
        initialWidth: 130
    },
    {
        label: '发票数量',
        label: "发票数量",
        //fieldName: "invoiceCount",
        hideDefaultActions: true,
        type: 'customShipment',
        type: "customShipment",
        cellAttributes: { alignment: 'right' },
        typeAttributes: {
            recordId: { fieldName: 'recordId' },
            shipmentNumber: { fieldName: 'shipmentNumber' },
            isConinvoice: { fieldName: 'isConinvoice' },
            esdInvoiceProNotCount: { fieldName: 'esdInvoiceProNotCount' }
        }
            recordId: { fieldName: "recordId" },
            shipmentNumber: { fieldName: "shipmentNumber" },
            isConinvoice: { fieldName: "isConinvoice" },
            esdInvoiceProNotCount: { fieldName: "esdInvoiceProNotCount" },
        },
    },
    {
        label: '发票票面金额(元)',
        label: "发票票面金额(元)",
        cellAttributes: { alignment: 'right' },
        fieldName: 'invoiceAllprice',
        fieldName: "invoiceAllprice",
        hideDefaultActions: true,
        type: 'number',
        type: "number",
        initialWidth: 150,
        typeAttributes: {
            minimumFractionDigits: 2
        }
    }
];
            minimumFractionDigits: 2,
        },
    },
]
const customLabel = {
    LexConInvoiceViewReport
};
export default class LexConInvoiceView extends NavigationMixin(
    LightningElement
) {
}
export default class LexConInvoiceView extends NavigationMixin(LightningElement) {
    @track label = customLabel;
    invoiceColumns = invoiceColumns;
    detailsColumns = detailsColumns;
    @track outboundColumns = [
        {
            label: '出库日期',
            fieldName: 'esdOutboundDate',
            label: "出库日期",
            fieldName: "esdOutboundDate",
            hideDefaultActions: true,
            wrapText: true
            wrapText: true,
        },
        {
            label: '出库单编码',
            fieldName: 'esdNameUrl',
            label: "出库单编码",
            fieldName: "esdNameUrl",
            type: 'url',
            typeAttributes: {
                label: { fieldName: 'esdName' },
                target: '_blank'
                label: { fieldName: "esdName" },
                target: "_blank",
            },
            hideDefaultActions: true,
            wrapText: true
            wrapText: true,
        }
    ];
    ]
    @track outboundData = [];
    @track outboundDataSumPrice = [];
    @track invoiceData = [];
@@ -302,7 +301,7 @@
    @track coc = {};
    @track EditAble = false;
    @track isChange = false;
    @track sumPrice = 0.0;
    @track sumPrice = 0.00;
    @track OrderCode = '';
    @track ExistOutbound = false;
    @track reopen = '';
@@ -314,7 +313,7 @@
    @track detailsInvoiceId = '';
    @track detailsCocId = '';
    @track detailsData = [];
    @track invoiceAllprice = 0.0;
    @track invoiceAllprice = 0.00;
    //状态
    @track invoiceStatusValue = '';
    @track invoiceStatusOptions = [];
@@ -338,9 +337,9 @@
    @track secondaryDistributor = '';
    //客户名
    @track isModalOpen = false;
    @track HospitalName = '';
    @track HospitalInfo = '';
    @track searchHospitalName = '';
    @track HospitalName = "";
    @track HospitalInfo = "";
    @track searchHospitalName = "";
    @track isDisabledHospitalName = false;
    @track agencyProType = '';
    @track accountid = '';
@@ -376,50 +375,47 @@
    //文件上传
    @track showLoadingSpinner = false;
    @track showPopSpinner = false;
    @track UploadFile = 'Upload File';
    @track fileName = '';
    @track UploadFile = "Upload File";
    @track fileName = "";
    @track fileData = [];
    @track fileColumns = [
        {
            label: '标题',
            fieldName: 'url',
            type: 'url',
            typeAttributes: { label: { fieldName: 'Title' }, target: '_blank' },
            hideDefaultActions: true
            label: "标题",
            fieldName: "url",
            type: "url",
            typeAttributes: { label: { fieldName: "Title" }, target: "_blank" },
            hideDefaultActions: true,
        },
        {
            label: '创建人',
            type: 'url',
            fieldName: 'CreatedByNameUrl',
            typeAttributes: {
                label: { fieldName: 'CreatedByName' },
                target: '_blank'
            },
            hideDefaultActions: true
            label: "创建人",
            type: "url",
            fieldName: "CreatedByNameUrl",
            typeAttributes: { label: { fieldName: "CreatedByName" }, target: "_blank" },
            hideDefaultActions: true,
        },
        {
            label: '上传日期',
            label: "上传日期",
            type: 'date',
            typeAttributes: {
                year: 'numeric',
                month: 'long',
                day: '2-digit',
                hour: '2-digit',
                minute: '2-digit'
                year: "numeric",
                month: "long",
                day: "2-digit",
                hour: "2-digit",
                minute: "2-digit"
            },
            fieldName: 'CreatedDate',
            hideDefaultActions: true
            fieldName: "CreatedDate",
            hideDefaultActions: true,
        },
        {
            label: '附件类型',
            type: 'customAttachmentType',
            label: "附件类型",
            type: "customAttachmentType",
            typeAttributes: {
                typeValue: { fieldName: 'typeValue' },
                typeOptions: { fieldName: 'typeOptions' },
                recordId: { fieldName: 'recordId' },
                isDisabledAttachment: { fieldName: 'isDisabledAttachment' }
                typeValue: { fieldName: "typeValue" },
                typeOptions: { fieldName: "typeOptions" },
                recordId: { fieldName: "recordId" },
                isDisabledAttachment: { fieldName: "isDisabledAttachment" },
            },
            hideDefaultActions: true
            hideDefaultActions: true,
        },
        {
            label: '',
@@ -432,7 +428,7 @@
            },
            initialWidth: 50,
            hideDefaultActions: true
        }
        },
    ];
    filesUploaded = [];
    fileContents;
@@ -445,19 +441,19 @@
        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");
                });
        }
    }
    //获取链接参数
    getQueryString(name) {
        console.log('getQueryString name ' + name);
        let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
        console.log("getQueryString name " + name);
        let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        let r = window.location.search.substr(1).match(reg);
        if (r != null) {
            return decodeURIComponent(r[2]);
@@ -471,178 +467,121 @@
    init() {
        this.isShowSpinner = true;
        this.deliveryId = this.getQueryString('deliveryId');
        this.deliveryId = this.deliveryId == null ? '' : this.deliveryId;
        this.invoiceId = this.getQueryString('invoiceId');
        this.invoiceId = this.invoiceId == null ? '' : this.invoiceId;
        this.orderId = this.getQueryString('orderId');
        this.orderId = this.orderId == null ? '' : this.orderId;
        this.statusEdit = this.getQueryString('KeyWords');
        this.statusEdit = this.statusEdit == null ? '' : this.statusEdit;
        this.reopen = this.getQueryString('reopen');
        this.reopen = this.reopen == null ? '' : this.reopen;
        this.isNew = this.getQueryString('isNew');
        this.isNew = this.isNew == null ? '' : this.isNew;
        console.log(
            'this.deliveryId = ' +
                this.deliveryId +
                ' this.invoiceId = ' +
                this.invoiceId +
                ' this.statusEdit = ' +
                this.statusEdit
        );
        this.deliveryId = this.getQueryString("deliveryId");
        this.deliveryId = this.deliveryId == null ? "" : this.deliveryId;
        this.invoiceId = this.getQueryString("invoiceId");
        this.invoiceId = this.invoiceId == null ? "" : this.invoiceId;
        this.orderId = this.getQueryString("orderId");
        this.orderId = this.orderId == null ? "" : this.orderId;
        this.statusEdit = this.getQueryString("KeyWords");
        this.statusEdit = this.statusEdit == null ? "" : this.statusEdit;
        this.reopen = this.getQueryString("reopen");
        this.reopen = this.reopen == null ? "" : this.reopen;
        this.isNew = this.getQueryString("isNew");
        this.isNew = this.isNew == null ? "" : this.isNew;
        console.log('this.deliveryId = ' + this.deliveryId + ' this.invoiceId = ' + this.invoiceId + ' this.statusEdit = ' + this.statusEdit);
        if (this.invoiceId != '' && this.orderId != '') {
            //进入coninvoiceDetails
            detailsInit({
                orderIdLwc: this.orderId,
                invoiceIdLwc: this.invoiceId
            })
                .then((r) => {
                    r = JSON.parse(JSON.stringify(r));
                    if (r.status == 'Success') {
                        this.detailsInvoiceId = r.entity.invoicecode.Id;
                        this.detailsCocId = r.entity.coc.Id;
                        this.detailsData =
                            r.entity.consumableorderdetails1Records;
                        for (var i in this.detailsData) {
                            this.detailsData[i]['Id'] =
                                this.detailsData[i].esd.Id;
            }).then((r) => {
                r = JSON.parse(JSON.stringify(r));
                if (r.status == "Success") {
                    this.detailsInvoiceId = r.entity.invoicecode.Id;
                    this.detailsCocId = r.entity.coc.Id;
                    this.detailsData = r.entity.consumableorderdetails1Records;
                    for (var i in this.detailsData) {
                        this.detailsData[i]['Id'] = this.detailsData[i].esd.Id;
                            this.detailsData[i]['esdAssetModelNo'] =
                                this.detailsData[i].esd.Asset_Model_No__c;
                            this.detailsData[i]['packingListManual'] =
                                this.detailsData[i].Packing_list_manual;
                            this.detailsData[i]['esdDeliveryListRMB'] =
                                this.detailsData[i].esd.Delivery_List_RMB__c;
                            this.detailsData[i]['esdShipmentCount'] =
                                this.detailsData[i].esd.Shipment_Count__c;
                            this.detailsData[i]['esdRrturnProCount'] =
                                this.detailsData[i].esd.RrturnPro_count__c;
                            this.detailsData[i]['esdBoxPiece'] =
                                this.detailsData[i].esd.Box_Piece__c;
                        this.detailsData[i]['esdAssetModelNo'] = this.detailsData[i].esd.Asset_Model_No__c;
                        this.detailsData[i]['packingListManual'] = this.detailsData[i].Packing_list_manual;
                        this.detailsData[i]['esdDeliveryListRMB'] = this.detailsData[i].esd.Delivery_List_RMB__c;
                        this.detailsData[i]['esdShipmentCount'] = this.detailsData[i].esd.Shipment_Count__c;
                        this.detailsData[i]['esdRrturnProCount'] = this.detailsData[i].esd.RrturnPro_count__c;
                        this.detailsData[i]['esdBoxPiece'] = this.detailsData[i].esd.Box_Piece__c;
                            this.detailsData[i]['esdInvoicedProcount'] =
                                this.detailsData[i].esd.Invoiced_Procount__c;
                            this.detailsData[i]['esdInvoiceProNotCount'] =
                                this.detailsData[i].esd.InvoiceProNot_count__c;
                            //开票单位
                            //this.detailsData[i].esd.Box_Piece__c
                            //this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Invoice_Unit__c;
                            this.detailsData[i]['unitValue'] =
                                this.detailsData[i].esd.Box_Piece__c;
                            console.log(
                                'unitValue = ' +
                                    this.detailsData[i]['unitValue']
                            );
                            this.detailsData[i]['recordId'] =
                                this.detailsData[i].esd.Id;
                            //disabled="{!IF(records.esd.Box_Piece__c =='个' || (records.esd.Box_Piece__c =='盒' && records.Packing_list_manual ==1),true,false)}"
                            //this.detailsData[i]['isDisabled'] = (this.detailsData[i].esd.Box_Piece__c == '个' || (this.detailsData[i].esd.Box_Piece__c =='盒' && this.detailsData[i].Packing_list_manual ==1)) ? true:false;
                            this.detailsData[i]['isDisabled'] = true;
                            let unitOptions = [];
                            for (var key in this.detailsData[i]
                                .Invoice_UnitOptsMap) {
                                let unitOption = {};
                                unitOption['label'] =
                                    this.detailsData[i].Invoice_UnitOptsMap[
                                        key
                                    ];
                                unitOption['value'] = key;
                                unitOptions.push(unitOption);
                            }
                            this.detailsData[i]['unitOptions'] = unitOptions;
                            this.detailsData[i]['esdInvoiceUnitprice'] =
                                this.detailsData[i].esd.Invoice_Unitprice__c;
                            //发票数量
                            this.detailsData[i]['shipmentNumber'] =
                                this.detailsData[i].invoiceCount;
                            this.detailsData[i]['isConinvoice'] = true;
                            this.detailsData[i]['invoiceAllprice'] =
                                this.detailsData[i].invoiceAllprice;
                            if (this.detailsData[i].check) {
                                this.detailsSelectedRows.push(
                                    this.detailsData[i]['Id']
                                );
                                this.invoiceAllprice +=
                                    this.detailsData[i]['invoiceAllprice'];
                            }
                        this.detailsData[i]['esdInvoicedProcount'] = this.detailsData[i].esd.Invoiced_Procount__c;
                        this.detailsData[i]['esdInvoiceProNotCount'] = this.detailsData[i].esd.InvoiceProNot_count__c;
                        //开票单位
                        //this.detailsData[i].esd.Box_Piece__c
                        //this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Invoice_Unit__c;
                        this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Box_Piece__c;
                        console.log('unitValue = ' + this.detailsData[i]['unitValue']);
                        this.detailsData[i]['recordId'] = this.detailsData[i].esd.Id;
                        //disabled="{!IF(records.esd.Box_Piece__c =='个' || (records.esd.Box_Piece__c =='盒' && records.Packing_list_manual ==1),true,false)}"
                        //this.detailsData[i]['isDisabled'] = (this.detailsData[i].esd.Box_Piece__c == '个' || (this.detailsData[i].esd.Box_Piece__c =='盒' && this.detailsData[i].Packing_list_manual ==1)) ? true:false;
                        this.detailsData[i]['isDisabled'] = true;
                        let unitOptions = [];
                        for (var key in this.detailsData[i].Invoice_UnitOptsMap) {
                            let unitOption = {};
                            unitOption["label"] = this.detailsData[i].Invoice_UnitOptsMap[key];
                            unitOption["value"] = key;
                            unitOptions.push(unitOption);
                        }
                        this.detailsData[i]["unitOptions"] = unitOptions;
                        this.detailsData[i]['esdInvoiceUnitprice'] = this.detailsData[i].esd.Invoice_Unitprice__c;
                        //发票数量
                        this.detailsData[i]['shipmentNumber'] = this.detailsData[i].invoiceCount;
                        this.detailsData[i]['isConinvoice'] = true;
                        this.detailsData[i]['invoiceAllprice'] = this.detailsData[i].invoiceAllprice;
                        console.log(
                            'this.detailsData = ' +
                                JSON.stringify(this.detailsData)
                        );
                        let lastInvoiceAllprice = {
                            invoiceAllprice: this.invoiceAllprice
                        };
                        this.invoiceAllpriceData.push(lastInvoiceAllprice);
                        console.log(
                            'this.invoiceAllpriceData = ' +
                                JSON.stringify(this.invoiceAllpriceData)
                        );
                        this.isShowSpinner = false;
                        this.isDetailsShow = true;
                    } else {
                        this.showMyToast('初始化失败', r.msg, 'Error');
                        if (this.detailsData[i].check) {
                            this.detailsSelectedRows.push(this.detailsData[i]['Id']);
                            this.invoiceAllprice += this.detailsData[i]['invoiceAllprice'];
                        }
                    }
                })
                .catch((error) => {
                    console.log('this.detailsData = ' + JSON.stringify(this.detailsData));
                    let lastInvoiceAllprice = {
                        invoiceAllprice: this.invoiceAllprice
                    }
                    this.invoiceAllpriceData.push(lastInvoiceAllprice);
                    console.log('this.invoiceAllpriceData = ' + JSON.stringify(this.invoiceAllpriceData))
                    this.isShowSpinner = false;
                    console.log('error = ' + JSON.stringify(error));
                });
        } else if (
            this.deliveryId == '' &&
            this.invoiceId == '' &&
            this.isNew == ''
        ) {
                    this.isDetailsShow = true;
                } else {
                    this.showMyToast('初始化失败', r.msg, 'Error');
                }
            }).catch((error) => {
                this.isShowSpinner = false;
                console.log("error = " + JSON.stringify(error));
            });
        } else if (this.deliveryId == '' && this.invoiceId == '' && this.isNew == '') {
            console.log('conInvoiceListInit');
            conInvoiceListInit()
                .then((r) => {
                    r = JSON.parse(JSON.stringify(r));
                    console.log('conInvoiceListInit r = ' + JSON.stringify(r));
                    if (r.status == 'Success') {
                        this.ConInvoiceListAccountId = r.entity.accountid;
                        this.ConInvoiceListUserWorkLocation =
                            r.entity.userWorkLocation;
            conInvoiceListInit().then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log("conInvoiceListInit r = " + JSON.stringify(r));
                if (r.status == "Success") {
                    this.ConInvoiceListAccountId = r.entity.accountid;
                    this.ConInvoiceListUserWorkLocation = r.entity.userWorkLocation;
                        this.ConInvoiceListAgencyProType =
                            r.entity.agencyProType;
                        //if (this.ConInvoiceListAgencyProType != 'ET')
                    this.ConInvoiceListAgencyProType = r.entity.agencyProType;
                    //if (this.ConInvoiceListAgencyProType != 'ET')
                        this.isOpenReportDisabled = false;
                        this.invoiceData = r.entity.raesList;
                        for (var i in this.invoiceData) {
                            this.invoiceData[i]['NameUrl'] =
                                '/lexconinvoiceview?invoiceId=' +
                                this.invoiceData[i].Id;
                        }
                        console.log(
                            'this.invoiceData = ' +
                                JSON.stringify(this.invoiceData)
                        );
                        for (var key in r.entity.statusMap) {
                            let object = {};
                            object['label'] = key;
                            object['value'] = r.entity.statusMap[key];
                            this.invoiceStatusOptions.push(object);
                        }
                        this.invoiceStatusOptions = [
                            ...this.invoiceStatusOptions
                        ];
                        console.log(
                            'this.invoiceStatusOptions = ' +
                                JSON.stringify(this.invoiceStatusOptions)
                        );
                        this.isShowSpinner = false;
                    } else {
                        this.showMyToast('初始化失败', r.msg, 'Error');
                    this.invoiceData = r.entity.raesList;
                    for (var i in this.invoiceData) {
                        this.invoiceData[i]['NameUrl'] = '/lexconinvoiceview?invoiceId=' + this.invoiceData[i].Id;
                    }
                })
                .catch((error) => {
                    console.log('error = ' + JSON.stringify(error));
                });
                    console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
                    for (var key in r.entity.statusMap) {
                        let object = {};
                        object["label"] = key;
                        object["value"] = r.entity.statusMap[key];
                        this.invoiceStatusOptions.push(object);
                    }
                    this.invoiceStatusOptions = [...this.invoiceStatusOptions];
                    console.log("this.invoiceStatusOptions = " + JSON.stringify(this.invoiceStatusOptions));
                    this.isShowSpinner = false;
                } else {
                    this.showMyToast('初始化失败', r.msg, 'Error');
                }
            }).catch((error) => {
                console.log("error = " + JSON.stringify(error));
            });
        } else {
            console.log('init');
            this.isConInvoiceList = false;
@@ -650,345 +589,226 @@
                invoiceId: this.invoiceId,
                statusEdit: this.statusEdit,
                deliveryId: this.deliveryId
            })
                .then((r) => {
                    r = JSON.parse(JSON.stringify(r));
                    console.log('r = ' + JSON.stringify(r));
                    if (r.status == 'Success') {
                        this.coc = r.entity.coc;
                        this.cocId = this.coc.Id;
                        this.EditAble = r.entity.EditAble;
                        this.isChange = r.entity.isChange;
                        this.ExistOutbound = r.entity.ExistOutbound;
                        this.outboundData = r.entity.invoiceOrderRecoeds;
                        console.log(
                            'this.outboundData = ' +
                                JSON.stringify(this.outboundData)
                        );
                        this.done = r.entity.done;
                        this.accountid = r.entity.accountid;
                        this.userWorkLocation = r.entity.userWorkLocation;
                        this.outOrderStringListLwc =
                            r.entity.outOrderStringList;
                        this.outordercountMapLwc = r.entity.outordercountMap;
                        this.invoiceOrderRecoedschange =
                            r.entity.invoiceOrderRecoedschange;
                        this.isDisabledEdit =
                            this.coc.Invoice_status__c == '提交' ||
                            this.coc.Invoice_status__c == '已完成'
                                ? true
                                : false;
                        this.isDisabledReopen =
                            this.coc.Invoice_status__c == '提交' ? false : true;
                        this.isDisabledDelete =
                            this.coc.Invoice_status__c == '草案中'
                                ? false
                                : true;
                        this.isDisabledAttachment =
                            this.coc.Invoice_status__c == '已完成'
                                ? true
                                : false;
                        this.OrderCode = this.coc.Name;
                        this.InvoiceDate = this.coc.Invoice_Date__c;
            }).then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log("r = " + JSON.stringify(r));
                if (r.status == "Success") {
                    this.coc = r.entity.coc;
                    this.cocId = this.coc.Id;
                    this.EditAble = r.entity.EditAble;
                    this.isChange = r.entity.isChange;
                    this.ExistOutbound = r.entity.ExistOutbound;
                    this.outboundData = r.entity.invoiceOrderRecoeds;
                    console.log('this.outboundData = ' + JSON.stringify(this.outboundData))
                    this.done = r.entity.done;
                    this.accountid = r.entity.accountid;
                    this.userWorkLocation = r.entity.userWorkLocation;
                    this.outOrderStringListLwc = r.entity.outOrderStringList;
                    this.outordercountMapLwc = r.entity.outordercountMap;
                    this.invoiceOrderRecoedschange = r.entity.invoiceOrderRecoedschange;
                    this.isDisabledEdit = (this.coc.Invoice_status__c == '提交' || this.coc.Invoice_status__c == '已完成') ? true : false;
                    this.isDisabledReopen = this.coc.Invoice_status__c == '提交' ? false : true;
                    this.isDisabledDelete = this.coc.Invoice_status__c == '草案中' ? false : true;
                    this.isDisabledAttachment = this.coc.Invoice_status__c == '已完成' ? true : false;
                    this.OrderCode = this.coc.Name;
                    this.InvoiceDate = this.coc.Invoice_Date__c;
                        for (var i in this.outboundData) {
                            this.outboundData[i].Id =
                                this.outboundData[i].esd.Id;
                            if (this.outboundData[i].check)
                                this.selectedRows.push(
                                    this.outboundData[i].esd.Id
                                );
                        }
                        this.selectedRows = [...this.selectedRows];
                        console.log(
                            'r.entity.attachmentRecoeds = ' +
                                JSON.stringify(r.entity.attachmentRecoeds)
                        );
                        if (!this.EditAble) {
                            //附件显示
                            this.showLoadingSpinner = true;
                            this.fileData = r.entity.attachmentRecoeds;
                            for (var i in this.fileData) {
                                this.fileData[i]['Id'] =
                                    this.fileData[i].cvInfo.Id;
                                this.fileData[i]['recordId'] =
                                    this.fileData[i].cvInfo.Id;
                                this.fileData[i]['url'] =
                                    '/' + this.fileData[i].cvInfo.Id;
                                this.fileData[i]['Title'] =
                                    this.fileData[i].cvInfo.Title;
                                this.fileData[i]['CreatedByName'] =
                                    this.fileData[i].cvInfo.Owner.Name;
                                this.fileData[i]['CreatedByNameUrl'] =
                                    '/' + this.fileData[i].cvInfo.OwnerId;
                                this.fileData[i]['CreatedDate'] =
                                    this.fileData[i].cvInfo.CreatedDate;
                                this.fileData[i]['attUrl'] =
                                    '/' + this.fileData[i].cvInfo.Id;
                                this.fileData[i]['downloadUrl'] =
                                    '/sfc/servlet.shepherd/document/download/' +
                                    this.fileData[i].cvInfo.ContentDocumentId +
                                    '?operationContext=S1';
                                if (this.isDisabledAttachment) {
                                    console.log(
                                        '进入this.isDisabledAttachment'
                                    );
                                    this.fileData[i][
                                        'isDisabledAttachment'
                                    ] = true;
                                }
                                let typeOptions = [];
                                for (var key in this.fileData[i]
                                    .mailSelectOptsMap) {
                                    let typeOption = {};
                                    typeOption['label'] =
                                        this.fileData[i].mailSelectOptsMap[key];
                                    typeOption['value'] = key;
                                    typeOptions.push(typeOption);
                                }
                                this.fileData[i]['typeValue'] =
                                    this.fileData[i].mailSelectOptsin == null
                                        ? typeOptions[0].value
                                        : this.fileData[i].mailSelectOptsin;
                                this.fileData[i]['typeOptions'] = typeOptions;
                                this.fileData[i]['mailSelectOptsin'] =
                                    this.fileData[i].mailSelectOptsin == null
                                        ? typeOptions[0].value
                                        : this.fileData[i].mailSelectOptsin;
                            }
                            console.log(
                                'this.fileData = ' +
                                    JSON.stringify(this.fileData)
                            );
                        }
                        //发票明细
                        this.invoiceOrderdetail1Recoeds =
                            r.entity.invoiceOrderdetail1Recoeds;
                        for (var i in this.invoiceOrderdetail1Recoeds) {
                            this.invoiceOrderdetail1Recoeds[i][
                                'esdetProductOutDate'
                            ] =
                                this.invoiceOrderdetail1Recoeds[
                                    i
                                ].esdet.Product_OutDate__c;
                            this.invoiceOrderdetail1Recoeds[i][
                                'esdetInvoicedet1ODlinkName'
                            ] =
                                this.invoiceOrderdetail1Recoeds[
                                    i
                                ].esdet.Invoicedet1_OD_link__r.Name;
                            this.invoiceOrderdetail1Recoeds[i][
                                'esdetAssetModelNo'
                            ] =
                                this.invoiceOrderdetail1Recoeds[
                                    i
                                ].esdet.Asset_Model_No__c;
                            this.invoiceOrderdetail1Recoeds[i][
                                'esdetInvoiceUnit'
                            ] =
                                this.invoiceOrderdetail1Recoeds[
                                    i
                                ].esdet.Invoice_Unit__c;
                            this.invoiceOrderdetail1Recoeds[i][
                                'esdetInvoiceUnitprice'
                            ] =
                                this.invoiceOrderdetail1Recoeds[
                                    i
                                ].esdet.Invoice_Unitprice__c;
                            this.invoiceOrderdetail1Recoeds[i][
                                'esdetInvoicedCount'
                            ] =
                                this.invoiceOrderdetail1Recoeds[
                                    i
                                ].esdet.Invoiced_Count__c;
                            this.invoiceOrderdetail1Recoeds[i][
                                'esdetInvoicedProCostRMB'
                            ] =
                                this.invoiceOrderdetail1Recoeds[
                                    i
                                ].esdet.InvoicedProCost_RMB__c;
                        }
                        //客户名
                        this.HospitalName = r.entity.HospitalName;
                        this.HospitalInfo = r.entity.HospitalInfo;
                        this.agencyProType = r.entity.agencyProType;
                        //if (this.agencyProType != 'ET')
                        this.isOpenReportDisabled = false;
                        //科室
                        this.ForCustomerText =
                            this.coc.Order_ForCustomerText__c;
                        //备注
                        this.InvoiceNote = this.coc.Invoice_Note__c;
                        //二级经销商
                        for (var key in r.entity.provinceOptsMap) {
                            let object = {};
                            object['label'] = r.entity.provinceOptsMap[key];
                            object['value'] = key;
                            this.provinceOptsMap.push(object);
                        }
                        //出货一览columns
                        if (this.EditAble) {
                            let object1 = {
                                label: '客户名',
                                fieldName: 'hospitalName',
                                hideDefaultActions: true,
                                wrapText: true
                            };
                            let object2 = {
                                label: '出货金额(元)',
                                fieldName: 'shipmentAmount',
                                type: 'number',
                                typeAttributes: {
                                    minimumFractionDigits: 2
                                },
                                hideDefaultActions: true
                            };
                            let object3 = {
                                label: '返品金额(元)',
                                fieldName: 'returnAmount',
                                type: 'number',
                                typeAttributes: {
                                    minimumFractionDigits: 2
                                },
                                hideDefaultActions: true
                            };
                            this.outboundColumns.push(object1);
                            this.outboundColumns.push(object2);
                            this.outboundColumns.push(object3);
                        }
                        let object4 = {
                            label: '未发票金额(元)',
                            fieldName: 'uninvoicedAmount',
                            type: 'number',
                            typeAttributes: {
                                minimumFractionDigits: 2
                            },
                            hideDefaultActions: true
                        };
                        this.outboundColumns.push(object4);
                        //出货一览Data
                        let index = 0;
                        for (var i in this.outboundData) {
                            this.outboundData[i]['esdOutboundDate'] =
                                this.outboundData[i].esd.Outbound_Date__c;
                            this.outboundData[i]['esdNameUrl'] =
                                '/s/lexsummonscreat?ESetid=' +
                                this.outboundData[i].esd.Id;
                            this.outboundData[i]['esdName'] =
                                this.outboundData[i].esd.Name;
                            if (this.EditAble) {
                                this.outboundData[i]['hospitalName'] =
                                    this.outboundData[i].esd.ShipmentAccount__c;
                                this.outboundData[i]['shipmentAmount'] =
                                    this.outboundData[
                                        i
                                    ].esd.Shipment_total_amount__c;
                                this.outboundData[i]['returnAmount'] =
                                    this.outboundData[
                                        i
                                    ].esd.RrturnPro_total_amount__c;
                            }
                            this.outboundData[i]['uninvoicedAmount'] =
                                this.outboundData[i].esd.InvoiceNotPro_money__c;
                            this.outboundData[i]['invoiceFaceAmount'] =
                                this.keepTwoDecimalStr(
                                    this.outboundData[i].needInvoiceCount
                                );
                            if (
                                !(
                                    this.outboundData[i].esd.Billed_Status__c ==
                                        '全部开票' ||
                                    this.EditAble ||
                                    this.coc.Invoice_status__c != '草案中'
                                )
                            ) {
                                console.log('进入 if');
                                let url =
                                    '/lexconinvoiceview?orderId=' +
                                    this.outboundData[i].esd.Id +
                                    '&invoiceId=' +
                                    this.invoiceId;
                                this.outboundData[i]['invoiceFaceAmountUrl'] =
                                    url;
                                if (index == 0) {
                                    let object5 = {
                                        label: '发票票面金额(元)',
                                        cellAttributes: { alignment: 'right' },
                                        type: 'url',
                                        fieldName: 'invoiceFaceAmountUrl',
                                        typeAttributes: {
                                            label: {
                                                fieldName: 'invoiceFaceAmount'
                                            }
                                            //target: "_blank",
                                        },
                                        hideDefaultActions: true
                                    };
                                    this.outboundColumns.push(object5);
                                    index++;
                                }
                            } else {
                                console.log('进入 else');
                                if (index == 0) {
                                    let object5 = {
                                        label: '发票票面金额(元)',
                                        cellAttributes: { alignment: 'right' },
                                        fieldName: 'invoiceFaceAmount',
                                        hideDefaultActions: true,
                                        type: 'number',
                                        typeAttributes: {
                                            minimumFractionDigits: 2
                                        }
                                    };
                                    this.outboundColumns.push(object5);
                                    index++;
                                }
                            }
                            //计算发票票面金额
                            this.sumPrice +=
                                this.outboundData[i].needInvoiceCount;
                        }
                        //四舍五入
                        //this.sumPrice = this.sumPrice.toFixed(2);
                        //如果不四舍五入
                        console.log('start keepTwoDecimalStr');
                        this.sumPrice = this.keepTwoDecimalStr(this.sumPrice);
                        console.log('end keepTwoDecimalStr = ' + this.sumPrice);
                        //加最后一行显示金额
                        if (this.EditAble) {
                            let lastOutboundData = {
                                invoiceFaceAmount: this.sumPrice
                            };
                            this.outboundDataSumPrice.push(lastOutboundData);
                        }
                        this.outboundColumns = [...this.outboundColumns];
                        this.isEditInvoice = !(!this.EditAble || this.isChange);
                        if (
                            this.coc.SummonsForDirction__c == '销售给二级经销商'
                        )
                            this.isShowSecondaryDistributor = true;
                        if (
                            this.deliveryId == '' &&
                            !this.ExistOutbound &&
                            this.EditAble
                        )
                            this.hideCheckbox = false;
                        this.isShowSpinner = false;
                        this.showLoadingSpinner = false;
                    } else {
                        this.showMyToast('失败', r.msg, 'Error');
                    for (var i in this.outboundData) {
                        this.outboundData[i].Id = this.outboundData[i].esd.Id;
                        if (this.outboundData[i].check)
                            this.selectedRows.push(this.outboundData[i].esd.Id);
                    }
                })
                .catch((error) => {
                    console.log('error = ' + JSON.stringify(error));
                });
                    this.selectedRows = [...this.selectedRows];
                    console.log('r.entity.attachmentRecoeds = ' + JSON.stringify(r.entity.attachmentRecoeds))
                    if (!this.EditAble) {
                        //附件显示
                        this.showLoadingSpinner = true;
                        this.fileData = r.entity.attachmentRecoeds;
                        for (var i in this.fileData) {
                            this.fileData[i]["Id"] = this.fileData[i].cvInfo.Id;
                            this.fileData[i]["recordId"] = this.fileData[i].cvInfo.Id;
                            this.fileData[i]["url"] = "/" + this.fileData[i].cvInfo.Id;
                            this.fileData[i]["Title"] = this.fileData[i].cvInfo.Title;
                            this.fileData[i]["CreatedByName"] = this.fileData[i].cvInfo.Owner.Name;
                            this.fileData[i]["CreatedByNameUrl"] = "/" + this.fileData[i].cvInfo.OwnerId;;
                            this.fileData[i]["CreatedDate"] = this.fileData[i].cvInfo.CreatedDate;
                            this.fileData[i]["attUrl"] = '/' + this.fileData[i].cvInfo.Id;
                            this.fileData[i]['downloadUrl'] = '/sfc/servlet.shepherd/document/download/' + this.fileData[i].cvInfo.ContentDocumentId + '?operationContext=S1';
                            if (this.isDisabledAttachment) {
                                console.log('进入this.isDisabledAttachment')
                                this.fileData[i]["isDisabledAttachment"] = true;
                            }
                            let typeOptions = [];
                            for (var key in this.fileData[i].mailSelectOptsMap) {
                                let typeOption = {};
                                typeOption["label"] = this.fileData[i].mailSelectOptsMap[key];
                                typeOption["value"] = key;
                                typeOptions.push(typeOption);
                            }
                            this.fileData[i]["typeValue"] = this.fileData[i].mailSelectOptsin == null ? typeOptions[0].value : this.fileData[i].mailSelectOptsin;
                            this.fileData[i]["typeOptions"] = typeOptions;
                            this.fileData[i]["mailSelectOptsin"] = this.fileData[i].mailSelectOptsin == null ? typeOptions[0].value : this.fileData[i].mailSelectOptsin;
                        }
                        console.log('this.fileData = ' + JSON.stringify(this.fileData))
                    }
                    //发票明细
                    this.invoiceOrderdetail1Recoeds = r.entity.invoiceOrderdetail1Recoeds;
                    for (var i in this.invoiceOrderdetail1Recoeds) {
                        this.invoiceOrderdetail1Recoeds[i]['esdetProductOutDate'] = this.invoiceOrderdetail1Recoeds[i].esdet.Product_OutDate__c;
                        this.invoiceOrderdetail1Recoeds[i]['esdetInvoicedet1ODlinkName'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoicedet1_OD_link__r.Name;
                        this.invoiceOrderdetail1Recoeds[i]['esdetAssetModelNo'] = this.invoiceOrderdetail1Recoeds[i].esdet.Asset_Model_No__c;
                        this.invoiceOrderdetail1Recoeds[i]['esdetInvoiceUnit'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unit__c;
                        this.invoiceOrderdetail1Recoeds[i]['esdetInvoiceUnitprice'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unitprice__c;
                        this.invoiceOrderdetail1Recoeds[i]['esdetInvoicedCount'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoiced_Count__c;
                        this.invoiceOrderdetail1Recoeds[i]['esdetInvoicedProCostRMB'] = this.invoiceOrderdetail1Recoeds[i].esdet.InvoicedProCost_RMB__c;
                    }
                    //客户名
                    this.HospitalName = r.entity.HospitalName;
                    this.HospitalInfo = r.entity.HospitalInfo;
                    this.agencyProType = r.entity.agencyProType;
                    //if (this.agencyProType != 'ET')
                        this.isOpenReportDisabled = false;
                    //科室
                    this.ForCustomerText = this.coc.Order_ForCustomerText__c;
                    //备注
                    this.InvoiceNote = this.coc.Invoice_Note__c;
                    //二级经销商
                    for (var key in r.entity.provinceOptsMap) {
                        let object = {};
                        object["label"] = r.entity.provinceOptsMap[key];
                        object["value"] = key;
                        this.provinceOptsMap.push(object);
                    }
                    //出货一览columns
                    if (this.EditAble) {
                        let object1 = {
                            label: '客户名',
                            fieldName: "hospitalName",
                            hideDefaultActions: true,
                            wrapText: true,
                        };
                        let object2 = {
                            label: '出货金额(元)',
                            fieldName: "shipmentAmount",
                            type: "number",
                            typeAttributes: {
                                minimumFractionDigits: 2,
                            },
                            hideDefaultActions: true,
                        };
                        let object3 = {
                            label: '返品金额(元)',
                            fieldName: "returnAmount",
                            type: "number",
                            typeAttributes: {
                                minimumFractionDigits: 2,
                            },
                            hideDefaultActions: true,
                        };
                        this.outboundColumns.push(object1)
                        this.outboundColumns.push(object2)
                        this.outboundColumns.push(object3)
                    }
                    let object4 = {
                        label: '未发票金额(元)',
                        fieldName: "uninvoicedAmount",
                        type: "number",
                        typeAttributes: {
                            minimumFractionDigits: 2,
                        },
                        hideDefaultActions: true,
                    };
                    this.outboundColumns.push(object4)
                    //出货一览Data
                    let index = 0;
                    for (var i in this.outboundData) {
                        this.outboundData[i]['esdOutboundDate'] = this.outboundData[i].esd.Outbound_Date__c;
                        this.outboundData[i]['esdNameUrl'] = '/s/lexsummonscreat?ESetid=' + this.outboundData[i].esd.Id;
                        this.outboundData[i]['esdName'] = this.outboundData[i].esd.Name;
                        if (this.EditAble) {
                            this.outboundData[i]['hospitalName'] = this.outboundData[i].esd.ShipmentAccount__c;
                            this.outboundData[i]['shipmentAmount'] = this.outboundData[i].esd.Shipment_total_amount__c;
                            this.outboundData[i]['returnAmount'] = this.outboundData[i].esd.RrturnPro_total_amount__c;
                        }
                        this.outboundData[i]['uninvoicedAmount'] = this.outboundData[i].esd.InvoiceNotPro_money__c;
                        this.outboundData[i]['invoiceFaceAmount'] = this.keepTwoDecimalStr(this.outboundData[i].needInvoiceCount);
                        if (!(this.outboundData[i].esd.Billed_Status__c == '全部开票' || this.EditAble || this.coc.Invoice_status__c != '草案中')) {
                            console.log('进入 if')
                            let url = "/lexconinvoiceview?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
                            this.outboundData[i]['invoiceFaceAmountUrl'] = url;
                            if (index == 0) {
                                let object5 = {
                                    label: '发票票面金额(元)',
                                    cellAttributes: { alignment: 'right' },
                                    type: 'url',
                                    fieldName: "invoiceFaceAmountUrl",
                                    typeAttributes: {
                                        label: { fieldName: "invoiceFaceAmount" },
                                        //target: "_blank",
                                    },
                                    hideDefaultActions: true,
                                };
                                this.outboundColumns.push(object5)
                                index++;
                            }
                        } else {
                            console.log('进入 else')
                            if (index == 0) {
                                let object5 = {
                                    label: '发票票面金额(元)',
                                    cellAttributes: { alignment: 'right' },
                                    fieldName: "invoiceFaceAmount",
                                    hideDefaultActions: true,
                                    type: "number",
                                    typeAttributes: {
                                        minimumFractionDigits: 2,
                                    },
                                };
                                this.outboundColumns.push(object5)
                                index++;
                            }
                        }
                        //计算发票票面金额
                        this.sumPrice += this.outboundData[i].needInvoiceCount;
                    }
                    //四舍五入
                    //this.sumPrice = this.sumPrice.toFixed(2);
                    //如果不四舍五入
                    console.log('start keepTwoDecimalStr')
                    this.sumPrice = this.keepTwoDecimalStr(this.sumPrice);
                    console.log('end keepTwoDecimalStr = ' + this.sumPrice)
                    //加最后一行显示金额
                    if (this.EditAble) {
                        let lastOutboundData = {
                            invoiceFaceAmount: this.sumPrice
                        }
                        this.outboundDataSumPrice.push(lastOutboundData);
                    }
                    this.outboundColumns = [...this.outboundColumns];
                    this.isEditInvoice = !(!this.EditAble || this.isChange);
                    if (this.coc.SummonsForDirction__c == '销售给二级经销商')
                        this.isShowSecondaryDistributor = true;
                    if (this.deliveryId == '' && !this.ExistOutbound && this.EditAble)
                        this.hideCheckbox = false;
                    this.isShowSpinner = false;
                    this.showLoadingSpinner = false;
                } else {
                    this.showMyToast('失败', r.msg, 'Error');
                }
            }).catch((error) => {
                console.log("error = " + JSON.stringify(error));
            });
        }
    }
    //上传配置单
    uploadOrder(event) {
@@ -1019,11 +839,7 @@
    //是否显示附件移除
    get attDelBtn() {
        if (
            this.fileName != '' &&
            this.fileName != null &&
            this.fileName != '选择一个文件上传'
        ) {
        if (this.fileName != '' && this.fileName != null && this.fileName != '选择一个文件上传') {
            return true;
        } else {
            return false;
@@ -1042,47 +858,47 @@
            s += '0';
        }
        return s;
    }
    };
    dataChange(event) {
        let fieldName = event.target.getAttribute('data-field');
        let fieldName = event.target.getAttribute("data-field");
        let value = event.detail.value;
        console.log('fieldName = ' + fieldName + ' value = ' + value);
        console.log("fieldName = " + fieldName + " value = " + value);
        switch (fieldName) {
            case 'OrderCode':
            case "OrderCode":
                this.OrderCode = value;
                this.coc['Name'] = value;
                break;
            case 'ForCustomerText':
            case "ForCustomerText":
                this.ForCustomerText = value;
                this.coc['Order_ForCustomerText__c'] = value;
                break;
            case 'InvoiceDate':
            case "InvoiceDate":
                this.InvoiceDate = value;
                this.coc['Invoice_Date__c'] = value;
                break;
            case 'secondaryDistributor':
            case "secondaryDistributor":
                this.secondaryDistributor = value;
                break;
            case 'deliveryFromDate':
            case "deliveryFromDate":
                this.deliveryFromDate = value;
                break;
            case 'deliveryToDate':
            case "deliveryToDate":
                this.deliveryToDate = value;
                break;
            case 'category1':
            case "category1":
                this.category1 = value;
                break;
            case 'category2':
            case "category2":
                this.category2 = value;
                break;
            case 'invoiceStatus':
            case "invoiceStatus":
                this.invoiceStatusValue = value;
                break;
            case 'searchHospitalName':
            case "searchHospitalName":
                this.searchHospitalName = value;
                break;
            case 'InvoiceNote':
            case "InvoiceNote":
                this.InvoiceNote = value;
                this.coc['Invoice_Note__c'] = value;
                break;
@@ -1097,68 +913,58 @@
    //搜索客户名
    searchHospitalNameModal() {
        console.log('searchHospitalNameModal');
        console.log("searchHospitalNameModal");
        hospitalInit({
            ctype: this.agencyProType
            ctype: this.agencyProType,
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            if (r.status == 'Success') {
            if (r.status == "Success") {
                this.hospitalList = r.entity.at;
                for (var i in this.hospitalList) {
                    this.hospitalList[i]['stateMasterName'] =
                        this.hospitalList[i].State_Master__r.Name;
                    this.hospitalList[i]["stateMasterName"] = this.hospitalList[i].State_Master__r.Name;
                }
                console.log(
                    'hospitalInit r = ' + JSON.stringify(this.hospitalList)
                );
                console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
                this.isModalOpen = true;
            }
        });
    }
    searchHospital() {
        console.log('this.searchHospitalName = ' + this.searchHospitalName);
        console.log("this.searchHospitalName = " + this.searchHospitalName);
        serContact({
            searchName: this.searchHospitalName,
            ctype: this.agencyProType
            ctype: this.agencyProType,
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            if (r.status == 'Success') {
            if (r.status == "Success") {
                this.hospitalList = r.entity.at;
                for (var i in this.hospitalList) {
                    this.hospitalList[i]['stateMasterName'] =
                    this.hospitalList[i]["stateMasterName"] =
                        this.hospitalList[i].State_Master__r.Name;
                }
                console.log(
                    'hospitalInit r = ' + JSON.stringify(this.hospitalList)
                );
                console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
            }
        });
    }
    //选择客户名
    searchHandleRowAction(event) {
        console.log('searchHandleRowAction');
        console.log("searchHandleRowAction");
        let row = event.detail.row;
        this.HospitalInfo = row.Id;
        this.HospitalName = row.Name;
        console.log(
            'this.HospitalInfo = ' +
                this.HospitalInfo +
                ' this.HospitalName = ' +
                this.HospitalName
        );
        console.log("this.HospitalInfo = " + this.HospitalInfo + " this.HospitalName = " + this.HospitalName);
        this.isModalOpen = false;
    }
    //当客户名是空时。客户id也变为空
    clearAgencyI(event) {
        this.HospitalName = event.target.value;
        if (this.HospitalName == '' || this.HospitalName == null) {
            this.HospitalInfo = '';
        if (this.HospitalName == "" || this.HospitalName == null) {
            this.HospitalInfo = "";
        }
        console.log('this.HospitalName = ' + this.HospitalName);
        console.log('this.HospitalInfo = ' + this.HospitalInfo);
        console.log("this.HospitalName = " + this.HospitalName);
        console.log("this.HospitalInfo = " + this.HospitalInfo);
    }
    closeModal() {
@@ -1167,12 +973,10 @@
    SaveJs() {
        this.isShowSpinner = true;
        let cloneData = this.outboundData;
        let cloneData = this.outboundData
        debugger;
        const selectedRows = this.template
            .querySelector("[data-field='outbound']")
            .getSelectedRows();
        debugger
        const selectedRows = this.template.querySelector("[data-field='outbound']").getSelectedRows();
        console.log('selectedRows = ' + JSON.stringify(selectedRows));
        for (var i in cloneData) {
@@ -1207,10 +1011,7 @@
        console.log('this.accountid = ' + this.accountid);
        console.log('this.agencyProType = ' + this.agencyProType);
        console.log('this.reopen = ' + this.reopen);
        console.log(
            'this.invoiceOrderRecoedschangeLwc = ' +
                JSON.stringify(this.invoiceOrderRecoedschange)
        );
        console.log('this.invoiceOrderRecoedschangeLwc = ' + JSON.stringify(this.invoiceOrderRecoedschange));
        save({
            cocLwc: this.coc,
            HospitalNameLwc: this.HospitalName,
@@ -1222,47 +1023,42 @@
            accountidLwc: this.accountid,
            agencyProTypeLwc: this.agencyProType,
            reopenLwc: this.reopen,
            invoiceOrderRecoedschangeLwc: JSON.stringify(
                this.invoiceOrderRecoedschange
            )
        })
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log('r = ' + JSON.stringify(r));
                if (r.status == 'Success' && r.msg == '') {
                    this.isShowSpinner = false;
                    console.log('save success');
                    let url =
                        '/lexconinvoiceview?invoiceId=' + r.entity.invoiceId;
                    console.log('url = ' + url);
                    this[NavigationMixin.Navigate]({
                        type: 'standard__webPage',
                        attributes: {
                            url: url
                        }
                    });
                } else {
                    this.showMyToast('保存失败', r.msg, 'Error');
                }
            })
            .catch((error) => {
                console.log('error = ' + JSON.stringify(error));
            });
            invoiceOrderRecoedschangeLwc: JSON.stringify(this.invoiceOrderRecoedschange)
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success" && r.msg == '') {
                this.isShowSpinner = false;
                console.log('save success');
                let url = "/lexconinvoiceview?invoiceId=" + r.entity.invoiceId;
                console.log('url = ' + url);
                this[NavigationMixin.Navigate]({
                    type: "standard__webPage",
                    attributes: {
                        url: url,
                    },
                });
            } else {
                this.showMyToast('保存失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + JSON.stringify(error));
        });
    }
    //上传附件,直接就保存好,然后展示
    handleFilesChange(event) {
        console.log('handleFilesChange');
        console.log("handleFilesChange");
        this.handleSave();
        // if (event.target.files.length > 0) {
        //     this.filesUploaded = event.target.files;
        //     this.fileName = event.target.files[0].name;
        //     this.handleSave();
        // }
    }
    handleSave() {
        console.log('saveFile');
            //     this.filesUploaded = event.target.files;
            //     this.fileName = event.target.files[0].name;
            //     this.handleSave();
            // }
        }
        handleSave() {
        console.log("saveFile");
        if (this.filesUploaded.length > 0) {
            this.showPopSpinner = true;
            this.file = this.filesUploaded[0];
@@ -1274,74 +1070,72 @@
            this.fileReader.onloadend = () => {
                this.fileContents = this.fileReader.result;
                let base64 = 'base64,';
                this.content =
                    this.fileContents.indexOf(base64) + base64.length;
                let base64 = "base64,";
                this.content = this.fileContents.indexOf(base64) + base64.length;
                this.fileContents = this.fileContents.substring(this.content);
                this.saveToFile();
            };
            this.fileReader.readAsDataURL(this.file);
        } else {
            this.fileName = '选择一个文件上传';
            this.fileName = "选择一个文件上传";
        }
    }
    saveToFile() {
        console.log('saveToFile');
        console.log('invoiceId = ' + this.invoiceId);
        console.log('fileName = ' + this.fileName);
        console.log('base64Data = ' + encodeURIComponent(this.fileContents));
        console.log("saveToFile");
        console.log("invoiceId = " + this.invoiceId);
        console.log("fileName = " + this.fileName);
        console.log("base64Data = " + encodeURIComponent(this.fileContents));
        saveFile({
            recordId: this.invoiceId,
            fileName: this.fileName,
            base64Data: encodeURIComponent(this.fileContents)
        })
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log('r = ' + JSON.stringify(r));
                if (r != '') {
                    this.showPopSpinner = false;
                    this.showMyToast('上传成功', '', 'Success');
                    this.closePop();
                    this.init();
                } else {
                    this.showMyToast('上传失败', r.msg, 'Error');
                }
            })
            .catch((error) => {
                console.log('error = ' + error.message);
                this.showMyToast('错误', '上传失败', 'Error');
            });
            base64Data: encodeURIComponent(this.fileContents),
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r != '') {
                this.showPopSpinner = false;
                this.showMyToast('上传成功', '', 'Success');
                this.closePop();
                this.init();
            } else {
                this.showMyToast('上传失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
            this.showMyToast('错误', '上传失败', 'Error');
        });
    }
    handleTypeChange(event) {
        console.log('handleTypeChange');
        console.log("handleTypeChange");
        const typeDetail = event.detail;
        console.log('typeDetail = ' + JSON.stringify(typeDetail));
        console.log("typeDetail = " + JSON.stringify(typeDetail));
        for (var i in this.fileData) {
            if (this.fileData[i].recordId == typeDetail.data.recordId) {
                this.fileData[i].typeValue = typeDetail.data.typeValue;
                this.fileData[i].mailSelectOptsin = typeDetail.data.typeValue;
            }
        }
        console.log('this.fileData = ' + JSON.stringify(this.fileData));
        console.log("this.fileData = " + JSON.stringify(this.fileData));
    }
    newInvoiceJs() {
        let url = '/lexconinvoiceview?isNew=yes';
        let url = "/lexconinvoiceview?isNew=yes";
        console.log('url = ' + url);
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            type: "standard__webPage",
            attributes: {
                url: url
            }
                url: url,
            },
        });
    }
    saveAttachmentJs() {
        debugger;
        debugger
        this.showLoadingSpinner = true;
        let cloneData = this.deepClone(this.fileData);
        let cloneData = this.deepClone(this.fileData)
        for (var i in cloneData) {
            delete cloneData[i].Id;
            delete cloneData[i].recordId;
@@ -1358,96 +1152,74 @@
        saveAttachment({
            attachmentRecoedsLwc: JSON.stringify(cloneData),
            invoiceId: this.invoiceId
        })
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log('r = ' + JSON.stringify(r));
                if (r.status == 'Success') {
                    this.showLoadingSpinner = false;
                    this.isShowSpinner = true;
                    // const event = new ShowToastEvent({
                    //     title: 'Success',
                    //     variant: 'Success',
                    //     message: '保存成功',
                    // });
                    // this.dispatchEvent(event);
                    this.showMyToast('附件保存成功', '', 'Success');
                    //this.init();
                    setTimeout(function () {
                        //1秒后执行刷新
                        window.location.reload();
                    }, 2000); //单位是毫秒
                    // let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
                    // console.log('url = ' + url);
                    // this[NavigationMixin.Navigate]({
                    //     type: "standard__webPage",
                    //     attributes: {
                    //         url: url,
                    //     },
                    // });
                } else {
                    this.showMyToast('上传失败', r.msg, 'Error');
                }
            })
            .catch((error) => {
                console.log('error = ' + error.message);
                this.showMyToast('错误', '上传失败', 'Error');
            });
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.showLoadingSpinner = false;
                this.isShowSpinner = true;
                // const event = new ShowToastEvent({
                //     title: 'Success',
                //     variant: 'Success',
                //     message: '保存成功',
                // });
                // this.dispatchEvent(event);
                this.showMyToast('附件保存成功', '', 'Success');
                //this.init();
                setTimeout(function () {
                    //1秒后执行刷新
                    window.location.reload();
                }, 2000); //单位是毫秒
                // let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
                // console.log('url = ' + url);
                // this[NavigationMixin.Navigate]({
                //     type: "standard__webPage",
                //     attributes: {
                //         url: url,
                //     },
                // });
            } else {
                this.showMyToast('上传失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
            this.showMyToast('错误', '上传失败', 'Error');
        });
    }
    invoiceCodeSearchJs() {
        this.isShowSpinner = true;
        invoiceCodeSearch({
            orderDateLwc:
                this.deliveryFromDate == null
                    ? null
                    : new Date(this.deliveryFromDate),
            deliverDateLwc:
                this.deliveryToDate == null
                    ? null
                    : new Date(this.deliveryToDate),
            orderDateLwc: this.deliveryFromDate == null ? null : new Date(this.deliveryFromDate),
            deliverDateLwc: this.deliveryToDate == null ? null : new Date(this.deliveryToDate),
            invoiceStatusLwc: this.invoiceStatusValue,
            category1Lwc: this.category1,
            category2Lwc: this.category2,
            accountidLwc: this.ConInvoiceListAccountId,
            userWorkLocationLwc: this.ConInvoiceListUserWorkLocation,
            agencyProTypeLwc: this.ConInvoiceListAgencyProType
        })
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log('r = ' + JSON.stringify(r));
                if (r.status == 'Success') {
                    this.invoiceData = r.entity.raesList;
                    for (var i in this.invoiceData) {
                        this.invoiceData[i]['NameUrl'] =
                            '/lexconinvoiceview?invoiceId=' +
                            this.invoiceData[i].Id;
                    }
                    console.log(
                        'this.invoiceData = ' + JSON.stringify(this.invoiceData)
                    );
                    this.isShowSpinner = false;
                    if (r.entity.raesListSize > 0) {
                        this.showMyToast(
                            '搜索成功',
                            '共检索到' + r.entity.raesListSize + '个发票',
                            'Success'
                        );
                    } else {
                        this.showMyToast(
                            '搜索失败',
                            '没有搜索到相关发票',
                            'Error'
                        );
                    }
                } else {
                    this.showMyToast('搜索失败', r.msg, 'Error');
            agencyProTypeLwc: this.ConInvoiceListAgencyProType,
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.invoiceData = r.entity.raesList;
                for (var i in this.invoiceData) {
                    this.invoiceData[i]['NameUrl'] = '/lexconinvoiceview?invoiceId=' + this.invoiceData[i].Id;
                }
            })
            .catch((error) => {
                console.log('error = ' + error.message);
                this.showMyToast('错误', '搜索失败', 'Error');
            });
                console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
                this.isShowSpinner = false;
                if (r.entity.raesListSize > 0) {
                    this.showMyToast('搜索成功', '共检索到' + r.entity.raesListSize + '个发票', 'Success');
                } else {
                    this.showMyToast('搜索失败', '没有搜索到相关发票', 'Error');
                }
            } else {
                this.showMyToast('搜索失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
            this.showMyToast('错误', '搜索失败', 'Error');
        });
    }
    ClearJs() {
@@ -1457,38 +1229,30 @@
        this.category2 = '';
        this.invoiceStatusValue = '';
        this.isShowSpinner = true;
        conInvoiceListInit()
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log('conInvoiceListInit r = ' + JSON.stringify(r));
                if (r.status == 'Success') {
                    this.invoiceData = r.entity.raesList;
                    for (var i in this.invoiceData) {
                        this.invoiceData[i]['NameUrl'] =
                            '/lexconinvoiceview?invoiceId=' +
                            this.invoiceData[i].Id;
                    }
                    console.log(
                        'this.invoiceData = ' + JSON.stringify(this.invoiceData)
                    );
                    this.isShowSpinner = false;
                } else {
                    this.showMyToast('搜索失败', r.msg, 'Error');
        conInvoiceListInit().then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("conInvoiceListInit r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.invoiceData = r.entity.raesList;
                for (var i in this.invoiceData) {
                    this.invoiceData[i]['NameUrl'] = '/lexconinvoiceview?invoiceId=' + this.invoiceData[i].Id;
                }
            })
            .catch((error) => {
                console.log('error = ' + JSON.stringify(error));
            });
                console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
                this.isShowSpinner = false;
            } else {
                this.showMyToast('搜索失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + JSON.stringify(error));
        });
    }
    InvoiceorderSearchJs() {
        this.isShowSpinner = true;
        debugger;
        let cloneData = this.outboundData;
        const selectedRows = this.template
            .querySelector("[data-field='outbound']")
            .getSelectedRows();
        debugger
        let cloneData = this.outboundData
        const selectedRows = this.template.querySelector("[data-field='outbound']").getSelectedRows();
        console.log('selectedRows ' + JSON.stringify(selectedRows));
        for (var i in cloneData) {
            let b = false;
@@ -1529,107 +1293,74 @@
            agencyProTypeLwc: this.agencyProType,
            HospitalInfoLwc: this.HospitalInfo,
            SecondDealerLwc: this.secondaryDistributor,
            invoiceOrderRecoedsLwc: JSON.stringify(cloneData)
        })
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log('r = ' + JSON.stringify(r));
                if (r.status == 'Success') {
                    this.outboundData = r.entity.invoiceOrderRecoeds;
                    console.log(
                        'this.outboundData = ' +
                            JSON.stringify(this.outboundData)
                    );
                    let index = 0;
                    this.selectedRows = [];
                    for (var i in this.outboundData) {
                        if (this.outboundData[i].check)
                            this.selectedRows.push(this.outboundData[i].esd.Id);
                        this.outboundData[i].Id = this.outboundData[i].esd.Id;
                        this.outboundData[i]['esdOutboundDate'] =
                            this.outboundData[i].esd.Outbound_Date__c;
                        this.outboundData[i]['esdNameUrl'] =
                            '/s/lexsummonscreat?ESetid=' +
                            this.outboundData[i].esd.Id;
                        this.outboundData[i]['esdName'] =
                            this.outboundData[i].esd.Name;
                        if (this.EditAble) {
                            this.outboundData[i]['hospitalName'] =
                                this.outboundData[i].esd.ShipmentAccount__c;
                            this.outboundData[i]['shipmentAmount'] =
                                this.outboundData[
                                    i
                                ].esd.Shipment_total_amount__c;
                            this.outboundData[i]['returnAmount'] =
                                this.outboundData[
                                    i
                                ].esd.RrturnPro_total_amount__c;
                        }
                        this.outboundData[i]['uninvoicedAmount'] =
                            this.outboundData[i].esd.InvoiceNotPro_money__c;
                        this.outboundData[i]['invoiceFaceAmount'] =
                            this.outboundData[i].needInvoiceCount;
                        if (
                            !(
                                this.outboundData[i].esd.Billed_Status__c ==
                                    '全部开票' ||
                                this.EditAble ||
                                this.coc.Invoice_status__c != '草案中'
                            )
                        ) {
                            //let url = "/ConInvoicedetails?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
                            let url =
                                '/s/lexconinvoiceview?orderId=' +
                                this.outboundData[i].esd.Id +
                                '&invoiceId=' +
                                this.invoiceId;
                            this.outboundData[i]['invoiceFaceAmountUrl'] = url;
            invoiceOrderRecoedsLwc: JSON.stringify(cloneData),
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.outboundData = r.entity.invoiceOrderRecoeds;
                console.log('this.outboundData = ' + JSON.stringify(this.outboundData));
                let index = 0;
                this.selectedRows = [];
                for (var i in this.outboundData) {
                            if (index == 0) {
                                let object5 = {
                                    label: '发票票面金额(元)',
                                    cellAttributes: { alignment: 'right' },
                                    type: 'url',
                                    fieldName: 'invoiceFaceAmountUrl',
                                    typeAttributes: {
                                        label: {
                                            fieldName: 'invoiceFaceAmount'
                                        },
                                        target: '_blank'
                                    },
                                    hideDefaultActions: true
                                };
                                this.outboundColumns.push(object5);
                                index++;
                            }
                        } else {
                            if (index == 0) {
                                let object5 = {
                                    label: '发票票面金额(元)',
                                    cellAttributes: { alignment: 'right' },
                                    fieldName: 'invoiceFaceAmount',
                                    hideDefaultActions: true
                                };
                                this.outboundColumns.push(object5);
                                index++;
                            }
                        }
                        //计算发票票面金额
                        this.sumPrice += this.outboundData[i].needInvoiceCount;
                    if (this.outboundData[i].check)
                        this.selectedRows.push(this.outboundData[i].esd.Id)
                    this.outboundData[i].Id = this.outboundData[i].esd.Id;
                    this.outboundData[i]['esdOutboundDate'] = this.outboundData[i].esd.Outbound_Date__c;
                    this.outboundData[i]['esdNameUrl'] = '/s/lexsummonscreat?ESetid=' + this.outboundData[i].esd.Id;
                    this.outboundData[i]['esdName'] = this.outboundData[i].esd.Name;
                    if (this.EditAble) {
                        this.outboundData[i]['hospitalName'] = this.outboundData[i].esd.ShipmentAccount__c;
                        this.outboundData[i]['shipmentAmount'] = this.outboundData[i].esd.Shipment_total_amount__c;
                        this.outboundData[i]['returnAmount'] = this.outboundData[i].esd.RrturnPro_total_amount__c;
                    }
                    console.log(
                        'this.selectedRows = ' +
                            JSON.stringify(this.selectedRows)
                    );
                    this.isShowSpinner = false;
                } else {
                    this.showMyToast('搜索失败', r.msg, 'Error');
                    this.outboundData[i]['uninvoicedAmount'] = this.outboundData[i].esd.InvoiceNotPro_money__c;
                    this.outboundData[i]['invoiceFaceAmount'] = this.outboundData[i].needInvoiceCount;
                    if (!(this.outboundData[i].esd.Billed_Status__c == '全部开票' || this.EditAble || this.coc.Invoice_status__c != '草案中')) {
                        //let url = "/ConInvoicedetails?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
                        let url = "/s/lexconinvoiceview?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
                        this.outboundData[i]['invoiceFaceAmountUrl'] = url;
                        if (index == 0) {
                            let object5 = {
                                label: '发票票面金额(元)',
                                cellAttributes: { alignment: 'right' },
                                type: 'url',
                                fieldName: "invoiceFaceAmountUrl",
                                typeAttributes: {
                                    label: { fieldName: "invoiceFaceAmount" },
                                    target: "_blank",
                                },
                                hideDefaultActions: true,
                            };
                            this.outboundColumns.push(object5)
                            index++;
                        }
                    } else {
                        if (index == 0) {
                            let object5 = {
                                label: '发票票面金额(元)',
                                cellAttributes: { alignment: 'right' },
                                fieldName: "invoiceFaceAmount",
                                hideDefaultActions: true,
                            };
                            this.outboundColumns.push(object5)
                            index++;
                        }
                    }
                    //计算发票票面金额
                    this.sumPrice += this.outboundData[i].needInvoiceCount;
                }
            })
            .catch((error) => {
                console.log('error = ' + error.message);
                this.showMyToast('错误', '搜索失败', 'Error');
            });
                console.log('this.selectedRows = ' + JSON.stringify(this.selectedRows))
                this.isShowSpinner = false;
            } else {
                this.showMyToast('搜索失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
            this.showMyToast('错误', '搜索失败', 'Error');
        });
    }
    getSelectedRows(event) {
@@ -1653,43 +1384,37 @@
        this.isShowSpinner = true;
        deleteButton({
            cocLwc: this.coc,
            invoiceIdLwc: this.invoiceId
        })
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log('r = ' + JSON.stringify(r));
                if (r.status == 'Success') {
                    this.isShowSpinner = false;
                    let url = '/lexconinvoiceview';
                    console.log('url = ' + url);
                    this[NavigationMixin.Navigate]({
                        type: 'standard__webPage',
                        attributes: {
                            url: url
                        }
                    });
                } else {
                    this.showMyToast('删除失败', r.msg, 'Error');
                }
            })
            .catch((error) => {
                console.log('error = ' + error.message);
            });
            invoiceIdLwc: this.invoiceId,
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.isShowSpinner = false
                let url = "/lexconinvoiceview";
                console.log('url = ' + url);
                this[NavigationMixin.Navigate]({
                    type: "standard__webPage",
                    attributes: {
                        url: url,
                    },
                });
            } else {
                this.showMyToast('删除失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
        });
    }
    SetEditAbleJs() {
        let statusEditAbleJs = 'Redirect';
        let url =
            '/lexconinvoiceview?invoiceId=' +
            this.invoiceId +
            '&KeyWords=' +
            statusEditAbleJs;
        let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId + '&KeyWords=' + statusEditAbleJs;
        console.log('url = ' + url);
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            type: "standard__webPage",
            attributes: {
                url: url
            }
                url: url,
            },
        });
    }
@@ -1699,44 +1424,35 @@
            outOrderStringListLwc: this.outOrderStringListLwc,
            outordercountMapLwc: this.outordercountMapLwc,
            invoiceIdLwc: this.invoiceId
        })
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log('r = ' + JSON.stringify(r));
                if (r.status == 'Success') {
                    this.isShowSpinner = false;
                    let url =
                        '/s/lexconinvoiceview?invoiceId=' + this.invoiceId;
                    console.log('url = ' + url);
                    window.open(url, '_self');
                    // this[NavigationMixin.Navigate]({
                    //     type: "standard__webPage",
                    //     attributes: {
                    //         url: url,
                    //     },
                    // });
                } else {
                    this.showMyToast('错误', r.msg, 'Error');
                }
            })
            .catch((error) => {
                console.log('error = ' + error.message);
            });
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.isShowSpinner = false
                let url = "/s/lexconinvoiceview?invoiceId=" + this.invoiceId;
                console.log('url = ' + url);
                window.open(url, '_self');
                // this[NavigationMixin.Navigate]({
                //     type: "standard__webPage",
                //     attributes: {
                //         url: url,
                //     },
                // });
            } else {
                this.showMyToast('错误', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
        });
    }
    openReportJs() {
        console.log('openReportJs');
        console.log("openReportJs");
        let reportUrl = this.label.LexConInvoiceViewReport;
        let reportFilters =
            '[{"operator":"equals","value":"' +
            this.OrderCode +
            '","column":"FK_NAME"}]';
        let reportFilters = '[{"operator":"equals","value":"' + this.OrderCode + '","column":"FK_NAME"}]';
        console.log('reportUrl = ' + reportUrl);
        let url =
            '/s/report/' +
            reportUrl +
            '?reportFilters=' +
            encodeURIComponent(reportFilters);
        let url = "/s/report/" + reportUrl + "?reportFilters=" + encodeURIComponent(reportFilters);
        window.open(url);
        // this[NavigationMixin.Navigate]({
        //     type: "standard__webPage",
@@ -1751,18 +1467,13 @@
        // statusEdit = 'Redirect';
        // PageReference ref = new Pagereference('/ConInvoiceView?invoiceId=' + invoiceId + '&reopen=isreopen' + '&KeyWords=' + statusEdit);
        let statusEditAbleJs = 'Redirect';
        let url =
            '/lexconinvoiceview?invoiceId=' +
            this.invoiceId +
            '&reopen=isreopen' +
            '&KeyWords=' +
            statusEditAbleJs;
        let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId + '&reopen=isreopen' + '&KeyWords=' + statusEditAbleJs;
        console.log('url = ' + url);
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            type: "standard__webPage",
            attributes: {
                url: url
            }
                url: url,
            },
        });
    }
@@ -1782,36 +1493,26 @@
            iconName = 'utility:error';
        }
        if (message != '') {
            content =
                '<h2><strong>' +
                title +
                '<strong/></h2><h5>' +
                message +
                '</h5>';
            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);
    }
    handleLoad() {
        console.log('handleLoad');
        console.log('handleLoad')
        try {
            const style = document.createElement('style');
            style.innerText =
                '.hehe-layoutItem .slds-button__icon {display: none;}';
            style.innerText = '.hehe-layoutItem .slds-button__icon {display: none;}';
            this.template.querySelector('.hideHelpText').appendChild(style);
            const style2 = document.createElement('style');
            style2.innerText =
                '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
            style2.innerText = '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
            this.template.querySelector('.hideHelpText').appendChild(style2);
            const style3 = document.createElement('style');
            style3.innerText =
                '.readOnly  .slds-form-element__label {padding-top: 7px;}';
            style3.innerText = '.readOnly  .slds-form-element__label {padding-top: 7px;}';
            this.template.querySelector('.hideHelpText').appendChild(style3);
        } catch (error) {
            console.log(error);
@@ -1830,19 +1531,17 @@
            s += '0';
        }
        return s;
    }
    };
    handleLoad2() {
        console.log('handleLoad2');
        console.log('handleLoad2')
        try {
            const style = document.createElement('style');
            style.innerText =
                '.hehe-layoutItem .slds-button__icon {display: none;}';
            style.innerText = '.hehe-layoutItem .slds-button__icon {display: none;}';
            this.template.querySelector('.hideHelpText').appendChild(style);
            const style2 = document.createElement('style');
            style2.innerText =
                '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
            style2.innerText = '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
            this.template.querySelector('.hideHelpText').appendChild(style2);
        } catch (error) {
            console.log(error);
@@ -1850,203 +1549,120 @@
    }
    handleUnitChange(event) {
        console.log('handleUnitChange');
        this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
        console.log("handleUnitChange");
        this.invoiceAllpriceData[0].invoiceAllprice = 0.00;
        const unitDetail = event.detail;
        console.log('unitDetail = ' + JSON.stringify(unitDetail));
        console.log("unitDetail = " + JSON.stringify(unitDetail));
        for (var i in this.detailsData) {
            if (this.detailsData[i].recordId == unitDetail.data.recordId) {
                this.detailsData[i].unitValue = unitDetail.data.unitValue;
                this.detailsData[i].esd.Invoice_Unit__c =
                    unitDetail.data.unitValue;
                if (
                    this.detailsSelectedRows.indexOf(
                        this.detailsData[i].recordId
                    ) == -1
                )
                this.detailsData[i].esd.Invoice_Unit__c = unitDetail.data.unitValue;
                if (this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) == -1)
                    this.detailsSelectedRows.push(this.detailsData[i].recordId);
            }
        }
        this.detailsSelectedRows = [...this.detailsSelectedRows];
        console.log(
            'this.detailsSelectedRows = ' +
                JSON.stringify(this.detailsSelectedRows)
        );
        console.log('this.detailsSelectedRows = ' + JSON.stringify(this.detailsSelectedRows))
        for (var i in this.detailsData) {
            this.detailsData[i].invoiceAllprice = 0.0;
            this.detailsData[i].invoiceAllprice = 0.00;
            for (var j in this.detailsSelectedRows) {
                console.log(
                    'this.detailsData[i].Id = ' + this.detailsData[i].Id
                );
                console.log(
                    'this.detailsSelectedRows[j] = ' +
                        this.detailsSelectedRows[j]
                );
                console.log('this.detailsData[i].Id = ' + this.detailsData[i].Id);
                console.log('this.detailsSelectedRows[j] = ' + this.detailsSelectedRows[j]);
                if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
                    this.detailsData[i].invoiceAllprice = this.amend(
                        this.detailsData[i].shipmentNumber,
                        this.detailsData[i].esdInvoiceUnitprice,
                        '*'
                    );
                    console.log(
                        'this.detailsData[i].invoiceAllprice = ' +
                            this.detailsData[i].invoiceAllprice
                    );
                    this.detailsData[i].invoiceAllprice = this.amend(this.detailsData[i].shipmentNumber, this.detailsData[i].esdInvoiceUnitprice, '*');
                    console.log('this.detailsData[i].invoiceAllprice = ' + this.detailsData[i].invoiceAllprice);
                }
            }
            this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
                this.invoiceAllpriceData[0].invoiceAllprice,
                this.detailsData[i].invoiceAllprice,
                '+'
            );
            this.invoiceAllpriceData[0].invoiceAllprice = this.amend(this.invoiceAllpriceData[0].invoiceAllprice, this.detailsData[i].invoiceAllprice, '+');
        }
        this.detailsData = [...this.detailsData];
        this.invoiceAllpriceData = [...this.invoiceAllpriceData];
    }
    handleShipmentNumber(event) {
        console.log('handleShipmentNumber');
        this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
        console.log("handleShipmentNumber");
        this.invoiceAllpriceData[0].invoiceAllprice = 0.00;
        const numberDetail = event.detail;
        console.log('numberDetail = ' + JSON.stringify(numberDetail));
        console.log('numberDetail = ' + JSON.stringify(numberDetail))
        if (numberDetail.data.shipmentnumber == 0) {
            if (
                this.detailsSelectedRows.indexOf(numberDetail.data.recordId) !=
                -1
            ) {
                this.detailsSelectedRows.splice(
                    this.detailsSelectedRows.indexOf(
                        numberDetail.data.recordId
                    ),
                    1
                );
            if (this.detailsSelectedRows.indexOf(numberDetail.data.recordId) != -1) {
                this.detailsSelectedRows.splice(this.detailsSelectedRows.indexOf(numberDetail.data.recordId), 1);
            }
        }
        console.log(
            'start this.detailsSelectedRows = ' +
                JSON.stringify(this.detailsSelectedRows)
        );
        console.log('numberDetail = ' + JSON.stringify(numberDetail));
        console.log("start this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows));
        console.log("numberDetail = " + JSON.stringify(numberDetail));
        for (var i in this.detailsData) {
            if (this.detailsData[i].recordId == numberDetail.data.recordId) {
                this.detailsData[i].shipmentNumber = Number(
                    numberDetail.data.shipmentnumber
                );
                this.detailsData[i].invoiceCount = Number(
                    numberDetail.data.shipmentnumber
                );
                if (
                    this.detailsSelectedRows.indexOf(
                        this.detailsData[i].recordId
                    ) == -1 &&
                    numberDetail.data.shipmentnumber != 0
                )
                this.detailsData[i].shipmentNumber = Number(numberDetail.data.shipmentnumber);
                this.detailsData[i].invoiceCount = Number(numberDetail.data.shipmentnumber);
                if (this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) == -1 && numberDetail.data.shipmentnumber != 0)
                    this.detailsSelectedRows.push(this.detailsData[i].recordId);
            }
        }
        console.log(
            'end this.detailsSelectedRows = ' +
                JSON.stringify(this.detailsSelectedRows)
        );
        console.log("end this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows));
        this.detailsSelectedRows = [...this.detailsSelectedRows];
        console.log(
            'this.detailsSelectedRows = ' +
                JSON.stringify(this.detailsSelectedRows)
        );
        console.log('this.detailsSelectedRows = ' + JSON.stringify(this.detailsSelectedRows));
        for (var i in this.detailsData) {
            this.detailsData[i].invoiceAllprice = 0.0;
            this.detailsData[i].invoiceAllprice = 0.00;
            for (var j in this.detailsSelectedRows) {
                console.log(
                    'this.detailsData[i].Id = ' + this.detailsData[i].Id
                );
                console.log(
                    'this.detailsSelectedRows[j] = ' +
                        this.detailsSelectedRows[j]
                );
                console.log('this.detailsData[i].Id = ' + this.detailsData[i].Id);
                console.log('this.detailsSelectedRows[j] = ' + this.detailsSelectedRows[j]);
                if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
                    this.detailsData[i].invoiceAllprice = this.amend(
                        this.detailsData[i].shipmentNumber,
                        this.detailsData[i].esdInvoiceUnitprice,
                        '*'
                    );
                    console.log(
                        'this.detailsData[i].invoiceAllprice = ' +
                            this.detailsData[i].invoiceAllprice
                    );
                    this.detailsData[i].invoiceAllprice = this.amend(this.detailsData[i].shipmentNumber, this.detailsData[i].esdInvoiceUnitprice, '*');
                    console.log('this.detailsData[i].invoiceAllprice = ' + this.detailsData[i].invoiceAllprice);
                }
            }
            this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
                this.invoiceAllpriceData[0].invoiceAllprice,
                this.detailsData[i].invoiceAllprice,
                '+'
            );
            this.invoiceAllpriceData[0].invoiceAllprice = this.amend(this.invoiceAllpriceData[0].invoiceAllprice, this.detailsData[i].invoiceAllprice, '+');
        }
        this.detailsData = [...this.detailsData];
        this.invoiceAllpriceData = [...this.invoiceAllpriceData];
    }
    detailsGetSelectedRows(event) {
        console.log('detailsGetSelectedRows ');
        this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
        console.log("detailsGetSelectedRows ");
        this.invoiceAllpriceData[0].invoiceAllprice = 0.00;
        let selectedRows = event.detail.selectedRows;
        for (var i in this.detailsData) {
            this.detailsData[i].invoiceAllprice = 0.0;
            this.detailsData[i].invoiceAllprice = 0.00;
            for (var j in selectedRows) {
                if (this.detailsData[i].Id == selectedRows[j].esd.Id) {
                    this.detailsData[i].invoiceAllprice = this.amend(
                        this.detailsData[i].shipmentNumber,
                        this.detailsData[i].esdInvoiceUnitprice,
                        '*'
                    );
                    console.log(
                        'this.detailsData[i].invoiceAllprice = ' +
                            this.detailsData[i].invoiceAllprice
                    );
                    this.detailsData[i].invoiceAllprice = this.amend(this.detailsData[i].shipmentNumber, this.detailsData[i].esdInvoiceUnitprice, '*');
                    console.log('this.detailsData[i].invoiceAllprice = ' + this.detailsData[i].invoiceAllprice);
                }
            }
            this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
                this.invoiceAllpriceData[0].invoiceAllprice,
                this.detailsData[i].invoiceAllprice,
                '+'
            );
            console.log(
                'this.invoiceAllpriceData[0].invoiceAllprice = ' +
                    this.invoiceAllpriceData[0].invoiceAllprice
            );
            this.invoiceAllpriceData[0].invoiceAllprice = this.amend(this.invoiceAllpriceData[0].invoiceAllprice, this.detailsData[i].invoiceAllprice, '+');
            console.log('this.invoiceAllpriceData[0].invoiceAllprice = ' + this.invoiceAllpriceData[0].invoiceAllprice);
        }
        console.log(
            'start this.detailsData = ' + JSON.stringify(this.detailsData)
        );
        console.log('start this.detailsData = ' + JSON.stringify(this.detailsData));
        this.detailsData = [...this.detailsData];
        console.log(
            'end this.detailsData = ' + JSON.stringify(this.detailsData)
        );
        console.log('end this.detailsData = ' + JSON.stringify(this.detailsData));
        this.invoiceAllpriceData = [...this.invoiceAllpriceData];
    }
    ComputePrice(index, number, price) {
        console.log('index = ' + index);
        console.log('number = ' + number);
        console.log('price = ' + price);
        let shipmentAmount = this.amend(number, price, '*');
        console.log('shipmentAmount = ' + shipmentAmount);
        console.log("index = " + index);
        console.log("number = " + number);
        console.log("price = " + price);
        let shipmentAmount = this.amend(number, price, "*");
        console.log("shipmentAmount = " + shipmentAmount);
        let sumPrice = 0.0;
        this.data[index].shipmentAmount = shipmentAmount;
        for (var i in this.data) {
            if (this.data[i].shipmentAmount)
                sumPrice += this.data[i].shipmentAmount;
            if (this.data[i].shipmentAmount) sumPrice += this.data[i].shipmentAmount;
        }
        this.sumPrice = sumPrice + '元';
        this.sumPrice = sumPrice + "元";
        //存下选择行,不会被清空
        if (this.selectedRows.indexOf(this.data[index].Id) == -1)
            this.selectedRows.push(this.data[index].Id);
        this.data = [...this.data];
        this.selectedRows = [...this.selectedRows];
        console.log('this.selectedRows = ' + JSON.stringify(this.selectedRows));
        console.log('this.data = ' + JSON.stringify(this.data));
        this.selectedRows = [...this.selectedRows]
        console.log("this.selectedRows = " + JSON.stringify(this.selectedRows));
        console.log("this.data = " + JSON.stringify(this.data));
    }
    deepClone(obj) {
@@ -2057,9 +1673,7 @@
        this.isShowSpinner = true;
        let cloneData = this.deepClone(this.detailsData);
        let selectedRows = this.template
            .querySelector('c-lex-custom-lightning-datatable')
            .getSelectedRows();
        let selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
        console.log('selectedRows = ' + JSON.stringify(selectedRows));
        for (var i in cloneData) {
@@ -2086,29 +1700,29 @@
        }
        console.log('cloneData = ' + JSON.stringify(cloneData));
        detailsSave({
            consumableorderdetails1RecordsLwc: JSON.stringify(cloneData),
            invoiceIdLwc: this.invoiceId,
            orderIdLwc: this.orderId
        })
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log('r = ' + JSON.stringify(r));
                if (r.status == 'Success') {
                    let url = '/lexconinvoiceview?invoiceId=' + this.invoiceId;
                    this[NavigationMixin.Navigate]({
                        type: 'standard__webPage',
                        attributes: {
                            url: url
                        }
                    });
                } else {
                    this.showMyToast('保存失败', r.msg, 'Error');
                }
            })
            .catch((error) => {
                console.log('error = ' + error.message);
            });
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
                this[NavigationMixin.Navigate]({
                    type: "standard__webPage",
                    attributes: {
                        url: url,
                    },
                });
            } else {
                this.showMyToast('保存失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
        });
    }
    //num1 num2传入两个值  symbol +-*/符号
@@ -2120,27 +1734,27 @@
            str2Length;
        //解决整数没有小数点方法
        try {
            str1Length = str1.split('.')[1].length;
            str1Length = str1.split(".")[1].length;
        } catch (error) {
            str1Length = 0;
        }
        try {
            str2Length = str2.split('.')[1].length;
            str2Length = str2.split(".")[1].length;
        } catch (error) {
            str2Length = 0;
        }
        var step = Math.pow(10, Math.max(str1Length, str2Length));
        switch (symbol) {
            case '+':
            case "+":
                result = (num1 * step + num2 * step) / step;
                break;
            case '-':
            case "-":
                result = (num1 * step - num2 * step) / step;
                break;
            case '*':
            case "*":
                result = (num1 * step * (num2 * step)) / step / step;
                break;
            case '/':
            case "/":
                result = (num1 * step) / (num2 * step);
                break;
            default:
@@ -2153,23 +1767,23 @@
    deleteAtt(event) {
        this.isShowSpinner = true;
        //var recordId = event.detail.data.recordId;
        var recordId = event.target.getAttribute('data-fileid');
        var recordId = event.target.getAttribute("data-fileid");
        console.log('attid:' + recordId);
        deleteAtt({
            contentVersionId: recordId
        }).then(r => {
            r = JSON.parse(JSON.stringify(r));
            if (r.status == "Success") {
                this.showMyToast('删除成功', '', 'Success');
                if (this.fileData.length == 1)
                    window.location.reload();
                else
                    this.init();
            } else {
                this.showMyToast('删除失败', r.msg, 'Error');
            }
        }).catch(error => {
            this.showMyToast('错误', error.message, 'Error');
        })
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                if (r.status == 'Success') {
                    this.showMyToast('删除成功', '', 'Success');
                    if (this.fileData.length == 1) window.location.reload();
                    else this.init();
                } else {
                    this.showMyToast('删除失败', r.msg, 'Error');
                }
            })
            .catch((error) => {
                this.showMyToast('错误', error.message, 'Error');
            });
    }
}
force-app/main/default/lwc/lexConsumable/lexConsumable.html
@@ -2,10 +2,7 @@
    <template if:true={showSpinner}>
        <!-- <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"
            >
            <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>
@@ -14,93 +11,36 @@
    </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;">
                <!-- 按钮 -->
                <template if:true={showEditBtn}>
                    <!-- <lightning-button style="margin: 5px;" label="编辑" disabled={disabledEditBtn} onclick={editOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        disabled={disabledEditBtn}
                        onclick={editOrder}
                    >
                        编辑
                    </button>
                    <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" disabled={disabledEditBtn} onclick={editOrder}>编辑</button>
                </template>
                <template if:true={showPrintSheetBtn}>
                    <!-- <lightning-button style="margin: 5px;" label="打印配置单" onclick={printOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="打印配置单"
                        onclick={printOrder}
                    >
                        打印配置单
                    </button>
                    <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="打印配置单" onclick={printOrder}>打印配置单</button>
                </template>
                <template if:true={showUploadSheetBtn}>
                    <!-- <lightning-button style="margin: 5px;" label="上传配置单" disabled={disabledUploadSheetBtn} onclick={uploadOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="上传配置单"
                        disabled={disabledUploadSheetBtn}
                        onclick={uploadOrder}
                    >
                        上传配置单
                    </button>
                    <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="上传配置单" disabled={disabledUploadSheetBtn} onclick={uploadOrder}>上传配置单</button>
                </template>
                <template if:true={showSubOrderbtn}>
                    <!-- <lightning-button style="margin: 5px;" label="提交订单" disabled={disabledSubOrderbtn} onclick={submitOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="提交订单"
                        disabled={disabledSubOrderbtn}
                        onclick={submitOrder}
                    >
                        提交订单
                    </button>
                    <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="提交订单" disabled={disabledSubOrderbtn} onclick={submitOrder}>提交订单</button>
                </template>
                <template if:true={showSaveOrderbtn1}>
                    <!-- <lightning-button style="margin: 5px;" label="保存订单" onclick={saveOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="保存订单"
                        onclick={saveOrder}
                    >
                        保存订单
                    </button>
                    <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="保存订单" onclick={saveOrder}>保存订单</button>
                </template>
                <template if:true={showSaveOrderbtn2}>
                    <!-- <lightning-button style="margin: 5px;" label="保存订单" onclick={orderCopy}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="保存订单"
                        onclick={orderCopy}
                    >
                        保存订单
                    </button>
                    <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="保存订单" onclick={orderCopy}>保存订单</button>
                </template>
                <template if:true={showDeleteBtn}>
                    <!-- <lightning-button style="margin: 5px;" label="删除" disabled={disabledDeleteBtn} onclick={deleteOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="删除"
                        disabled={disabledDeleteBtn}
                        onclick={deleteOrder}
                    >
                        删除
                    </button>
                    <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="删除" disabled={disabledDeleteBtn} onclick={deleteOrder}>删除</button>
                </template>
                <!-- <template if:true={showOfferPriceInputBtn}>
                    <lightning-button style="margin: 5px;" label="特价金额录入" disabled={disabledOfferPriceInputBtn} onclick={inputOfferPrice}></lightning-button>
@@ -108,32 +48,13 @@
                </template> -->
                <template if:true={showReapplyBtn}>
                    <!-- <lightning-button style="margin: 5px;" label="再申请" onclick={reapplyOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="再申请"
                        onclick={reapplyOrder}
                    >
                        再申请
                    </button>
                    <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="再申请" onclick={reapplyOrder}>再申请</button>
                </template>
                <p style="height: 10px"></p>
                <p style="height: 10px;"></p>
                <!-- 订单信息 -->
                <template if:false={editAble}>
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-top: 3px solid #51606e;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                        <div
                            style="
                                border-bottom: 1px solid #d4d4d4;
                                padding: 3px;
                            "
                        >
                    <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">
@@ -143,35 +64,21 @@
                            </lightning-layout>
                            <!-- <p style="font-size: 16px;"><strong>订单信息</strong></p> -->
                        </div>
                        <div style="padding: 10px">
                            <lightning-record-view-form
                                record-id={cocId}
                                object-api-name="Consumable_order__c"
                            >
                                <table style="width: 100%">
                        <div style="padding:10px;">
                            <lightning-record-view-form record-id={cocId} object-api-name="Consumable_order__c">
                                <table style="width: 100%;">
                                    <tbody>
                                        <tr>
                                            <td style="width: 10%"></td>
                                            <td style="width: 40%">
                                                <lightning-output-field
                                                    class="outputfont"
                                                    field-name="Name"
                                                ></lightning-output-field>
                                            </td>
                                            <td style="width: 40%">
                                                <lightning-output-field
                                                    field-name="Order_status__c"
                                                ></lightning-output-field>
                                            </td>
                                            <td style="width: 40%;"><lightning-output-field class="outputfont" field-name="Name"></lightning-output-field></td>
                                            <td style="width: 40%;"><lightning-output-field field-name="Order_status__c"></lightning-output-field></td>
                                            <td style="width: 10%"></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td>
                                                <template if:false={editAble}>
                                                    <lightning-output-field
                                                        field-name="Total_amount__c"
                                                    ></lightning-output-field>
                                                    <lightning-output-field field-name="Total_amount__c"></lightning-output-field>
                                                </template>
                                            </td>
                                            <td>
@@ -180,14 +87,11 @@
                                                    <lightning-formatted-text value={contractName}></lightning-formatted-text>
                                                </div> -->
                                                <!-- style="pointer-events: none;" -->
                                                <lightning-output-field
                                                    class="showContract"
                                                    field-name="Order_effective_contact__c"
                                                ></lightning-output-field>
                                                    <lightning-output-field class="showContract" field-name="Order_effective_contact__c"  ></lightning-output-field>
                                            </td>
                                            <!-- <td>合同:<lightning-formatted-text value={coc.Order_effective_contact__r.Name}></lightning-formatted-text></td> -->
                                            <td></td>
                                        </tr>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <!-- <td>
@@ -199,12 +103,8 @@
                                                </template>
                                            </td> -->
                                            <td>
                                                <template
                                                    if:true={showAttUploadDate}
                                                >
                                                    <lightning-output-field
                                                        field-name="Consumable_pdf_insert_day__c"
                                                    ></lightning-output-field>
                                                <template if:true={showAttUploadDate}>
                                                    <lightning-output-field field-name="Consumable_pdf_insert_day__c"></lightning-output-field>
                                                </template>
                                            </td>
                                            <td></td>
@@ -222,12 +122,8 @@
                                        <tr>
                                            <td></td>
                                            <td>
                                                <template
                                                    if:true={showOrderDate}
                                                >
                                                    <lightning-output-field
                                                        field-name="Order_date__c"
                                                    ></lightning-output-field>
                                                <template if:true={showOrderDate}>
                                                    <lightning-output-field field-name="Order_date__c"></lightning-output-field>
                                                </template>
                                            </td>
                                            <td></td>
@@ -236,71 +132,26 @@
                                        <tr>
                                            <td></td>
                                            <td colspan="2">
                                                <lightning-card
                                                    class="attListTitle"
                                                    variant="Narrow"
                                                    title="附件列表"
                                                    icon-name="utility:attach"
                                                >
                                                    <lightning-layout
                                                        slot="footer"
                                                        multiple-rows="true"
                                                    >
                                                        <template
                                                            for:each={attachmentRecoeds}
                                                            for:item="item"
                                                            for:index="index"
                                                        >
                                                            <lightning-layout-item
                                                                padding="around-none"
                                                                size="2"
                                                                key={item.recordId}
                                                                style="
                                                                    text-align: left;
                                                                    padding: 5px;
                                                                "
                                                            >
                                                                <lightning-icon
                                                                    title={item.fileFullName}
                                                                    style="
                                                                        margin-left: 20px;
                                                                    "
                                                                    icon-name="doctype:gform"
                                                                    alternative-text={item.fileFullName}
                                                                    size="large"
                                                                ></lightning-icon
                                                                ><br />
                                                <lightning-card class="attListTitle" variant="Narrow"  title="附件列表" icon-name="utility:attach">
                                                    <lightning-layout slot="footer" multiple-rows="true">
                                                        <template for:each={attachmentRecoeds} for:item="item" for:index="index">
                                                            <lightning-layout-item padding="around-none" size="2" key={item.recordId} style="text-align: left;padding:5px">
                                                                <lightning-icon title={item.fileFullName} style="margin-left: 20px;" icon-name="doctype:gform" alternative-text={item.fileFullName} size="large"></lightning-icon><br/>
                                                                <!-- <span style="word-wrap:break-word; word-break:break-all;width:80px;display:flex;" title={item.fileFullName}>
                                                                    {item.fileName}
                                                                </span> -->
                                                                <div
                                                                    title={item.fileFullName}
                                                                    style="
                                                                        width: 100px;
                                                                        text-overflow: ellipsis;
                                                                        overflow: hidden;
                                                                        white-space: nowrap;
                                                                    "
                                                                >
                                                                <div title={item.fileFullName} style="width: 100px;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;">
                                                                    {item.fileName}
                                                                </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.recordId} onclick={deleteAtt}>
                                                                        删除
                                                                    </a>
                                                                </p>
@@ -320,15 +171,8 @@
                </template>
                <!-- searchBlock -->
                <template if:true={editAble}>
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-top: 3px solid #51606e;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                        <div style="padding: 10px">
                    <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                        <div style="padding:10px;">
                            <table>
                                <tbody>
                                    <!-- <tr>
@@ -364,190 +208,62 @@
                                    <!-- <tr style="height: 10px;"></tr> -->
                                    <tr>
                                        <td>
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 16px;
                                                "
                                            >
                                                消耗品名称
                                            </div>
                                            <div style="color:#696969;font-size:16px;">消耗品名称</div>
                                        </td>
                                        <td>
                                            <lightning-input
                                                class="inputFont"
                                                variant="label-hidden"
                                                label="消耗品名称"
                                                value={category1}
                                                onchange={category1Change}
                                            ></lightning-input>
                                            <lightning-input class="inputFont" variant="label-hidden" label="消耗品名称" value={category1} onchange={category1Change}></lightning-input>
                                        </td>
                                        <td></td>
                                        <td>
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 16px;
                                                "
                                            >
                                                第3分类
                                            </div>
                                            <div style="color:#696969;font-size:16px;">第3分类</div>
                                        </td>
                                        <td>
                                            <lightning-combobox
                                                class="inputFont"
                                                variant="label-hidden"
                                                label="第3分类"
                                                value={category3}
                                                options={category3Option}
                                                onchange={category3Change}
                                            ></lightning-combobox>
                                            <lightning-combobox class="inputFont" variant="label-hidden" label="第3分类" value={category3} options={category3Option} onchange={category3Change}></lightning-combobox>
                                        </td>
                                        <td style="width: 30px"></td>
                                        <td style="width: 66px">
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 16px;
                                                "
                                            >
                                                第4分类
                                            </div>
                                        <td style="width:30px;"></td>
                                        <td style="width:66px;">
                                            <div style="color:#696969;font-size:16px;">第4分类</div>
                                        </td>
                                        <td>
                                            <lightning-combobox
                                                class="inputFont"
                                                variant="label-hidden"
                                                label="第4分类"
                                                value={category4}
                                                options={category4Option}
                                                onchange={category4Change}
                                            ></lightning-combobox>
                                        <td >
                                            <lightning-combobox class="inputFont" variant="label-hidden" label="第4分类" value={category4} options={category4Option} onchange={category4Change}></lightning-combobox>
                                        </td>
                                        <td></td>
                                        <td style="width: 66px">
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 16px;
                                                "
                                            >
                                                第5分类
                                            </div>
                                        <td style="width: 66px;">
                                            <div style="color:#696969;font-size:16px;">第5分类</div>
                                        </td>
                                        <td style="width: 160px">
                                            <lightning-combobox
                                                class="inputFont"
                                                variant="label-hidden"
                                                label="第5分类"
                                                value={category5}
                                                options={category5Option}
                                                onchange={category5Change}
                                            ></lightning-combobox>
                                        <td style="width: 160px;">
                                            <lightning-combobox class="inputFont" variant="label-hidden" label="第5分类" value={category5} options={category5Option} onchange={category5Change}></lightning-combobox>
                                        </td>
                                    </tr>
                                    <tr style="height: 10px"></tr>
                                    <tr style="height: 10px;"></tr>
                                    <tr>
                                        <td style="width: 100px">
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 16px;
                                                "
                                            >
                                                <span style="color: red"
                                                    >*&nbsp;</span
                                                >合同
                                        <td style="width: 100px;">
                                            <div style="color:#696969;font-size:16px;"><span style="color: red;">*&nbsp;</span>合同</div>
                                        </td>
                                        <td style="width:320px;">
                                            <div class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
                                                <lightning-icon size="x-small" class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default" icon-name="utility:search" ></lightning-icon>
                                                <lightning-input class="inputFont" variant="label-hidden" label="合同" placeholder="请选择合同" value={contractName} onchange={changeCon} onclick={showSearchCon}></lightning-input>
                                            </div>
                                        </td>
                                        <td style="width: 320px">
                                            <div
                                                class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right"
                                            >
                                                <lightning-icon
                                                    size="x-small"
                                                    class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default"
                                                    icon-name="utility:search"
                                                ></lightning-icon>
                                                <lightning-input
                                                    class="inputFont"
                                                    variant="label-hidden"
                                                    label="合同"
                                                    placeholder="请选择合同"
                                                    value={contractName}
                                                    onchange={changeCon}
                                                    onclick={showSearchCon}
                                                ></lightning-input>
                                            </div>
                                        </td>
                                        <td style="width: 30px"></td>
                                        <td style="width: 66px">
                                        <td style="width: 30px;"></td>
                                        <td style="width:66px;">
                                            <template if:true={showHospital}>
                                                <div
                                                    style="
                                                        color: #696969;
                                                        font-size: 16px;
                                                    "
                                                >
                                                    <span style="color: red"
                                                        >*&nbsp;</span
                                                    >医院
                                                <div style="color:#696969;font-size:16px;"><span style="color: red;">*&nbsp;</span>医院</div>
                                            </template>
                                        </td>
                                        <td colspan="4" style="padding-bottom:5px;padding-top:5px;">
                                            <template if:true={showHospital}>
                                                <div class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
                                                    <lightning-icon size="x-small" class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default" icon-name="utility:search" ></lightning-icon>
                                                    <lightning-input class="inputFont" variant="label-hidden" label="医院" placeholder="请选择医院" value={hospitalName} onclick={showSearchHos} onchange={changeHos}></lightning-input>
                                                </div>
                                            </template>
                                        </td>
                                        <td
                                            colspan="4"
                                            style="
                                                padding-bottom: 5px;
                                                padding-top: 5px;
                                            "
                                        >
                                            <template if:true={showHospital}>
                                                <div
                                                    class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right"
                                                >
                                                    <lightning-icon
                                                        size="x-small"
                                                        class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default"
                                                        icon-name="utility:search"
                                                    ></lightning-icon>
                                                    <lightning-input
                                                        class="inputFont"
                                                        variant="label-hidden"
                                                        label="医院"
                                                        placeholder="请选择医院"
                                                        value={hospitalName}
                                                        onclick={showSearchHos}
                                                        onchange={changeHos}
                                                    ></lightning-input>
                                                </div>
                                            </template>
                                        </td>
                                        <td style="width: 30px"></td>
                                        <td style="width: 30px;"></td>
                                        <td colspan="2">
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                                style="
                                                    width: 130px;
                                                    height: 32px;
                                                    margin-right: 10px;
                                                "
                                                label="消耗品搜索"
                                                onclick={searchProduct}
                                            >
                                                消耗品搜索
                                            </button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                                                style="
                                                    width: 80px;
                                                    height: 32px;
                                                "
                                                label="清空"
                                                onclick={clear}
                                            >
                                                清空
                                            </button>
                                            <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="width:130px;height:32px;margin-right: 10px;" label="消耗品搜索" onclick={searchProduct}>消耗品搜索</button>
                                            <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="width:80px;height:32px;" label="清空" onclick={clear}>清空</button>
                                        </td>
                                    </tr>
                                </tbody>
@@ -557,94 +273,31 @@
                </template>
                <!-- 警告提醒 -->
                <template if:true={hasWarning}>
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                        <div
                            style="
                                border-bottom: 1px solid #d4d4d4;
                                border-radius: 5px;
                                margin-bottom: 7px;
                                color: #ff6a00;
                                font-size: 17px;
                            "
                        >
                            <lightning-icon
                                style="margin: 3px"
                                icon-name="utility:warning"
                                size="small"
                            ></lightning-icon>
                    <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;">
                        <div style="border-bottom: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;color:#ff6a00;font-size:17px;">
                            <lightning-icon style="margin: 3px;" icon-name="utility:warning" size="small"></lightning-icon>
                            <strong>&nbsp;&nbsp;&nbsp;警告</strong>
                        </div>
                        <template for:each={warningMsgs} for:item="msg">
                            <p
                                key={msg}
                                style="
                                    color: #ff6a00;
                                    padding-left: 7px;
                                    font-size: 16px;
                                    margin-bottom: 7px;
                                "
                            >
                                &nbsp;&nbsp;&nbsp;・&nbsp;{msg}
                            </p>
                            <p key={msg} style="color:#ff6a00;padding-left:7px;font-size:16px;margin-bottom:7px;">&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
                                style="margin: 3px"
                                icon-name="utility:error"
                                size="small"
                            ></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 style="margin: 3px;" icon-name="utility:error" size="small"></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: 16px;
                                    margin-bottom: 7px;
                                "
                            >
                                &nbsp;&nbsp;&nbsp;・&nbsp;{msg}
                            </p>
                            <p key={msg} style="color:red;padding-left:7px;font-size:16px;margin-bottom:7px;">&nbsp;&nbsp;&nbsp;・&nbsp;{msg}</p>
                        </template>
                    </div>
                </template>
                <!-- 消耗品明细 -->
                <div
                    style="
                        border: 1px solid #d4d4d4;
                        border-top: 3px solid #51606e;
                        border-radius: 5px;
                        margin-bottom: 7px;
                    "
                >
                    <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
                <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">
@@ -654,65 +307,24 @@
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>消耗品明细</strong></p> -->
                    </div>
                    <div style="padding: 10px">
                    <div style="padding:10px;">
                        <template if:true={editAble}>
                            <c-lex-custom-lightning-datatable
                                class="wrapped-header-datatable"
                                style="
                                    word-wrap: break-word;
                                    word-break: break-all;
                                "
                                key-field="recordId"
                                data={currentRecord}
                                columns={cols}
                                selected-rows={selectRows}
                                onrowselection={checkRows}
                                onchangevalue={conCountChange}
                                onvalueblur={conCountBlur}
                                default-sort-direction="asc"
                                sorted-direction={sortDirection}
                                sorted-by={sortedBy}
                                onsort={onHandleSort}
                            ></c-lex-custom-lightning-datatable>
                            <c-paginator
                                onprevious={prePageClick}
                                onnext={nextPageClick}
                                onpageschange={pageSizeChange}
                                onfirst={goFirstPage}
                                onlast={goLastPage}
                                page-size-options={pageSizeOptions}
                                previous-button-disabled={previousButtonDisabled}
                                next-button-disabled={nextButtonDisabled}
                                record-start={recordStart}
                                record-end={recordEnd}
                                total-records={totalRecords}
                            ></c-paginator>
                            <c-lex-custom-lightning-datatable class="wrapped-header-datatable" style="word-wrap:break-word; word-break:break-all;" key-field="recordId" data={currentRecord} columns={cols}
                            selected-rows={selectRows} onrowselection={checkRows} onchangevalue={conCountChange} onvalueblur={conCountBlur}
                            default-sort-direction="asc" sorted-direction={sortDirection} sorted-by={sortedBy} onsort={onHandleSort}></c-lex-custom-lightning-datatable>
                            <c-paginator onprevious={prePageClick} onnext={nextPageClick}
                                onpageschange={pageSizeChange} onfirst={goFirstPage} onlast={goLastPage}
                                page-size-options={pageSizeOptions} previous-button-disabled={previousButtonDisabled}
                                next-button-disabled={nextButtonDisabled} record-start={recordStart}
                                record-end={recordEnd} total-records={totalRecords}></c-paginator>
                        </template>
                        <template if:false={editAble}>
                            <c-lex-custom-lightning-datatable
                                class="wrapped-header-datatable"
                                style="
                                    word-wrap: break-word;
                                    word-break: break-all;
                                "
                                hide-checkbox-column
                                key-field="recordId"
                                data={consumableorderdetailsRecordsview}
                                columns={cols}
                            ></c-lex-custom-lightning-datatable>
                            <c-paginator
                                onprevious={prePageClick}
                                onnext={nextPageClick}
                                onpageschange={pageSizeChange}
                                onfirst={goFirstPage}
                                onlast={goLastPage}
                                page-size-options={pageSizeOptions}
                                previous-button-disabled={previousButtonDisabled}
                                next-button-disabled={nextButtonDisabled}
                                record-start={recordStart}
                                record-end={recordEnd}
                                total-records={totalRecords}
                            ></c-paginator>
                            <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={consumableorderdetailsRecordsview} columns={cols}></c-lex-custom-lightning-datatable>
                            <c-paginator onprevious={prePageClick} onnext={nextPageClick}
                                onpageschange={pageSizeChange} onfirst={goFirstPage} onlast={goLastPage}
                                page-size-options={pageSizeOptions} previous-button-disabled={previousButtonDisabled}
                                next-button-disabled={nextButtonDisabled} record-start={recordStart}
                                record-end={recordEnd} total-records={totalRecords}></c-paginator>
                        </template>
                    </div>
                </div>
@@ -737,65 +349,27 @@
        </template> -->
        <!-- 上传附件弹窗 -->
        <template if:true={showAttPop}>
            <section
                role="dialog"
                tabindex="-1"
                aria-labelledby="modal-heading-01"
                aria-modal="true"
                aria-describedby="modal-content-id-1"
                class="slds-modal slds-fade-in-open slds-modal_small"
                style="border: 1px solid #d4d4d4"
            >
            <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small" style="border: 1px solid #D4D4D4;">
                <template if:true={showPopSpinner}>
                    <lightning-spinner
                        size="medium"
                        variant="brand"
                    ></lightning-spinner>
                    <lightning-spinner size="medium" variant="brand"></lightning-spinner>
                </template>
                <div class="slds-modal__container">
                    <header
                        class="slds-modal__header"
                        style="background-color: #f3f3f3"
                    >
                        <button
                            style=""
                            class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                            title="Close"
                            onclick={closePop}
                        >
                            <lightning-icon
                                icon-name="utility:close"
                    <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"
                        >
                            上传配置单
                        </h2>
                        <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">上传配置单</h2>
                    </header>
                    <div
                        class="slds-modal__content slds-p-around_medium"
                        id="modal-content-id-1"
                        style="border: 1px solid #f3f3f3"
                    >
                    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1" style="border: 1px solid #F3F3F3;">
                        <div class="slds-m-top_medium slds-m-bottom_x-large">
                            <div class="slds-p-around_medium lgc-bg">
                                <lightning-input
                                    class="fileUpload"
                                    type="file"
                                    label="附件上传"
                                    accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
                                    onchange={attChange}
                                ></lightning-input>
                                <lightning-input class="fileUpload" type="file" label="附件上传" accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf" onchange={attChange}></lightning-input>
                            </div>
                            <p style="font-size: 16px">
                                已选择文件:{fileName}
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <p style="font-size: 16px;">已选择文件:{fileName} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <template if:true={attDelBtn}>
                                    <a onclick={removeAtt}>移除</a>
                                </template>
@@ -805,24 +379,8 @@
                    <footer class="slds-modal__footer">
                        <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="取消" onclick={closePop}></lightning-button>
                        <lightning-button style="margin-left: 10px;" variant="neutral" label="上传" onclick={uploadAtt}></lightning-button> -->
                        <button
                            class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                            style="margin-left: 10px"
                            variant="neutral"
                            label="取消"
                            onclick={closePop}
                        >
                            取消
                        </button>
                        <button
                            class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                            style="margin-left: 10px"
                            variant="neutral"
                            label="上传"
                            onclick={uploadAtt}
                        >
                            上传
                        </button>
                        <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="margin-left: 10px;" variant="neutral" label="取消" onclick={closePop}>取消</button>
                        <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="margin-left: 10px;" variant="neutral" label="上传" onclick={uploadAtt}>上传</button>
                    </footer>
                </div>
            </section>
@@ -830,104 +388,35 @@
        </template>
        <!-- 搜索医院 -->
        <template if:true={showAttHosPop}>
            <section
                role="dialog"
                tabindex="-1"
                aria-labelledby="modal-heading-01"
                aria-modal="true"
                aria-describedby="modal-content-id-1"
                class="slds-modal slds-fade-in-open slds-modal_medium"
                style="border: 1px solid #d4d4d4"
            >
            <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_medium" style="border: 1px solid #D4D4D4;">
                <div class="slds-modal__container">
                    <header
                        class="slds-modal__header"
                        style="background-color: #f3f3f3"
                    >
                        <button
                            style=""
                            class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                            title="Close"
                            onclick={closeHospitalPop}
                        >
                            <lightning-icon
                                icon-name="utility:close"
                    <header class="slds-modal__header" style="background-color: #F3F3F3;">
                        <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeHospitalPop}>
                            <lightning-icon icon-name="utility:close"
                                alternative-text="close"
                                variant="inverse"
                                size="small"
                            ></lightning-icon>
                                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"
                        id="modal-content-id-2"
                        style="border: 1px solid #f3f3f3"
                    >
                        <table style="width: 100%">
                    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2" style="border: 1px solid #F3F3F3;">
                        <table style="width: 100%;">
                            <tbody>
                                <tr>
                                    <td style="width: 74px">
                                        <div
                                            style="
                                                color: #696969;
                                                font-size: 16px;
                                                text-align: left;
                                            "
                                        >
                                            医院名称
                                        </div>
                                    </td>
                                    <td style="width: 60%">
                                        <lightning-input
                                            class="inputFont"
                                            label="医院名称"
                                            variant="label-hidden"
                                            placeholder="请输入医院名称"
                                            value={searchNameHos}
                                            onchange={searchNameHosChange}
                                        ></lightning-input>
                                    </td>
                                    <td style="width: 10px"></td>
                                    <td>
                                        <button
                                            class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                            style="height: 32px"
                                            label="搜索"
                                            onclick={searchHos}
                                        >
                                            搜索
                                        </button>
                                    </td>
                                    <td style="width: 74px;"><div style="color:#696969;font-size:16px;text-align: left;">医院名称</div></td>
                                    <td style="width: 60%;"><lightning-input class="inputFont" label="医院名称" variant="label-hidden" placeholder="请输入医院名称" value={searchNameHos} onchange={searchNameHosChange}></lightning-input></td>
                                    <td style="width: 10px;"></td>
                                    <td><button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="height: 32px;" label="搜索" onclick={searchHos}>搜索</button></td>
                                </tr>
                            </tbody>
                        </table>
                        <p style="height: 20px"></p>
                        <p 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;
                                "
                            >
                        <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"
                                    >
                                    <lightning-layout-item padding="around-small">
                                        <p style="font-size: 18px">
                                            <strong>搜索结果</strong>
                                        </p>
@@ -935,27 +424,14 @@
                                </lightning-layout>
                                <!-- <p style="font-size: 16px;"><strong>搜索结果</strong></p> -->
                            </div>
                            <div class="myTable" style="padding: 10px">
                                <lightning-datatable
                                    class="wrapped-header-datatable"
                                    key-field="id"
                                    hide-checkbox-column="true"
                                    data={hospitalList}
                                    columns={hosCols}
                                    onrowaction={chooseHos}
                                ></lightning-datatable>
                            <div class="myTable" style="padding:10px;">
                                <lightning-datatable class="wrapped-header-datatable" key-field="id" hide-checkbox-column="true" data={hospitalList} columns={hosCols} onrowaction={chooseHos}></lightning-datatable>
                            </div>
                        </div>
                    </div>
                    <footer class="slds-modal__footer">
                        <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="取消" onclick={closeHospitalPop}></lightning-button> -->
                        <button
                            class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                            label="取消"
                            onclick={closeHospitalPop}
                        >
                            取消
                        </button>
                        <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" label="取消" onclick={closeHospitalPop}>取消</button>
                        <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="确认" onclick={confirmHospital}></lightning-button> -->
                    </footer>
                </div>
@@ -964,132 +440,50 @@
        </template>
        <!-- 搜索合同 -->
        <template if:true={showConPop}>
            <section
                role="dialog"
                tabindex="-1"
                aria-labelledby="modal-heading-01"
                aria-modal="true"
                aria-describedby="modal-content-id-1"
                class="slds-modal slds-fade-in-open slds-modal_medium"
                style="border: 1px solid #d4d4d4"
            >
            <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_medium" style="border: 1px solid #D4D4D4;">
                <div class="slds-modal__container">
                    <header
                        class="slds-modal__header"
                        style="background-color: #f3f3f3"
                    >
                        <button
                            style=""
                            class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                            title="Close"
                            onclick={closeContractPop}
                        >
                            <lightning-icon
                                icon-name="utility:close"
                    <header class="slds-modal__header" style="background-color: #F3F3F3;">
                        <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeContractPop}>
                            <lightning-icon icon-name="utility:close"
                                alternative-text="close"
                                variant="inverse"
                                size="small"
                            ></lightning-icon>
                                size="small" ></lightning-icon>
                            <span class="slds-assistive-text">Close</span>
                        </button>
                        <h2
                            id="modal-heading-03"
                            class="slds-text-heading_medium slds-hyphenate"
                        >
                            合同检索
                        </h2>
                        <h2 id="modal-heading-03" class="slds-text-heading_medium slds-hyphenate">合同检索</h2>
                    </header>
                    <div
                        class="slds-modal__content slds-p-around_medium"
                        id="modal-content-id-3"
                        style="border: 1px solid #f3f3f3"
                    >
                        <table style="width: 100%">
                    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-3" style="border: 1px solid #F3F3F3;">
                        <table style="width: 100%;">
                            <tbody>
                                <tr>
                                    <td style="width: 74px">
                                        <div
                                            style="
                                                color: #696969;
                                                font-size: 16px;
                                                text-align: left;
                                            "
                                        >
                                            合同名称
                                        </div>
                                    </td>
                                    <td style="width: 60%">
                                        <lightning-input
                                            class="inputFont"
                                            label="合同名称"
                                            variant="label-hidden"
                                            placeholder="请输入合同名称"
                                            value={searchNameCon}
                                            onchange={searchNameConChange}
                                        ></lightning-input>
                                    </td>
                                    <td style="width: 10px"></td>
                                    <td>
                                        <button
                                            class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                            style="height: 32px"
                                            label="搜索"
                                            onclick={searchCon}
                                        >
                                            搜索
                                        </button>
                                    </td>
                                    <td style="width: 74px;"><div style="color:#696969;font-size:16px;text-align: left;">合同名称</div></td>
                                    <td style="width: 60%;"><lightning-input class="inputFont" label="合同名称" variant="label-hidden" placeholder="请输入合同名称" value={searchNameCon} onchange={searchNameConChange}></lightning-input></td>
                                    <td style="width: 10px;"></td>
                                    <td><button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="height: 32px;" label="搜索" onclick={searchCon}>搜索</button></td>
                                    <!-- <td><lightning-button label="搜索" onclick={searchCon}></lightning-button></td> -->
                                </tr>
                            </tbody>
                        </table>
                        <p style="height: 10px"></p>
                        <p style="height: 10px;"></p>
                        <!-- <p>已选择合同:{chooseContract}</p> -->
                        <div
                            style="
                                border: 1px solid #d4d4d4;
                                border-top: 3px solid #51606e;
                                border-radius: 5px;
                                margin-bottom: 7px;
                            "
                        >
                            <div
                                style="
                                    border-bottom: 1px solid #d4d4d4;
                                    padding: 3px;
                                "
                            >
                        <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"
                                    >
                                    <lightning-layout-item padding="around-small">
                                        <p style="font-size: 18px">
                                            <strong>搜索结果</strong>
                                        </p>
                                    </lightning-layout-item>
                                </lightning-layout>
                            </div>
                            <div style="padding: 20px">
                                <lightning-datatable
                                    class="wrapped-header-datatable"
                                    key-field="id"
                                    hide-checkbox-column="true"
                                    data={contractList}
                                    columns={conCols}
                                    onrowaction={chooseCon}
                                ></lightning-datatable>
                            <div style="padding:20px;">
                                <lightning-datatable class="wrapped-header-datatable" key-field="id" hide-checkbox-column="true" data={contractList} columns={conCols} onrowaction={chooseCon}></lightning-datatable>
                            </div>
                        </div>
                    </div>
                    <footer class="slds-modal__footer">
                        <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="取消" onclick={closeContractPop}></lightning-button> -->
                        <button
                            class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                            label="取消"
                            onclick={closeContractPop}
                        >
                            取消
                        </button>
                        <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"  label="取消" onclick={closeContractPop}>取消</button>
                        <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="确认" onclick={confirmContract}></lightning-button> -->
                    </footer>
                </div>
Diff truncated after the above file
force-app/main/default/lwc/lexConsumable/lexConsumable.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/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.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.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.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